Skip to content

Commit

Permalink
fix: VersionMap from upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jul 29, 2024
1 parent 6d3c5c6 commit d1f9700
Showing 1 changed file with 12 additions and 7 deletions.
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

0 comments on commit d1f9700

Please sign in to comment.