Skip to content
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

fix: VersionMap from upgrade handler #15

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,24 @@ func (app *EthermintApp) RegisterUpgradeHandlers(
func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

if fromVM, err := app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM); err != nil {
return fromVM, err
var (
updatedVM module.VersionMap
err error
)

if updatedVM, err = app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM); err != nil {
return updatedVM, err
}

// ibc v7
// OPTIONAL: prune expired tendermint consensus states to save storage space
if _, err := ibctmmigrations.PruneExpiredConsensusStates(sdkCtx, cdc, clientKeeper); err != nil {
return fromVM, err
return updatedVM, err
}

legacyBaseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())
if err := baseapp.MigrateParams(sdkCtx, legacyBaseAppSubspace, &consensusParamsKeeper.ParamsStore); err != nil {
return fromVM, err
return updatedVM, err
}

// ibc v7.1
Expand All @@ -117,12 +122,12 @@ func (app *EthermintApp) RegisterUpgradeHandlers(

// cosmos-sdk v047
// Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module.
err := baseapp.MigrateParams(sdkCtx, baseAppLegacySS, consensusParamsKeeper.ParamsStore)
err = baseapp.MigrateParams(sdkCtx, baseAppLegacySS, consensusParamsKeeper.ParamsStore)
if err != nil {
return fromVM, err
return updatedVM, err
}

return fromVM, err
return updatedVM, err
},
)

Expand Down
Loading