Skip to content

Commit

Permalink
v12 migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsingh33 committed May 31, 2023
1 parent 11a42d9 commit 4f8e445
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ import (

cwasm "github.com/comdex-official/comdex/app/wasm"

tv10 "github.com/comdex-official/comdex/app/upgrades/testnet/v10"
tv12 "github.com/comdex-official/comdex/app/upgrades/testnet/v12"
)

const (
Expand Down Expand Up @@ -1211,10 +1211,6 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {
}

func (a *App) registerUpgradeHandlers() {
a.UpgradeKeeper.SetUpgradeHandler(
tv10.UpgradeName,
tv10.CreateUpgradeHandlerV10(a.mm, a.configurator),
)
// When a planned update height is reached, the old binary will panic
// writing on disk the height and name of the update that triggered it
// This will read that value, and execute the preparations for the upgrade.
Expand All @@ -1223,6 +1219,14 @@ func (a *App) registerUpgradeHandlers() {
panic(err)
}

switch {
case upgradeInfo.Name == tv12.UpgradeName:
a.UpgradeKeeper.SetUpgradeHandler(
tv12.UpgradeName,
tv12.CreateUpgradeHandlerV12(a.mm, a.configurator),
)
}

var storeUpgrades *storetypes.StoreUpgrades

storeUpgrades = upgradeHandlers(upgradeInfo, a, storeUpgrades)
Expand All @@ -1236,8 +1240,10 @@ func (a *App) registerUpgradeHandlers() {
func upgradeHandlers(upgradeInfo storetypes.UpgradeInfo, a *App, storeUpgrades *storetypes.StoreUpgrades) *storetypes.StoreUpgrades {
switch {

case upgradeInfo.Name == tv10.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{}
case upgradeInfo.Name == tv12.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{},
}
}

return storeUpgrades
Expand Down

0 comments on commit 4f8e445

Please sign in to comment.