Skip to content

Commit

Permalink
πŸ› Fix upgrade fail due to missing store loader for group module
Browse files Browse the repository at this point in the history
  • Loading branch information
nnkken authored and williamchong committed May 17, 2023
1 parent 253dc00 commit 142e1f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ func NewLikeApp(
skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath,
app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
app.setupUpgradeStoreLoaders()
app.registerUpgradeHandlers()
app.IscnKeeper = iscnkeeper.NewKeeper(appCodec, keys[iscntypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, iscnSubspace)

Expand Down Expand Up @@ -572,6 +573,19 @@ func (app *LikeApp) registerUpgradeHandlers() {
})
}

func (app *LikeApp) setupUpgradeStoreLoaders() {
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{"group"},
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}

func (app *LikeApp) Name() string {
return app.BaseApp.Name()
}
Expand Down

0 comments on commit 142e1f2

Please sign in to comment.