Skip to content

Commit

Permalink
chore: add compiler assertions for capability module (cosmos#4654)
Browse files Browse the repository at this point in the history
* chore: add compiler assertions for capability module

* chore: add HasGenesis assertion
  • Loading branch information
colin-axner authored Sep 14, 2023
1 parent 4ef9186 commit acfe815
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions modules/capability/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ 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/modules/capability/keeper"
"github.com/cosmos/ibc-go/modules/capability/simulation"
"github.com/cosmos/ibc-go/modules/capability/types"
)

var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasName = (*AppModule)(nil)
_ module.HasConsensusVersion = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasBeginBlocker = (*AppModule)(nil)
)
Expand Down Expand Up @@ -113,23 +115,14 @@ func (am AppModule) Name() string {
return am.AppModuleBasic.Name()
}

// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (AppModule) RegisterServices(module.Configurator) {}

// RegisterInvariants registers the capability module's invariants.
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}

// InitGenesis performs the capability module's genesis initialization It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate {
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) {
var genState types.GenesisState
// Initialize global index to index in genesis state
cdc.MustUnmarshalJSON(gs, &genState)

InitGenesis(ctx, am.keeper, genState)

return []abci.ValidatorUpdate{}
}

// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes.
Expand Down

0 comments on commit acfe815

Please sign in to comment.