diff --git a/protocol/app/upgrades.go b/protocol/app/upgrades.go index 2fa4544cc90..fc7578c0d79 100644 --- a/protocol/app/upgrades.go +++ b/protocol/app/upgrades.go @@ -4,6 +4,7 @@ import ( "fmt" v6_0_0 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v6.0.0" + v6_0_0_testnet_fix "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v6.0.0_testnet_fix" upgradetypes "cosmossdk.io/x/upgrade/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,6 +16,7 @@ var ( // New upgrades should be added to this slice after they are implemented. Upgrades = []upgrades.Upgrade{ v6_0_0.Upgrade, + v6_0_0_testnet_fix.Upgrade, } Forks = []upgrades.Fork{} ) @@ -37,6 +39,20 @@ func (app *App) setupUpgradeHandlers() { app.VaultKeeper, ), ) + if app.UpgradeKeeper.HasHandler(v6_0_0_testnet_fix.UpgradeName) { + panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v6_0_0_testnet_fix.UpgradeName)) + } + app.UpgradeKeeper.SetUpgradeHandler( + v6_0v6_0_0_testnet_fix_0.UpgradeName, + v6_0_0_testnet_fix.CreateUpgradeHandler( + app.ModuleManager, + app.configurator, + app.ClobKeeper, + app.PricesKeeper, + app.MarketMapKeeper, + app.RevShareKeeper, + app.VaultKeeper, + ), } // setUpgradeStoreLoaders sets custom store loaders to customize the rootMultiStore diff --git a/protocol/app/upgrades/v6.0.0_testnet_fix/constants.go b/protocol/app/upgrades/v6.0.0_testnet_fix/constants.go new file mode 100644 index 00000000000..c017f219851 --- /dev/null +++ b/protocol/app/upgrades/v6.0.0_testnet_fix/constants.go @@ -0,0 +1,18 @@ +package v_6_0_0_testnet_fix + +import ( + store "cosmossdk.io/store/types" + + "github.com/dydxprotocol/v4-chain/protocol/app/upgrades" +) + +const ( + UpgradeName = "v6.0.0_testnet_fix" +) + +var ( + Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + StoreUpgrades: store.StoreUpgrades{}, + } +) diff --git a/protocol/app/upgrades/v6.0.0_testnet_fix/upgrade.go b/protocol/app/upgrades/v6.0.0_testnet_fix/upgrade.go new file mode 100644 index 00000000000..113c88308d2 --- /dev/null +++ b/protocol/app/upgrades/v6.0.0_testnet_fix/upgrade.go @@ -0,0 +1,21 @@ +package v_6_0_0_testnet_fix + +import ( + "context" + "fmt" + + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/dydxprotocol/v4-chain/protocol/lib" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + sdkCtx := lib.UnwrapSDKContext(ctx, "app/upgrades") + sdkCtx.Logger().Info(fmt.Sprintf("Running %s Upgrade...", UpgradeName)) + return mm.RunMigrations(ctx, configurator, vm) + } +}