Skip to content

Commit d399e26

Browse files
authored
v9.3 upgrade (#3156)
1 parent 34c347b commit d399e26

File tree

8 files changed

+49
-11
lines changed

8 files changed

+49
-11
lines changed

protocol/app/upgrades.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55

66
v_9_1 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v9.1"
7+
v_9_3 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v9.3"
78

89
upgradetypes "cosmossdk.io/x/upgrade/types"
910
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -14,7 +15,7 @@ var (
1415
// `Upgrades` defines the upgrade handlers and store loaders for the application.
1516
// New upgrades should be added to this slice after they are implemented.
1617
Upgrades = []upgrades.Upgrade{
17-
v_9_1.Upgrade,
18+
v_9_3.Upgrade,
1819
}
1920
Forks = []upgrades.Fork{}
2021
)
@@ -23,11 +24,11 @@ var (
2324
// logic and state migrations for software upgrades.
2425
func (app *App) setupUpgradeHandlers() {
2526
if app.UpgradeKeeper.HasHandler(v_9_1.UpgradeName) {
26-
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v_9_1.UpgradeName))
27+
panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v_9_3.UpgradeName))
2728
}
2829
app.UpgradeKeeper.SetUpgradeHandler(
29-
v_9_1.UpgradeName,
30-
v_9_1.CreateUpgradeHandler(
30+
v_9_3.UpgradeName,
31+
v_9_3.CreateUpgradeHandler(
3132
app.ModuleManager,
3233
app.configurator,
3334
),
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package v_9_3
2+
3+
import (
4+
store "cosmossdk.io/store/types"
5+
"github.com/dydxprotocol/v4-chain/protocol/app/upgrades"
6+
)
7+
8+
const (
9+
UpgradeName = "v9.3"
10+
)
11+
12+
var Upgrade = upgrades.Upgrade{
13+
UpgradeName: UpgradeName,
14+
StoreUpgrades: store.StoreUpgrades{},
15+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package v_9_3
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
upgradetypes "cosmossdk.io/x/upgrade/types"
8+
"github.com/cosmos/cosmos-sdk/types/module"
9+
"github.com/dydxprotocol/v4-chain/protocol/lib"
10+
)
11+
12+
func CreateUpgradeHandler(
13+
mm *module.Manager,
14+
configurator module.Configurator,
15+
) upgradetypes.UpgradeHandler {
16+
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
17+
sdkCtx := lib.UnwrapSDKContext(ctx, "app/upgrades")
18+
sdkCtx.Logger().Info(fmt.Sprintf("Running %s Upgrade...", UpgradeName))
19+
20+
return mm.RunMigrations(ctx, configurator, vm)
21+
}
22+
}

protocol/app/upgrades/v9.1/upgrade_container_test.go renamed to protocol/app/upgrades/v9.3/upgrade_container_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//go:build all || container_test
22

3-
package v_9_1_test
3+
package v_9_3_test
44

55
import (
66
"testing"
77

8-
v_9_1 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v9.1"
8+
v_9_3 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v9.3"
99

1010
"github.com/dydxprotocol/v4-chain/protocol/testing/containertest"
1111
"github.com/dydxprotocol/v4-chain/protocol/testutil/constants"
@@ -24,7 +24,7 @@ func TestStateUpgrade(t *testing.T) {
2424
preUpgradeSetups(node, t)
2525
preUpgradeChecks(node, t)
2626

27-
err = containertest.UpgradeTestnet(nodeAddress, t, node, v_9_1.UpgradeName)
27+
err = containertest.UpgradeTestnet(nodeAddress, t, node, v_9_3.UpgradeName)
2828
require.NoError(t, err)
2929

3030
postUpgradeChecks(node, t)

protocol/testing/containertest/preupgrade_genesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"app_name": "dydxprotocold",
3-
"app_version": "7.0.0-dev0-303-g3b0e4145c",
3+
"app_version": "9.2.1",
44
"genesis_time": "2023-01-01T00:00:00Z",
55
"chain_id": "localdydxprotocol",
66
"initial_height": 1,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v9.1
1+
v9.3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v9.0.0
1+
v9.2.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v9.0
1+
v9.2

0 commit comments

Comments
 (0)