From 07316fa17a7143c4b26df459011ae47c6b902dae Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Wed, 10 Jul 2024 19:45:35 +0200 Subject: [PATCH] chore: remove gov v1beta1 from simapp (#6798) * chore: remove gov v1beta1 router from simapps * fix ica gov test failing intermittently * Remove usage of gov v1beta1 from relay test --- e2e/tests/interchain_accounts/gov_test.go | 2 + .../host/keeper/relay_test.go | 129 ++++++------------ modules/apps/callbacks/testing/simapp/app.go | 13 -- .../08-wasm/testing/simapp/app.go | 12 -- simapp/app.go | 13 +- testing/simapp/app.go | 13 +- 6 files changed, 48 insertions(+), 134 deletions(-) diff --git a/e2e/tests/interchain_accounts/gov_test.go b/e2e/tests/interchain_accounts/gov_test.go index b0a46e1d026..620d82bfb17 100644 --- a/e2e/tests/interchain_accounts/gov_test.go +++ b/e2e/tests/interchain_accounts/gov_test.go @@ -109,6 +109,8 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration() s.ExecuteAndPassGovV1Proposal(ctx, msgSendTx, chainA, controllerAccount) }) + s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB)) // wait for the ica tx to be relayed + t.Run("verify tokens transferred", func(t *testing.T) { balance, err := query.Balance(ctx, chainB, chainBAccount.FormattedAddress(), chainB.Config().Denom) s.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go index ba726c508bb..2fa5d5b876a 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go @@ -3,17 +3,18 @@ package keeper_test import ( "fmt" "strings" + "time" "github.com/cosmos/gogoproto/proto" sdkmath "cosmossdk.io/math" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" @@ -44,16 +45,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID) suite.Require().True(found) - // Populate the gov keeper in advance with an active proposal - testProposal := &govtypes.TextProposal{ - Title: "IBC Gov Proposal", - Description: "tokens for all!", - } - - proposalMsg, err := govv1.NewLegacyContent(testProposal, interchainAccountAddr) - suite.Require().NoError(err) - - proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false) + proposal, err := govtypesv1.NewProposal([]sdk.Msg{getTestProposalMessage()}, govtypesv1.DefaultStartingProposalID, time.Now(), time.Now().Add(time.Hour), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false) suite.Require().NoError(err) err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) @@ -61,10 +53,10 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal) suite.Require().NoError(err) - msg := &govtypes.MsgVote{ - ProposalId: govtypes.DefaultStartingProposalID, + msg := &govtypesv1.MsgVote{ + ProposalId: govtypesv1.DefaultStartingProposalID, Voter: interchainAccountAddr, - Option: govtypes.OptionYes, + Option: govtypesv1.OptionYes, } data, err := icatypes.SerializeCosmosTx(suite.chainA.GetSimApp().AppCodec(), []proto.Message{msg}, encoding) @@ -172,25 +164,14 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { nil, }, { - "interchain account successfully executes govtypes.MsgSubmitProposal", + "interchain account successfully executes govtypesv1.MsgSubmitProposal", func(encoding string) { interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID) suite.Require().True(found) - testProposal := &govtypes.TextProposal{ - Title: "IBC Gov Proposal", - Description: "tokens for all!", - } - - protoAny, err := codectypes.NewAnyWithValue(testProposal) + msg, err := govtypesv1.NewMsgSubmitProposal([]sdk.Msg{}, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000))), interchainAccountAddr, "metadata", "title", "summary", false) suite.Require().NoError(err) - msg := &govtypes.MsgSubmitProposal{ - Content: protoAny, - InitialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000))), - Proposer: interchainAccountAddr, - } - data, err := icatypes.SerializeCosmosTx(suite.chainA.GetSimApp().AppCodec(), []proto.Message{msg}, encoding) suite.Require().NoError(err) @@ -207,21 +188,12 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { nil, }, { - "interchain account successfully executes govtypes.MsgVote", + "interchain account successfully executes govtypesv1.MsgVote", func(encoding string) { interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID) suite.Require().True(found) - // Populate the gov keeper in advance with an active proposal - testProposal := &govtypes.TextProposal{ - Title: "IBC Gov Proposal", - Description: "tokens for all!", - } - - proposalMsg, err := govv1.NewLegacyContent(testProposal, interchainAccountAddr) - suite.Require().NoError(err) - - proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "description", sdk.AccAddress(interchainAccountAddr), false) + proposal, err := govtypesv1.NewProposal([]sdk.Msg{getTestProposalMessage()}, govtypesv1.DefaultStartingProposalID, time.Now(), time.Now().Add(time.Hour), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false) suite.Require().NoError(err) err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) @@ -229,10 +201,10 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal) suite.Require().NoError(err) - msg := &govtypes.MsgVote{ - ProposalId: govtypes.DefaultStartingProposalID, + msg := &govtypesv1.MsgVote{ + ProposalId: govtypesv1.DefaultStartingProposalID, Voter: interchainAccountAddr, - Option: govtypes.OptionYes, + Option: govtypesv1.OptionYes, } data, err := icatypes.SerializeCosmosTx(suite.chainA.GetSimApp().AppCodec(), []proto.Message{msg}, encoding) @@ -601,16 +573,7 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { { "interchain account successfully executes an arbitrary message type using the * (allow all message types) param", func(icaAddress string) { - // Populate the gov keeper in advance with an active proposal - testProposal := &govtypes.TextProposal{ - Title: "IBC Gov Proposal", - Description: "tokens for all!", - } - - proposalMsg, err := govv1.NewLegacyContent(testProposal, interchainAccountAddr) - suite.Require().NoError(err) - - proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false) + proposal, err := govtypesv1.NewProposal([]sdk.Msg{getTestProposalMessage()}, govtypesv1.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false) suite.Require().NoError(err) err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) @@ -621,7 +584,7 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { msgBytes := []byte(`{ "messages": [ { - "@type": "/cosmos.gov.v1beta1.MsgVote", + "@type": "/cosmos.gov.v1.MsgVote", "voter": "` + icaAddress + `", "proposal_id": 1, "option": 1 @@ -668,17 +631,17 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { nil, }, { - "interchain account successfully executes govtypes.MsgSubmitProposal", + "interchain account successfully executes govtypesv1.MsgSubmitProposal", func(icaAddress string) { msgBytes := []byte(`{ "messages": [ { - "@type": "/cosmos.gov.v1beta1.MsgSubmitProposal", - "content": { - "@type": "/cosmos.gov.v1beta1.TextProposal", - "title": "IBC Gov Proposal", - "description": "tokens for all!" - }, + "@type": "/cosmos.gov.v1.MsgSubmitProposal", + "messages": [], + "metadata": "ipfs://CID", + "title": "IBC Gov Proposal", + "summary": "tokens for all!", + "expedited": false, "initial_deposit": [{ "denom": "stake", "amount": "100000" }], "proposer": "` + icaAddress + `" } @@ -691,24 +654,15 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { "data":` + byteArrayString + ` }`) - params := types.NewParams(true, []string{sdk.MsgTypeURL((*govtypes.MsgSubmitProposal)(nil))}) + params := types.NewParams(true, []string{sdk.MsgTypeURL((*govtypesv1.MsgSubmitProposal)(nil))}) suite.chainB.GetSimApp().ICAHostKeeper.SetParams(suite.chainB.GetContext(), params) }, nil, }, { - "interchain account successfully executes govtypes.MsgVote", + "interchain account successfully executes govtypesv1.MsgVote", func(icaAddress string) { - // Populate the gov keeper in advance with an active proposal - testProposal := &govtypes.TextProposal{ - Title: "IBC Gov Proposal", - Description: "tokens for all!", - } - - proposalMsg, err := govv1.NewLegacyContent(testProposal, interchainAccountAddr) - suite.Require().NoError(err) - - proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "description", sdk.AccAddress(interchainAccountAddr), false) + proposal, err := govtypesv1.NewProposal([]sdk.Msg{getTestProposalMessage()}, govtypesv1.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false) suite.Require().NoError(err) err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal) @@ -719,7 +673,7 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { msgBytes := []byte(`{ "messages": [ { - "@type": "/cosmos.gov.v1beta1.MsgVote", + "@type": "/cosmos.gov.v1.MsgVote", "voter": "` + icaAddress + `", "proposal_id": 1, "option": 1 @@ -733,34 +687,34 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { "data":` + byteArrayString + ` }`) - params := types.NewParams(true, []string{sdk.MsgTypeURL((*govtypes.MsgVote)(nil))}) + params := types.NewParams(true, []string{sdk.MsgTypeURL((*govtypesv1.MsgVote)(nil))}) suite.chainB.GetSimApp().ICAHostKeeper.SetParams(suite.chainB.GetContext(), params) }, nil, }, { - "interchain account successfully executes govtypes.MsgSubmitProposal, govtypes.MsgDeposit, and then govtypes.MsgVote sequentially", + "interchain account successfully executes govtypesv1.MsgSubmitProposal, govtypesv1.MsgDeposit, and then govtypesv1.MsgVote sequentially", func(icaAddress string) { msgBytes := []byte(`{ "messages": [ { - "@type": "/cosmos.gov.v1beta1.MsgSubmitProposal", - "content": { - "@type": "/cosmos.gov.v1beta1.TextProposal", - "title": "IBC Gov Proposal", - "description": "tokens for all!" - }, + "@type": "/cosmos.gov.v1.MsgSubmitProposal", + "messages": [], + "metadata": "ipfs://CID", + "title": "IBC Gov Proposal", + "summary": "tokens for all!", + "expedited": false, "initial_deposit": [{ "denom": "stake", "amount": "100000" }], "proposer": "` + icaAddress + `" }, { - "@type": "/cosmos.gov.v1beta1.MsgDeposit", + "@type": "/cosmos.gov.v1.MsgDeposit", "proposal_id": 1, "depositor": "` + icaAddress + `", "amount": [{ "denom": "stake", "amount": "10000000" }] }, { - "@type": "/cosmos.gov.v1beta1.MsgVote", + "@type": "/cosmos.gov.v1.MsgVote", "voter": "` + icaAddress + `", "proposal_id": 1, "option": 1 @@ -774,7 +728,7 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { "data":` + byteArrayString + ` }`) - params := types.NewParams(true, []string{sdk.MsgTypeURL((*govtypes.MsgSubmitProposal)(nil)), sdk.MsgTypeURL((*govtypes.MsgDeposit)(nil)), sdk.MsgTypeURL((*govtypes.MsgVote)(nil))}) + params := types.NewParams(true, []string{sdk.MsgTypeURL((*govtypesv1.MsgSubmitProposal)(nil)), sdk.MsgTypeURL((*govtypesv1.MsgDeposit)(nil)), sdk.MsgTypeURL((*govtypesv1.MsgVote)(nil))}) suite.chainB.GetSimApp().ICAHostKeeper.SetParams(suite.chainB.GetContext(), params) }, nil, @@ -946,3 +900,8 @@ func (suite *KeeperTestSuite) fundICAWallet(ctx sdk.Context, portID string, amou suite.Require().NotEmpty(res) suite.Require().NoError(err) } + +func getTestProposalMessage() sdk.Msg { + _, _, addr := testdata.KeyTestPubAddr() + return banktypes.NewMsgSend(authtypes.NewModuleAddress("gov"), addr, sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(1000)))) +} diff --git a/modules/apps/callbacks/testing/simapp/app.go b/modules/apps/callbacks/testing/simapp/app.go index a01a8e01657..8f8c54f8b94 100644 --- a/modules/apps/callbacks/testing/simapp/app.go +++ b/modules/apps/callbacks/testing/simapp/app.go @@ -82,7 +82,6 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" @@ -93,7 +92,6 @@ import ( paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -414,14 +412,6 @@ func NewSimApp( // Real applications should not use the mock ContractKeeper app.MockContractKeeper = NewContractKeeper(memKeys[ibcmock.MemStoreKey]) - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) - govConfig := govtypes.DefaultConfig() /* Example of setting gov params: @@ -432,9 +422,6 @@ func NewSimApp( app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // Set legacy router for backwards compatibility with gov v1beta1 - govKeeper.SetLegacyRouter(govRouter) - app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( // register the governance hooks diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index b4ce8b04ce7..afee7a5316d 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -84,7 +84,6 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" @@ -95,7 +94,6 @@ import ( paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -418,13 +416,6 @@ func NewSimApp( appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), ibctm.NewConsensusHost(app.StakingKeeper), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) govConfig := govtypes.DefaultConfig() /* Example of setting gov params: @@ -435,9 +426,6 @@ func NewSimApp( app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // Set legacy router for backwards compatibility with gov v1beta1 - govKeeper.SetLegacyRouter(govRouter) - app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( // register the governance hooks diff --git a/simapp/app.go b/simapp/app.go index c5c638a2b6f..d4192831fc0 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -82,7 +82,6 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" @@ -93,7 +92,6 @@ import ( paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -408,13 +406,7 @@ func NewSimApp( app.IBCKeeper = ibckeeper.NewKeeper( appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), ibctm.NewConsensusHost(app.StakingKeeper), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) + govConfig := govtypes.DefaultConfig() /* Example of setting gov params: @@ -425,9 +417,6 @@ func NewSimApp( app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // Set legacy router for backwards compatibility with gov v1beta1 - govKeeper.SetLegacyRouter(govRouter) - app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( // register the governance hooks diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 91f1e43f467..7c65bae608b 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -70,7 +70,6 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" @@ -79,7 +78,6 @@ import ( paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -371,13 +369,7 @@ func NewSimApp( app.IBCKeeper = ibckeeper.NewKeeper( appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), ibctm.NewConsensusHost(app.StakingKeeper), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) + govConfig := govtypes.DefaultConfig() /* Example of setting gov params: @@ -388,9 +380,6 @@ func NewSimApp( app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // Set legacy router for backwards compatibility with gov v1beta1 - govKeeper.SetLegacyRouter(govRouter) - app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( // register the governance hooks