From 4020149c9e041f6c2c1759e09f989de65340ff72 Mon Sep 17 00:00:00 2001 From: Chandragupta Singh Date: Wed, 11 Oct 2023 03:53:02 +0530 Subject: [PATCH] paramKeyTable fix for wasm and upgrade --- app/app.go | 2 +- app/upgrades/testnet/v13/upgrades.go | 64 ++-------------------------- 2 files changed, 4 insertions(+), 62 deletions(-) diff --git a/app/app.go b/app/app.go index 2822e5664..9d472a3af 100644 --- a/app/app.go +++ b/app/app.go @@ -487,7 +487,7 @@ func New( app.ParamsKeeper.Subspace(liquidationtypes.ModuleName) app.ParamsKeeper.Subspace(lockertypes.ModuleName) app.ParamsKeeper.Subspace(bandoraclemoduletypes.ModuleName) - app.ParamsKeeper.Subspace(wasmtypes.ModuleName) + app.ParamsKeeper.Subspace(wasmtypes.ModuleName).WithKeyTable(wasmtypes.ParamKeyTable()) app.ParamsKeeper.Subspace(auctiontypes.ModuleName) app.ParamsKeeper.Subspace(tokenminttypes.ModuleName) app.ParamsKeeper.Subspace(liquiditytypes.ModuleName) diff --git a/app/upgrades/testnet/v13/upgrades.go b/app/upgrades/testnet/v13/upgrades.go index 6158df289..bd98e9308 100644 --- a/app/upgrades/testnet/v13/upgrades.go +++ b/app/upgrades/testnet/v13/upgrades.go @@ -2,33 +2,21 @@ package v13 import ( "fmt" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - // SDK v47 modules - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" exported "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" ) func CreateUpgradeHandlerV13( @@ -47,52 +35,6 @@ func CreateUpgradeHandlerV13( ctx.Logger().Info("Applying test net upgrade - v.13.0.0") logger := ctx.Logger().With("upgrade", UpgradeName) - // https://github.com/cosmos/cosmos-sdk/pull/12363/files - // Set param key table for params module migration - for _, subspace := range paramsKeeper.GetSubspaces() { - subspace := subspace - - var keyTable paramstypes.KeyTable - switch subspace.Name() { - case authtypes.ModuleName: - keyTable = authtypes.ParamKeyTable() //nolint:staticcheck - case banktypes.ModuleName: - keyTable = banktypes.ParamKeyTable() //nolint:staticcheck - case stakingtypes.ModuleName: - keyTable = stakingtypes.ParamKeyTable() //nolint:staticcheck - - // case minttypes.ModuleName: - // keyTable = minttypes.ParamKeyTable() //nolint:staticcheck - case distrtypes.ModuleName: - keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck - case slashingtypes.ModuleName: - keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck - case govtypes.ModuleName: - keyTable = govv1.ParamKeyTable() //nolint:staticcheck - case crisistypes.ModuleName: - keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck - - // ibc types - case ibctransfertypes.ModuleName: - keyTable = ibctransfertypes.ParamKeyTable() - case icahosttypes.SubModuleName: - keyTable = icahosttypes.ParamKeyTable() - case icacontrollertypes.SubModuleName: - keyTable = icacontrollertypes.ParamKeyTable() - - // wasm - case wasmtypes.ModuleName: - keyTable = wasmtypes.ParamKeyTable() //nolint:staticcheck - - // TODO: comdex modules - - } - - if !subspace.HasKeyTable() { - subspace.WithKeyTable(keyTable) - } - } - // Migrate Tendermint consensus parameters from x/params module to a deprecated x/consensus module. // The old params module is required to still be imported in your app.go in order to handle this migration. ctx.Logger().Info("Migrating tendermint consensus params from x/params to x/consensus...")