Skip to content

Commit 8d01d68

Browse files
lfportalclaude
andcommitted
Replace dual-impl deployment with version selector
Rather than deploying both V1 and V2 implementations, the script now reads stark_exchange_migration.version from the config (1 or 2) and deploys only the selected implementation. Config files updated to add the version field; input configs set to version 2 (V2 not yet deployed), deployed configs set to version 1 (V1 currently deployed). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent beffd07 commit 8d01d68

6 files changed

Lines changed: 28 additions & 42 deletions

File tree

‎config/deploy/mainnet/eth_config_input.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"axelar_gateway": "0x4F4495243837681061C4743b74B3eEdf548D56A5"
99
},
1010
"stark_exchange_migration": {
11-
"implementation_address": "0x58b5484F489f7858DC83a5a677338074b57de806",
12-
"v2_implementation_address": "0x0000000000000000000000000000000000000000"
11+
"version": 2,
12+
"implementation_address": "0x0000000000000000000000000000000000000000"
1313
}
1414
}

‎config/deploy/mainnet/eth_deployed.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"axelar_gateway": "0x4F4495243837681061C4743b74B3eEdf548D56A5"
99
},
1010
"stark_exchange_migration": {
11-
"implementation_address": "0x58b5484F489f7858DC83a5a677338074b57de806",
12-
"v2_implementation_address": "0x0000000000000000000000000000000000000000"
11+
"version": 1,
12+
"implementation_address": "0x58b5484F489f7858DC83a5a677338074b57de806"
1313
}
1414
}

‎config/deploy/sandbox/eth_config_input.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"axelar_gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31"
99
},
1010
"stark_exchange_migration": {
11-
"implementation_address": "0x9F9b4A495A62191A4225759Ae7C00906Cc6417B8",
12-
"v2_implementation_address": "0x0000000000000000000000000000000000000000"
11+
"version": 2,
12+
"implementation_address": "0x0000000000000000000000000000000000000000"
1313
}
1414
}

‎config/deploy/sandbox/eth_deployed.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"axelar_gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31"
99
},
1010
"stark_exchange_migration": {
11-
"implementation_address": "0x9F9b4A495A62191A4225759Ae7C00906Cc6417B8",
12-
"v2_implementation_address": "0x0000000000000000000000000000000000000000"
11+
"version": 1,
12+
"implementation_address": "0x9F9b4A495A62191A4225759Ae7C00906Cc6417B8"
1313
}
1414
}

‎script/DeployEthContracts.s.sol‎

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import {StarkExchangeMigrationV2} from "../src/bridge/starkex/StarkExchangeMigra
1212
* @title DeployEthContracts
1313
* @notice Deploys the migration contracts on Ethereum:
1414
* 1. VaultRootSenderAdapter
15-
* 2. StarkExchangeMigration (implementation only, no proxy)
16-
* 3. StarkExchangeMigrationV2 (implementation only, no proxy)
15+
* 2. StarkExchangeMigration implementation (version selected via config)
1716
*
1817
* @dev The StarkExchangeMigration is deployed as an implementation contract only.
1918
* The existing StarkEx bridge proxy on-chain will be upgraded to point to this
@@ -38,11 +37,9 @@ contract DeployEthContracts is Script {
3837
address private axelarGasService;
3938
address private axelarGateway;
4039

41-
// StarkExchangeMigration
40+
// StarkExchangeMigration implementation (version 1 or 2, selected via config)
4241
address private migrationImpl;
43-
44-
// StarkExchangeMigrationV2
45-
address private migrationV2Impl;
42+
uint256 private migrationVersion;
4643

4744
string private configFilePath;
4845
string private outputFilePath;
@@ -67,9 +64,7 @@ contract DeployEthContracts is Script {
6764

6865
// --- StarkExchangeMigration ---
6966
migrationImpl = vm.parseJsonAddress(config, "$.stark_exchange_migration.implementation_address");
70-
71-
// --- StarkExchangeMigrationV2 ---
72-
migrationV2Impl = vm.parseJsonAddress(config, "$.stark_exchange_migration.v2_implementation_address");
67+
migrationVersion = vm.parseJsonUint(config, "$.stark_exchange_migration.version");
7368
}
7469

7570
/// @notice Deploys the Ethereum contracts.
@@ -91,24 +86,19 @@ contract DeployEthContracts is Script {
9186
console.log("Using existing VaultRootSenderAdapter:", senderAdapter);
9287
}
9388

94-
// 2. Deploy StarkExchangeMigration implementation (if not already deployed)
89+
// 2. Deploy StarkExchangeMigration implementation (if not already deployed).
90+
// The version is selected via stark_exchange_migration.version in the config.
9591
// The constructor only calls _disableInitializers(). No proxy is deployed here.
9692
// The existing StarkEx bridge proxy will be upgraded separately via governance.
9793
if (migrationImpl == address(0)) {
98-
migrationImpl = address(new StarkExchangeMigration());
99-
console.log("Deployed StarkExchangeMigration implementation:", migrationImpl);
100-
} else {
101-
console.log("Using existing StarkExchangeMigration implementation:", migrationImpl);
102-
}
103-
104-
// 3. Deploy StarkExchangeMigrationV2 implementation (if not already deployed)
105-
// The constructor only calls _disableInitializers(). No proxy is deployed here.
106-
// The existing StarkEx bridge proxy will be upgraded separately via governance.
107-
if (migrationV2Impl == address(0)) {
108-
migrationV2Impl = address(new StarkExchangeMigrationV2());
109-
console.log("Deployed StarkExchangeMigrationV2 implementation:", migrationV2Impl);
94+
if (migrationVersion == 1) {
95+
migrationImpl = address(new StarkExchangeMigration());
96+
} else {
97+
migrationImpl = address(new StarkExchangeMigrationV2());
98+
}
99+
console.log("Deployed StarkExchangeMigration v%d implementation:", migrationVersion, migrationImpl);
110100
} else {
111-
console.log("Using existing StarkExchangeMigrationV2 implementation:", migrationV2Impl);
101+
console.log("Using existing StarkExchangeMigration v%d implementation:", migrationVersion, migrationImpl);
112102
}
113103

114104
vm.stopBroadcast();
@@ -131,7 +121,8 @@ contract DeployEthContracts is Script {
131121
require(axelarGateway != address(0), "vault_root_sender_adapter.axelar_gateway is zero address");
132122
}
133123

134-
// StarkExchangeMigration: no constructor params to validate (only calls _disableInitializers)
124+
// StarkExchangeMigration: validate version selector
125+
require(migrationVersion == 1 || migrationVersion == 2, "stark_exchange_migration.version must be 1 or 2");
135126
}
136127

137128
/**
@@ -144,17 +135,13 @@ contract DeployEthContracts is Script {
144135

145136
vm.writeJson(vm.toString(senderAdapter), outputFilePath, ".vault_root_sender_adapter.address");
146137
vm.writeJson(vm.toString(migrationImpl), outputFilePath, ".stark_exchange_migration.implementation_address");
147-
vm.writeJson(
148-
vm.toString(migrationV2Impl), outputFilePath, ".stark_exchange_migration.v2_implementation_address"
149-
);
150138

151139
console.log("Deployment output written to:", outputFilePath);
152140
}
153141

154142
function _logSummary() private view {
155143
console.log("--- Ethereum Deployment Summary ---");
156144
console.log("VaultRootSenderAdapter:", senderAdapter);
157-
console.log("StarkExchangeMigration (impl):", migrationImpl);
158-
console.log("StarkExchangeMigrationV2 (impl):", migrationV2Impl);
145+
console.log("StarkExchangeMigration v%d (impl):", migrationVersion, migrationImpl);
159146
}
160147
}

‎script/README.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Solidity scripts for deploying and configuring the migration contracts using Fou
77
| Script | Chain | Purpose | Executed By |
88
|--------|-------|---------|-------------|
99
| `DeployZkEVMContracts.s.sol` | zkEVM | Deploy VaultEscapeProofVerifier, VaultRootReceiverAdapter, VaultWithdrawalProcessor | Deployer |
10-
| `DeployEthContracts.s.sol` | Ethereum | Deploy VaultRootSenderAdapter, StarkExchangeMigration, and StarkExchangeMigrationV2 implementations | Deployer |
10+
| `DeployEthContracts.s.sol` | Ethereum | Deploy VaultRootSenderAdapter and StarkExchangeMigration implementation (version selected via config) | Deployer |
1111
| `GenerateAssetMappings.s.sol` | - | Generate asset mappings by querying bridge contract | Utility (offline) |
1212
| `VerifyAssetMappings.s.sol` | - | Verify asset mappings against bridge contract | Utility (read-only) |
1313
| `RegisterTokenMappings.s.sol` | zkEVM | Register token mappings on the processor | TOKEN_MAPPING_MANAGER |
@@ -88,9 +88,8 @@ forge script script/DeployEthContracts.s.sol \
8888
**Output:** Creates `config/eth_deployed.json` with deployed addresses populated in:
8989
- `vault_root_sender_adapter.address`
9090
- `stark_exchange_migration.implementation_address`
91-
- `stark_exchange_migration.v2_implementation_address`
9291

93-
**Note:** Both `StarkExchangeMigration` and `StarkExchangeMigrationV2` are deployed as implementations only (no proxy). The existing StarkEx bridge proxy on-chain must be upgraded to point to an implementation separately (e.g., via governance), at which point `initialize` is called with the appropriate parameters.
92+
**Note:** The `StarkExchangeMigration` is deployed as an implementation only (no proxy). The existing StarkEx bridge proxy on-chain must be upgraded to point to this implementation separately (e.g., via governance), at which point `initialize` is called with the appropriate parameters. Set `stark_exchange_migration.version` to `1` for `StarkExchangeMigration` or `2` for `StarkExchangeMigrationV2`.
9493

9594
### Step 4: Generate Asset Mappings (zkEVM)
9695

@@ -192,8 +191,8 @@ Deploys the Ethereum contracts for the migration system.
192191
"axelar_gateway": "0x..."
193192
},
194193
"stark_exchange_migration": {
195-
"implementation_address": "0x0000...",
196-
"v2_implementation_address": "0x0000..."
194+
"version": 2,
195+
"implementation_address": "0x0000..."
197196
}
198197
}
199198
```

0 commit comments

Comments
 (0)