Skip to content

Commit 7a35c7b

Browse files
ypatil120xClandestine
authored andcommitted
Feat/operator sets (#579)
* feat: operator set scaffold * fix: impl/storage compile errors; pending updating of tests * chore: `forge fmt` * fix: `OperatorSet` struct misuse * fix: comment * chore: verbose use of `OperatorSet` * test: `registerOperatorToOperatorSet` * feat: `registerOperatorToOperatorSets` Enables registering multiple operator sets in a single call. * chore: `forge fmt` * feat: interface changes * fix: operator set digest * fix: `OPERATOR_SET_REGISTRATION_TYPEHASH` * chore: `forge fmt` * test: wrong avs using signature * fix: optimize for SSTOREs * test: `deregisterOperatorFromOperatorSets` * chore: rename `operatorSetStrategies` * test: `addStrategiesToOperatorSet` * test: `removeStrategiesFromOperatorSet` * test: more coverage * chore: improve natspec * WIP: simp mode * WIP: simp mode * WIP: simp mode - includes interface change, specifically the `StandbyParams` structure. `id` isn't needed for storage. * test: simp mode * test: simp mode * test: simp mode * refactor: simp mode storage * Revert "refactor: simp mode storage" This reverts commit 3b0450e. * Reapply "refactor: simp mode storage" This reverts commit 5f90d78. * feat: simp mode * fix(optimize): salt cancellation - remove check * test: improvements * test: improvements * fix: move `isOperatorSetAVS` update out of loop ooops * fix: standby update typehash * test: cleanup * fix: move mutation out of loop * nit: cleanup * fix: remove unused events --------- Co-authored-by: clandestine.eth <[email protected]>
1 parent 0408749 commit 7a35c7b

File tree

8 files changed

+30
-9
lines changed

8 files changed

+30
-9
lines changed

script/deploy/devnet/M2_Deploy_From_Scratch.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ contract Deployer_M2 is Script, Test {
217217
// Second, deploy the *implementation* contracts, using the *proxy contracts* as inputs
218218
delegationImplementation = new DelegationManager(strategyManager, slasher, eigenPodManager);
219219
strategyManagerImplementation = new StrategyManager(delegation, eigenPodManager, slasher);
220-
avsDirectoryImplementation = new AVSDirectory(delegation);
220+
avsDirectoryImplementation = new AVSDirectory(delegation, strategyManager);
221221
slasherImplementation = new Slasher(strategyManager, delegation);
222222
eigenPodManagerImplementation = new EigenPodManager(
223223
ethPOSDeposit,

script/deploy/holesky/M2_Deploy_From_Scratch.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ contract M2_Deploy_Holesky_From_Scratch is ExistingDeploymentParser {
7575
);
7676

7777
eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
78-
avsDirectoryImplementation = new AVSDirectory(delegationManager);
78+
avsDirectoryImplementation = new AVSDirectory(delegationManager, strategyManager);
7979
delegationManagerImplementation = new DelegationManager(strategyManager, slasher, eigenPodManager);
8080
strategyManagerImplementation = new StrategyManager(delegationManager, eigenPodManager, slasher);
8181
slasherImplementation = new Slasher(strategyManager, delegationManager);

script/deploy/mainnet/M2_Mainnet_Upgrade.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ contract M2_Mainnet_Upgrade is ExistingDeploymentParser {
4545
*/
4646
function _deployImplementationContracts() internal {
4747
// 1. Deploy New TUPS
48-
avsDirectoryImplementation = new AVSDirectory(delegationManager);
48+
avsDirectoryImplementation = new AVSDirectory(delegationManager, strategyManager);
4949
avsDirectory = AVSDirectory(
5050
address(
5151
new TransparentUpgradeableProxy(

src/contracts/core/AVSDirectory.sol

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ contract AVSDirectory is
3232
/// @dev Returns the chain ID from the time the contract was deployed.
3333
uint256 internal immutable ORIGINAL_CHAIN_ID;
3434

35+
/// @notice Canonical, virtual beacon chain ETH strategy
36+
IStrategy public constant beaconChainETHStrategy = IStrategy(0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0);
37+
3538
/**
3639
*
3740
* INITIALIZING FUNCTIONS
@@ -42,7 +45,10 @@ contract AVSDirectory is
4245
* @dev Initializes the immutable addresses of the strategy mananger, delegationManager, slasher,
4346
* and eigenpodManager contracts
4447
*/
45-
constructor(IDelegationManager _delegation) AVSDirectoryStorage(_delegation) {
48+
constructor(
49+
IDelegationManager _delegation,
50+
IStrategyManager _strategyManager
51+
) AVSDirectoryStorage(_delegation, _strategyManager) {
4652
_disableInitializers();
4753
ORIGINAL_CHAIN_ID = block.chainid;
4854
}
@@ -171,6 +177,10 @@ contract AVSDirectory is
171177
!operatorSaltIsSpent[operator][operatorSignature.salt],
172178
"AVSDirectory.registerOperatorToOperatorSets: salt already spent"
173179
);
180+
require(
181+
!isOperatorSetAVS[msg.sender],
182+
"AVSDirectory.registerOperatorToAVS: operator set AVS cannot register operators with legacy method"
183+
);
174184

175185
// Assert that `operatorSignature.signature` is a valid signature for operator set registrations.
176186
EIP1271SignatureUtils.checkSignature_EIP1271(

src/contracts/core/AVSDirectoryStorage.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ abstract contract AVSDirectoryStorage is IAVSDirectory {
2828
/// @notice The DelegationManager contract for EigenLayer
2929
IDelegationManager public immutable delegation;
3030

31+
/// @notice The StrategyManager contract for EigenLayer
32+
IStrategyManager public immutable strategyManager;
33+
3134
/**
3235
* @notice Original EIP-712 Domain separator for this contract.
3336
* @dev The domain separator may change in the event of a fork that modifies the ChainID.
@@ -79,12 +82,13 @@ abstract contract AVSDirectoryStorage is IAVSDirectory {
7982

8083
constructor(IDelegationManager _delegation) {
8184
delegation = _delegation;
85+
strategyManager = _strategyManager;
8286
}
8387

8488
/**
8589
* @dev This empty reserved space is put in place to allow future versions to add new
8690
* variables without shifting down storage in the inheritance chain.
8791
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
8892
*/
89-
uint256[36] private __gap;
93+
uint256[37] private __gap;
9094
}

src/contracts/interfaces/IAVSDirectory.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ pragma solidity >=0.5.0;
33

44
import "./IDelegationManager.sol";
55
import "./ISignatureUtils.sol";
6+
import "./IStrategy.sol";
67

78
interface IAVSDirectory is ISignatureUtils {
89
/// @notice Enum representing the registration status of an operator with an AVS.
910
/// @notice Only used by legacy M2 AVSs that have not integrated with operatorSets.
1011
enum OperatorAVSRegistrationStatus {
11-
UNREGISTERED, // Operator not registered to AVS
12-
REGISTERED // Operator registered to AVS
12+
UNREGISTERED, // Operator is not registered with the AVS.
13+
REGISTERED // Operator is registered with the AVS.
1314

1415
}
1516

src/test/integration/IntegrationDeployer.t.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,12 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {
409409
slasher,
410410
delegationManager
411411
);
412+
<<<<<<< HEAD
412413
avsDirectoryImplementation = new AVSDirectory(delegationManager);
414+
=======
415+
delayedWithdrawalRouterImplementation = new DelayedWithdrawalRouter(eigenPodManager);
416+
avsDirectoryImplementation = new AVSDirectory(delegationManager, strategyManager);
417+
>>>>>>> d7c6f3fe (Feat/operator sets (#579))
413418

414419
// Second, upgrade the proxy contracts to point to the implementations
415420
// DelegationManager
@@ -503,7 +508,8 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {
503508
slasher,
504509
delegationManager
505510
);
506-
avsDirectoryImplementation = new AVSDirectory(delegationManager);
511+
delayedWithdrawalRouterImplementation = new DelayedWithdrawalRouter(eigenPodManager);
512+
avsDirectoryImplementation = new AVSDirectory(delegationManager, strategyManager);
507513

508514
// Second, upgrade the proxy contracts to point to the implementations
509515
// DelegationManager

src/test/unit/AVSDirectoryUnit.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ contract AVSDirectoryUnitTests is EigenLayerUnitTestSetup, IAVSDirectoryEvents {
7272
);
7373

7474
// Deploy AVSDirectory implmentation and proxy
75-
avsDirectoryImplementation = new AVSDirectory(delegationManager);
75+
avsDirectoryImplementation = new AVSDirectory(delegationManager, IStrategyManager(address(strategyManagerMock)));
7676
avsDirectory = AVSDirectory(
7777
address(
7878
new TransparentUpgradeableProxy(

0 commit comments

Comments
 (0)