From d1f9700c01db412078c63ed2f29431e57628dd6a Mon Sep 17 00:00:00 2001 From: dudong2 Date: Mon, 29 Jul 2024 20:03:44 +0900 Subject: [PATCH] fix: VersionMap from upgrade handler --- app/upgrades.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 95f6ddec2c..ede416d198 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -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 @@ -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 }, )