From 09067e96a9223b32e1641bb555f6acdfd7361a7a Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:33:26 -0500 Subject: [PATCH] fix: upgrade handler for v1.1.0 --- app/upgrades.go | 2 +- app/upgrades/types.go | 3 ++- app/upgrades/v1_1_0/constants.go | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 4a863d0aa..8487b5f22 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -20,7 +20,7 @@ func (app *NibiruApp) setupUpgrades() { func (app *NibiruApp) setUpgradeHandlers() { for _, u := range Upgrades { - app.upgradeKeeper.SetUpgradeHandler(u.UpgradeName, u.CreateUpgradeHandler()) + app.upgradeKeeper.SetUpgradeHandler(u.UpgradeName, u.CreateUpgradeHandler(app.mm, app.configurator)) } } diff --git a/app/upgrades/types.go b/app/upgrades/types.go index caa328bb8..a2cdde4b5 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -2,13 +2,14 @@ package upgrades import ( store "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) type Upgrade struct { UpgradeName string - CreateUpgradeHandler func() types.UpgradeHandler + CreateUpgradeHandler func(*module.Manager, module.Configurator) types.UpgradeHandler StoreUpgrades store.StoreUpgrades } diff --git a/app/upgrades/v1_1_0/constants.go b/app/upgrades/v1_1_0/constants.go index 9a384e5b5..257ef77c5 100644 --- a/app/upgrades/v1_1_0/constants.go +++ b/app/upgrades/v1_1_0/constants.go @@ -2,6 +2,8 @@ package v1_1_0 import ( "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/NibiruChain/nibiru/app/upgrades" @@ -12,8 +14,10 @@ const UpgradeName = "v1.1.0" var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, - CreateUpgradeHandler: func() upgradetypes.UpgradeHandler { - return nil + CreateUpgradeHandler: func(mm *module.Manager, cfg module.Configurator) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, cfg, fromVM) + } }, StoreUpgrades: types.StoreUpgrades{ Added: []string{inflationtypes.ModuleName},