Skip to content

Commit

Permalink
test: state-sync upgrade handler fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deepan95dev committed Mar 6, 2024
1 parent e575046 commit 7c49552
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
tmjson "github.com/cometbft/cometbft/libs/json"
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -1062,14 +1063,27 @@ func (app *App) RegisterUpgradeHandlers() {
params.AllowedClients = append(params.AllowedClients, ibcexported.Localhost)
app.IBCKeeper.ClientKeeper.SetParams(ctx, params)

consensusParams, err := app.ConsensusParamsKeeper.Get(ctx)
if err != nil {
return nil, err
}

// 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)
return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
migrations, err := app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)

return migrations, err
},
)
}
Expand Down

0 comments on commit 7c49552

Please sign in to comment.