Skip to content

Commit f9eeeb2

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 f2a7515 commit f9eeeb2

File tree

8 files changed

+27
-7
lines changed

8 files changed

+27
-7
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ InheritanceGraph.png
4545
surya_report.md
4646

4747
.idea
48+
49+
*_state.json
50+
**/deployed_strategies.json
51+
52+
**/Populate*

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
@@ -26,6 +26,9 @@ contract AVSDirectory is
2626
/// @dev Returns the chain ID from the time the contract was deployed.
2727
uint256 internal immutable ORIGINAL_CHAIN_ID;
2828

29+
/// @notice Canonical, virtual beacon chain ETH strategy
30+
IStrategy public constant beaconChainETHStrategy = IStrategy(0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0);
31+
2932
/**
3033
*
3134
* INITIALIZING FUNCTIONS
@@ -36,7 +39,10 @@ contract AVSDirectory is
3639
* @dev Initializes the immutable addresses of the strategy mananger, delegationManager, slasher,
3740
* and eigenpodManager contracts
3841
*/
39-
constructor(IDelegationManager _delegation) AVSDirectoryStorage(_delegation) {
42+
constructor(
43+
IDelegationManager _delegation,
44+
IStrategyManager _strategyManager
45+
) AVSDirectoryStorage(_delegation, _strategyManager) {
4046
_disableInitializers();
4147
ORIGINAL_CHAIN_ID = block.chainid;
4248
}
@@ -314,6 +320,10 @@ contract AVSDirectory is
314320
delegation.isOperator(operator),
315321
"AVSDirectory.registerOperatorToAVS: operator not registered to EigenLayer yet"
316322
);
323+
require(
324+
!isOperatorSetAVS[msg.sender],
325+
"AVSDirectory.registerOperatorToAVS: operator set AVS cannot register operators with legacy method"
326+
);
317327

318328
// Assert that `operatorSignature.signature` is a valid signature for the operator AVS registration.
319329
EIP1271SignatureUtils.checkSignature_EIP1271({

src/contracts/core/AVSDirectoryStorage.sol

Lines changed: 4 additions & 0 deletions
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.
@@ -57,6 +60,7 @@ abstract contract AVSDirectoryStorage is IAVSDirectory {
5760

5861
constructor(IDelegationManager _delegation) {
5962
delegation = _delegation;
63+
strategyManager = _strategyManager;
6064
}
6165

6266
/**

src/contracts/interfaces/IAVSDirectory.sol

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

44
import "./ISignatureUtils.sol";
5+
import "./IStrategy.sol";
56

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

1314
}
1415

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)