118: queryRecords should return [] when no matching records exist, not an error
Some checks failed
Build / cleanup-runs (pull_request) Successful in 5s
Deploy Contract / cleanup-runs (pull_request) Successful in 5s
CodeQL / Analyze (go) (pull_request) Failing after 39s
Deploy Contract / deploy (pull_request) Failing after 36s
Pull Request Labeler / triage (pull_request) Successful in 10s
Build / build (pull_request) Failing after 1m3s
Dependency Review / dependency-review (pull_request) Failing after 1m3s
Run Gosec / Gosec (pull_request) Failing after 13s
Semgrep / Scan (pull_request) Failing after 11s
Tests / cleanup-runs (pull_request) Failing after 5s
Lint / Run flake8 on python integration tests (pull_request) Failing after 34s
Tests / test-unit-cover (pull_request) Failing after 42s
Tests / test-importer (pull_request) Failing after 39s
Lint / Run golangci-lint (pull_request) Failing after 1m27s
Tests / test-rpc (pull_request) Failing after 58s
Tests / sdk_tests (pull_request) Failing after 1m40s

This commit is contained in:
Thomas E Lackey 2023-11-28 13:27:37 -06:00
parent d57743bfd5
commit cd144330aa

View File

@ -20,6 +20,7 @@ import (
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/tendermint/tendermint/libs/log"
)
var (
@ -96,6 +97,11 @@ func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeep
}
}
// Logger returns a module-specific logger.
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", types.ModuleName)
}
// GetRecordIndexKey Generates Bond ID -> Bond index key.
func GetRecordIndexKey(id string) []byte {
return append(PrefixCIDToRecordIndex, []byte(id)...)
@ -389,7 +395,8 @@ func (k Keeper) GetAttributeMapping(ctx sdk.Context, key []byte) ([]string, erro
store := ctx.KVStore(k.storeKey)
if !store.Has(key) {
return nil, fmt.Errorf("store doesn't have key: %q", key)
k.Logger(ctx).Debug(fmt.Sprintf("store doesn't have key: %q", key))
return []string{}, nil
}
var recordIds []string