Skip to content

Commit

Permalink
add testnet upgrade handlers back
Browse files Browse the repository at this point in the history
  • Loading branch information
jgtormo committed Oct 9, 2024
1 parent e227e49 commit eaa579b
Showing 1 changed file with 124 additions and 3 deletions.
127 changes: 124 additions & 3 deletions app/app_upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ const GroupModuleName = "group"
func (app *App) SetUpgradeHandlers() {
setHandlerForVersion_1_0(app)
setHandlerForVersion_1_1(app)
setHandlerForVersion_1_9_9(app)
setHandlerForVersion_1_2(app)
setHandlerForVersion_1_2_2(app)
setHandlerForVersion_1_2_3(app)
setHandlerForVersion_1_2_4(app)
setHandlerForVersion_1_2_5(app)
setHandlerForVersion_9_1_1(app)
}

func setHandlerForVersion_1_0(app *App) {
Expand Down Expand Up @@ -80,8 +85,124 @@ func setHandlerForVersion_1_1(app *App) {
}
}

func setHandlerForVersion_1_9_9(app *App) {
const upgradeVersion string = "v1.9.9"
func setHandlerForVersion_1_2(app *App) {
const upgradeVersion string = "Plan of maximum success"
app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{},
Deleted: []string{
AddressBookModuleName,
MarketplaceModuleName,
NftModuleName,
GroupModuleName,
},
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
func setHandlerForVersion_1_2_2(app *App) {
const upgradeVersion string = "v1.2.2"
app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{},
Deleted: []string{
AddressBookModuleName,
MarketplaceModuleName,
NftModuleName,
GroupModuleName,
},
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
func setHandlerForVersion_1_2_3(app *App) {
const upgradeVersion string = "v1.2.3"
app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{},
Deleted: []string{
AddressBookModuleName,
MarketplaceModuleName,
NftModuleName,
GroupModuleName,
},
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
func setHandlerForVersion_1_2_4(app *App) {
const upgradeVersion string = "v1.2.4"
app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{},
Deleted: []string{
AddressBookModuleName,
MarketplaceModuleName,
NftModuleName,
GroupModuleName,
},
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}

func setHandlerForVersion_1_2_5(app *App) {
const upgradeVersion string = "v1.2.5"

app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}

if upgradeInfo.Name == upgradeVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{},
Deleted: []string{
AddressBookModuleName,
MarketplaceModuleName,
NftModuleName,
GroupModuleName,
},
}

app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}

func setHandlerForVersion_9_1_1(app *App) {
const upgradeVersion string = "v9.1.1"

app.UpgradeKeeper.SetUpgradeHandler(upgradeVersion, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
Expand Down

0 comments on commit eaa579b

Please sign in to comment.