Skip to content

Commit

Permalink
Add prev upgrade handlers 102 and store upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
philipsu522 committed Jul 28, 2022
1 parent fa3a874 commit 1259b72
Show file tree
Hide file tree
Showing 2 changed files with 16 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 @@ -3,6 +3,7 @@ package app
import (
"context"
"fmt"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -651,6 +652,19 @@ func New(
app.sm.RegisterStoreDecoders()

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

if upgradeInfo.Name == "1.0.4beta" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{oracletypes.StoreKey},
}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}

// initialize stores
app.MountKVStores(keys)
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
// for both the current (n) and the previous (n-1) upgrade name. There is a bug
// in a missing value in a log statement for which the fix is not released
var upgradesList = []string{
// 1.0.2beta
"1.0.2beta",
// 1.0.3beta
"1.0.3beta",
// 1.0.4beta
Expand Down

0 comments on commit 1259b72

Please sign in to comment.