diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go index 4c1c112615a..1ceaee62032 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go @@ -182,7 +182,7 @@ func (im IBCMiddleware) OnRecvPacket( ) ibcexported.Acknowledgement { err := errorsmod.Wrapf(icatypes.ErrInvalidChannelFlow, "cannot receive packet on controller chain") ack := channeltypes.NewErrorAcknowledgement(err) - keeper.EmitAcknowledgementEvent(ctx, packet, ack, err, im.keeper) + keeper.EmitAcknowledgementEvent(ctx, packet, ack, err, im.keeper.Environment) return ack } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go index e548f9fc0f2..acf30c9e20d 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "cosmossdk.io/core/appmodule" "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" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" @@ -14,10 +13,6 @@ import ( func (suite *KeeperTestSuite) TestInitGenesis() { ports := []string{"port1", "port2", "port3"} - env := appmodule.Environment{ - Logger: suite.chainA.GetSimApp().Logger(), - } - testCases := []struct { name string malleate func() @@ -35,7 +30,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { }, } - interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), env, ibctesting.FirstConnectionID, TestPortID) + interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), suite.chainB.GetSimApp().ICAControllerKeeper.Environment, ibctesting.FirstConnectionID, TestPortID) genesisState := genesistypes.ControllerGenesisState{ ActiveChannels: []genesistypes.ActiveChannel{ { 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 0826faca5c7..92284eae8fe 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go @@ -5,9 +5,7 @@ import ( testifysuite "github.com/stretchr/testify/suite" - "cosmossdk.io/core/appmodule" govtypes "cosmossdk.io/x/gov/types" - "github.com/cosmos/cosmos-sdk/runtime" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -111,11 +109,6 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) TestNewKeeper() { - env := appmodule.Environment{ - Logger: suite.chainA.GetSimApp().Logger(), - KVStoreService: runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), - } - testCases := []struct { name string instantiateFn func() @@ -124,7 +117,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"success", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - env, + suite.chainA.GetSimApp().ICAControllerKeeper.Environment, suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, @@ -137,7 +130,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: empty authority", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - env, + suite.chainA.GetSimApp().ICAControllerKeeper.Environment, suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, 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 f7751fa9476..b6d9344ff36 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go @@ -3,8 +3,6 @@ package keeper_test import ( "fmt" - "github.com/cosmos/cosmos-sdk/runtime" - icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" icacontrollertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" ) @@ -29,7 +27,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { func() { suite.chainA.GetSimApp().ICAControllerKeeper = icacontrollerkeeper.NewKeeper( suite.chainA.Codec, - runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(icacontrollertypes.StoreKey)), + suite.chainA.GetSimApp().ICAControllerKeeper.Environment, nil, // assign a nil legacy param subspace suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go b/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go index 7f1decd4ab5..ee313ca5e22 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/require" + "cosmossdk.io/core/registry" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" "github.com/cosmos/cosmos-sdk/codec" @@ -46,7 +47,7 @@ func TestGeneratePacketData(t *testing.T) { memo string expectedPass bool message string - registerInterfaceFn func(registry codectypes.InterfaceRegistry) + registerInterfaceFn func(registry registry.InterfaceRegistrar) assertionFn func(t *testing.T, msgs []sdk.Msg) }{ { @@ -54,7 +55,7 @@ func TestGeneratePacketData(t *testing.T) { memo: "", expectedPass: true, message: multiMsg, - registerInterfaceFn: func(registry codectypes.InterfaceRegistry) { + registerInterfaceFn: func(registry registry.InterfaceRegistrar) { stakingtypes.RegisterInterfaces(registry) banktypes.RegisterInterfaces(registry) }, diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index fb87dde0a73..4cdd9bf6ce5 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -148,7 +148,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() { }, { "account address generation is block dependent", func() { - icaHostAccount := icatypes.GenerateAddress(suite.chainB.GetContext(), path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID) + icaHostAccount := icatypes.GenerateAddress(suite.chainB.GetContext(), suite.chainB.GetSimApp().ICAHostKeeper.Environment, path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID) err := suite.chainB.GetSimApp().BankKeeper.SendCoins(suite.chainB.GetContext(), suite.chainB.SenderAccount.GetAddress(), icaHostAccount, sdk.Coins{sdk.NewCoin("stake", sdkmath.NewInt(1))}) suite.Require().NoError(err) suite.Require().True(suite.chainB.GetSimApp().AccountKeeper.HasAccount(suite.chainB.GetContext(), icaHostAccount)) diff --git a/modules/apps/27-interchain-accounts/host/keeper/account.go b/modules/apps/27-interchain-accounts/host/keeper/account.go index c6b239232bb..bc01a19bfe9 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/account.go +++ b/modules/apps/27-interchain-accounts/host/keeper/account.go @@ -15,7 +15,7 @@ import ( // and block dependent information. An error is returned if an account already exists for the generated account. // An interchain account type is set in the account keeper and the interchain account address mapping is updated. func (k Keeper) createInterchainAccount(ctx context.Context, connectionID, controllerPortID string) (sdk.AccAddress, error) { - accAddress := icatypes.GenerateAddress(ctx, connectionID, controllerPortID) + accAddress := icatypes.GenerateAddress(ctx, k.Environment, connectionID, controllerPortID) if acc := k.accountKeeper.GetAccount(ctx, accAddress); acc != nil { return nil, errorsmod.Wrapf(icatypes.ErrAccountAlreadyExist, "existing account for newly generated interchain account address %s", accAddress) diff --git a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go index 079e2aa7903..364cbd9a3fc 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go @@ -10,7 +10,7 @@ import ( ) func (suite *KeeperTestSuite) TestInitGenesis() { - interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, TestPortID) + interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), suite.chainB.GetSimApp().ICAHostKeeper.Environment, ibctesting.FirstConnectionID, TestPortID) genesisState := genesistypes.HostGenesisState{ ActiveChannels: []genesistypes.ActiveChannel{ { @@ -65,7 +65,7 @@ func (suite *KeeperTestSuite) TestGenesisParams() { suite.Run(tc.name, func() { suite.SetupTest() // reset - interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, TestPortID) + interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), suite.chainB.GetSimApp().ICAHostKeeper.Environment, ibctesting.FirstConnectionID, TestPortID) genesisState := genesistypes.HostGenesisState{ ActiveChannels: []genesistypes.ActiveChannel{ { diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index 53279b724a0..66365cafdfa 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -172,7 +172,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { { "account already exists", func() { - interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID) + interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), suite.chainB.GetSimApp().ICAHostKeeper.Environment, path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID) err := suite.chainB.GetSimApp().BankKeeper.SendCoins(suite.chainB.GetContext(), suite.chainB.SenderAccount.GetAddress(), interchainAccAddr, sdk.Coins{sdk.NewCoin("stake", sdkmath.NewInt(1))}) suite.Require().NoError(err) suite.Require().True(suite.chainB.GetSimApp().AccountKeeper.HasAccount(suite.chainB.GetContext(), interchainAccAddr)) diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go index 6f664d79b84..7887d1cbdd2 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go @@ -4,10 +4,8 @@ import ( "fmt" "testing" - "cosmossdk.io/core/appmodule" testifysuite "github.com/stretchr/testify/suite" - "github.com/cosmos/cosmos-sdk/runtime" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" @@ -135,11 +133,6 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) TestNewKeeper() { - env := appmodule.Environment{ - Logger: suite.chainA.GetSimApp().Logger(), - KVStoreService: runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), - } - testCases := []struct { name string instantiateFn func() @@ -148,7 +141,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"success", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - env, + suite.chainA.GetSimApp().ICAHostKeeper.Environment, suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, @@ -163,7 +156,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: interchain accounts module account does not exist", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - env, + suite.chainA.GetSimApp().ICAHostKeeper.Environment, suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, @@ -178,7 +171,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: empty mock staking keeper", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - env, + suite.chainA.GetSimApp().ICAHostKeeper.Environment, suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, diff --git a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go index 3868d836325..b91fc09845a 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go @@ -4,7 +4,6 @@ import ( "fmt" govtypes "cosmossdk.io/x/gov/types" - "github.com/cosmos/cosmos-sdk/runtime" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" icahostkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/keeper" @@ -31,7 +30,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { func() { suite.chainA.GetSimApp().ICAHostKeeper = icahostkeeper.NewKeeper( suite.chainA.Codec, - runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(icahosttypes.StoreKey)), + suite.chainA.GetSimApp().ICAHostKeeper.Environment, nil, // assign a nil legacy param subspace suite.chainA.GetSimApp().IBCFeeKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay.go b/modules/apps/27-interchain-accounts/host/keeper/relay.go index 9b7c34e6038..a7e25d3f281 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay.go @@ -133,10 +133,10 @@ func (k Keeper) authenticateTx(ctx context.Context, msgs []sdk.Msg, connectionID // Attempts to get the message handler from the router and if found will then execute the message. // If the message execution is successful, the proto marshaled message response will be returned. func (k Keeper) executeMsg(ctx context.Context, env appmodule.Environment, msg sdk.Msg) (*codectypes.Any, error) { // TODO: https://github.com/cosmos/ibc-go/issues/7223 - handler := env.MsgRouterService.CanInvoke(ctx, msg) - if handler == nil { - return nil, icatypes.ErrInvalidRoute - } + // handler := env.MsgRouterService.CanInvoke(ctx, msg) + // if handler == nil { + // return nil, icatypes.ErrInvalidRoute + // } res, err := env.MsgRouterService.Invoke(ctx, msg) if err != nil { diff --git a/modules/apps/27-interchain-accounts/simulation/proposals.go b/modules/apps/27-interchain-accounts/simulation/proposals.go index 1776362f8fc..cc1ff0521ed 100644 --- a/modules/apps/27-interchain-accounts/simulation/proposals.go +++ b/modules/apps/27-interchain-accounts/simulation/proposals.go @@ -1,11 +1,13 @@ package simulation import ( + "context" "math/rand" + "cosmossdk.io/core/address" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/simulation" controllerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -25,14 +27,14 @@ const ( func ProposalMsgs(controllerKeeper *controllerkeeper.Keeper, hostKeeper *hostkeeper.Keeper) []simtypes.WeightedProposalMsg { msgs := make([]simtypes.WeightedProposalMsg, 0, 2) if hostKeeper != nil { - msgs = append(msgs, simulation.NewWeightedProposalMsg( + msgs = append(msgs, simulation.NewWeightedProposalMsgX( OpWeightMsgUpdateParams, DefaultWeightMsgUpdateParams, SimulateHostMsgUpdateParams, )) } if controllerKeeper != nil { - msgs = append(msgs, simulation.NewWeightedProposalMsg( + msgs = append(msgs, simulation.NewWeightedProposalMsgX( OpWeightMsgUpdateParams, DefaultWeightMsgUpdateParams, SimulateControllerMsgUpdateParams, @@ -42,25 +44,25 @@ func ProposalMsgs(controllerKeeper *controllerkeeper.Keeper, hostKeeper *hostkee } // SimulateHostMsgUpdateParams returns a MsgUpdateParams for the host module -func SimulateHostMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { - var signer sdk.AccAddress = address.Module("gov") +func SimulateHostMsgUpdateParams(_ context.Context, r *rand.Rand, _ []simtypes.Account, _ address.Codec) (sdk.Msg, error) { + var signer sdk.AccAddress = authtypes.NewModuleAddress("gov") params := types.DefaultParams() params.HostEnabled = false return &types.MsgUpdateParams{ Signer: signer.String(), Params: params, - } + }, nil } // SimulateControllerMsgUpdateParams returns a MsgUpdateParams for the controller module -func SimulateControllerMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { - var signer sdk.AccAddress = address.Module("gov") +func SimulateControllerMsgUpdateParams(_ context.Context, r *rand.Rand, _ []simtypes.Account, _ address.Codec) (sdk.Msg, error) { + var signer sdk.AccAddress = authtypes.NewModuleAddress("gov") params := controllertypes.DefaultParams() params.ControllerEnabled = false return &controllertypes.MsgUpdateParams{ Signer: signer.String(), Params: params, - } + }, nil } diff --git a/modules/apps/27-interchain-accounts/simulation/proposals_test.go b/modules/apps/27-interchain-accounts/simulation/proposals_test.go index 4799b16f57a..ec22e30817c 100644 --- a/modules/apps/27-interchain-accounts/simulation/proposals_test.go +++ b/modules/apps/27-interchain-accounts/simulation/proposals_test.go @@ -84,7 +84,8 @@ func TestProposalMsgs(t *testing.T) { require.Equal(t, simulation.OpWeightMsgUpdateParams, weightedMsg.AppParamsKey()) require.Equal(t, simulation.DefaultWeightMsgUpdateParams, weightedMsg.DefaultWeight()) - msg := weightedMsg.MsgSimulatorFn()(r, ctx, accounts) + msg, err := weightedMsg.MsgSimulatorFn()(ctx, r, accounts, nil) // TODO: codec + require.NoError(t, err) if msgUpdateHostParams, ok := msg.(*hosttypes.MsgUpdateParams); ok { require.Equal(t, tc.expMsgs[idx], msgUpdateHostParams) diff --git a/modules/apps/27-interchain-accounts/types/account_test.go b/modules/apps/27-interchain-accounts/types/account_test.go index 60f4b5f297d..206071ae8d7 100644 --- a/modules/apps/27-interchain-accounts/types/account_test.go +++ b/modules/apps/27-interchain-accounts/types/account_test.go @@ -44,7 +44,7 @@ func TestTypesTestSuite(t *testing.T) { } func (suite *TypesTestSuite) TestGenerateAddress() { - addr := types.GenerateAddress(suite.chainA.GetContext(), "test-connection-id", "test-port-id") + addr := types.GenerateAddress(suite.chainA.GetContext(), suite.chainA.GetSimApp().ICAHostKeeper.Environment, "test-connection-id", "test-port-id") accAddr, err := sdk.AccAddressFromBech32(addr.String()) suite.Require().NoError(err, "TestGenerateAddress failed") diff --git a/modules/core/02-client/abci.go b/modules/core/02-client/abci.go index 1901405b979..392f4e393ec 100644 --- a/modules/core/02-client/abci.go +++ b/modules/core/02-client/abci.go @@ -22,8 +22,8 @@ func BeginBlocker(ctx context.Context, k *keeper.Keeper) { hi := k.HeaderService.HeaderInfo(ctx) if err == nil && hi.Height == plan.Height-1 { upgradedConsState := &ibctm.ConsensusState{ - Timestamp: hi.Time, - NextValidatorsHash: hi.NextValidatorsHash, //TODO: need to pass the consensus modules blocked on https://github.com/cosmos/cosmos-sdk/pull/21480 + Timestamp: hi.Time, + // NextValidatorsHash: hi.NextValidatorsHash, //TODO: need to pass the consensus modules blocked on https://github.com/cosmos/cosmos-sdk/pull/21480 } bz := types.MustMarshalConsensusState(k.Codec(), upgradedConsState) diff --git a/modules/core/04-channel/types/acknowledgement_test.go b/modules/core/04-channel/types/acknowledgement_test.go index edddef900c8..882af430970 100644 --- a/modules/core/04-channel/types/acknowledgement_test.go +++ b/modules/core/04-channel/types/acknowledgement_test.go @@ -5,8 +5,6 @@ import ( errorsmod "cosmossdk.io/errors" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" cmtstate "github.com/cometbft/cometbft/state" @@ -107,13 +105,13 @@ func (suite *TypesTestSuite) TestABCICodeDeterminism() { // different ABCI error code used errDifferentABCICode := ibcerrors.ErrNotFound - deliverTx := sdkerrors.ResponseExecTxResultWithEvents(err, gasUsed, gasWanted, []abci.Event{}, false) + deliverTx := responseExecTxResultWithEvents(err, gasUsed, gasWanted, []abci.Event{}, false) execTxResults := []*abci.ExecTxResult{deliverTx} - deliverTxSameABCICode := sdkerrors.ResponseExecTxResultWithEvents(errSameABCICode, gasUsed, gasWanted, []abci.Event{}, false) + deliverTxSameABCICode := responseExecTxResultWithEvents(errSameABCICode, gasUsed, gasWanted, []abci.Event{}, false) resultsSameABCICode := []*abci.ExecTxResult{deliverTxSameABCICode} - deliverTxDifferentABCICode := sdkerrors.ResponseExecTxResultWithEvents(errDifferentABCICode, gasUsed, gasWanted, []abci.Event{}, false) + deliverTxDifferentABCICode := responseExecTxResultWithEvents(errDifferentABCICode, gasUsed, gasWanted, []abci.Event{}, false) resultsDifferentABCICode := []*abci.ExecTxResult{deliverTxDifferentABCICode} hash := cmtstate.TxResultsHash(execTxResults) @@ -124,6 +122,21 @@ func (suite *TypesTestSuite) TestABCICodeDeterminism() { suite.Require().NotEqual(hash, hashDifferentABCICode) } +// cosmos-sdk/baseapp/errors.go @ 01c0e9ba35818be56428483222b79f6d9cfaa105 +// responseExecTxResultWithEvents returns an ABCI ExecTxResult object with fields +// filled in from the given error, gas values and events. +func responseExecTxResultWithEvents(err error, gw, gu uint64, events []abci.Event, debug bool) *abci.ExecTxResult { + space, code, log := errorsmod.ABCIInfo(err, debug) + return &abci.ExecTxResult{ + Codespace: space, + Code: code, + Log: log, + GasWanted: int64(gw), + GasUsed: int64(gu), + Events: events, + } +} + // TestAcknowledgementError will verify that only a constant string and // ABCI error code are used in constructing the acknowledgement error string func (suite *TypesTestSuite) TestAcknowledgementError() { diff --git a/modules/light-clients/08-wasm/simulation/proposals.go b/modules/light-clients/08-wasm/simulation/proposals.go index 2767d5fa52c..b5a20dee2f6 100644 --- a/modules/light-clients/08-wasm/simulation/proposals.go +++ b/modules/light-clients/08-wasm/simulation/proposals.go @@ -9,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // Simulation operation weights constants @@ -21,7 +22,7 @@ const ( // ProposalMsgs defines the module weighted proposals' contents func ProposalMsgs() []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( + simulation.NewWeightedProposalMsgX( OpWeightMsgStoreCode, DefaultWeightMsgStoreCode, SimulateMsgStoreCode, @@ -31,7 +32,7 @@ func ProposalMsgs() []simtypes.WeightedProposalMsg { // SimulateMsgStoreCode returns a random MsgStoreCode for the 08-wasm module func SimulateMsgStoreCode(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { - var signer sdk.AccAddress = address.Module("gov") + var signer sdk.AccAddress = authtypes.NewModuleAddress("gov") return &types.MsgStoreCode{ Signer: signer.String(),