From 4c6747ca77b60cc78ac2b17869313fc519b4875a Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 13 Sep 2023 12:28:56 +0200 Subject: [PATCH] chore: adding HasGenesis compiler assertions to ibc modules --- modules/apps/27-interchain-accounts/module.go | 7 ++----- modules/apps/29-fee/module.go | 6 ++---- modules/apps/transfer/module.go | 6 ++---- modules/core/module.go | 8 +++----- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index 5d02007f402..08568c6b6db 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -17,8 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/client/cli" controllerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" controllertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" @@ -36,6 +34,7 @@ var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) _ porttypes.IBCModule = (*host.IBCModule)(nil) @@ -173,7 +172,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // InitGenesis performs genesis initialization for the interchain accounts module. // It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) { var genesisState genesistypes.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) @@ -184,8 +183,6 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. if am.hostKeeper != nil { hostkeeper.InitGenesis(ctx, *am.hostKeeper, genesisState.HostGenesisState) } - - return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the interchain accounts module diff --git a/modules/apps/29-fee/module.go b/modules/apps/29-fee/module.go index 9006f4713d1..7e6626ad5a1 100644 --- a/modules/apps/29-fee/module.go +++ b/modules/apps/29-fee/module.go @@ -17,8 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/client/cli" "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" @@ -27,6 +25,7 @@ import ( var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) + _ module.HasGenesis = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) ) @@ -111,11 +110,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // InitGenesis performs genesis initialization for the ibc-29-fee module. It returns // no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) { var genesisState types.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) am.keeper.InitGenesis(ctx, genesisState) - return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the ibc-29-fee diff --git a/modules/apps/transfer/module.go b/modules/apps/transfer/module.go index fb7df4d7192..9a0ec2a41e7 100644 --- a/modules/apps/transfer/module.go +++ b/modules/apps/transfer/module.go @@ -17,8 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/ibc-go/v8/modules/apps/transfer/client/cli" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" "github.com/cosmos/ibc-go/v8/modules/apps/transfer/simulation" @@ -29,6 +27,7 @@ import ( var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) + _ module.HasGenesis = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) _ porttypes.IBCModule = (*IBCModule)(nil) ) @@ -134,11 +133,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // InitGenesis performs genesis initialization for the ibc-transfer module. It returns // no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) { var genesisState types.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) am.keeper.InitGenesis(ctx, genesisState) - return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the ibc-transfer diff --git a/modules/core/module.go b/modules/core/module.go index 65d59272829..d1f5580d8d8 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -17,8 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" - ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -36,8 +34,9 @@ var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) - _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) ) // AppModuleBasic defines the basic application module used by the ibc module. @@ -163,14 +162,13 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // InitGenesis performs genesis initialization for the ibc module. It returns // no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) { var gs types.GenesisState err := cdc.UnmarshalJSON(bz, &gs) if err != nil { panic(fmt.Sprintf("failed to unmarshal %s genesis state: %s", exported.ModuleName, err)) } InitGenesis(ctx, *am.keeper, &gs) - return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the ibc