Skip to content

Commit 943d7ee

Browse files
feat: add SemVerMixin (#1034)
* feat: add `SemVerMixin` * refactor: add `_majorVersion` helper for `SignatureUtils` * test: passing * test: passing * refactor: rename EIP712_VERSION * refactor: review changes
1 parent 6920ec1 commit 943d7ee

26 files changed

+327
-172
lines changed

script/deploy/devnet/deploy_from_scratch.s.sol

+27-17
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ contract DeployFromScratch is Script, Test {
7676
// strategies deployed
7777
StrategyBaseTVLLimits[] public deployedStrategyArray;
7878

79-
string EIP712_VERSION;
79+
string SEMVER;
8080

8181
// IMMUTABLES TO SET
8282
uint64 GOERLI_GENESIS_TIME = 1616508000;
@@ -123,7 +123,7 @@ contract DeployFromScratch is Script, Test {
123123
string memory config_data = vm.readFile(deployConfigPath);
124124
// bytes memory parsedData = vm.parseJson(config_data);
125125

126-
EIP712_VERSION = stdJson.readString(config_data, ".eip712_version");
126+
SEMVER = stdJson.readString(config_data, ".SEMVER");
127127

128128
STRATEGY_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".strategyManager.init_paused_status");
129129
DELEGATION_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".delegation.init_paused_status");
@@ -245,30 +245,40 @@ contract DeployFromScratch is Script, Test {
245245
eigenLayerPauserReg,
246246
permissionController,
247247
MIN_WITHDRAWAL_DELAY,
248-
EIP712_VERSION
248+
SEMVER
249249
);
250250

251-
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, EIP712_VERSION);
252-
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, EIP712_VERSION);
251+
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, SEMVER);
252+
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
253253
eigenPodManagerImplementation = new EigenPodManager(
254254
ethPOSDeposit,
255255
eigenPodBeacon,
256256
delegation,
257257
eigenLayerPauserReg
258258
);
259259
rewardsCoordinatorImplementation = new RewardsCoordinator(
260-
delegation,
261-
strategyManager,
262-
allocationManager,
263-
eigenLayerPauserReg,
264-
permissionController,
265-
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
266-
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
267-
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
268-
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
269-
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
270-
);
271-
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
260+
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
261+
delegation,
262+
strategyManager,
263+
allocationManager,
264+
eigenLayerPauserReg,
265+
permissionController,
266+
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
267+
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
268+
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
269+
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
270+
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
271+
SEMVER
272+
)
273+
);
274+
allocationManagerImplementation = new AllocationManager(
275+
delegation,
276+
eigenLayerPauserReg,
277+
permissionController,
278+
DEALLOCATION_DELAY,
279+
ALLOCATION_CONFIGURATION_DELAY,
280+
SEMVER
281+
);
272282
permissionControllerImplementation = new PermissionController();
273283
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg);
274284

script/deploy/local/Deploy_From_Scratch.s.sol

+27-17
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ contract DeployFromScratch is Script, Test {
7979
// strategies deployed
8080
StrategyBaseTVLLimits[] public deployedStrategyArray;
8181

82-
string EIP712_VERSION;
82+
string SEMVER;
8383

8484
// IMMUTABLES TO SET
8585
uint64 GOERLI_GENESIS_TIME = 1616508000;
@@ -126,7 +126,7 @@ contract DeployFromScratch is Script, Test {
126126
string memory config_data = vm.readFile(deployConfigPath);
127127
// bytes memory parsedData = vm.parseJson(config_data);
128128

129-
EIP712_VERSION = stdJson.readString(config_data, ".eip712_version");
129+
SEMVER = stdJson.readString(config_data, ".SEMVER");
130130

131131
STRATEGY_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".strategyManager.init_paused_status");
132132
DELEGATION_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".delegation.init_paused_status");
@@ -257,29 +257,39 @@ contract DeployFromScratch is Script, Test {
257257
eigenLayerPauserReg,
258258
permissionController,
259259
MIN_WITHDRAWAL_DELAY,
260-
EIP712_VERSION
260+
SEMVER
261261
);
262-
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, EIP712_VERSION);
263-
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, EIP712_VERSION);
262+
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, SEMVER);
263+
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
264264
eigenPodManagerImplementation = new EigenPodManager(
265265
ethPOSDeposit,
266266
eigenPodBeacon,
267267
delegation,
268268
eigenLayerPauserReg
269269
);
270270
rewardsCoordinatorImplementation = new RewardsCoordinator(
271-
delegation,
272-
strategyManager,
273-
allocationManager,
274-
eigenLayerPauserReg,
275-
permissionController,
276-
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
277-
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
278-
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
279-
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
280-
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
281-
);
282-
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
271+
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
272+
delegation,
273+
strategyManager,
274+
allocationManager,
275+
eigenLayerPauserReg,
276+
permissionController,
277+
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
278+
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
279+
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
280+
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
281+
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
282+
SEMVER
283+
)
284+
);
285+
allocationManagerImplementation = new AllocationManager(
286+
delegation,
287+
eigenLayerPauserReg,
288+
permissionController,
289+
DEALLOCATION_DELAY,
290+
ALLOCATION_CONFIGURATION_DELAY,
291+
SEMVER
292+
);
283293
permissionControllerImplementation = new PermissionController();
284294

285295
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.

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

+27-17
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ contract DeployFromScratch is Script, Test {
7373
address operationsMultisig;
7474
address pauserMultisig;
7575

76-
string EIP712_VERSION;
76+
string SEMVER;
7777

7878
// the ETH2 deposit contract -- if not on mainnet, we deploy a mock as stand-in
7979
IETHPOSDeposit public ethPOSDeposit;
@@ -126,7 +126,7 @@ contract DeployFromScratch is Script, Test {
126126
string memory config_data = vm.readFile(deployConfigPath);
127127
// bytes memory parsedData = vm.parseJson(config_data);
128128

129-
EIP712_VERSION = stdJson.readString(config_data, ".eip712_version");
129+
SEMVER = stdJson.readString(config_data, ".SEMVER");
130130

131131
MIN_WITHDRAWAL_DELAY = uint32(stdJson.readUint(config_data, ".delegation.withdrawal_delay_blocks"));
132132
STRATEGY_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".strategyManager.init_paused_status");
@@ -252,29 +252,39 @@ contract DeployFromScratch is Script, Test {
252252
eigenLayerPauserReg,
253253
permissionController,
254254
MIN_WITHDRAWAL_DELAY,
255-
EIP712_VERSION
255+
SEMVER
256256
);
257-
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, EIP712_VERSION);
258-
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, EIP712_VERSION);
257+
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, SEMVER);
258+
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
259259
eigenPodManagerImplementation = new EigenPodManager(
260260
ethPOSDeposit,
261261
eigenPodBeacon,
262262
delegation,
263263
eigenLayerPauserReg
264264
);
265265
rewardsCoordinatorImplementation = new RewardsCoordinator(
266-
delegation,
267-
strategyManager,
268-
allocationManager,
269-
eigenLayerPauserReg,
270-
permissionController,
271-
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
272-
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
273-
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
274-
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
275-
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
276-
);
277-
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
266+
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
267+
delegation,
268+
strategyManager,
269+
allocationManager,
270+
eigenLayerPauserReg,
271+
permissionController,
272+
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
273+
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
274+
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
275+
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
276+
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
277+
SEMVER
278+
)
279+
);
280+
allocationManagerImplementation = new AllocationManager(
281+
delegation,
282+
eigenLayerPauserReg,
283+
permissionController,
284+
DEALLOCATION_DELAY,
285+
ALLOCATION_CONFIGURATION_DELAY,
286+
SEMVER
287+
);
278288
permissionControllerImplementation = new PermissionController();
279289

280290
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.

script/releases/v1.0.0-slashing/1-deployContracts.s.sol

+17-13
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ contract Deploy is EOADeployer {
5656
_pauserRegistry: Env.impl.pauserRegistry(),
5757
_permissionController: Env.proxy.permissionController(),
5858
_DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(),
59-
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY()
59+
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY(),
60+
_version: Env.version()
6061
}))
6162
});
6263

@@ -99,18 +100,21 @@ contract Deploy is EOADeployer {
99100

100101
deployImpl({
101102
name: type(RewardsCoordinator).name,
102-
deployedTo: address(new RewardsCoordinator({
103-
_delegationManager: Env.proxy.delegationManager(),
104-
_strategyManager: Env.proxy.strategyManager(),
105-
_allocationManager: Env.proxy.allocationManager(),
106-
_pauserRegistry: Env.impl.pauserRegistry(),
107-
_permissionController: Env.proxy.permissionController(),
108-
_CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
109-
_MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
110-
_MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
111-
_MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
112-
_GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP()
113-
}))
103+
deployedTo: address(new RewardsCoordinator(
104+
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({
105+
delegationManager: Env.proxy.delegationManager(),
106+
strategyManager: Env.proxy.strategyManager(),
107+
allocationManager: Env.proxy.allocationManager(),
108+
pauserRegistry: Env.impl.pauserRegistry(),
109+
permissionController: Env.proxy.permissionController(),
110+
CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
111+
MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
112+
MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
113+
MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
114+
GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP(),
115+
version: Env.version()
116+
})
117+
))
114118
});
115119

116120
deployImpl({

script/releases/v1.0.1-slashing/1-eoa.s.sol

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ contract Deploy is EOADeployer {
2121
_pauserRegistry: Env.impl.pauserRegistry(),
2222
_permissionController: Env.proxy.permissionController(),
2323
_DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(),
24-
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY()
24+
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY(),
25+
_version: Env.version()
2526
}))
2627
});
2728

script/releases/v1.0.2-slashing-consolidated/1-deployContracts.s.sol

+17-13
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ contract Deploy is EOADeployer {
5656
_pauserRegistry: Env.impl.pauserRegistry(),
5757
_permissionController: Env.proxy.permissionController(),
5858
_DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(),
59-
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY()
59+
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY(),
60+
_version: Env.version()
6061
}))
6162
});
6263

@@ -99,18 +100,21 @@ contract Deploy is EOADeployer {
99100

100101
deployImpl({
101102
name: type(RewardsCoordinator).name,
102-
deployedTo: address(new RewardsCoordinator({
103-
_delegationManager: Env.proxy.delegationManager(),
104-
_strategyManager: Env.proxy.strategyManager(),
105-
_allocationManager: Env.proxy.allocationManager(),
106-
_pauserRegistry: Env.impl.pauserRegistry(),
107-
_permissionController: Env.proxy.permissionController(),
108-
_CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
109-
_MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
110-
_MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
111-
_MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
112-
_GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP()
113-
}))
103+
deployedTo: address(new RewardsCoordinator(
104+
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({
105+
delegationManager: Env.proxy.delegationManager(),
106+
strategyManager: Env.proxy.strategyManager(),
107+
allocationManager: Env.proxy.allocationManager(),
108+
pauserRegistry: Env.impl.pauserRegistry(),
109+
permissionController: Env.proxy.permissionController(),
110+
CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
111+
MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
112+
MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
113+
MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
114+
GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP(),
115+
version: Env.version()
116+
})
117+
))
114118
});
115119

116120
deployImpl({

script/releases/v1.0.3-slashing/1-eoa.s.sol

+15-12
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,21 @@ contract Deploy is EOADeployer {
5353
// Deploy RC
5454
deployImpl({
5555
name: type(RewardsCoordinator).name,
56-
deployedTo: address(new RewardsCoordinator({
57-
_delegationManager: Env.proxy.delegationManager(),
58-
_strategyManager: Env.proxy.strategyManager(),
59-
_allocationManager: Env.proxy.allocationManager(),
60-
_pauserRegistry: Env.impl.pauserRegistry(),
61-
_permissionController: Env.proxy.permissionController(),
62-
_CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
63-
_MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
64-
_MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
65-
_MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
66-
_GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP()
67-
}))
56+
deployedTo: address(new RewardsCoordinator(
57+
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({
58+
delegationManager: Env.proxy.delegationManager(),
59+
strategyManager: Env.proxy.strategyManager(),
60+
allocationManager: Env.proxy.allocationManager(),
61+
pauserRegistry: Env.impl.pauserRegistry(),
62+
permissionController: Env.proxy.permissionController(),
63+
CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(),
64+
MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(),
65+
MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(),
66+
MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(),
67+
GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP(),
68+
version: Env.version()
69+
})
70+
))
6871
});
6972

7073
vm.stopBroadcast();

script/utils/ExistingDeploymentParser.sol

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ contract ExistingDeploymentParser is Script, Logger {
5050
/// EigenLayer Contract Parameters
5151
/// -----------------------------------------------------------------------
5252

53+
string public SEMVER;
5354
/// @dev AllocationManager
5455
uint256 ALLOCATION_MANAGER_INIT_PAUSED_STATUS;
5556
uint32 DEALLOCATION_DELAY;
@@ -193,6 +194,8 @@ contract ExistingDeploymentParser is Script, Logger {
193194
// READ JSON CONFIG DATA
194195
string memory json = cheats.readFile(existingDeploymentInfoPath);
195196

197+
SEMVER = stdJson.readString(json, ".parameters.version");
198+
196199
// check that the chainID matches the one in the config
197200
uint256 configChainId = json.readUint(".chainInfo.chainId");
198201
assertEq(configChainId, currentChainId, "You are on the wrong chain for this config");
@@ -221,7 +224,8 @@ contract ExistingDeploymentParser is Script, Logger {
221224
eigenLayerPauserReg,
222225
permissionController,
223226
DEALLOCATION_DELAY,
224-
ALLOCATION_CONFIGURATION_DELAY
227+
ALLOCATION_CONFIGURATION_DELAY,
228+
SEMVER
225229
);
226230
allocationManager = AllocationManager(
227231
address(new TransparentUpgradeableProxy(address(allocationManagerImplementation), address(eigenLayerProxyAdmin), ""))

0 commit comments

Comments
 (0)