From 346d83d2e5d9ee00e51cfc30e7f6b686edd29217 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Thu, 21 Nov 2024 18:13:01 +0100 Subject: [PATCH 1/4] feat: adding runtime Environment --- .../controller/keeper/account.go | 12 ++++------- .../controller/keeper/keeper.go | 6 +++++- .../controller/keeper/keeper_test.go | 3 +++ .../controller/keeper/migrations_test.go | 3 +++ modules/apps/callbacks/testing/simapp/app.go | 6 ++++-- .../08-wasm/testing/simapp/app.go | 21 +++++++++++-------- simapp/app.go | 4 +++- testing/simapp/app.go | 4 +++- 8 files changed, 37 insertions(+), 22 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account.go b/modules/apps/27-interchain-accounts/controller/keeper/account.go index b49662ad049..9ee8392c086 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account.go @@ -5,7 +5,6 @@ import ( errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" @@ -65,19 +64,16 @@ func (k Keeper) registerInterchainAccount(ctx context.Context, connectionID, por k.setPort(ctx, portID) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 msg := channeltypes.NewMsgChannelOpenInit(portID, version, ordering, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) - handler := k.msgRouter.Handler(msg) - res, err := handler(sdkCtx, msg) + res, err := k.Environment.MsgRouterService.Invoke(ctx, msg) if err != nil { return "", err } - firstMsgResponse := res.MsgResponses[0] - channelOpenInitResponse, ok := firstMsgResponse.GetCachedValue().(*channeltypes.MsgChannelOpenInitResponse) + chanOpenInitResp, ok := res.(*channeltypes.MsgChannelOpenInitResponse) if !ok { - return "", errorsmod.Wrapf(ibcerrors.ErrInvalidType, "failed to convert %T message response to %T", firstMsgResponse.GetCachedValue(), &channeltypes.MsgChannelOpenInitResponse{}) + return "", errorsmod.Wrapf(ibcerrors.ErrInvalidType, "failed to convert %T message response to %T", res, &channeltypes.MsgChannelOpenInitResponse{}) } - return channelOpenInitResponse.ChannelId, nil + return chanOpenInitResp.ChannelId, nil } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index b118915bf87..1ac8f2a8243 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "fmt" "strings" + "cosmossdk.io/core/appmodule" corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" @@ -28,6 +29,8 @@ import ( // Keeper defines the IBC interchain accounts controller keeper type Keeper struct { + appmodule.Environment + storeService corestore.KVStoreService cdc codec.Codec legacySubspace icatypes.ParamSubspace @@ -43,7 +46,7 @@ type Keeper struct { // NewKeeper creates a new interchain accounts controller Keeper instance func NewKeeper( - cdc codec.Codec, storeService corestore.KVStoreService, legacySubspace icatypes.ParamSubspace, + cdc codec.Codec, env appmodule.Environment, storeService corestore.KVStoreService, legacySubspace icatypes.ParamSubspace, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, msgRouter icatypes.MessageRouter, authority string, ) Keeper { @@ -52,6 +55,7 @@ func NewKeeper( } return Keeper{ + Environment: env, storeService: storeService, cdc: cdc, legacySubspace: legacySubspace, diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go index 754f7c84198..dd2a77c8b58 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go @@ -5,6 +5,7 @@ import ( testifysuite "github.com/stretchr/testify/suite" + "cosmossdk.io/log" govtypes "cosmossdk.io/x/gov/types" "github.com/cosmos/cosmos-sdk/runtime" @@ -119,6 +120,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"success", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), + runtime.NewEnvironment(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), log.NewNopLogger()), runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, @@ -130,6 +132,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: empty authority", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), + runtime.NewEnvironment(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), log.NewNopLogger()), runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, diff --git a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go index 0a9da175f92..a69caa9229f 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go @@ -3,9 +3,11 @@ package keeper_test import ( "fmt" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/runtime" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" + "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" icacontrollertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" ) @@ -29,6 +31,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { func() { suite.chainA.GetSimApp().ICAControllerKeeper = icacontrollerkeeper.NewKeeper( suite.chainA.Codec, + runtime.NewEnvironment(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), log.NewNopLogger()), runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(icacontrollertypes.StoreKey)), nil, // assign a nil legacy param subspace suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, diff --git a/modules/apps/callbacks/testing/simapp/app.go b/modules/apps/callbacks/testing/simapp/app.go index 4f73b8a0aba..a409b6695e2 100644 --- a/modules/apps/callbacks/testing/simapp/app.go +++ b/modules/apps/callbacks/testing/simapp/app.go @@ -433,11 +433,13 @@ func NewSimApp( // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), logger.With(log.ModuleKey, "x/icacontroller"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter())), + runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, app.MsgServiceRouter(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + govModuleAddr, ) // ICA Host keeper diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index a17fdbb96d9..5debc2de103 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -1,6 +1,14 @@ package simapp import ( + "encoding/json" + "fmt" + "io" + "math/rand" + "os" + "path/filepath" + "strconv" + coreaddress "cosmossdk.io/core/address" "cosmossdk.io/x/accounts/accountstd" baseaccount "cosmossdk.io/x/accounts/defaults/base" @@ -9,17 +17,10 @@ import ( epochstypes "cosmossdk.io/x/epochs/types" nftkeeper "cosmossdk.io/x/nft/keeper" txdecode "cosmossdk.io/x/tx/decode" - "encoding/json" - "fmt" cmtcrypto "github.com/cometbft/cometbft/crypto" cmted25519 "github.com/cometbft/cometbft/crypto/ed25519" sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - "io" - "math/rand" - "os" - "path/filepath" - "strconv" "github.com/cosmos/gogoproto/proto" "github.com/spf13/cast" @@ -559,11 +560,13 @@ func NewSimApp( // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), logger.With(log.ModuleKey, "x/icacontroller"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter())), + runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, app.MsgServiceRouter(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + govModuleAddr, ) // ICA Host keeper diff --git a/simapp/app.go b/simapp/app.go index 00a1148747c..d7834f23870 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -539,7 +539,9 @@ func NewSimApp( // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), logger.With(log.ModuleKey, "x/icacontroller"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter())), + runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, app.MsgServiceRouter(), diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 53c0d583b70..5476d9476c5 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -515,7 +515,9 @@ func NewSimApp( // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), logger.With(log.ModuleKey, "x/icacontroller"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter())), + runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, app.MsgServiceRouter(), From 29ce5f20f789d7852dcec2462e629ee8f56808e9 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Thu, 21 Nov 2024 18:21:13 +0100 Subject: [PATCH 2/4] chore: run make lint-fix --- .../controller/keeper/migrations_test.go | 1 + .../simulation/proposals_test.go | 4 +- modules/core/simulation/proposals_test.go | 4 +- simapp/app.go | 53 +++++++++---------- simapp/simd/cmd/config.go | 4 +- testing/chain.go | 5 +- testing/simapp/app.go | 48 ++++++++--------- 7 files changed, 62 insertions(+), 57 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go index a69caa9229f..607d2d267ee 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go @@ -4,6 +4,7 @@ import ( "fmt" "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/runtime" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" diff --git a/modules/apps/27-interchain-accounts/simulation/proposals_test.go b/modules/apps/27-interchain-accounts/simulation/proposals_test.go index f3d5cc3becd..95c0e790270 100644 --- a/modules/apps/27-interchain-accounts/simulation/proposals_test.go +++ b/modules/apps/27-interchain-accounts/simulation/proposals_test.go @@ -1,12 +1,14 @@ package simulation_test import ( - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" "math/rand" "testing" + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/stretchr/testify/require" + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" diff --git a/modules/core/simulation/proposals_test.go b/modules/core/simulation/proposals_test.go index 23578134a1e..2344dd945e5 100644 --- a/modules/core/simulation/proposals_test.go +++ b/modules/core/simulation/proposals_test.go @@ -1,13 +1,15 @@ package simulation_test import ( - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" "math/rand" "testing" "time" + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/stretchr/testify/require" + codecaddress "github.com/cosmos/cosmos-sdk/codec/address" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" diff --git a/simapp/app.go b/simapp/app.go index d7834f23870..2ae2be5582e 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -8,37 +8,11 @@ import ( "os" "path/filepath" - epochskeeper "cosmossdk.io/x/epochs/keeper" - evidencekeeper "cosmossdk.io/x/evidence/keeper" - - sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - - abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" - cmtcrypto "github.com/cometbft/cometbft/crypto" - cmted25519 "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cosmos/gogoproto/proto" "github.com/spf13/cast" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - baseaccount "cosmossdk.io/x/accounts/defaults/base" - "cosmossdk.io/x/circuit" - circuitkeeper "cosmossdk.io/x/circuit/keeper" - circuittypes "cosmossdk.io/x/circuit/types" - "cosmossdk.io/x/epochs" - "cosmossdk.io/x/evidence" - evidencetypes "cosmossdk.io/x/evidence/types" - "cosmossdk.io/x/feegrant" - feegrantkeeper "cosmossdk.io/x/feegrant/keeper" - feegrantmodule "cosmossdk.io/x/feegrant/module" - groupkeeper "cosmossdk.io/x/group/keeper" - groupmodule "cosmossdk.io/x/group/module" - nftkeeper "cosmossdk.io/x/nft/keeper" - nftmodule "cosmossdk.io/x/nft/module" - "cosmossdk.io/x/protocolpool" - "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" - "cosmossdk.io/client/v2/autocli" clienthelpers "cosmossdk.io/client/v2/helpers" coreaddress "cosmossdk.io/core/address" @@ -47,6 +21,7 @@ import ( storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/accounts" "cosmossdk.io/x/accounts/accountstd" + baseaccount "cosmossdk.io/x/accounts/defaults/base" lockup "cosmossdk.io/x/accounts/defaults/lockup" "cosmossdk.io/x/accounts/defaults/multisig" "cosmossdk.io/x/authz" @@ -55,26 +30,42 @@ import ( "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" + "cosmossdk.io/x/circuit" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + circuittypes "cosmossdk.io/x/circuit/types" "cosmossdk.io/x/consensus" consensusparamkeeper "cosmossdk.io/x/consensus/keeper" consensustypes "cosmossdk.io/x/consensus/types" distr "cosmossdk.io/x/distribution" distrkeeper "cosmossdk.io/x/distribution/keeper" distrtypes "cosmossdk.io/x/distribution/types" + "cosmossdk.io/x/epochs" + epochskeeper "cosmossdk.io/x/epochs/keeper" epochstypes "cosmossdk.io/x/epochs/types" + "cosmossdk.io/x/evidence" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + feegrantmodule "cosmossdk.io/x/feegrant/module" "cosmossdk.io/x/gov" govkeeper "cosmossdk.io/x/gov/keeper" govtypes "cosmossdk.io/x/gov/types" govv1beta1 "cosmossdk.io/x/gov/types/v1beta1" "cosmossdk.io/x/group" + groupkeeper "cosmossdk.io/x/group/keeper" + groupmodule "cosmossdk.io/x/group/module" "cosmossdk.io/x/mint" mintkeeper "cosmossdk.io/x/mint/keeper" minttypes "cosmossdk.io/x/mint/types" "cosmossdk.io/x/nft" + nftkeeper "cosmossdk.io/x/nft/keeper" + nftmodule "cosmossdk.io/x/nft/module" "cosmossdk.io/x/params" paramskeeper "cosmossdk.io/x/params/keeper" paramstypes "cosmossdk.io/x/params/types" paramproposal "cosmossdk.io/x/params/types/proposal" + "cosmossdk.io/x/protocolpool" poolkeeper "cosmossdk.io/x/protocolpool/keeper" pooltypes "cosmossdk.io/x/protocolpool/types" "cosmossdk.io/x/slashing" @@ -108,19 +99,27 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/msgservice" + sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + + abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" + cmtcrypto "github.com/cometbft/cometbft/crypto" + cmted25519 "github.com/cometbft/cometbft/crypto/ed25519" + ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -319,7 +318,7 @@ func NewSimApp( // baseAppOptions = append(baseAppOptions, prepareOpt) // create and set dummy vote extension handler - //voteExtOp := func(bApp *baseapp.BaseApp) { + // voteExtOp := func(bApp *baseapp.BaseApp) { // voteExtHandler := NewVoteExtensionHandler() // voteExtHandler.SetHandlers(bApp) //} diff --git a/simapp/simd/cmd/config.go b/simapp/simd/cmd/config.go index 0424e975095..14e1543450c 100644 --- a/simapp/simd/cmd/config.go +++ b/simapp/simd/cmd/config.go @@ -3,11 +3,11 @@ package cmd import ( "strings" - cmtcfg "github.com/cometbft/cometbft/config" - clientconfig "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/crypto/keyring" serverconfig "github.com/cosmos/cosmos-sdk/server/config" + + cmtcfg "github.com/cometbft/cometbft/config" ) // initCometBFTConfig helps to override default CometBFT Config values. diff --git a/testing/chain.go b/testing/chain.go index a4b9dc43143..a0a64e56b13 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -1,13 +1,15 @@ package ibctesting import ( - "cosmossdk.io/core/header" "fmt" "testing" "time" + "cosmossdk.io/core/header" + "github.com/stretchr/testify/require" + "cosmossdk.io/core/header" errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" banktypes "cosmossdk.io/x/bank/types" @@ -199,7 +201,6 @@ func NewTestChain(t *testing.T, coord *Coordinator, chainID string) *TestChain { // GetContext returns the current context for the application. func (chain *TestChain) GetContext() sdk.Context { - ctx := chain.App.GetBaseApp().NewUncachedContext(false, chain.ProposedHeader) // when fetching time from context, the header info time is used, rather than the proposed header. diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 5476d9476c5..c992a48fc10 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -8,34 +8,11 @@ import ( "os" "path/filepath" - epochskeeper "cosmossdk.io/x/epochs/keeper" - evidencekeeper "cosmossdk.io/x/evidence/keeper" - - abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" - cmtcrypto "github.com/cometbft/cometbft/crypto" - cmted25519 "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cosmos/gogoproto/proto" "github.com/spf13/cast" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - baseaccount "cosmossdk.io/x/accounts/defaults/base" - "cosmossdk.io/x/circuit" - circuitkeeper "cosmossdk.io/x/circuit/keeper" - circuittypes "cosmossdk.io/x/circuit/types" - "cosmossdk.io/x/epochs" - "cosmossdk.io/x/evidence" - evidencetypes "cosmossdk.io/x/evidence/types" - "cosmossdk.io/x/feegrant" - feegrantkeeper "cosmossdk.io/x/feegrant/keeper" - feegrantmodule "cosmossdk.io/x/feegrant/module" - groupkeeper "cosmossdk.io/x/group/keeper" - groupmodule "cosmossdk.io/x/group/module" - nftkeeper "cosmossdk.io/x/nft/keeper" - nftmodule "cosmossdk.io/x/nft/module" - "cosmossdk.io/x/protocolpool" - "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" - "cosmossdk.io/client/v2/autocli" clienthelpers "cosmossdk.io/client/v2/helpers" coreaddress "cosmossdk.io/core/address" @@ -44,6 +21,7 @@ import ( storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/accounts" "cosmossdk.io/x/accounts/accountstd" + baseaccount "cosmossdk.io/x/accounts/defaults/base" lockup "cosmossdk.io/x/accounts/defaults/lockup" "cosmossdk.io/x/accounts/defaults/multisig" "cosmossdk.io/x/authz" @@ -52,26 +30,42 @@ import ( "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" + "cosmossdk.io/x/circuit" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + circuittypes "cosmossdk.io/x/circuit/types" "cosmossdk.io/x/consensus" consensusparamkeeper "cosmossdk.io/x/consensus/keeper" consensustypes "cosmossdk.io/x/consensus/types" distr "cosmossdk.io/x/distribution" distrkeeper "cosmossdk.io/x/distribution/keeper" distrtypes "cosmossdk.io/x/distribution/types" + "cosmossdk.io/x/epochs" + epochskeeper "cosmossdk.io/x/epochs/keeper" epochstypes "cosmossdk.io/x/epochs/types" + "cosmossdk.io/x/evidence" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + feegrantmodule "cosmossdk.io/x/feegrant/module" "cosmossdk.io/x/gov" govkeeper "cosmossdk.io/x/gov/keeper" govtypes "cosmossdk.io/x/gov/types" govv1beta1 "cosmossdk.io/x/gov/types/v1beta1" "cosmossdk.io/x/group" + groupkeeper "cosmossdk.io/x/group/keeper" + groupmodule "cosmossdk.io/x/group/module" "cosmossdk.io/x/mint" mintkeeper "cosmossdk.io/x/mint/keeper" minttypes "cosmossdk.io/x/mint/types" "cosmossdk.io/x/nft" + nftkeeper "cosmossdk.io/x/nft/keeper" + nftmodule "cosmossdk.io/x/nft/module" "cosmossdk.io/x/params" paramskeeper "cosmossdk.io/x/params/keeper" paramstypes "cosmossdk.io/x/params/types" paramproposal "cosmossdk.io/x/params/types/proposal" + "cosmossdk.io/x/protocolpool" poolkeeper "cosmossdk.io/x/protocolpool/keeper" pooltypes "cosmossdk.io/x/protocolpool/types" "cosmossdk.io/x/slashing" @@ -108,6 +102,7 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" @@ -118,6 +113,11 @@ import ( vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + + abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" + cmtcrypto "github.com/cometbft/cometbft/crypto" + cmted25519 "github.com/cometbft/cometbft/crypto/ed25519" + ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -314,7 +314,7 @@ func NewSimApp( // baseAppOptions = append(baseAppOptions, prepareOpt) // create and set dummy vote extension handler - //voteExtOp := func(bApp *baseapp.BaseApp) { + // voteExtOp := func(bApp *baseapp.BaseApp) { // voteExtHandler := NewVoteExtensionHandler() // voteExtHandler.SetHandlers(bApp) //} From 7e7d17de56e07910b4091117cb63532d02a846fc Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 22 Nov 2024 00:21:12 +0100 Subject: [PATCH 3/4] chore: remove duplicate import --- testing/chain.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/testing/chain.go b/testing/chain.go index a0a64e56b13..939ad817060 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -5,8 +5,6 @@ import ( "testing" "time" - "cosmossdk.io/core/header" - "github.com/stretchr/testify/require" "cosmossdk.io/core/header" From 7e2f6995de182fdcd1b389d9538c66ffd32a178c Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 22 Nov 2024 10:10:04 +0100 Subject: [PATCH 4/4] chore: rm duplicate import --- .../apps/27-interchain-accounts/simulation/proposals_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/apps/27-interchain-accounts/simulation/proposals_test.go b/modules/apps/27-interchain-accounts/simulation/proposals_test.go index 95c0e790270..b385d11cc70 100644 --- a/modules/apps/27-interchain-accounts/simulation/proposals_test.go +++ b/modules/apps/27-interchain-accounts/simulation/proposals_test.go @@ -4,8 +4,6 @@ import ( "math/rand" "testing" - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/stretchr/testify/require" codecaddress "github.com/cosmos/cosmos-sdk/codec/address"