From 7cf30ef6a01b68e5bb8bbad473245cd65ef2de24 Mon Sep 17 00:00:00 2001 From: Muku <44918265+muku314115@users.noreply.github.com> Date: Mon, 30 Oct 2023 16:33:32 +0530 Subject: [PATCH] (mod/capability) Use AppModule directly in favour of AppModuleBasic in mod/capability (#4982) * removing appmodulebasic and all nil/unneeded functions * lint * test file changes * lint --------- Co-authored-by: Damian Nolan --- modules/capability/capability_test.go | 2 +- modules/capability/keeper/keeper_test.go | 2 +- modules/capability/module.go | 15 +-------------- modules/capability/simulation/decoder_test.go | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/modules/capability/capability_test.go b/modules/capability/capability_test.go index e725fdf1cb2..77c7170401d 100644 --- a/modules/capability/capability_test.go +++ b/modules/capability/capability_test.go @@ -39,7 +39,7 @@ type CapabilityTestSuite struct { } func (suite *CapabilityTestSuite) SetupTest() { - encodingCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModuleBasic{}) + encodingCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModule{}) suite.cdc = encodingCfg.Codec suite.storeKey = storetypes.NewKVStoreKey(types.StoreKey) diff --git a/modules/capability/keeper/keeper_test.go b/modules/capability/keeper/keeper_test.go index 9fada176f38..12ac910a7c2 100644 --- a/modules/capability/keeper/keeper_test.go +++ b/modules/capability/keeper/keeper_test.go @@ -33,7 +33,7 @@ func (suite *KeeperTestSuite) SetupTest() { key := storetypes.NewKVStoreKey(types.StoreKey) testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) suite.ctx = testCtx.Ctx - encCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModuleBasic{}) + encCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModule{}) suite.keeper = keeper.NewKeeper(encCfg.Codec, key, key) } diff --git a/modules/capability/module.go b/modules/capability/module.go index ab9bc97a9db..355ec428f65 100644 --- a/modules/capability/module.go +++ b/modules/capability/module.go @@ -7,7 +7,6 @@ import ( "time" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" "cosmossdk.io/core/appmodule" @@ -26,7 +25,6 @@ import ( var ( _ module.AppModule = (*AppModule)(nil) - _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) _ module.HasName = (*AppModule)(nil) _ module.HasConsensusVersion = (*AppModule)(nil) @@ -48,11 +46,6 @@ func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { return AppModuleBasic{cdc: cdc} } -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - // RegisterLegacyAminoCodec does nothing. Capability does not support amino. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} @@ -77,12 +70,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *gwruntime.ServeMux) { } -// GetTxCmd returns the capability module's root tx command. -func (AppModuleBasic) GetTxCmd() *cobra.Command { return nil } - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil } - // ---------------------------------------------------------------------------- // AppModule // ---------------------------------------------------------------------------- @@ -112,7 +99,7 @@ func (AppModule) IsAppModule() {} // Name returns the capability module's name. func (am AppModule) Name() string { - return am.AppModuleBasic.Name() + return types.ModuleName } // InitGenesis performs the capability module's genesis initialization It returns diff --git a/modules/capability/simulation/decoder_test.go b/modules/capability/simulation/decoder_test.go index c47ce7dc9bc..b5115e66139 100644 --- a/modules/capability/simulation/decoder_test.go +++ b/modules/capability/simulation/decoder_test.go @@ -16,7 +16,7 @@ import ( ) func TestDecodeStore(t *testing.T) { - encodingCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModuleBasic{}) + encodingCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModule{}) dec := simulation.NewDecodeStore(encodingCfg.Codec) capOwners := types.CapabilityOwners{