Skip to content

Commit

Permalink
Set store loader with default upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
Hungry Warrior committed Jun 25, 2024
1 parent 6ebcaa4 commit 464339d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
16 changes: 5 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1080,17 +1080,11 @@ func (app *App) setupUpgradeHandlers() {
}

if upgradeInfo.Name == v1_0_3.UpgradeName {
//storeUpgrades := storetypes.StoreUpgrades{
// Added: []string{
// consensusparamtypes.StoreKey,
// crisistypes.ModuleName,
// },
//}
//// Use upgrade store loader for the initial loading of all stores when app starts,
//// it checks if version == upgradeHeight and applies store upgrades before loading the stores,
//// so that new stores start with the correct version (the current height of chain),
//// instead the default which is the latest version that store last committed i.e 0 for new stores.
//app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
// Use upgrade store loader for the initial loading of all stores when app starts,
// it checks if version == upgradeHeight and applies store upgrades before loading the stores,
// so that new stores start with the correct version (the current height of chain),
// instead the default which is the latest version that store last committed i.e 0 for new stores.
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storetypes.StoreUpgrades{}))
}
}

Expand Down
11 changes: 9 additions & 2 deletions app/upgrades/v1_0_3/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ func CreateUpgradeHandler(
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
// Leave modules as-is to avoid running InitGenesis.
return mm.RunMigrations(ctx, configurator, vm)
ctx.Logger().Info("Starting module migrations...")

vm, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return vm, err
}

ctx.Logger().Info("Upgrade complete")
return vm, err
}
}

0 comments on commit 464339d

Please sign in to comment.