Skip to content

Commit

Permalink
fix upgrade test wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed May 9, 2024
1 parent fdde58c commit a3a76f0
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,51 @@ import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types"
)

const releaseVersion = "v17"

func SetupHandlers(app *App) {
// Set param key table for params module migration
for _, subspace := range app.ParamsKeeper.GetSubspaces() {
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()
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
case emissionstypes.ModuleName:
keyTable = emissionstypes.ParamKeyTable()
default:
continue
}
if !subspace.HasKeyTable() {
subspace.WithKeyTable(keyTable)
}
}
baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())
allUpgrades := upgradeTracker{
upgrades: []upgradeTrackerItem{
Expand All @@ -28,6 +64,9 @@ func SetupHandlers(app *App) {
// Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module
// https://docs.cosmos.network/main/build/migrations/upgrading#xconsensus
baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper)

// skip consensus genesis
app.mm.Modules[consensustypes.ModuleName] = consensus.ConsensusVersion
return vm, nil
},
},
Expand Down

0 comments on commit a3a76f0

Please sign in to comment.