From e169c844a80697d785b524d8e033accfb0435e07 Mon Sep 17 00:00:00 2001 From: muku314115 Date: Mon, 30 Oct 2023 12:04:55 +0530 Subject: [PATCH 1/4] removing appmodulebasic and all nil/unneeded functions --- modules/capability/module.go | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/modules/capability/module.go b/modules/capability/module.go index ab9bc97a9db..ce72a5aa5ce 100644 --- a/modules/capability/module.go +++ b/modules/capability/module.go @@ -4,16 +4,14 @@ import ( "context" "encoding/json" "fmt" - "time" - + "github.com/cosmos/cosmos-sdk/client" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" + "time" "cosmossdk.io/core/appmodule" - "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/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -26,7 +24,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 +45,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 +69,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 +98,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 From 201a3b7f9caae4eca8fd4829465fb434623d6ee9 Mon Sep 17 00:00:00 2001 From: muku314115 Date: Mon, 30 Oct 2023 12:10:19 +0530 Subject: [PATCH 2/4] lint --- modules/capability/module.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/capability/module.go b/modules/capability/module.go index ce72a5aa5ce..c0dfbf562e3 100644 --- a/modules/capability/module.go +++ b/modules/capability/module.go @@ -4,10 +4,11 @@ import ( "context" "encoding/json" "fmt" + "time" + "github.com/cosmos/cosmos-sdk/client" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" - "time" "cosmossdk.io/core/appmodule" From 1d0864604727b2cb122fbf1c846ac1f5bfbfcb1c Mon Sep 17 00:00:00 2001 From: muku314115 Date: Mon, 30 Oct 2023 12:11:59 +0530 Subject: [PATCH 3/4] test file changes --- modules/capability/capability_test.go | 2 +- modules/capability/keeper/keeper_test.go | 2 +- modules/capability/simulation/decoder_test.go | 2 +- 3 files changed, 3 insertions(+), 3 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/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{ From 0fb295702d0d024563f834044bc64b5699b1487d Mon Sep 17 00:00:00 2001 From: muku314115 Date: Mon, 30 Oct 2023 12:14:58 +0530 Subject: [PATCH 4/4] lint --- modules/capability/module.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/capability/module.go b/modules/capability/module.go index c0dfbf562e3..355ec428f65 100644 --- a/modules/capability/module.go +++ b/modules/capability/module.go @@ -6,13 +6,13 @@ import ( "fmt" "time" - "github.com/cosmos/cosmos-sdk/client" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "cosmossdk.io/core/appmodule" + "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/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module"