diff --git a/x/authz/migrations/v2/store.go b/x/authz/migrations/v2/store.go index 65d3be4140d..cca5fdcc609 100644 --- a/x/authz/migrations/v2/store.go +++ b/x/authz/migrations/v2/store.go @@ -4,11 +4,11 @@ import ( "context" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/codec" "cosmossdk.io/store/prefix" "cosmossdk.io/x/authz" "cosmossdk.io/x/authz/internal/conv" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" ) diff --git a/x/authz/module/module.go b/x/authz/module/module.go index d25ab35eba8..abc6be81358 100644 --- a/x/authz/module/module.go +++ b/x/authz/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/authz" @@ -18,7 +19,6 @@ import ( "cosmossdk.io/x/authz/simulation" 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/simsx" "github.com/cosmos/cosmos-sdk/types/module" @@ -110,7 +110,11 @@ func (AppModule) GetTxCmd() *cobra.Command { // DefaultGenesis returns default genesis state as raw bytes for the authz module. func (am AppModule) DefaultGenesis() json.RawMessage { - return am.cdc.MustMarshalJSON(authz.DefaultGenesisState()) + data, err := am.cdc.MarshalJSON(authz.DefaultGenesisState()) + if err != nil { + panic(err) + } + return data } // ValidateGenesis performs genesis state validation for the authz module. diff --git a/x/authz/simulation/decoder.go b/x/authz/simulation/decoder.go index c5a8b929620..9f22d9c78da 100644 --- a/x/authz/simulation/decoder.go +++ b/x/authz/simulation/decoder.go @@ -4,10 +4,10 @@ import ( "bytes" "fmt" + "cosmossdk.io/core/codec" "cosmossdk.io/x/authz" "cosmossdk.io/x/authz/keeper" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/kv" ) @@ -18,13 +18,21 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { switch { case bytes.Equal(kvA.Key[:1], keeper.GrantKey): var grantA, grantB authz.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) case bytes.Equal(kvA.Key[:1], keeper.GrantQueuePrefix): var grantA, grantB authz.GrantQueueItem - 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 authz key %X", kvA.Key)) diff --git a/x/gov/migrations/v5/store.go b/x/gov/migrations/v5/store.go index b4c86f51e6b..526a6bc250a 100644 --- a/x/gov/migrations/v5/store.go +++ b/x/gov/migrations/v5/store.go @@ -4,10 +4,9 @@ import ( "context" "cosmossdk.io/collections" + "cosmossdk.io/core/codec" corestoretypes "cosmossdk.io/core/store" govv1 "cosmossdk.io/x/gov/types/v1" - - "github.com/cosmos/cosmos-sdk/codec" ) var ( diff --git a/x/gov/module.go b/x/gov/module.go index df3f35c0aee..62cfcadf2ec 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/codec" "cosmossdk.io/core/registry" govclient "cosmossdk.io/x/gov/client" "cosmossdk.io/x/gov/client/cli" @@ -20,7 +21,6 @@ import ( "cosmossdk.io/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simsx" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -157,7 +157,11 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { // DefaultGenesis returns default genesis state as raw bytes for the gov module. func (am AppModule) DefaultGenesis() json.RawMessage { - return am.cdc.MustMarshalJSON(v1.DefaultGenesisState()) + data, err := am.cdc.MarshalJSON(v1.DefaultGenesisState()) + if err != nil { + panic(err) + } + return data } // ValidateGenesis performs genesis state validation for the gov module.