Skip to content

Commit

Permalink
fix: upgrade handler with consensus, crisis
Browse files Browse the repository at this point in the history
  • Loading branch information
deepan95dev committed Feb 26, 2024
1 parent 667a98f commit 20c8109
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ func New(
memKeys: memKeys,
// invCheckPeriod: invCheckPeriod,
}

app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])

// set the BaseApp's parameter store
Expand Down Expand Up @@ -447,7 +446,7 @@ func New(
app.BaseApp,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.setupUpgradeStoreLoaders()
// Create IBC Keeper
app.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -1160,6 +1159,26 @@ func BlockedAddresses() map[string]bool {
return modAccAddrs
}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
func (app *App) setupUpgradeStoreLoaders() {
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}

if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
return
}

storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
consensusparamtypes.ModuleName,
crisistypes.ModuleName,
},
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}

func (app *App) RegisterUpgradeHandlers() {
baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())

Expand Down

0 comments on commit 20c8109

Please sign in to comment.