Skip to content

Commit

Permalink
paramKeyTable fix for wasm and upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsingh33 committed Oct 10, 2023
1 parent a84e5ca commit 4020149
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 62 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
64 changes: 3 additions & 61 deletions app/upgrades/testnet/v13/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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...")
Expand Down

0 comments on commit 4020149

Please sign in to comment.