Skip to content

Commit

Permalink
set upgradehandlers for each past upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
catShaark committed Oct 9, 2023
1 parent 9bde73f commit 6dbd1ee
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ import (

// Upgrade Handler
upgrades "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades"
v2 "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades/v2"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades/v2_2_5"
v3 "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades/v3"
)

Expand All @@ -163,7 +165,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{v3.Upgrade}
Upgrades = []upgrades.Upgrade{v2.Upgrade, v2_2_5.Upgrade, v3.Upgrade}
)

// GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to
Expand Down Expand Up @@ -1096,22 +1098,17 @@ func (app *MigalooApp) setupUpgradeHandlers(cfg module.Configurator) {
return
}

currentHeight := app.CommitMultiStore().LastCommitID().Version

for _, upgrade := range Upgrades {
upgrade := upgrade
if upgradeInfo.Name == upgrade.UpgradeName {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades))

Check failure on line 1103 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

G601: Implicit memory aliasing in for loop. (gosec)
}
if upgradeInfo.Height == currentHeight+1 {
app.UpgradeKeeper.SetUpgradeHandler(
upgrade.UpgradeName,
upgrade.CreateUpgradeHandler(
app.mm,
cfg,
),
)
}
app.UpgradeKeeper.SetUpgradeHandler(
upgrade.UpgradeName,
upgrade.CreateUpgradeHandler(
app.mm,
cfg,
),
)
}
}

Expand Down

0 comments on commit 6dbd1ee

Please sign in to comment.