From 456b40ec5150ea8434446c2f8866da7d73c1b349 Mon Sep 17 00:00:00 2001 From: huangyi Date: Thu, 18 Jul 2024 15:43:54 +0800 Subject: [PATCH] remove ModuleBasics --- app/app.go | 38 +------------------------------------- app/genesis.go | 9 ++++++++- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/app/app.go b/app/app.go index b1122feb2..1993e9759 100644 --- a/app/app.go +++ b/app/app.go @@ -126,8 +126,6 @@ import ( porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" // chain-main imports @@ -171,40 +169,6 @@ var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - params.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - solomachine.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - transfer.AppModuleBasic{}, - nfttransfer.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, - vesting.AppModuleBasic{}, - ica.AppModuleBasic{}, - icaauthmodule.AppModuleBasic{}, - ibcfee.AppModuleBasic{}, - supply.AppModuleBasic{}, - chainmain.AppModuleBasic{}, - nft.AppModuleBasic{}, - ) - // module account permissions maccPerms = map[string][]string{ authtypes.FeeCollectorName: nil, @@ -1009,7 +973,7 @@ func (app *ChainApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIC nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // Register grpc-gateway routes for all modules. - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily if apiConfig.Swagger { diff --git a/app/genesis.go b/app/genesis.go index 5bf0c1da8..3688c4a8e 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -3,7 +3,10 @@ package app import ( "encoding/json" + "cosmossdk.io/log" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/codec" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" ) // The genesis state of the blockchain is represented here as a map of raw json @@ -17,5 +20,9 @@ type GenesisState map[string]json.RawMessage // NewDefaultGenesisState generates the default state for the application. func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) + tempApp := New( + log.NewNopLogger(), dbm.NewMemDB(), nil, true, + simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome), + ) + return tempApp.BasicModuleManager.DefaultGenesis(cdc) }