Skip to content

Commit

Permalink
Add upgrade handler for v5.1.0 (#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentwschau authored Jul 3, 2024
1 parent 0e3864f commit 7aa0952
Show file tree
Hide file tree
Showing 8 changed files with 840 additions and 1,028 deletions.
17 changes: 6 additions & 11 deletions protocol/app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app
import (
"fmt"

v5_0_0 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v5.0.0"
v5_1_0 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v5.1.0"

upgradetypes "cosmossdk.io/x/upgrade/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -14,27 +14,22 @@ var (
// `Upgrades` defines the upgrade handlers and store loaders for the application.
// New upgrades should be added to this slice after they are implemented.
Upgrades = []upgrades.Upgrade{
v5_0_0.Upgrade,
v5_1_0.Upgrade,
}
Forks = []upgrades.Fork{}
)

// setupUpgradeHandlers registers the upgrade handlers to perform custom upgrade
// logic and state migrations for software upgrades.
func (app *App) setupUpgradeHandlers() {
if app.UpgradeKeeper.HasHandler(v5_0_0.UpgradeName) {
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v5_0_0.UpgradeName))
if app.UpgradeKeeper.HasHandler(v5_1_0.UpgradeName) {
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v5_1_0.UpgradeName))
}
app.UpgradeKeeper.SetUpgradeHandler(
v5_0_0.UpgradeName,
v5_0_0.CreateUpgradeHandler(
v5_1_0.UpgradeName,
v5_1_0.CreateUpgradeHandler(
app.ModuleManager,
app.configurator,
app.PerpetualsKeeper,
app.ClobKeeper,
app.SubaccountsKeeper,
app.ConsensusParamsKeeper,
app.VaultKeeper,
),
)
}
Expand Down
Loading

0 comments on commit 7aa0952

Please sign in to comment.