-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Documentation]: Upgrade directly from cosmos sdk 0.46.5 to cosmos sdk 0.50.4 #20160
Comments
@QuocThi Are you using app wiring? I was running into this exact issue when upgrading from v0.45.x, and it was because I wasn't registering the |
Hi @johnletey , can you give me some docs about registering the x/upgrade Pre Blocker. |
Hi @johnletey, I just finish switch to use app wiring, and also has bellow code in app_config.go, |
From the code I could see this issue is expected from 0.46 to 0.50: Line 524 in 7dbed2f
But my binary still crashed after that. |
I found that this issue doesn't cause the binary crashed, so the case can be close here. |
I had the same exact issue and after registering the x/upgrade Pre Blocker and after adding QuocThi's upgrade handler I managed to fix it. Thx! |
Hi @vladimir-trifonov, I updated the upgrade handler and this is the currently working for me: const UpgradeName = "v045-to-v050"
func setupLegacyKeyTables(k *paramskeeper.Keeper) {
for _, subspace := range k.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
// wasm
case wasmtypes.ModuleName:
keyTable = v2.ParamKeyTable() //nolint:staticcheck
case ibcexported.ModuleName:
keyTable = ibcclienttypes.ParamKeyTable()
keyTable.RegisterParamSet(&ibcconnectiontypes.Params{})
case icatypes.SubModuleName:
keyTable = icatypes.ParamKeyTable() //nolint:staticcheck
case icacontrollertypes.SubModuleName:
keyTable = icacontrollertypes.ParamKeyTable() //nolint:staticcheck
case ibctransfertypes.ModuleName:
keyTable = ibctransfertypes.ParamKeyTable() //nolint:staticcheck
default:
continue
}
if !subspace.HasKeyTable() {
subspace.WithKeyTable(keyTable)
}
}
// sdk 47
k.Subspace(baseapp.Paramspace).
WithKeyTable(paramstypes.ConsensusParamsKeyTable())
}
func (app App) RegisterUpgradeHandlers() {
setupLegacyKeyTables(&app.ParamsKeeper)
app.UpgradeKeeper.SetUpgradeHandler(
UpgradeName,
func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
},
)
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
consensustypes.ModuleName,
crisistypes.ModuleName,
circuittypes.ModuleName,
ibcfee.ModuleName,
capabilitytypes.MemStoreKey,
nft.ModuleName,
},
}
// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
} |
Summary
Hi,
I am upgrading from cosmos sdk 0.46.5 to cosmos sdk version 0.50.4. Currently my upgrade handler is merged from this (version 0.47.5) and this to upgrade directly from version 0.46.5 to version 0.50.4, here is the code:
But I got this error when start the new binary (use cosmos sdk 0.50.4) after gov upgrade proposal pass and reach the upgrade height:
In my code above I already apply the code follow this command from a related issue: #18733 (comment)
Can I upgrade the binary using cosmos sdk 0.46.5 to use cosmos sdk 0.50.4 directly (skip upgrade to version 0.47 before upgrade to 0.50.4)? Or any mistake in my code?
Thanks!
The text was updated successfully, but these errors were encountered: