diff --git a/CHANGELOG.md b/CHANGELOG.md index 660866500e77..74b1f5963852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (runtime) [#15818](https://github.com/cosmos/cosmos-sdk/pull/15818) Provide logger through `depinject` instead of appBuilder. * (client) [#15597](https://github.com/cosmos/cosmos-sdk/pull/15597) Add status endpoint for clients. * (testutil/integration) [#15556](https://github.com/cosmos/cosmos-sdk/pull/15556) Introduce `testutil/integration` package for module integration testing. * (types) [#15735](https://github.com/cosmos/cosmos-sdk/pull/15735) Make `ValidateBasic() error` method of `Msg` interface optional. Modules should validate messages directly in their message handlers ([RFC 001](https://docs.cosmos.network/main/rfc/rfc-001-tx-validation)). @@ -109,6 +110,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* (x/bank) [#15818](https://github.com/cosmos/cosmos-sdk/issues/15818) `BaseViewKeeper`'s `Logger` method now doesn't require a context. `NewBaseKeeper`, `NewBaseSendKeeper` and `NewBaseViewKeeper` now also require a `log.Logger` to be passed in. * (client) [#15597](https://github.com/cosmos/cosmos-sdk/pull/15597) `RegisterNodeService` now requires a config parameter. * (x/*all*) [#15648](https://github.com/cosmos/cosmos-sdk/issues/15648) Make `SetParams` consistent across all modules and validate the params at the message handling instead of `SetParams` method. * (x/genutil) [#15679](https://github.com/cosmos/cosmos-sdk/pull/15679) `MigrateGenesisCmd` now takes a `MigrationMap` instead of having the SDK genesis migration hardcoded. diff --git a/UPGRADING.md b/UPGRADING.md index f2fafaa33a11..fb9b6174fd03 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -82,6 +82,30 @@ app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( ) ``` +The following modules `NewKeeper` function now also take a `log.Logger`: + +* `x/bank` + + +### depinject + +For `depinject` users, now the logger must be supplied through the main `depinject.Inject` function instead of passing it to `appBuilder.Build`. + +```diff +appConfig = depinject.Configs( + AppConfig, + depinject.Supply( + // supply the application options + appOpts, ++ logger, + ... +``` + +```diff +- app.App = appBuilder.Build(logger, db, traceStore, baseAppOptions...) ++ app.App = appBuilder.Build(db, traceStore, baseAppOptions...) +``` + ### Packages #### Store diff --git a/baseapp/block_gas_test.go b/baseapp/block_gas_test.go index 105cb4f29066..b16e8074ee50 100644 --- a/baseapp/block_gas_test.go +++ b/baseapp/block_gas_test.go @@ -82,14 +82,18 @@ func TestBaseApp_BlockGas(t *testing.T) { err error ) - err = depinject.Inject(configurator.NewAppConfig( - configurator.AuthModule(), - configurator.TxModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.BankModule(), - configurator.StakingModule(), - ), + err = depinject.Inject( + depinject.Configs( + configurator.NewAppConfig( + configurator.AuthModule(), + configurator.TxModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.BankModule(), + configurator.StakingModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), &bankKeeper, &accountKeeper, &interfaceRegistry, @@ -99,7 +103,7 @@ func TestBaseApp_BlockGas(t *testing.T) { &appBuilder) require.NoError(t, err) - bapp := appBuilder.Build(log.NewNopLogger(), dbm.NewMemDB(), nil) + bapp := appBuilder.Build(dbm.NewMemDB(), nil) err = bapp.Load(true) require.NoError(t, err) diff --git a/baseapp/grpcrouter_test.go b/baseapp/grpcrouter_test.go index 419c2e2845a0..825a89dad284 100644 --- a/baseapp/grpcrouter_test.go +++ b/baseapp/grpcrouter_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" @@ -55,10 +56,15 @@ func TestGRPCQueryRouter(t *testing.T) { func TestRegisterQueryServiceTwice(t *testing.T) { // Setup baseapp. var appBuilder *runtime.AppBuilder - err := depinject.Inject(makeMinimalConfig(), &appBuilder) + err := depinject.Inject( + depinject.Configs( + makeMinimalConfig(), + depinject.Supply(log.NewTestLogger(t)), + ), + &appBuilder) require.NoError(t, err) db := dbm.NewMemDB() - app := appBuilder.Build(log.NewTestLogger(t), db, nil) + app := appBuilder.Build(db, nil) // First time registering service shouldn't panic. require.NotPanics(t, func() { diff --git a/baseapp/msg_service_router_test.go b/baseapp/msg_service_router_test.go index 3d0b637462cd..f0a388a11809 100644 --- a/baseapp/msg_service_router_test.go +++ b/baseapp/msg_service_router_test.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -27,9 +28,13 @@ func TestRegisterMsgService(t *testing.T) { appBuilder *runtime.AppBuilder registry codectypes.InterfaceRegistry ) - err := depinject.Inject(makeMinimalConfig(), &appBuilder, ®istry) + err := depinject.Inject( + depinject.Configs( + makeMinimalConfig(), + depinject.Supply(log.NewTestLogger(t)), + ), &appBuilder, ®istry) require.NoError(t, err) - app := appBuilder.Build(log.NewTestLogger(t), dbm.NewMemDB(), nil) + app := appBuilder.Build(dbm.NewMemDB(), nil) require.Panics(t, func() { testdata.RegisterMsgServer( @@ -55,10 +60,14 @@ func TestRegisterMsgServiceTwice(t *testing.T) { appBuilder *runtime.AppBuilder registry codectypes.InterfaceRegistry ) - err := depinject.Inject(makeMinimalConfig(), &appBuilder, ®istry) + err := depinject.Inject( + depinject.Configs( + makeMinimalConfig(), + depinject.Supply(log.NewTestLogger(t)), + ), &appBuilder, ®istry) require.NoError(t, err) db := dbm.NewMemDB() - app := appBuilder.Build(log.NewTestLogger(t), db, nil) + app := appBuilder.Build(db, nil) testdata.RegisterInterfaces(registry) // First time registering service shouldn't panic. @@ -86,9 +95,13 @@ func TestMsgService(t *testing.T) { cdc codec.ProtoCodecMarshaler interfaceRegistry codectypes.InterfaceRegistry ) - err := depinject.Inject(makeMinimalConfig(), &appBuilder, &cdc, &interfaceRegistry) + err := depinject.Inject( + depinject.Configs( + makeMinimalConfig(), + depinject.Supply(log.NewNopLogger()), + ), &appBuilder, &cdc, &interfaceRegistry) require.NoError(t, err) - app := appBuilder.Build(log.NewNopLogger(), dbm.NewMemDB(), nil) + app := appBuilder.Build(dbm.NewMemDB(), nil) // patch in TxConfig instead of using an output from x/auth/tx txConfig := authtx.NewTxConfig(cdc, authtx.DefaultSignModes) diff --git a/client/grpc_query_test.go b/client/grpc_query_test.go index fd43d6cf812c..1637917df2f3 100644 --- a/client/grpc_query_test.go +++ b/client/grpc_query_test.go @@ -52,10 +52,15 @@ func (s *IntegrationTestSuite) SetupSuite() { // TODO duplicated from testutils/sims/app_helpers.go // need more composable startup options for simapp, this test needed a handle to the closed over genesis account // to query balances - err := depinject.Inject(testutil.AppConfig, &interfaceRegistry, &bankKeeper, &appBuilder, &cdc) + err := depinject.Inject( + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), + &interfaceRegistry, &bankKeeper, &appBuilder, &cdc) s.NoError(err) - app := appBuilder.Build(log.NewNopLogger(), dbm.NewMemDB(), nil) + app := appBuilder.Build(dbm.NewMemDB(), nil) err = app.Load(true) s.NoError(err) diff --git a/crypto/armor_test.go b/crypto/armor_test.go index 23c5e629cf2b..69d56cbeaacc 100644 --- a/crypto/armor_test.go +++ b/crypto/armor_test.go @@ -13,6 +13,8 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/crypto" @@ -75,7 +77,11 @@ func TestArmorUnarmorPrivKey(t *testing.T) { func TestArmorUnarmorPubKey(t *testing.T) { // Select the encryption and storage for your cryptostore var cdc codec.Codec - err := depinject.Inject(configurator.NewAppConfig(), &cdc) + + err := depinject.Inject(depinject.Configs( + configurator.NewAppConfig(), + depinject.Supply(log.NewNopLogger()), + ), &cdc) require.NoError(t, err) cstore := keyring.NewInMemory(cdc) diff --git a/crypto/keys/multisig/multisig_test.go b/crypto/keys/multisig/multisig_test.go index cc9b6cf176bc..9c02fe6e1550 100644 --- a/crypto/keys/multisig/multisig_test.go +++ b/crypto/keys/multisig/multisig_test.go @@ -7,6 +7,8 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" @@ -354,7 +356,11 @@ func TestDisplay(t *testing.T) { require.NotEmpty(msig.String()) var cdc codec.Codec - err := depinject.Inject(configurator.NewAppConfig(), &cdc) + err := depinject.Inject( + depinject.Configs( + configurator.NewAppConfig(), + depinject.Supply(log.NewNopLogger()), + ), &cdc) require.NoError(err) bz, err := cdc.MarshalInterfaceJSON(msig) require.NoError(err) diff --git a/docs/architecture/adr-063-core-module-api.md b/docs/architecture/adr-063-core-module-api.md index b10aca759835..c065ce92ee75 100644 --- a/docs/architecture/adr-063-core-module-api.md +++ b/docs/architecture/adr-063-core-module-api.md @@ -166,6 +166,34 @@ the block or app hash is left to the runtime to specify). Events emitted by `EmitKVEvent` and `EmitProtoEventNonConsensus` are not considered to be part of consensus and cannot be observed by other modules. If there is a client-side need to add events in patch releases, these methods can be used. +#### Logger + +A logger (`cosmossdk.io/log`) must be supplied using `depinject`, and will +be made available for modules to use via `depinject.In`. +Modules using it should follow the current pattern in the SDK by adding the module name before using it. + +```go +type ModuleInputs struct { + depinject.In + + Logger log.Logger +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + keeper := keeper.NewKeeper( + in.logger, + ) +} + +func NewKeeper(logger log.Logger) Keeper { + return Keeper{ + logger: logger.With(log.ModuleKey, "x/"+types.ModuleName), + } +} +``` + +``` + ### Core `AppModule` extension interfaces diff --git a/runtime/app.go b/runtime/app.go index 4bfd07798f20..079d417e8697 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -6,6 +6,8 @@ import ( runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" abci "github.com/cometbft/cometbft/abci/types" "golang.org/x/exp/slices" @@ -47,6 +49,7 @@ type App struct { baseAppOptions []BaseAppOption msgServiceRouter *baseapp.MsgServiceRouter appConfig *appv1alpha1.Config + logger log.Logger // initChainer is the init chainer function defined by the app config. // this is only required if the chain wants to add special InitChainer logic. initChainer sdk.InitChainer diff --git a/runtime/builder.go b/runtime/builder.go index c4a8a8f2e3c8..22aaf329ad6c 100644 --- a/runtime/builder.go +++ b/runtime/builder.go @@ -4,7 +4,6 @@ import ( "encoding/json" "io" - "cosmossdk.io/log" dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" @@ -26,7 +25,6 @@ func (a *AppBuilder) DefaultGenesis() map[string]json.RawMessage { // Build builds an *App instance. func (a *AppBuilder) Build( - logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptions ...func(*baseapp.BaseApp), @@ -35,7 +33,7 @@ func (a *AppBuilder) Build( baseAppOptions = append(baseAppOptions, option) } - bApp := baseapp.NewBaseApp(a.app.config.AppName, logger, db, nil, baseAppOptions...) + bApp := baseapp.NewBaseApp(a.app.config.AppName, a.app.logger, db, nil, baseAppOptions...) bApp.SetMsgServiceRouter(a.app.msgServiceRouter) bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetVersion(version.Version) diff --git a/runtime/module.go b/runtime/module.go index 82ee40470fba..81cda6e1ed0f 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -5,6 +5,7 @@ import ( "os" "cosmossdk.io/core/store" + "cosmossdk.io/log" "github.com/cosmos/gogoproto/proto" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoregistry" @@ -127,6 +128,7 @@ type AppInputs struct { BaseAppOptions []BaseAppOption InterfaceRegistry codectypes.InterfaceRegistry LegacyAmino *codec.LegacyAmino + Logger log.Logger } func SetupAppBuilder(inputs AppInputs) { @@ -135,6 +137,7 @@ func SetupAppBuilder(inputs AppInputs) { app.config = inputs.Config app.ModuleManager = module.NewManagerFromMap(inputs.Modules) app.appConfig = inputs.AppConfig + app.logger = inputs.Logger for name, mod := range inputs.Modules { if basicMod, ok := mod.(module.AppModuleBasic); ok { diff --git a/simapp/app.go b/simapp/app.go index 68b796061cbb..768a2dbcb3ce 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -291,6 +291,7 @@ func NewSimApp( app.AccountKeeper, BlockedAddresses(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), + logger, ) app.StakingKeeper = stakingkeeper.NewKeeper( appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), diff --git a/simapp/app_v2.go b/simapp/app_v2.go index 89d77b2205ba..51d30fe00003 100644 --- a/simapp/app_v2.go +++ b/simapp/app_v2.go @@ -168,6 +168,7 @@ func NewSimApp( depinject.Supply( // supply the application options appOpts, + logger, // ADVANCED CONFIGURATION @@ -248,7 +249,7 @@ func NewSimApp( // } // baseAppOptions = append(baseAppOptions, prepareOpt) - app.App = appBuilder.Build(logger, db, traceStore, baseAppOptions...) + app.App = appBuilder.Build(db, traceStore, baseAppOptions...) // register streaming services if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { diff --git a/tests/e2e/bank/suite.go b/tests/e2e/bank/suite.go index 961aca4474a6..8faf8c4f5ba8 100644 --- a/tests/e2e/bank/suite.go +++ b/tests/e2e/bank/suite.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/testutil" diff --git a/tests/e2e/params/suite.go b/tests/e2e/params/suite.go index 0d4e852ebd14..1f69d4725c98 100644 --- a/tests/e2e/params/suite.go +++ b/tests/e2e/params/suite.go @@ -57,7 +57,12 @@ func (s *E2ETestSuite) SetupSuite() { appBuilder *runtime.AppBuilder paramsKeeper keeper.Keeper ) - if err := depinject.Inject(AppConfig, &appBuilder, ¶msKeeper); err != nil { + if err := depinject.Inject( + depinject.Configs( + AppConfig, + depinject.Supply(val.GetCtx().Logger), + ), + &appBuilder, ¶msKeeper); err != nil { panic(err) } @@ -66,7 +71,6 @@ func (s *E2ETestSuite) SetupSuite() { subspace := paramsKeeper.Subspace(mySubspace).WithKeyTable(paramtypes.NewKeyTable().RegisterParamSet(¶mSet)) app := appBuilder.Build( - val.GetCtx().Logger, dbm.NewMemDB(), nil, baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), diff --git a/tests/integration/bank/keeper/deterministic_test.go b/tests/integration/bank/keeper/deterministic_test.go index 2acef84bad15..ef92d9cebf34 100644 --- a/tests/integration/bank/keeper/deterministic_test.go +++ b/tests/integration/bank/keeper/deterministic_test.go @@ -7,6 +7,8 @@ import ( "gotest.tools/v3/assert" "pgregory.net/rapid" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/baseapp" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/configurator" @@ -62,13 +64,16 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { var interfaceRegistry codectypes.InterfaceRegistry app, err := simstestutil.Setup( - configurator.NewAppConfig( - configurator.AuthModule(), - configurator.TxModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.BankModule(), - configurator.StakingModule(), + depinject.Configs( + configurator.NewAppConfig( + configurator.AuthModule(), + configurator.TxModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.BankModule(), + configurator.StakingModule(), + ), + depinject.Supply(log.NewNopLogger()), ), &f.bankKeeper, &interfaceRegistry, diff --git a/tests/integration/bank/keeper/keeper_test.go b/tests/integration/bank/keeper/keeper_test.go index c4edbf85a731..c62d66832250 100644 --- a/tests/integration/bank/keeper/keeper_test.go +++ b/tests/integration/bank/keeper/keeper_test.go @@ -8,6 +8,8 @@ import ( "time" authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -118,13 +120,16 @@ func initFixture(t assert.TestingT) *fixture { var interfaceRegistry codectypes.InterfaceRegistry app, err := sims.Setup( - configurator.NewAppConfig( - configurator.AuthModule(), - configurator.BankModule(), - configurator.StakingModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.VestingModule()), + depinject.Configs( + configurator.NewAppConfig( + configurator.AuthModule(), + configurator.BankModule(), + configurator.StakingModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.VestingModule()), + depinject.Supply(log.NewNopLogger()), + ), &f.accountKeeper, &f.bankKeeper, &f.stakingKeeper, &f.appCodec, &f.authConfig, &interfaceRegistry, ) @@ -165,7 +170,7 @@ func initKeepersWithmAccPerms(f *fixture, blockedAddrs map[string]bool) (authkee maccPerms, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) bankKeeper := keeper.NewBaseKeeper( - appCodec, f.fetchStoreKey(types.StoreKey), authKeeper, blockedAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, f.fetchStoreKey(types.StoreKey), authKeeper, blockedAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String(), log.NewNopLogger(), ) return authKeeper, bankKeeper @@ -1205,6 +1210,7 @@ func TestBalanceTrackingEvents(t *testing.T) { f.bankKeeper = keeper.NewBaseKeeper(f.appCodec, f.fetchStoreKey(types.StoreKey), f.accountKeeper, nil, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + log.NewNopLogger(), ) // set account with multiple permissions @@ -1372,6 +1378,7 @@ func TestMintCoinRestrictions(t *testing.T) { for _, test := range tests { f.bankKeeper = keeper.NewBaseKeeper(f.appCodec, f.fetchStoreKey(types.StoreKey), f.accountKeeper, nil, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + log.NewNopLogger(), ).WithMintCoinsRestriction(keeper.MintingRestrictionFn(test.restrictionFn)) for _, testCase := range test.testCases { if testCase.expectPass { diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 65bd57837ba5..513365ae48de 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -92,6 +92,7 @@ func initFixture(t testing.TB) *fixture { accountKeeper, blockedAddresses, authority.String(), + log.NewNopLogger(), ) stakingKeeper := stakingkeeper.NewKeeper(cdc, keys[stakingtypes.StoreKey], accountKeeper, bankKeeper, authority.String()) diff --git a/tests/integration/distribution/module_test.go b/tests/integration/distribution/module_test.go index 2497c5b3a1ee..226e3f937ca5 100644 --- a/tests/integration/distribution/module_test.go +++ b/tests/integration/distribution/module_test.go @@ -3,6 +3,8 @@ package distribution_test import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "gotest.tools/v3/assert" @@ -16,7 +18,12 @@ import ( func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { var accountKeeper authkeeper.AccountKeeper - app, err := simtestutil.SetupAtGenesis(testutil.AppConfig, &accountKeeper) + app, err := simtestutil.SetupAtGenesis( + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), + &accountKeeper) assert.NilError(t, err) ctx := app.BaseApp.NewContext(false, cmtproto.Header{}) diff --git a/tests/integration/evidence/keeper/infraction_test.go b/tests/integration/evidence/keeper/infraction_test.go index 41fe09ec5e97..3603ab299585 100644 --- a/tests/integration/evidence/keeper/infraction_test.go +++ b/tests/integration/evidence/keeper/infraction_test.go @@ -6,6 +6,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/x/evidence/exported" "cosmossdk.io/x/evidence/keeper" "cosmossdk.io/x/evidence/testutil" @@ -63,7 +65,11 @@ func initFixture(t assert.TestingT) *fixture { f := &fixture{} var evidenceKeeper keeper.Keeper - app, err := simtestutil.Setup(testutil.AppConfig, + app, err := simtestutil.Setup( + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &evidenceKeeper, &f.interfaceRegistry, &f.accountKeeper, diff --git a/tests/integration/genutil/gentx_test.go b/tests/integration/genutil/gentx_test.go index 2b9001b68ae2..4663fe0d6b21 100644 --- a/tests/integration/genutil/gentx_test.go +++ b/tests/integration/genutil/gentx_test.go @@ -7,6 +7,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" @@ -61,13 +63,17 @@ func initFixture(t assert.TestingT) *fixture { encCfg := moduletestutil.TestEncodingConfig{} app, err := simtestutil.SetupWithConfiguration( - configurator.NewAppConfig( - configurator.BankModule(), - configurator.TxModule(), - configurator.StakingModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.AuthModule()), + depinject.Configs( + configurator.NewAppConfig( + configurator.BankModule(), + configurator.TxModule(), + configurator.StakingModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.AuthModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), simtestutil.DefaultStartUpConfig(), &encCfg.InterfaceRegistry, &encCfg.Codec, &encCfg.TxConfig, &encCfg.Amino, &f.accountKeeper, &f.bankKeeper, &f.stakingKeeper) diff --git a/tests/integration/gov/genesis_test.go b/tests/integration/gov/genesis_test.go index 0a0036a41a1d..2bb1e6d439b8 100644 --- a/tests/integration/gov/genesis_test.go +++ b/tests/integration/gov/genesis_test.go @@ -8,6 +8,9 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "gotest.tools/v3/assert" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/configurator" @@ -60,7 +63,10 @@ func TestImportExportQueues(t *testing.T) { s1 := suite{} s1.app, err = simtestutil.SetupWithConfiguration( - appConfig, + depinject.Configs( + appConfig, + depinject.Supply(log.NewNopLogger()), + ), simtestutil.DefaultStartUpConfig(), &s1.AccountKeeper, &s1.BankKeeper, &s1.DistrKeeper, &s1.GovKeeper, &s1.StakingKeeper, &s1.cdc, &s1.appBuilder, ) @@ -113,7 +119,10 @@ func TestImportExportQueues(t *testing.T) { s2 := suite{} s2.app, err = simtestutil.SetupWithConfiguration( - appConfig, + depinject.Configs( + appConfig, + depinject.Supply(log.NewNopLogger()), + ), simtestutil.DefaultStartUpConfig(), &s2.AccountKeeper, &s2.BankKeeper, &s2.DistrKeeper, &s2.GovKeeper, &s2.StakingKeeper, &s2.cdc, &s2.appBuilder, ) diff --git a/tests/integration/gov/module_test.go b/tests/integration/gov/module_test.go index 83bf6321f2e5..67106e5674f9 100644 --- a/tests/integration/gov/module_test.go +++ b/tests/integration/gov/module_test.go @@ -3,6 +3,8 @@ package gov_test import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "gotest.tools/v3/assert" @@ -18,14 +20,17 @@ import ( func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { var accountKeeper authkeeper.AccountKeeper app, err := simtestutil.SetupAtGenesis( - configurator.NewAppConfig( - configurator.ParamsModule(), - configurator.AuthModule(), - configurator.StakingModule(), - configurator.BankModule(), - configurator.GovModule(), - configurator.DistributionModule(), - configurator.ConsensusModule(), + depinject.Configs( + configurator.NewAppConfig( + configurator.ParamsModule(), + configurator.AuthModule(), + configurator.StakingModule(), + configurator.BankModule(), + configurator.GovModule(), + configurator.DistributionModule(), + configurator.ConsensusModule(), + ), + depinject.Supply(log.NewNopLogger()), ), &accountKeeper, ) diff --git a/tests/integration/runtime/query_test.go b/tests/integration/runtime/query_test.go index f000c827d758..9ff348602936 100644 --- a/tests/integration/runtime/query_test.go +++ b/tests/integration/runtime/query_test.go @@ -13,6 +13,8 @@ import ( appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/baseapp" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -41,13 +43,16 @@ func initFixture(t assert.TestingT) *fixture { var interfaceRegistry codectypes.InterfaceRegistry app, err := simtestutil.Setup( - configurator.NewAppConfig( - configurator.AuthModule(), - configurator.TxModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.BankModule(), - configurator.StakingModule(), + depinject.Configs( + configurator.NewAppConfig( + configurator.AuthModule(), + configurator.TxModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.BankModule(), + configurator.StakingModule(), + ), + depinject.Supply(log.NewNopLogger()), ), &interfaceRegistry, ) diff --git a/tests/integration/slashing/keeper/keeper_test.go b/tests/integration/slashing/keeper/keeper_test.go index 78c1222f0781..844850486a98 100644 --- a/tests/integration/slashing/keeper/keeper_test.go +++ b/tests/integration/slashing/keeper/keeper_test.go @@ -8,6 +8,8 @@ import ( "github.com/stretchr/testify/require" "gotest.tools/v3/assert" + "cosmossdk.io/depinject" + "cosmossdk.io/log" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/slashing/testutil" @@ -35,7 +37,10 @@ type fixture struct { func initFixture(t assert.TestingT) *fixture { f := &fixture{} app, err := simtestutil.Setup( - testutil.AppConfig, + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &f.bankKeeper, &f.slashingKeeper, &f.stakingKeeper, diff --git a/tests/integration/staking/keeper/determinstic_test.go b/tests/integration/staking/keeper/determinstic_test.go index ded82a8be2d4..a1a97ff36c3f 100644 --- a/tests/integration/staking/keeper/determinstic_test.go +++ b/tests/integration/staking/keeper/determinstic_test.go @@ -4,6 +4,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "gotest.tools/v3/assert" @@ -51,7 +53,10 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { var interfaceRegistry codectypes.InterfaceRegistry app, err := simtestutil.Setup( - stakingtestutil.AppConfig, + depinject.Configs( + stakingtestutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &f.bankKeeper, &f.accountKeeper, &f.stakingKeeper, diff --git a/tests/integration/staking/keeper/msg_server_test.go b/tests/integration/staking/keeper/msg_server_test.go index 50b3e9d3c47e..8212dba951a4 100644 --- a/tests/integration/staking/keeper/msg_server_test.go +++ b/tests/integration/staking/keeper/msg_server_test.go @@ -7,6 +7,8 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "gotest.tools/v3/assert" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" @@ -25,13 +27,16 @@ func TestCancelUnbondingDelegation(t *testing.T) { accountKeeper authkeeper.AccountKeeper ) app, err := simtestutil.SetupWithConfiguration( - configurator.NewAppConfig( - configurator.BankModule(), - configurator.TxModule(), - configurator.StakingModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.AuthModule(), + depinject.Configs( + configurator.NewAppConfig( + configurator.BankModule(), + configurator.TxModule(), + configurator.StakingModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.AuthModule(), + ), + depinject.Supply(log.NewNopLogger()), ), simtestutil.DefaultStartUpConfig(), &stakingKeeper, &bankKeeper, &accountKeeper) diff --git a/tests/integration/staking/keeper/params_test.go b/tests/integration/staking/keeper/params_test.go index e77240c5bbb6..e7db4ef6574c 100644 --- a/tests/integration/staking/keeper/params_test.go +++ b/tests/integration/staking/keeper/params_test.go @@ -3,6 +3,8 @@ package keeper import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "gotest.tools/v3/assert" @@ -15,13 +17,16 @@ import ( func TestParams(t *testing.T) { var stakingKeeper *keeper.Keeper app, err := simtestutil.SetupWithConfiguration( - configurator.NewAppConfig( - configurator.BankModule(), - configurator.TxModule(), - configurator.StakingModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.AuthModule(), + depinject.Configs( + configurator.NewAppConfig( + configurator.BankModule(), + configurator.TxModule(), + configurator.StakingModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.AuthModule(), + ), + depinject.Supply(log.NewNopLogger()), ), simtestutil.DefaultStartUpConfig(), &stakingKeeper) diff --git a/testutil/network/network.go b/testutil/network/network.go index 8ed0bd5354c2..f1616e5953bd 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -182,7 +182,11 @@ func DefaultConfigWithAppConfig(appConfig depinject.Config) (Config, error) { interfaceRegistry codectypes.InterfaceRegistry ) - if err := depinject.Inject(appConfig, + if err := depinject.Inject( + depinject.Configs( + appConfig, + depinject.Supply(log.NewNopLogger()), + ), &appBuilder, &txConfig, &cdc, @@ -203,11 +207,15 @@ func DefaultConfigWithAppConfig(appConfig depinject.Config) (Config, error) { cfg.AppConstructor = func(val ValidatorI) servertypes.Application { // we build a unique app instance for every validator here var appBuilder *runtime.AppBuilder - if err := depinject.Inject(appConfig, &appBuilder); err != nil { + if err := depinject.Inject( + depinject.Configs( + appConfig, + depinject.Supply(val.GetCtx().Logger), + ), + &appBuilder); err != nil { panic(err) } app := appBuilder.Build( - val.GetCtx().Logger, dbm.NewMemDB(), nil, baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), diff --git a/testutil/sims/app_helpers.go b/testutil/sims/app_helpers.go index 349215bb6da7..f4dae4d1cc3a 100644 --- a/testutil/sims/app_helpers.go +++ b/testutil/sims/app_helpers.go @@ -13,7 +13,6 @@ import ( cmttypes "github.com/cometbft/cometbft/types" dbm "github.com/cosmos/cosmos-db" - "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -118,17 +117,14 @@ func SetupWithConfiguration(appConfig depinject.Config, startupConfig StartupCon codec codec.Codec ) - if err := depinject.Inject( - appConfig, - append(extraOutputs, &appBuilder, &codec)..., - ); err != nil { + if err := depinject.Inject(appConfig, append(extraOutputs, &appBuilder, &codec)...); err != nil { return nil, fmt.Errorf("failed to inject dependencies: %w", err) } if startupConfig.BaseAppOption != nil { - app = appBuilder.Build(log.NewNopLogger(), startupConfig.DB, nil, startupConfig.BaseAppOption) + app = appBuilder.Build(startupConfig.DB, nil, startupConfig.BaseAppOption) } else { - app = appBuilder.Build(log.NewNopLogger(), startupConfig.DB, nil) + app = appBuilder.Build(startupConfig.DB, nil) } if err := app.Load(true); err != nil { return nil, fmt.Errorf("failed to load app: %w", err) diff --git a/types/query/pagination_test.go b/types/query/pagination_test.go index a31c43c0e3e9..4c34399c5279 100644 --- a/types/query/pagination_test.go +++ b/types/query/pagination_test.go @@ -5,6 +5,8 @@ import ( "fmt" "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/suite" @@ -65,12 +67,15 @@ func (s *paginationTestSuite) SetupTest() { ) app, err := testutilsims.Setup( - configurator.NewAppConfig( - configurator.AuthModule(), - configurator.BankModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.OmitInitGenesis(), + depinject.Configs( + configurator.NewAppConfig( + configurator.AuthModule(), + configurator.BankModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.OmitInitGenesis(), + ), + depinject.Supply(log.NewNopLogger()), ), &bankKeeper, &accountKeeper, ®, &cdc) diff --git a/x/auth/migrations/v2/store_test.go b/x/auth/migrations/v2/store_test.go index 0663f29f1a3a..b4508b5c3af4 100644 --- a/x/auth/migrations/v2/store_test.go +++ b/x/auth/migrations/v2/store_test.go @@ -8,6 +8,8 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" + "cosmossdk.io/depinject" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" @@ -57,7 +59,10 @@ func TestMigrateVestingAccounts(t *testing.T) { stakingKeeper *stakingkeeper.Keeper ) app, err := simtestutil.Setup( - authtestutil.AppConfig, + depinject.Configs( + authtestutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &accountKeeper, &bankKeeper, &stakingKeeper, diff --git a/x/auth/migrations/v3/store_test.go b/x/auth/migrations/v3/store_test.go index df48533de972..39c958707d30 100644 --- a/x/auth/migrations/v3/store_test.go +++ b/x/auth/migrations/v3/store_test.go @@ -8,6 +8,8 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" + "cosmossdk.io/depinject" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -50,7 +52,10 @@ func TestMigrateMapAccAddressToAccNumberKey(t *testing.T) { var accountKeeper keeper.AccountKeeper app, err := simtestutil.Setup( - authtestutil.AppConfig, + depinject.Configs( + authtestutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &accountKeeper, ) require.NoError(t, err) diff --git a/x/auth/module_test.go b/x/auth/module_test.go index 73ab20793194..cacc42bd69d0 100644 --- a/x/auth/module_test.go +++ b/x/auth/module_test.go @@ -3,6 +3,8 @@ package auth_test import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" @@ -14,7 +16,12 @@ import ( func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { var accountKeeper keeper.AccountKeeper - app, err := simtestutil.SetupAtGenesis(testutil.AppConfig, &accountKeeper) + app, err := simtestutil.SetupAtGenesis( + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), + &accountKeeper) require.NoError(t, err) ctx := app.BaseApp.NewContext(false, cmtproto.Header{}) diff --git a/x/auth/simulation/decoder_test.go b/x/auth/simulation/decoder_test.go index da1099ed59bf..17a4433561e7 100644 --- a/x/auth/simulation/decoder_test.go +++ b/x/auth/simulation/decoder_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" @@ -31,7 +32,10 @@ func TestDecodeStore(t *testing.T) { cdc codec.Codec accountKeeper authkeeper.AccountKeeper ) - err := depinject.Inject(testutil.AppConfig, &cdc, &accountKeeper) + err := depinject.Inject(depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &cdc, &accountKeeper) require.NoError(t, err) acc := types.NewBaseAccountWithAddress(delAddr1) diff --git a/x/auth/types/account_test.go b/x/auth/types/account_test.go index e6d3c5c468cf..8f0952f2e088 100644 --- a/x/auth/types/account_test.go +++ b/x/auth/types/account_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -67,7 +68,10 @@ func TestBaseSequence(t *testing.T) { func TestBaseAccountMarshal(t *testing.T) { var accountKeeper authkeeper.AccountKeeper - err := depinject.Inject(testutil.AppConfig, &accountKeeper) + err := depinject.Inject(depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &accountKeeper) require.NoError(t, err) _, pub, addr := testdata.KeyTestPubAddr() diff --git a/x/authz/simulation/operations_test.go b/x/authz/simulation/operations_test.go index 7e298fb93ceb..a81bfbfbba54 100644 --- a/x/authz/simulation/operations_test.go +++ b/x/authz/simulation/operations_test.go @@ -5,6 +5,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/suite" @@ -43,7 +45,10 @@ type SimTestSuite struct { func (suite *SimTestSuite) SetupTest() { app, err := simtestutil.Setup( - testutil.AppConfig, + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &suite.legacyAmino, &suite.codec, &suite.interfaceRegistry, diff --git a/x/bank/app_test.go b/x/bank/app_test.go index a47e060a96f5..663227ae913c 100644 --- a/x/bank/app_test.go +++ b/x/bank/app_test.go @@ -3,6 +3,8 @@ package bank_test import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/assert" @@ -109,16 +111,20 @@ func createTestSuite(t *testing.T, genesisAccounts []authtypes.GenesisAccount) s startupCfg := simtestutil.DefaultStartUpConfig() startupCfg.GenesisAccounts = genAccounts - app, err := simtestutil.SetupWithConfiguration(configurator.NewAppConfig( - configurator.ParamsModule(), - configurator.AuthModule(), - configurator.StakingModule(), - configurator.TxModule(), - configurator.ConsensusModule(), - configurator.BankModule(), - configurator.GovModule(), - configurator.DistributionModule(), - ), + app, err := simtestutil.SetupWithConfiguration( + depinject.Configs( + configurator.NewAppConfig( + configurator.ParamsModule(), + configurator.AuthModule(), + configurator.StakingModule(), + configurator.TxModule(), + configurator.ConsensusModule(), + configurator.BankModule(), + configurator.GovModule(), + configurator.DistributionModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), startupCfg, &res.BankKeeper, &res.AccountKeeper, &res.DistributionKeeper) res.App = app diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index d767ae5f31bb..fda321702681 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + "cosmossdk.io/log" "cosmossdk.io/math" errorsmod "cosmossdk.io/errors" @@ -59,6 +60,7 @@ type BaseKeeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey mintCoinsRestrictionFn MintingRestrictionFn + logger log.Logger } type MintingRestrictionFn func(ctx sdk.Context, coins sdk.Coins) error @@ -89,17 +91,22 @@ func NewBaseKeeper( ak types.AccountKeeper, blockedAddrs map[string]bool, authority string, + logger log.Logger, ) BaseKeeper { if _, err := sdk.AccAddressFromBech32(authority); err != nil { panic(fmt.Errorf("invalid bank authority address: %w", err)) } + // add the module name to the logger + logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) + return BaseKeeper{ - BaseSendKeeper: NewBaseSendKeeper(cdc, storeKey, ak, blockedAddrs, authority), + BaseSendKeeper: NewBaseSendKeeper(cdc, storeKey, ak, blockedAddrs, authority, logger), ak: ak, cdc: cdc, storeKey: storeKey, mintCoinsRestrictionFn: func(ctx sdk.Context, coins sdk.Coins) error { return nil }, + logger: logger, } } @@ -347,7 +354,7 @@ func (k BaseKeeper) UndelegateCoinsFromModuleToAccount( func (k BaseKeeper) MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error { err := k.mintCoinsRestrictionFn(ctx, amounts) if err != nil { - ctx.Logger().Error(fmt.Sprintf("Module %q attempted to mint coins %s it doesn't have permission for, error %v", moduleName, amounts, err)) + k.logger.Error(fmt.Sprintf("Module %q attempted to mint coins %s it doesn't have permission for, error %v", moduleName, amounts, err)) return err } acc := k.ak.GetModuleAccount(ctx, moduleName) @@ -370,8 +377,7 @@ func (k BaseKeeper) MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Co k.setSupply(ctx, supply) } - logger := k.Logger(ctx) - logger.Debug("minted coins from module account", "amount", amounts.String(), "from", moduleName) + k.logger.Debug("minted coins from module account", "amount", amounts.String(), "from", moduleName) // emit mint event ctx.EventManager().EmitEvent( @@ -404,8 +410,7 @@ func (k BaseKeeper) BurnCoins(ctx sdk.Context, moduleName string, amounts sdk.Co k.setSupply(ctx, supply) } - logger := k.Logger(ctx) - logger.Debug("burned tokens from module account", "amount", amounts.String(), "from", moduleName) + k.logger.Debug("burned tokens from module account", "amount", amounts.String(), "from", moduleName) // emit burn event ctx.EventManager().EmitEvent( diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 14d2b7c7f978..0862ac9c482b 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -8,6 +8,7 @@ import ( "testing" "time" + "cosmossdk.io/log" "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -139,6 +140,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.authKeeper, map[string]bool{accAddrs[4].String(): true}, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + log.NewNopLogger(), ) banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) @@ -240,6 +242,7 @@ func (suite *KeeperTestSuite) TestGetAuthority() { nil, nil, authority, + log.NewNopLogger(), ) } diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index da48effc09ef..1ab7dd22c0ff 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -4,6 +4,7 @@ import ( "fmt" "cosmossdk.io/collections" + "cosmossdk.io/log" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" @@ -53,6 +54,7 @@ type BaseSendKeeper struct { cdc codec.BinaryCodec ak types.AccountKeeper storeKey storetypes.StoreKey + logger log.Logger // list of addresses that are restricted from receiving transactions blockedAddrs map[string]bool @@ -68,18 +70,20 @@ func NewBaseSendKeeper( ak types.AccountKeeper, blockedAddrs map[string]bool, authority string, + logger log.Logger, ) BaseSendKeeper { if _, err := sdk.AccAddressFromBech32(authority); err != nil { panic(fmt.Errorf("invalid bank authority address: %w", err)) } return BaseSendKeeper{ - BaseViewKeeper: NewBaseViewKeeper(cdc, storeKey, ak), + BaseViewKeeper: NewBaseViewKeeper(cdc, storeKey, ak, logger), cdc: cdc, ak: ak, storeKey: storeKey, blockedAddrs: blockedAddrs, authority: authority, + logger: logger, } } diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index 308557889388..9e55f8d354c7 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -4,6 +4,7 @@ import ( "fmt" "cosmossdk.io/collections/indexes" + "cosmossdk.io/log" "github.com/cockroachdb/errors" @@ -11,7 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" - "cosmossdk.io/log" "cosmossdk.io/math" errorsmod "cosmossdk.io/errors" @@ -64,6 +64,7 @@ type BaseViewKeeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey ak types.AccountKeeper + logger log.Logger Schema collections.Schema Supply collections.Map[string, math.Int] @@ -74,12 +75,13 @@ type BaseViewKeeper struct { } // NewBaseViewKeeper returns a new BaseViewKeeper. -func NewBaseViewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, ak types.AccountKeeper) BaseViewKeeper { +func NewBaseViewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, ak types.AccountKeeper, logger log.Logger) BaseViewKeeper { sb := collections.NewSchemaBuilder(runtime.NewKVStoreService(storeKey.(*storetypes.KVStoreKey))) k := BaseViewKeeper{ cdc: cdc, storeKey: storeKey, ak: ak, + logger: logger, Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey, sdk.IntValue), DenomMetadata: collections.NewMap(sb, types.DenomMetadataPrefix, "denom_metadata", collections.StringKey, codec.CollValue[types.Metadata](cdc)), SendEnabled: collections.NewMap(sb, types.SendEnabledPrefix, "send_enabled", collections.StringKey, codec.BoolValue), // NOTE: we use a bool value which uses protobuf to retain state backwards compat @@ -95,16 +97,16 @@ func NewBaseViewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, ak t return k } -// Logger returns a module-specific logger. -func (k BaseViewKeeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+types.ModuleName) -} - // HasBalance returns whether or not an account has at least amt balance. func (k BaseViewKeeper) HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool { return k.GetBalance(ctx, addr, amt.Denom).IsGTE(amt) } +// Logger returns a module-specific logger. +func (k BaseViewKeeper) Logger() log.Logger { + return k.logger +} + // GetAllBalances returns all the account balances for the given account address. func (k BaseViewKeeper) GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { balances := sdk.NewCoins() diff --git a/x/bank/module.go b/x/bank/module.go index e892e95cd819..1014c4d771e9 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -9,6 +9,7 @@ import ( modulev1 "cosmossdk.io/api/cosmos/bank/module/v1" "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -212,6 +213,7 @@ type ModuleInputs struct { Config *modulev1.Module Cdc codec.Codec Key *store.KVStoreKey + Logger log.Logger AccountKeeper types.AccountKeeper @@ -254,6 +256,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { in.AccountKeeper, blockedAddresses, authority.String(), + in.Logger, ) m := NewAppModule(in.Cdc, bankKeeper, in.AccountKeeper, in.LegacySubspace) diff --git a/x/bank/simulation/operations_test.go b/x/bank/simulation/operations_test.go index 8f95b4199c69..dff5c698ef8b 100644 --- a/x/bank/simulation/operations_test.go +++ b/x/bank/simulation/operations_test.go @@ -4,6 +4,8 @@ import ( "math/rand" "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/suite" @@ -43,14 +45,18 @@ func (suite *SimTestSuite) SetupTest() { appBuilder *runtime.AppBuilder err error ) - suite.app, err = simtestutil.Setup(configurator.NewAppConfig( - configurator.AuthModule(), - configurator.ParamsModule(), - configurator.BankModule(), - configurator.StakingModule(), - configurator.ConsensusModule(), - configurator.TxModule(), - ), &suite.accountKeeper, &suite.bankKeeper, &suite.cdc, &suite.txConfig, &appBuilder) + suite.app, err = simtestutil.Setup( + depinject.Configs( + configurator.NewAppConfig( + configurator.AuthModule(), + configurator.ParamsModule(), + configurator.BankModule(), + configurator.StakingModule(), + configurator.ConsensusModule(), + configurator.TxModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), &suite.accountKeeper, &suite.bankKeeper, &suite.cdc, &suite.txConfig, &appBuilder) suite.NoError(err) diff --git a/x/distribution/simulation/operations_test.go b/x/distribution/simulation/operations_test.go index 9a5ed8b246c3..2bafc656bd41 100644 --- a/x/distribution/simulation/operations_test.go +++ b/x/distribution/simulation/operations_test.go @@ -4,6 +4,8 @@ import ( "math/rand" "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -234,7 +236,12 @@ func (suite *SimTestSuite) SetupTest() { appBuilder *runtime.AppBuilder err error ) - suite.app, err = simtestutil.Setup(distrtestutil.AppConfig, &suite.accountKeeper, + suite.app, err = simtestutil.Setup( + depinject.Configs( + distrtestutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), + &suite.accountKeeper, &suite.bankKeeper, &suite.cdc, &appBuilder, diff --git a/x/evidence/simulation/decoder_test.go b/x/evidence/simulation/decoder_test.go index c9dddff69c5f..bfcd1d88d296 100644 --- a/x/evidence/simulation/decoder_test.go +++ b/x/evidence/simulation/decoder_test.go @@ -6,6 +6,7 @@ import ( "time" "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/x/evidence/keeper" "cosmossdk.io/x/evidence/simulation" "cosmossdk.io/x/evidence/testutil" @@ -19,7 +20,10 @@ import ( func TestDecodeStore(t *testing.T) { var evidenceKeeper keeper.Keeper - err := depinject.Inject(testutil.AppConfig, &evidenceKeeper) + err := depinject.Inject(depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &evidenceKeeper) require.NoError(t, err) dec := simulation.NewDecodeStore(evidenceKeeper) diff --git a/x/gov/common_test.go b/x/gov/common_test.go index 55e684439663..0837c14cca8d 100644 --- a/x/gov/common_test.go +++ b/x/gov/common_test.go @@ -6,7 +6,11 @@ import ( "sort" "testing" + "cosmossdk.io/depinject" + sdklog "cosmossdk.io/log" "cosmossdk.io/math" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/runtime" @@ -29,7 +33,6 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" ) var ( @@ -112,14 +115,17 @@ func createTestSuite(t *testing.T) suite { res := suite{} app, err := simtestutil.SetupWithConfiguration( - configurator.NewAppConfig( - configurator.ParamsModule(), - configurator.AuthModule(), - configurator.StakingModule(), - configurator.BankModule(), - configurator.GovModule(), - configurator.ConsensusModule(), - configurator.DistributionModule(), + depinject.Configs( + configurator.NewAppConfig( + configurator.ParamsModule(), + configurator.AuthModule(), + configurator.StakingModule(), + configurator.BankModule(), + configurator.GovModule(), + configurator.ConsensusModule(), + configurator.DistributionModule(), + ), + depinject.Supply(sdklog.NewNopLogger()), ), simtestutil.DefaultStartUpConfig(), &res.AccountKeeper, &res.BankKeeper, &res.GovKeeper, &res.DistributionKeeper, &res.StakingKeeper, diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index aa661f639b94..3ccdefe6c197 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -6,6 +6,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" @@ -382,16 +384,21 @@ type suite struct { func createTestSuite(t *testing.T, isCheckTx bool) (suite, sdk.Context) { res := suite{} - app, err := simtestutil.Setup(configurator.NewAppConfig( - configurator.AuthModule(), - configurator.TxModule(), - configurator.ParamsModule(), - configurator.BankModule(), - configurator.StakingModule(), - configurator.ConsensusModule(), - configurator.DistributionModule(), - configurator.GovModule(), - ), &res.TxConfig, &res.AccountKeeper, &res.BankKeeper, &res.GovKeeper, &res.StakingKeeper, &res.DistributionKeeper) + app, err := simtestutil.Setup( + depinject.Configs( + configurator.NewAppConfig( + configurator.AuthModule(), + configurator.TxModule(), + configurator.ParamsModule(), + configurator.BankModule(), + configurator.StakingModule(), + configurator.ConsensusModule(), + configurator.DistributionModule(), + configurator.GovModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), + &res.TxConfig, &res.AccountKeeper, &res.BankKeeper, &res.GovKeeper, &res.StakingKeeper, &res.DistributionKeeper) require.NoError(t, err) ctx := app.BaseApp.NewContext(isCheckTx, cmtproto.Header{}) diff --git a/x/group/module/abci_test.go b/x/group/module/abci_test.go index c669fb3b4654..330af29dd1f4 100644 --- a/x/group/module/abci_test.go +++ b/x/group/module/abci_test.go @@ -6,9 +6,13 @@ import ( "time" "cosmossdk.io/core/address" + "cosmossdk.io/depinject" + "cosmossdk.io/log" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" cmttime "github.com/cometbft/cometbft/types/time" + "github.com/stretchr/testify/suite" + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" @@ -22,7 +26,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/group/module" grouptestutil "github.com/cosmos/cosmos-sdk/x/group/testutil" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/stretchr/testify/suite" ) type IntegrationTestSuite struct { @@ -45,7 +48,10 @@ func TestIntegrationTestSuite(t *testing.T) { func (s *IntegrationTestSuite) SetupTest() { app, err := simtestutil.Setup( - grouptestutil.AppConfig, + depinject.Configs( + grouptestutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &s.interfaceRegistry, &s.bankKeeper, &s.stakingKeeper, diff --git a/x/group/simulation/operations_test.go b/x/group/simulation/operations_test.go index 315b5280ad0f..936c0267aeae 100644 --- a/x/group/simulation/operations_test.go +++ b/x/group/simulation/operations_test.go @@ -5,6 +5,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/suite" @@ -42,7 +44,10 @@ type SimTestSuite struct { func (suite *SimTestSuite) SetupTest() { app, err := simtestutil.Setup( - grouptestutil.AppConfig, + depinject.Configs( + grouptestutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &suite.codec, &suite.interfaceRegistry, &suite.txConfig, diff --git a/x/mint/module_test.go b/x/mint/module_test.go index ed4f510bfc68..37bf7d4d88ab 100644 --- a/x/mint/module_test.go +++ b/x/mint/module_test.go @@ -3,6 +3,8 @@ package mint_test import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" @@ -16,7 +18,11 @@ import ( func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { var accountKeeper authkeeper.AccountKeeper - app, err := simtestutil.SetupAtGenesis(testutil.AppConfig, &accountKeeper) + app, err := simtestutil.SetupAtGenesis( + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &accountKeeper) require.NoError(t, err) ctx := app.BaseApp.NewContext(false, cmtproto.Header{}) diff --git a/x/slashing/abci_test.go b/x/slashing/abci_test.go index a87cf4bf827f..8547825939eb 100644 --- a/x/slashing/abci_test.go +++ b/x/slashing/abci_test.go @@ -4,6 +4,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" @@ -27,7 +29,10 @@ func TestBeginBlocker(t *testing.T) { var slashingKeeper slashingkeeper.Keeper app, err := simtestutil.Setup( - testutil.AppConfig, + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &interfaceRegistry, &bankKeeper, &stakingKeeper, diff --git a/x/slashing/app_test.go b/x/slashing/app_test.go index aa5ac935f197..028f3e77bedc 100644 --- a/x/slashing/app_test.go +++ b/x/slashing/app_test.go @@ -4,11 +4,14 @@ import ( "errors" "testing" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" + "cosmossdk.io/depinject" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/configurator" @@ -51,15 +54,21 @@ func TestSlashingMsgs(t *testing.T) { slashingKeeper keeper.Keeper ) - app, err := sims.SetupWithConfiguration(configurator.NewAppConfig( - configurator.ParamsModule(), - configurator.AuthModule(), - configurator.StakingModule(), - configurator.SlashingModule(), - configurator.TxModule(), - configurator.ConsensusModule(), - configurator.BankModule()), + app, err := sims.SetupWithConfiguration( + depinject.Configs( + configurator.NewAppConfig( + configurator.ParamsModule(), + configurator.AuthModule(), + configurator.StakingModule(), + configurator.SlashingModule(), + configurator.TxModule(), + configurator.ConsensusModule(), + configurator.BankModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), startupCfg, &stakingKeeper, &bankKeeper, &slashingKeeper) + require.NoError(t, err) baseApp := app.BaseApp diff --git a/x/slashing/simulation/operations_test.go b/x/slashing/simulation/operations_test.go index 0990f5f9e891..324d55e2d160 100644 --- a/x/slashing/simulation/operations_test.go +++ b/x/slashing/simulation/operations_test.go @@ -11,6 +11,8 @@ import ( cmttypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/suite" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client" @@ -78,7 +80,10 @@ func (suite *SimTestSuite) SetupTest() { startupCfg.ValidatorSet = createValidator app, err := simtestutil.SetupWithConfiguration( - testutil.AppConfig, + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), startupCfg, &suite.legacyAmino, &suite.codec, diff --git a/x/staking/app_test.go b/x/staking/app_test.go index 4a81bac5eb83..fd854894a2fb 100644 --- a/x/staking/app_test.go +++ b/x/staking/app_test.go @@ -5,12 +5,16 @@ import ( "github.com/stretchr/testify/require" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -53,7 +57,12 @@ func TestStakingMsgs(t *testing.T) { startupCfg := simtestutil.DefaultStartUpConfig() startupCfg.GenesisAccounts = accs - app, err := simtestutil.SetupWithConfiguration(testutil.AppConfig, startupCfg, &bankKeeper, &stakingKeeper) + app, err := simtestutil.SetupWithConfiguration( + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), + startupCfg, &bankKeeper, &stakingKeeper) require.NoError(t, err) ctxCheck := app.BaseApp.NewContext(true, cmtproto.Header{}) diff --git a/x/staking/module_test.go b/x/staking/module_test.go index aaea7b0cd52c..d8e6530a487c 100644 --- a/x/staking/module_test.go +++ b/x/staking/module_test.go @@ -3,6 +3,8 @@ package staking_test import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" @@ -15,7 +17,11 @@ import ( func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { var accountKeeper authKeeper.AccountKeeper - app, err := simtestutil.SetupAtGenesis(testutil.AppConfig, &accountKeeper) + app, err := simtestutil.SetupAtGenesis( + depinject.Configs( + testutil.AppConfig, + depinject.Supply(log.NewNopLogger()), + ), &accountKeeper) require.NoError(t, err) ctx := app.BaseApp.NewContext(false, cmtproto.Header{}) diff --git a/x/staking/simulation/operations_test.go b/x/staking/simulation/operations_test.go index 6d1484a6991f..ac3fe9874020 100644 --- a/x/staking/simulation/operations_test.go +++ b/x/staking/simulation/operations_test.go @@ -6,6 +6,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + sdklog "cosmossdk.io/log" "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -13,6 +15,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" cmttypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/client" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -88,7 +91,12 @@ func (s *SimTestSuite) SetupTest() { stakingKeeper *stakingkeeper.Keeper ) - app, err := simtestutil.SetupWithConfiguration(testutil.AppConfig, startupCfg, &s.txConfig, &bankKeeper, &accountKeeper, &mintKeeper, &distrKeeper, &stakingKeeper) + cfg := depinject.Configs( + testutil.AppConfig, + depinject.Supply(sdklog.NewNopLogger()), + ) + + app, err := simtestutil.SetupWithConfiguration(cfg, startupCfg, &s.txConfig, &bankKeeper, &accountKeeper, &mintKeeper, &distrKeeper, &stakingKeeper) require.NoError(s.T(), err) ctx := app.BaseApp.NewContext(false, cmtproto.Header{})