From 6dbd1ee260fefa1be880b8ca8b87962dd6d355eb Mon Sep 17 00:00:00 2001 From: catShaark Date: Mon, 9 Oct 2023 21:14:19 +0700 Subject: [PATCH] set upgradehandlers for each past upgrades --- app/app.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/app/app.go b/app/app.go index 48818ca6..8b70fba9 100644 --- a/app/app.go +++ b/app/app.go @@ -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" ) @@ -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 @@ -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)) } - 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, + ), + ) } }