diff --git a/x/feegrant/migrations/v2/store.go b/x/feegrant/migrations/v2/store.go index 93551a4ed99e..4643fc4441f2 100644 --- a/x/feegrant/migrations/v2/store.go +++ b/x/feegrant/migrations/v2/store.go @@ -4,11 +4,11 @@ import ( "context" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/codec" "cosmossdk.io/core/store" "cosmossdk.io/store/prefix" "cosmossdk.io/x/feegrant" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" ) diff --git a/x/feegrant/module/module.go b/x/feegrant/module/module.go index 2e22fef937bc..05ec0d4dd355 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/codec" "cosmossdk.io/core/registry" "cosmossdk.io/errors" "cosmossdk.io/x/feegrant" @@ -17,7 +18,6 @@ import ( "cosmossdk.io/x/feegrant/keeper" sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" ) @@ -103,7 +103,11 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { // DefaultGenesis returns default genesis state as raw bytes for the feegrant module. func (am AppModule) DefaultGenesis() json.RawMessage { - return am.cdc.MustMarshalJSON(feegrant.DefaultGenesisState()) + data, err := am.cdc.MarshalJSON(feegrant.DefaultGenesisState()) + if err != nil { + panic(err) + } + return data } // ValidateGenesis performs genesis state validation for the feegrant module. diff --git a/x/feegrant/simulation/decoder.go b/x/feegrant/simulation/decoder.go index c1b4eedeb478..e99b39851b32 100644 --- a/x/feegrant/simulation/decoder.go +++ b/x/feegrant/simulation/decoder.go @@ -4,9 +4,9 @@ import ( "bytes" "fmt" + "cosmossdk.io/core/codec" "cosmossdk.io/x/feegrant" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/kv" ) @@ -17,8 +17,12 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { switch { case bytes.Equal(kvA.Key[:1], feegrant.FeeAllowanceKeyPrefix): var grantA, grantB feegrant.Grant - cdc.MustUnmarshal(kvA.Value, &grantA) - cdc.MustUnmarshal(kvB.Value, &grantB) + if err := cdc.Unmarshal(kvA.Value, &grantA); err != nil { + panic(err) + } + if err := cdc.Unmarshal(kvB.Value, &grantB); err != nil { + panic(err) + } return fmt.Sprintf("%v\n%v", grantA, grantB) default: panic(fmt.Sprintf("invalid feegrant key %X", kvA.Key))