From 686e6bfe79f42b42920f3704a34d31bccabb16a4 Mon Sep 17 00:00:00 2001 From: deepan95dev Date: Mon, 11 Mar 2024 18:28:32 +0530 Subject: [PATCH] fix: state sync param fix --- app/app.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/app.go b/app/app.go index 18d8214bb..1ed50f826 100644 --- a/app/app.go +++ b/app/app.go @@ -1056,13 +1056,17 @@ func (app *App) RegisterUpgradeHandlers() { func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { // IBC v6 - v7 upgrade _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, app.appCodec, app.IBCKeeper.ClientKeeper) - + if err != nil { + return nil, err + } // IBC v7 - v7.3 upgrade // explicitly update the IBC 02-client params, adding the localhost client type params := app.IBCKeeper.ClientKeeper.GetParams(ctx) params.AllowedClients = append(params.AllowedClients, ibcexported.Localhost) app.IBCKeeper.ClientKeeper.SetParams(ctx, params) + // this should be before updating the version in consensus params + baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper) consensusParams, err := app.ConsensusParamsKeeper.Get(ctx) if err != nil { return nil, err @@ -1071,18 +1075,15 @@ func (app *App) RegisterUpgradeHandlers() { // Hack to fix state-sync issue consensusParams.Version = &tmproto.VersionParams{App: 2} - app.ConsensusParamsKeeper.Set(ctx, consensusParams) - updatedVersion, err := app.ConsensusParamsKeeper.Get(ctx) - fmt.Println(">>>>>>>>>>>>>>>>>>> new version ", updatedVersion, err) if err != nil { return nil, err } ctx.Logger().Info("Handler for upgrade plan: " + upgradeV2.UpgradeName) // Migrate Tendermint consensus parameters from x/params module to a // dedicated x/consensus module. - baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper) - migrations, err := app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) + migrations, err := app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) + app.ConsensusParamsKeeper.Set(ctx, consensusParams) return migrations, err }, )