Skip to content

Commit

Permalink
fix: signature utils
Browse files Browse the repository at this point in the history
refactor: review changes

refactor: review changes

feat: remaining semver

feat: remaining semver

refactor: review changes

refactor: review changes

fix: ci

refactor: remove make cmd

fix: ci

fix: ci

feat: add `SemVerMixin` (#1034)

* feat: add `SemVerMixin`

* refactor: add `_majorVersion` helper for `SignatureUtils`

* test: passing

* test: passing

* refactor: rename EIP712_VERSION

* refactor: review changes

chore: forge fmt

refactor: natspec improvements

chore: forge fmt

fix: eip712 typehash

refactor: remove version overrides

refactor: remove make bump-version

refactor: immutable version

refactor: remove unused import

chore: `make bump-version VERSION=1`

refactor: `SignatureUtils` -> `SignatureUtilsMixin`

fix: bump-version.sh

chore: `make bump-version VERSION=1.0.3`

feat: add `make bump-version`

feat: add version fn

refactor: cleanup

fix: signature utils
  • Loading branch information
0xClandestine committed Jan 29, 2025
1 parent bd2453c commit a09d514
Show file tree
Hide file tree
Showing 71 changed files with 799 additions and 426 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ gha-docker:
docker run -v $(PWD):/build -w /build --rm -i ${CONTAINER_NAME}:latest bash -c "make gha"

storage-report:
bash "bin/storage-report.sh" "docs/storage-report/"
bash "bin/storage-report.sh" "docs/storage-report/"
3 changes: 2 additions & 1 deletion script/configs/devnet/deploy_from_scratch.anvil.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@
"OPERATOR_SET_GENESIS_REWARDS_TIMESTAMP": 1720656000,
"OPERATOR_SET_MAX_RETROACTIVE_LENGTH": 2592000
},
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa"
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
"semver": "v1.0.3"
}
5 changes: 3 additions & 2 deletions script/configs/devnet/deploy_from_scratch.holesky.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@
"OPERATOR_SET_GENESIS_REWARDS_TIMESTAMP": 1720656000,
"OPERATOR_SET_MAX_RETROACTIVE_LENGTH": 2592000
},
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa"
}
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
"semver": "v0.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"DEALLOCATION_DELAY": 86400,
"ALLOCATION_CONFIGURATION_DELAY": 600
},
"ethPOSDepositAddress": "0x4242424242424242424242424242424242424242"
"ethPOSDepositAddress": "0x4242424242424242424242424242424242424242",
"semver": "v0.0.0"
}
3 changes: 2 additions & 1 deletion script/configs/local/deploy_from_scratch.anvil.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"DEALLOCATION_DELAY": 900,
"ALLOCATION_CONFIGURATION_DELAY": 1200
},
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa"
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
"semver": "v0.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"OPERATOR_SET_GENESIS_REWARDS_TIMESTAMP": 1720656000,
"OPERATOR_SET_MAX_RETROACTIVE_LENGTH": 2592000
},
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa"
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
"semver": "v0.0.0"
}
3 changes: 2 additions & 1 deletion script/configs/mainnet/mainnet-addresses.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"executorMultisig": "0x369e6F597e22EaB55fFb173C6d9cD234BD699111",
"operationsMultisig": "0xBE1685C81aA44FF9FB319dD389addd9374383e90",
"pauserMultisig": "0x5050389572f2d220ad927CcbeA0D406831012390",
"timelock": "0xA6Db1A8C5a981d1536266D2a393c5F8dDb210EAF"
"timelock": "0xA6Db1A8C5a981d1536266D2a393c5F8dDb210EAF",
"semver": "v0.5.4"
}
}
63 changes: 44 additions & 19 deletions script/deploy/devnet/deploy_from_scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ contract DeployFromScratch is Script, Test {
// strategies deployed
StrategyBaseTVLLimits[] public deployedStrategyArray;

string SEMVER;

// IMMUTABLES TO SET
uint64 GOERLI_GENESIS_TIME = 1616508000;

Expand Down Expand Up @@ -121,6 +123,8 @@ contract DeployFromScratch is Script, Test {
string memory config_data = vm.readFile(deployConfigPath);
// bytes memory parsedData = vm.parseJson(config_data);

SEMVER = stdJson.readString(config_data, ".semver");

STRATEGY_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".strategyManager.init_paused_status");
DELEGATION_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".delegation.init_paused_status");
DELEGATION_WITHDRAWAL_DELAY_BLOCKS = stdJson.readUint(config_data, ".delegation.init_withdrawal_delay_blocks");
Expand Down Expand Up @@ -227,37 +231,58 @@ contract DeployFromScratch is Script, Test {
eigenPodImplementation = new EigenPod(
ethPOSDeposit,
eigenPodManager,
GOERLI_GENESIS_TIME
GOERLI_GENESIS_TIME,
SEMVER
);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));

// Second, deploy the *implementation* contracts, using the *proxy contracts* as inputs

delegationImplementation = new DelegationManager(strategyManager, eigenPodManager, allocationManager, eigenLayerPauserReg, permissionController, MIN_WITHDRAWAL_DELAY);
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg);
delegationImplementation = new DelegationManager(
strategyManager,
eigenPodManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
MIN_WITHDRAWAL_DELAY,
SEMVER
);

strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, SEMVER);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
eigenPodManagerImplementation = new EigenPodManager(
ethPOSDeposit,
eigenPodBeacon,
delegation,
eigenLayerPauserReg
eigenLayerPauserReg,
SEMVER
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
SEMVER
)
);
allocationManagerImplementation = new AllocationManager(
delegation,
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY,
SEMVER
);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
permissionControllerImplementation = new PermissionController();
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg);
permissionControllerImplementation = new PermissionController(SEMVER);
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg, SEMVER);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
Expand Down Expand Up @@ -325,7 +350,7 @@ contract DeployFromScratch is Script, Test {

// Deploy strategyFactory & base
// Create base strategy implementation
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg);
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg, SEMVER);

// Create a proxy beacon for base strategy implementation
strategyBeacon = new UpgradeableBeacon(address(baseStrategyImplementation));
Expand Down
59 changes: 41 additions & 18 deletions script/deploy/local/Deploy_From_Scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ contract DeployFromScratch is Script, Test {
// strategies deployed
StrategyBaseTVLLimits[] public deployedStrategyArray;

string SEMVER;

// IMMUTABLES TO SET
uint64 GOERLI_GENESIS_TIME = 1616508000;

Expand Down Expand Up @@ -124,6 +126,8 @@ contract DeployFromScratch is Script, Test {
string memory config_data = vm.readFile(deployConfigPath);
// bytes memory parsedData = vm.parseJson(config_data);

SEMVER = stdJson.readString(config_data, ".semver");

STRATEGY_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".strategyManager.init_paused_status");
DELEGATION_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".delegation.init_paused_status");
DELEGATION_WITHDRAWAL_DELAY_BLOCKS = stdJson.readUint(config_data, ".delegation.init_withdrawal_delay_blocks");
Expand Down Expand Up @@ -240,35 +244,54 @@ contract DeployFromScratch is Script, Test {
} else {
ethPOSDeposit = IETHPOSDeposit(stdJson.readAddress(config_data, ".ethPOSDepositAddress"));
}
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, GOERLI_GENESIS_TIME);
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, GOERLI_GENESIS_TIME, SEMVER);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));

// Second, deploy the *implementation* contracts, using the *proxy contracts* as inputs

delegationImplementation = new DelegationManager(strategyManager, eigenPodManager, allocationManager, eigenLayerPauserReg, permissionController, MIN_WITHDRAWAL_DELAY);
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg);
delegationImplementation = new DelegationManager(
strategyManager,
eigenPodManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
MIN_WITHDRAWAL_DELAY,
SEMVER
);
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, SEMVER);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
eigenPodManagerImplementation = new EigenPodManager(
ethPOSDeposit,
eigenPodBeacon,
delegation,
eigenLayerPauserReg
eigenLayerPauserReg,
SEMVER
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
SEMVER
)
);
allocationManagerImplementation = new AllocationManager(
delegation,
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY,
SEMVER
);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
permissionControllerImplementation = new PermissionController();
permissionControllerImplementation = new PermissionController(SEMVER);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
Expand Down Expand Up @@ -340,7 +363,7 @@ contract DeployFromScratch is Script, Test {
);

// deploy StrategyBaseTVLLimits contract implementation
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg);
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg, SEMVER);
// create upgradeable proxies that each point to the implementation and initialize them
for (uint256 i = 0; i < strategyConfigs.length; ++i) {
if (strategyConfigs[i].tokenAddress == address(0)) {
Expand Down
60 changes: 42 additions & 18 deletions script/deploy/local/deploy_from_scratch.slashing.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ contract DeployFromScratch is Script, Test {
address operationsMultisig;
address pauserMultisig;

string SEMVER;

// the ETH2 deposit contract -- if not on mainnet, we deploy a mock as stand-in
IETHPOSDeposit public ethPOSDeposit;

Expand Down Expand Up @@ -124,6 +126,8 @@ contract DeployFromScratch is Script, Test {
string memory config_data = vm.readFile(deployConfigPath);
// bytes memory parsedData = vm.parseJson(config_data);

SEMVER = stdJson.readString(config_data, ".semver");

MIN_WITHDRAWAL_DELAY = uint32(stdJson.readUint(config_data, ".delegation.withdrawal_delay_blocks"));
STRATEGY_MANAGER_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".strategyManager.init_paused_status");
DELEGATION_INIT_PAUSED_STATUS = stdJson.readUint(config_data, ".delegation.init_paused_status");
Expand Down Expand Up @@ -234,36 +238,56 @@ contract DeployFromScratch is Script, Test {
eigenPodImplementation = new EigenPod(
ethPOSDeposit,
eigenPodManager,
GOERLI_GENESIS_TIME
GOERLI_GENESIS_TIME,
SEMVER
);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));

// Second, deploy the *implementation* contracts, using the *proxy contracts* as inputs

delegationImplementation = new DelegationManager(strategyManager, eigenPodManager, allocationManager, eigenLayerPauserReg, permissionController, MIN_WITHDRAWAL_DELAY);
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg);
delegationImplementation = new DelegationManager(
strategyManager,
eigenPodManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
MIN_WITHDRAWAL_DELAY,
SEMVER
);
strategyManagerImplementation = new StrategyManager(delegation, eigenLayerPauserReg, SEMVER);
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
eigenPodManagerImplementation = new EigenPodManager(
ethPOSDeposit,
eigenPodBeacon,
delegation,
eigenLayerPauserReg
eigenLayerPauserReg,
SEMVER
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
delegation,
strategyManager,
allocationManager,
eigenLayerPauserReg,
permissionController,
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
SEMVER
)
);
allocationManagerImplementation = new AllocationManager(
delegation,
eigenLayerPauserReg,
permissionController,
DEALLOCATION_DELAY,
ALLOCATION_CONFIGURATION_DELAY,
SEMVER
);
allocationManagerImplementation = new AllocationManager(delegation, eigenLayerPauserReg, permissionController, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
permissionControllerImplementation = new PermissionController();
permissionControllerImplementation = new PermissionController(SEMVER);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
Expand Down Expand Up @@ -335,7 +359,7 @@ contract DeployFromScratch is Script, Test {
);

// deploy StrategyBaseTVLLimits contract implementation
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg);
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg, SEMVER);
// create upgradeable proxies that each point to the implementation and initialize them
for (uint256 i = 0; i < strategyConfigs.length; ++i) {
if (strategyConfigs[i].tokenAddress == address(0)) {
Expand Down
8 changes: 8 additions & 0 deletions script/releases/Env.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ library Env {
* env
*/

function version() internal view returns (string memory) {
return _envString("version");
}

function executorMultisig() internal view returns (address) {
return _envAddress("executorMultisig");
}
Expand Down Expand Up @@ -301,6 +305,10 @@ library Env {
return ZEnvHelpers.state().deployedImpl(name);
}

function _envString(string memory key) private view returns (string memory) {
return ZEnvHelpers.state().envString(key);
}

function _envAddress(string memory key) private view returns (address) {
return ZEnvHelpers.state().envAddress(key);
}
Expand Down
Loading

0 comments on commit a09d514

Please sign in to comment.