Skip to content

Commit 2425104

Browse files
committed
chore: natspec
1 parent f4b0d57 commit 2425104

File tree

2 files changed

+49
-21
lines changed

2 files changed

+49
-21
lines changed

src/ServiceManagerBase.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
108108
}
109109

110110
_operatorSetManager.addStrategiesToOperatorSet(uint32(i), strategies);
111+
emit OperatorSetStrategiesMigrated(uint32(i), strategies);
111112
}
112113
isStrategiesMigrated = true;
113114
}
@@ -117,15 +118,17 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
117118
* for. This can be called externally by getOperatorSetIds
118119
*/
119120
function migrateOperatorToOperatorSets(
121+
address operator,
120122
ISignatureUtils.SignatureWithSaltAndExpiry memory signature
121123
) external {
122124
require(
123-
!isOperatorMigrated[msg.sender],
125+
!isOperatorMigrated[operator],
124126
"ServiceManagerBase.migrateOperatorToOperatorSets: already migrated"
125127
);
126-
uint32[] memory operatorSetIds = getOperatorSetIds(msg.sender);
128+
uint32[] memory operatorSetIds = getOperatorSetIds(operator);
127129

128-
_operatorSetManager.registerOperatorToOperatorSets(msg.sender, operatorSetIds, signature);
130+
_operatorSetManager.registerOperatorToOperatorSets(operator, operatorSetIds, signature);
131+
emit OperatorMigratedToOperatorSets(operator, operatorSetIds);
129132
}
130133

131134
/**
@@ -322,6 +325,7 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
322325
return operatorSetIds;
323326
}
324327

328+
/// @notice Returns the operator set IDs for the given operator address by querying the RegistryCoordinator
325329
function getOperatorSetIds(address operator) public view returns (uint32[] memory) {
326330
bytes32 operatorId = _registryCoordinator.getOperatorId(operator);
327331
uint192 operatorBitmap = _registryCoordinator.getCurrentQuorumBitmap(operatorId);

src/interfaces/IServiceManager.sol

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ import {IServiceManagerUI} from "./IServiceManagerUI.sol";
1111
* @author Layr Labs, Inc.
1212
*/
1313
interface IServiceManager is IServiceManagerUI {
14+
15+
/// EVENTS
16+
17+
event RewardsInitiatorUpdated(address prevRewardsInitiator, address newRewardsInitiator);
18+
event OperatorSetStrategiesMigrated(uint32 operatorSetId, IStrategy[] strategies);
19+
event OperatorMigratedToOperatorSets(address operator, uint32[] indexed operatorSetIds);
20+
21+
/// EXTERNAL - STATE MODIFYING
22+
1423
/**
1524
* @notice Creates a new rewards submission to the EigenLayer RewardsCoordinator contract, to be split amongst the
1625
* set of stakers delegated to operators who are registered to this `avs`
@@ -26,26 +35,45 @@ interface IServiceManager is IServiceManagerUI {
2635
IRewardsCoordinator.RewardsSubmission[] calldata rewardsSubmissions
2736
) external;
2837

29-
/// TODO: natspec
38+
39+
/**
40+
* @notice called by the AVS StakeRegistry whenever a new IStrategy
41+
* is added to a quorum/operatorSet
42+
* @dev calls operatorSetManager.addStrategiesToOperatorSet()
43+
*/
3044
function addStrategiesToOperatorSet(
3145
uint32 operatorSetID,
3246
IStrategy[] calldata strategies
3347
) external;
3448

35-
/// TODO: natspec
49+
/**
50+
* @notice called by the AVS StakeRegistry whenever a new IStrategy
51+
* is removed from a quorum/operatorSet
52+
* @dev calls operatorSetManager.removeStrategiesFromOperatorSet()
53+
*/
3654
function removeStrategiesFromOperatorSet(
3755
uint32 operatorSetID,
3856
IStrategy[] calldata strategies
3957
) external;
4058

41-
/// @notice migrates all existing operators and strategies to operator sets
59+
/**
60+
* @notice One-time call that migrates all existing strategies for each quorum to their respective operator sets
61+
* Note: a separate migration per operator must be performed to migrate an existing operator to the operator set
62+
* See migrateOperatorToOperatorSets() below
63+
* @dev calls operatorSetManager.addStrategiesToOperatorSet()
64+
*/
4265
function migrateStrategiesToOperatorSets() external;
4366

4467
/**
45-
* @notice the operator needs to provide a signature over the operatorSetIds they will be registering
46-
* for. This can be called externally by getOperatorSetIds
68+
* @notice One-time call to migrate an existing operator to the respective operator sets.
69+
* The operator needs to provide a signature over the operatorSetIds they are currently registered
70+
* for. This can be retrieved externally by calling getOperatorSetIds.
71+
* @param operator the address of the operator to be migrated
72+
* @param signature the signature of the operator on their intent to migrate
73+
* @dev calls operatorSetManager.registerOperatorToOperatorSets()
4774
*/
4875
function migrateOperatorToOperatorSets(
76+
address operator,
4977
ISignatureUtils.SignatureWithSaltAndExpiry memory signature
5078
) external;
5179

@@ -55,11 +83,8 @@ interface IServiceManager is IServiceManagerUI {
5583
* @param operator the address of the operator to be added to the operator set
5684
* @param quorumNumbers quorums/operatorSetIds to add the operator to
5785
* @param signature the signature of the operator on their intent to register
58-
* @dev msg.sender is used as the AVS
59-
* @dev operator must not have a pending a deregistration from the operator set
60-
* @dev if this is the first operator set in the AVS that the operator is
61-
* registering for, a OperatorAVSRegistrationStatusUpdated event is emitted with
62-
* a REGISTERED status
86+
* @dev msg.sender should be the RegistryCoordinator
87+
* @dev calls operatorSetManager.registerOperatorToOperatorSets()
6388
*/
6489
function registerOperatorToOperatorSets(
6590
address operator,
@@ -74,18 +99,17 @@ interface IServiceManager is IServiceManagerUI {
7499
* operator set
75100
* @param quorumNumbers the quorumNumbers/operatorSetIds to deregister the operator for
76101
*
77-
* @dev msg.sender is used as the AVS
78-
* @dev operator must be registered for msg.sender AVS and the given
79-
* operator set
80-
* @dev if this removes operator from all operator sets for the msg.sender AVS
81-
* then an OperatorAVSRegistrationStatusUpdated event is emitted with a DEREGISTERED
82-
* status
102+
* @dev msg.sender should be the RegistryCoordinator
103+
* @dev operator must be registered for the given operator sets
104+
* @dev calls operatorSetManager.deregisterOperatorFromOperatorSets()
83105
*/
84106
function deregisterOperatorFromOperatorSets(
85107
address operator,
86108
bytes calldata quorumNumbers
87109
) external;
88110

89-
// EVENTS
90-
event RewardsInitiatorUpdated(address prevRewardsInitiator, address newRewardsInitiator);
111+
/// VIEW
112+
113+
/// @notice Returns the operator set IDs for the given operator address by querying the RegistryCoordinator
114+
function getOperatorSetIds(address operator) external view returns (uint32[] memory);
91115
}

0 commit comments

Comments
 (0)