diff --git a/protocol/app/upgrades.go b/protocol/app/upgrades.go index 10844af9f1..c70a6031de 100644 --- a/protocol/app/upgrades.go +++ b/protocol/app/upgrades.go @@ -5,6 +5,7 @@ import ( 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" + v6_0_0_testnet_fix_1 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v6.0.0_testnet_fix_1" upgradetypes "cosmossdk.io/x/upgrade/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -17,6 +18,7 @@ var ( Upgrades = []upgrades.Upgrade{ v6_0_0.Upgrade, v6_0_0_testnet_fix.Upgrade, + v6_0_0_testnet_fix_1.Upgrade, } Forks = []upgrades.Fork{} ) @@ -50,6 +52,18 @@ func (app *App) setupUpgradeHandlers() { app.configurator, ), ) + + // v6_0_0_testnet_fix_1 not intended for prod use. + if app.UpgradeKeeper.HasHandler(v6_0_0_testnet_fix_1.UpgradeName) { + panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v6_0_0_testnet_fix_1.UpgradeName)) + } + app.UpgradeKeeper.SetUpgradeHandler( + v6_0_0_testnet_fix_1.UpgradeName, + v6_0_0_testnet_fix_1.CreateUpgradeHandler( + app.ModuleManager, + app.configurator, + ), + ) } // setUpgradeStoreLoaders sets custom store loaders to customize the rootMultiStore diff --git a/protocol/app/upgrades/v6.0.0_testnet_fix_1/constants.go b/protocol/app/upgrades/v6.0.0_testnet_fix_1/constants.go new file mode 100644 index 0000000000..f8306fedaa --- /dev/null +++ b/protocol/app/upgrades/v6.0.0_testnet_fix_1/constants.go @@ -0,0 +1,19 @@ +package v_6_0_0_testnet_fix_1 + +import ( + store "cosmossdk.io/store/types" + + "github.com/dydxprotocol/v4-chain/protocol/app/upgrades" +) + +const ( + // v6_0_0_testnet_fix_1 not intended for prod use. + UpgradeName = "v6.0.0_testnet_fix_1" +) + +var ( + Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + StoreUpgrades: store.StoreUpgrades{}, + } +) diff --git a/protocol/app/upgrades/v6.0.0_testnet_fix_1/upgrade.go b/protocol/app/upgrades/v6.0.0_testnet_fix_1/upgrade.go new file mode 100644 index 0000000000..8f083da957 --- /dev/null +++ b/protocol/app/upgrades/v6.0.0_testnet_fix_1/upgrade.go @@ -0,0 +1,21 @@ +package v_6_0_0_testnet_fix_1 + +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) + } +}