Skip to content

Commit bec851a

Browse files
feat: remove SemVerMixin + add ProtocolRegistry (#1639)
**Motivation:** We want to reduce codesize so there's room for future functionality. **Modifications:** - Removed `SemVerMixin` imports, updated tests, scripts, etc. - Added `ProtocolRegistry` which now tracks semver on a per contract basis set by owner. - Wrapped some modifiers to reduce codesize. - TODO: Explore whether some `.length == .length` checks can be removed as the compiler already handles them. **Result:** Codesize savings.
1 parent 7dc8bb1 commit bec851a

File tree

63 files changed

+1051
-311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1051
-311
lines changed

.size-after-commit0

Lines changed: 246 additions & 0 deletions
Large diffs are not rendered by default.

.size-after-removing-semver

Lines changed: 244 additions & 0 deletions
Large diffs are not rendered by default.

.size-before-commit0

Lines changed: 246 additions & 0 deletions
Large diffs are not rendered by default.

script/deploy/devnet/deploy_from_scratch.s.sol

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ contract DeployFromScratch is Script, Test {
225225
if (chainId == 1) ethPOSDeposit = IETHPOSDeposit(0x00000000219ab540356cBB839Cbe05303d7705Fa);
226226
// if not on mainnet, deploy a mock
227227
else ethPOSDeposit = IETHPOSDeposit(stdJson.readAddress(config_data, ".ethPOSDepositAddress"));
228-
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, SEMVER);
228+
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager);
229229

230230
eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
231231

@@ -245,7 +245,7 @@ contract DeployFromScratch is Script, Test {
245245
new StrategyManager(IAllocationManager(address(allocationManager)), delegation, eigenLayerPauserReg, SEMVER);
246246
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
247247
eigenPodManagerImplementation =
248-
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg, SEMVER);
248+
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg);
249249
rewardsCoordinatorImplementation = new RewardsCoordinator(
250250
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
251251
delegation,
@@ -257,8 +257,7 @@ contract DeployFromScratch is Script, Test {
257257
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
258258
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
259259
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
260-
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
261-
SEMVER
260+
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
262261
)
263262
);
264263
allocationManagerImplementation = new AllocationManager(
@@ -268,13 +267,12 @@ contract DeployFromScratch is Script, Test {
268267
eigenLayerPauserReg,
269268
permissionController,
270269
DEALLOCATION_DELAY,
271-
ALLOCATION_CONFIGURATION_DELAY,
272-
SEMVER
270+
ALLOCATION_CONFIGURATION_DELAY
273271
);
274272
allocationManagerViewImplementation =
275273
new AllocationManagerView(delegation, eigenStrategy, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
276-
permissionControllerImplementation = new PermissionController(SEMVER);
277-
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg, SEMVER);
274+
permissionControllerImplementation = new PermissionController();
275+
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg);
278276

279277
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
280278
{
@@ -341,7 +339,7 @@ contract DeployFromScratch is Script, Test {
341339

342340
// Deploy strategyFactory & base
343341
// Create base strategy implementation
344-
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg, SEMVER);
342+
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg);
345343

346344
// Create a proxy beacon for base strategy implementation
347345
strategyBeacon = new UpgradeableBeacon(address(baseStrategyImplementation));

script/deploy/local/deploy_from_scratch.slashing.s.sol

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ contract DeployFromScratch is Script, Test {
229229
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
230230
);
231231

232-
eigenStrategy = IStrategy(new EigenStrategy(strategyManager, eigenLayerPauserReg, SEMVER));
232+
eigenStrategy = IStrategy(new EigenStrategy(strategyManager, eigenLayerPauserReg));
233233

234234
// if on mainnet, use the ETH2 deposit contract address
235235
if (chainId == 1) ethPOSDeposit = IETHPOSDeposit(0x00000000219ab540356cBB839Cbe05303d7705Fa);
236236
// if not on mainnet, deploy a mock
237237
else ethPOSDeposit = IETHPOSDeposit(stdJson.readAddress(config_data, ".ethPOSDepositAddress"));
238-
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, SEMVER);
238+
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager);
239239

240240
eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
241241

@@ -254,7 +254,7 @@ contract DeployFromScratch is Script, Test {
254254
new StrategyManager(IAllocationManager(address(allocationManager)), delegation, eigenLayerPauserReg, SEMVER);
255255
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
256256
eigenPodManagerImplementation =
257-
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg, SEMVER);
257+
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg);
258258
rewardsCoordinatorImplementation = new RewardsCoordinator(
259259
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
260260
delegation,
@@ -266,8 +266,7 @@ contract DeployFromScratch is Script, Test {
266266
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
267267
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
268268
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
269-
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
270-
SEMVER
269+
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
271270
)
272271
);
273272
allocationManagerImplementation = new AllocationManager(
@@ -277,12 +276,11 @@ contract DeployFromScratch is Script, Test {
277276
eigenLayerPauserReg,
278277
permissionController,
279278
DEALLOCATION_DELAY,
280-
ALLOCATION_CONFIGURATION_DELAY,
281-
SEMVER
279+
ALLOCATION_CONFIGURATION_DELAY
282280
);
283281
allocationManagerViewImplementation =
284282
new AllocationManagerView(delegation, eigenStrategy, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
285-
permissionControllerImplementation = new PermissionController(SEMVER);
283+
permissionControllerImplementation = new PermissionController();
286284

287285
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
288286
{
@@ -355,7 +353,7 @@ contract DeployFromScratch is Script, Test {
355353
);
356354

357355
// deploy StrategyBaseTVLLimits contract implementation
358-
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg, SEMVER);
356+
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg);
359357
// create upgradeable proxies that each point to the implementation and initialize them
360358
for (uint256 i = 0; i < strategyConfigs.length; ++i) {
361359
if (strategyConfigs[i].tokenAddress == address(0)) {

script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/1-deploySourceChain.s.sol

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ contract DeploySourceChain is EOADeployer {
5151
_allocationManager: IAllocationManager(address(Env.proxy.allocationManager())),
5252
_keyRegistrar: Env.proxy.keyRegistrar(),
5353
_permissionController: Env.proxy.permissionController(),
54-
_pauserRegistry: Env.impl.pauserRegistry(),
55-
_version: Env.deployVersion()
54+
_pauserRegistry: Env.impl.pauserRegistry()
5655
})
5756
)
5857
});
@@ -80,7 +79,7 @@ contract DeploySourceChain is EOADeployer {
8079
deployImpl({
8180
name: type(ReleaseManager).name,
8281
deployedTo: address(
83-
new ReleaseManager({_permissionController: Env.proxy.permissionController(), _version: Env.deployVersion()})
82+
new ReleaseManager({_permissionController: Env.proxy.permissionController()})
8483
)
8584
});
8685

@@ -180,7 +179,6 @@ contract DeploySourceChain is EOADeployer {
180179
address(crossChainRegistry.pauserRegistry()) == address(Env.impl.pauserRegistry()),
181180
"ccr.pauserRegistry invalid"
182181
);
183-
assertEq(crossChainRegistry.version(), Env.deployVersion(), "ccr.version failed");
184182
}
185183

186184
{
@@ -190,7 +188,6 @@ contract DeploySourceChain is EOADeployer {
190188
releaseManager.permissionController() == Env.proxy.permissionController(),
191189
"rm.permissionController invalid"
192190
);
193-
assertEq(releaseManager.version(), Env.deployVersion(), "rm.version failed");
194191
}
195192
}
196193

@@ -216,7 +213,6 @@ contract DeploySourceChain is EOADeployer {
216213
);
217214

218215
CrossChainRegistry crossChainRegistry = Env.proxy.crossChainRegistry();
219-
assertEq(crossChainRegistry.version(), Env.deployVersion(), "crossChainRegistry version mismatch");
220216
assertTrue(
221217
crossChainRegistry.allocationManager() == Env.proxy.allocationManager(),
222218
"crossChainRegistry allocationManager mismatch"
@@ -234,7 +230,6 @@ contract DeploySourceChain is EOADeployer {
234230
);
235231

236232
ReleaseManager releaseManager = Env.proxy.releaseManager();
237-
assertEq(releaseManager.version(), Env.deployVersion(), "releaseManager version mismatch");
238233
assertTrue(
239234
releaseManager.permissionController() == Env.proxy.permissionController(),
240235
"releaseManager permissionController mismatch"

script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/3-deployDestinationChainImpls.s.sol

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi
3636
new OperatorTableUpdater({
3737
_bn254CertificateVerifier: Env.proxy.bn254CertificateVerifier(),
3838
_ecdsaCertificateVerifier: Env.proxy.ecdsaCertificateVerifier(),
39-
_pauserRegistry: Env.impl.pauserRegistry(),
40-
_version: Env.deployVersion()
39+
_pauserRegistry: Env.impl.pauserRegistry()
4140
})
4241
)
4342
});
@@ -56,12 +55,7 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi
5655
// BN254CertificateVerifier
5756
deployImpl({
5857
name: type(BN254CertificateVerifier).name,
59-
deployedTo: address(
60-
new BN254CertificateVerifier({
61-
_operatorTableUpdater: Env.proxy.operatorTableUpdater(),
62-
_version: Env.deployVersion()
63-
})
64-
)
58+
deployedTo: address(new BN254CertificateVerifier({_operatorTableUpdater: Env.proxy.operatorTableUpdater()}))
6559
});
6660

6761
// TaskMailbox
@@ -72,8 +66,7 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi
7266
new TaskMailbox({
7367
_bn254CertificateVerifier: address(Env.proxy.bn254CertificateVerifier()),
7468
_ecdsaCertificateVerifier: address(Env.proxy.ecdsaCertificateVerifier()),
75-
_maxTaskSLA: Env.MAX_TASK_SLA(),
76-
_version: Env.deployVersion()
69+
_maxTaskSLA: Env.MAX_TASK_SLA()
7770
})
7871
)
7972
});
@@ -121,7 +114,6 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi
121114
== address(Env.proxy.ecdsaCertificateVerifier()),
122115
"out.ecdsaCertificateVerifier invalid"
123116
);
124-
assertEq(operatorTableUpdater.version(), Env.deployVersion(), "out.version failed");
125117
}
126118

127119
{
@@ -141,7 +133,6 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi
141133
address(bn254CertificateVerifier.operatorTableUpdater()) == address(Env.proxy.operatorTableUpdater()),
142134
"b254cv.operatorTableUpdater invalid"
143135
);
144-
assertEq(bn254CertificateVerifier.version(), Env.deployVersion(), "b254cv.version failed");
145136
}
146137

147138
{
@@ -156,7 +147,6 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi
156147
"tm.ecdsaCertificateVerifier invalid"
157148
);
158149
assertEq(taskMailbox.MAX_TASK_SLA(), Env.MAX_TASK_SLA(), "tm.maxTaskSLA failed");
159-
assertEq(taskMailbox.version(), Env.deployVersion(), "tm.version failed");
160150
}
161151
}
162152

@@ -191,12 +181,5 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi
191181
// ECDSACertificateVerifier and BN254CertificateVerifier don't have initialize functions
192182
}
193183

194-
function _validateVersion() internal view {
195-
string memory expected = Env.deployVersion();
196-
197-
assertEq(Env.impl.operatorTableUpdater().version(), expected, "operatorTableUpdater version mismatch");
198-
assertEq(Env.impl.ecdsaCertificateVerifier().version(), expected, "ecdsaCertificateVerifier version mismatch");
199-
assertEq(Env.impl.bn254CertificateVerifier().version(), expected, "bn254CertificateVerifier version mismatch");
200-
assertEq(Env.impl.taskMailbox().version(), expected, "taskMailbox version mismatch");
201-
}
184+
function _validateVersion() internal view {}
202185
}

script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/4-instantiateDestinationChainProxies.s.sol

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ contract InstantiateDestinationChainProxies is DeployDestinationChainImpls {
283283
/// OperatorTableUpdater
284284
{
285285
OperatorTableUpdater operatorTableUpdater = Env.proxy.operatorTableUpdater();
286-
assertEq(operatorTableUpdater.version(), Env.deployVersion(), "operatorTableUpdater version mismatch");
287286
assertTrue(
288287
operatorTableUpdater.bn254CertificateVerifier() == Env.proxy.bn254CertificateVerifier(),
289288
"out.bn254CertificateVerifier mismatch"
@@ -309,9 +308,6 @@ contract InstantiateDestinationChainProxies is DeployDestinationChainImpls {
309308
/// BN254CertificateVerifier
310309
{
311310
BN254CertificateVerifier bn254CertificateVerifier = Env.proxy.bn254CertificateVerifier();
312-
assertEq(
313-
bn254CertificateVerifier.version(), Env.deployVersion(), "bn254CertificateVerifier version mismatch"
314-
);
315311
assertTrue(
316312
bn254CertificateVerifier.operatorTableUpdater() == Env.proxy.operatorTableUpdater(),
317313
"bn254CertificateVerifier operatorTableUpdater mismatch"
@@ -321,7 +317,6 @@ contract InstantiateDestinationChainProxies is DeployDestinationChainImpls {
321317
/// TaskMailbox
322318
{
323319
TaskMailbox taskMailbox = Env.proxy.taskMailbox();
324-
assertEq(taskMailbox.version(), Env.deployVersion(), "taskMailbox version mismatch");
325320
assertTrue(
326321
taskMailbox.BN254_CERTIFICATE_VERIFIER() == address(Env.proxy.bn254CertificateVerifier()),
327322
"taskMailbox.BN254_CERTIFICATE_VERIFIER mismatch"

script/releases/v1.8.1-hourglass-testnet-replay-fix/1-deployTaskMailboxImpl.s.sol

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ contract DeployTaskMailboxImpl is EOADeployer {
2929
new TaskMailbox({
3030
_bn254CertificateVerifier: address(Env.proxy.bn254CertificateVerifier()),
3131
_ecdsaCertificateVerifier: address(Env.proxy.ecdsaCertificateVerifier()),
32-
_maxTaskSLA: Env.MAX_TASK_SLA(),
33-
_version: Env.deployVersion()
32+
_maxTaskSLA: Env.MAX_TASK_SLA()
3433
})
3534
)
3635
});
@@ -72,13 +71,6 @@ contract DeployTaskMailboxImpl is EOADeployer {
7271
function _validateImplConstructor() internal view {
7372
TaskMailbox taskMailboxImpl = Env.impl.taskMailbox();
7473

75-
// Validate version
76-
assertEq(
77-
keccak256(bytes(taskMailboxImpl.version())),
78-
keccak256(bytes(Env.deployVersion())),
79-
"TaskMailbox impl version mismatch"
80-
);
81-
8274
// Validate certificate verifiers
8375
assertTrue(
8476
taskMailboxImpl.BN254_CERTIFICATE_VERIFIER() == address(Env.proxy.bn254CertificateVerifier()),
@@ -108,11 +100,5 @@ contract DeployTaskMailboxImpl is EOADeployer {
108100
}
109101

110102
/// @dev Validate the version is correctly set
111-
function _validateVersion() internal view {
112-
assertEq(
113-
keccak256(bytes(Env.impl.taskMailbox().version())),
114-
keccak256(bytes(Env.deployVersion())),
115-
"TaskMailbox version should match deploy version"
116-
);
117-
}
103+
function _validateVersion() internal view {}
118104
}

script/releases/v1.8.1-hourglass-testnet-replay-fix/3-executeTaskMailboxUpgrade.s.sol

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ contract ExecuteTaskMailboxUpgrade is QueueTaskMailboxUpgrade {
8686
function _validateProxyConstructor() internal view {
8787
TaskMailbox taskMailbox = Env.proxy.taskMailbox();
8888

89-
// Validate version
90-
assertEq(
91-
keccak256(bytes(taskMailbox.version())),
92-
keccak256(bytes(Env.deployVersion())),
93-
"TaskMailbox version mismatch"
94-
);
95-
9689
// Validate certificate verifiers
9790
assertTrue(
9891
taskMailbox.BN254_CERTIFICATE_VERIFIER() == address(Env.proxy.bn254CertificateVerifier()),

0 commit comments

Comments
 (0)