diff --git a/app/app.go b/app/app.go index 26fb7d712..027dcc70f 100644 --- a/app/app.go +++ b/app/app.go @@ -78,6 +78,7 @@ 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" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" 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" @@ -481,6 +482,9 @@ func New( 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 @@ -970,14 +974,21 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) { func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName) - paramsKeeper.Subspace(crisistypes.ModuleName) + //nolint: staticcheck + paramsKeeper.Subspace(authtypes.ModuleName).WithKeyTable(authtypes.ParamKeyTable()) + //nolint: staticcheck + paramsKeeper.Subspace(banktypes.ModuleName).WithKeyTable(banktypes.ParamKeyTable()) + paramsKeeper.Subspace(stakingtypes.ModuleName).WithKeyTable(stakingtypes.ParamKeyTable()) + //nolint: staticcheck + paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) + //nolint: staticcheck + paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) + //nolint: staticcheck + paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) + //nolint: staticcheck + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable()) + //nolint: staticcheck + paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibcexported.ModuleName) paramsKeeper.Subspace(icacontrollertypes.SubModuleName) @@ -1045,16 +1056,6 @@ func (app *App) RegisterUpgradeHandlers() { return nil, err } ctx.Logger().Info("Handler for upgrade plan: " + upgradeV2.UpgradeName) - bankSubspace := app.GetSubspace(banktypes.ModuleName) - bankSubspace.Set(ctx, banktypes.ParamsKey, banktypes.DefaultParams()) - - // Add defaults for DID module subspace - didSubspace := app.GetSubspace(didtypes.ModuleName) - didSubspace.Set(ctx, didtypes.ParamStoreKeyFeeParams, didtypes.DefaultFeeParams()) - - // Add defaults for resource subspace - resourceSubspace := app.GetSubspace(resourcetypes.ModuleName) - resourceSubspace.Set(ctx, resourcetypes.ParamStoreKeyFeeParams, resourcetypes.DefaultFeeParams()) // Migrate Tendermint consensus parameters from x/params module to a // dedicated x/consensus module. baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper) diff --git a/app/upgrades/v2/upgrade.go b/app/upgrades/v2/upgrade.go deleted file mode 100644 index 758e1837d..000000000 --- a/app/upgrades/v2/upgrade.go +++ /dev/null @@ -1,15 +0,0 @@ -package v2 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" -) - -func CreateUpgradeHandler(mm *module.Manager, cfg module.Configurator) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - ctx.Logger().Info("Handler for upgrade plan: " + UpgradeName) - // this will migrate the diff for resource from v2 -> v3 - return mm.RunMigrations(ctx, cfg, fromVM) - } -} diff --git a/tests/upgrade/integration/v2/generated/post/query - module-version-map/v2.json b/tests/upgrade/integration/v2/generated/post/query - module-version-map/v2.json index 18d212058..66b2381ea 100644 --- a/tests/upgrade/integration/v2/generated/post/query - module-version-map/v2.json +++ b/tests/upgrade/integration/v2/generated/post/query - module-version-map/v2.json @@ -21,6 +21,10 @@ "name": "cheqd", "version": 4 }, + { + "name": "consensus", + "version": 1 + }, { "name": "crisis", "version": 2 diff --git a/tests/upgrade/integration/v2/param_change_proposal_test.go b/tests/upgrade/integration/v2/param_change_proposal_test.go index 943d92fb8..d3d5f7902 100644 --- a/tests/upgrade/integration/v2/param_change_proposal_test.go +++ b/tests/upgrade/integration/v2/param_change_proposal_test.go @@ -20,7 +20,7 @@ var _ = Describe("Upgrade - Fee parameter change proposal", func() { Expect(err).To(BeNil()) }) - It("should submit a parameter change proposal for did module", func() { + It("should submit a parameter change proposal for did module (optimistic)", func() { By("passing the proposal file to the container") _, err := cli.LocalnetExecCopyAbsoluteWithPermissions(filepath.Join(GeneratedJSONDir, ProposalJSONDir, "existing", "param_change_did.json"), cli.DockerHome, cli.Validator0) Expect(err).To(BeNil()) @@ -31,6 +31,16 @@ var _ = Describe("Upgrade - Fee parameter change proposal", func() { Expect(res.Code).To(BeEquivalentTo(0)) }) + It("should wait for the proposal submission to be included in a block", func() { + By("getting the current block height") + currentHeight, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName) + Expect(err).To(BeNil()) + + By("waiting for the proposal to be included in a block") + err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*3) + Expect(err).To(BeNil()) + }) + It("should vote for the parameter change proposal from `validator0` container", func() { By("sending a VoteProposal transaction from `validator0` container") res, err := cli.VoteProposal(cli.Validator0, "2", "yes") @@ -88,7 +98,7 @@ var _ = Describe("Upgrade - Fee parameter change proposal", func() { Expect(feeParams).To(Equal(expectedFeeParams)) }) - It("should submit a parameter change proposal for resource module", func() { + It("should submit a parameter change proposal for resource module (optimistic)", func() { By("passing the proposal file to the container") _, err := cli.LocalnetExecCopyAbsoluteWithPermissions(filepath.Join(GeneratedJSONDir, ProposalJSONDir, "existing", "param_change_resource.json"), cli.DockerHome, cli.Validator0) Expect(err).To(BeNil()) @@ -99,6 +109,16 @@ var _ = Describe("Upgrade - Fee parameter change proposal", func() { Expect(res.Code).To(BeEquivalentTo(0)) }) + It("should wait for the proposal submission to be included in a block", func() { + By("getting the current block height") + currentHeight, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName) + Expect(err).To(BeNil()) + + By("waiting for the proposal to be included in a block") + err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*3) + Expect(err).To(BeNil()) + }) + It("should vote for the parameter change proposal from `validator0` container", func() { By("sending a VoteProposal transaction from `validator0` container") res, err := cli.VoteProposal(cli.Validator0, "3", "yes")