From cdef40ad7797be36b2035ed52d6c8ab9baff8251 Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:26:55 +0200 Subject: [PATCH 1/2] feat: add GB drain upgrade handler (#2107) * feat: add GB drain upgrade handler * fix * fix format * fix format * added todo * remove gravity begin and end blocker * remove gravity begin and end blocker * lint * re-add gb in begin blocker end blocker * upgrade gb to latest --- app/upgrades.go | 21 ++++++++++++++++++++- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 28f7e86e3a..d507b20ec2 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -52,10 +52,29 @@ func (app UmeeApp) RegisterUpgradeHandlers(bool) { app.registerUpgrade4_3(upgradeInfo) app.registerUpgrade("v4.4", upgradeInfo) app.registerUpgrade("v5.0", upgradeInfo, ugov.ModuleName, wasm.ModuleName) - app.registerUpgrade("v5.1-alpha1", upgradeInfo, incentive.ModuleName) + app.registerUpgrade5_1(upgradeInfo) // TODO: set correct 5.1 name and add borrowFactor migration } +func (app *UmeeApp) registerUpgrade5_1(upgradeInfo upgradetypes.Plan) { + planName := "v5.1" + app.UpgradeKeeper.SetUpgradeHandler(planName, + func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + app.storeUpgrade(planName, upgradeInfo, storetypes.StoreUpgrades{ + Added: []string{incentive.ModuleName}, + }) + + // TODO: set the correct drain account. This will panic if executed. + if err := app.GravityKeeper.MigrateFundsToDrainAccount( + ctx, + sdk.MustAccAddressFromBech32("the_drain_account"), + ); err != nil { + return nil, err + } + return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }) +} + // performs upgrade from v4.2 to v4.3 func (app *UmeeApp) registerUpgrade4_3(upgradeInfo upgradetypes.Plan) { const planName = "v4.3" diff --git a/go.mod b/go.mod index 9ca79bf847..0afbff0690 100644 --- a/go.mod +++ b/go.mod @@ -334,7 +334,7 @@ require ( replace ( github.com/CosmWasm/wasmd => github.com/notional-labs/wasmd v0.31.0-umee.46 - github.com/Gravity-Bridge/Gravity-Bridge/module => github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-9 + github.com/Gravity-Bridge/Gravity-Bridge/module => github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-10 github.com/cosmos/cosmos-sdk => github.com/umee-network/cosmos-sdk v0.46.13-umee // dgrijalva/jwt-go is deprecated and doesn't receive security updates. github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 diff --git a/go.sum b/go.sum index 17a2f1e7af..8ea76af234 100644 --- a/go.sum +++ b/go.sum @@ -1463,8 +1463,8 @@ github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iL github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-9 h1:uo8+3gFo/EhQtjbiP7AfN0Pqx6ddFf9iWcvlfeChNsY= -github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-9/go.mod h1:NR6UwQPZUoLckpOtCxgROWNEDzepe2JhxQ2u9cL+pbo= +github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-10 h1:aKj8zwDz6vZO/mOVCgLvEKI9PbZaF3AH4UJKv5npElg= +github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-10/go.mod h1:NR6UwQPZUoLckpOtCxgROWNEDzepe2JhxQ2u9cL+pbo= github.com/umee-network/bech32-ibc v0.3.3 h1:wUX5uSYZl8yiFdttOvunfRihsE4miYmzl7pK2FEUs+U= github.com/umee-network/bech32-ibc v0.3.3/go.mod h1:UbhzCKN+Z7RoUdCkAanmIy+wufwQ/aQJrDEoVORhC2Y= github.com/umee-network/cosmos-sdk v0.46.13-umee h1:EeSalZHGoWdkKkCNhNd80jzRMNEQWLyDPUU5aUJQpIs= From 945b88c94226d4476a4b7f67e19c5924548046a2 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 29 Jun 2023 12:24:14 +0200 Subject: [PATCH 2/2] chore: upgrade GB (#2120)