Skip to content

Commit

Permalink
fix: state sync param fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deepan95dev committed Mar 11, 2024
1 parent 7c49552 commit 686e6bf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
},
)
Expand Down

0 comments on commit 686e6bf

Please sign in to comment.