Skip to content

Commit 3768612

Browse files
committed
docs: natspec IServiceManager
1 parent 2bf7961 commit 3768612

File tree

5 files changed

+97
-170
lines changed

5 files changed

+97
-170
lines changed

Diff for: src/BLSApkRegistryStorage.sol

-3
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ abstract contract BLSApkRegistryStorage is Initializable, IBLSApkRegistry {
2020

2121
/// @inheritdoc IBLSApkRegistry
2222
mapping(address operator => bytes32 operatorId) public operatorToPubkeyHash;
23-
2423
/// @inheritdoc IBLSApkRegistry
2524
mapping(bytes32 pubkeyHash => address operator) public pubkeyHashToOperator;
26-
2725
/// @inheritdoc IBLSApkRegistry
2826
mapping(address operator => BN254.G1Point pubkeyG1) public operatorToPubkey;
2927

3028
/// AGGREGATE PUBLIC KEY STORAGE
3129

3230
/// @inheritdoc IBLSApkRegistry
3331
mapping(uint8 quorumNumber => IBLSApkRegistryTypes.ApkUpdate[]) public apkHistory;
34-
3532
/// @inheritdoc IBLSApkRegistry
3633
mapping(uint8 quorumNumber => BN254.G1Point) public currentApk;
3734

Diff for: src/EjectionManager.sol

+5-25
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity ^0.8.27;
44
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
55
import {
66
EjectionManagerStorage,
7+
IEjectionManager,
78
IRegistryCoordinator,
89
IStakeRegistry
910
} from "./EjectionManagerStorage.sol";
@@ -22,11 +23,6 @@ contract EjectionManager is OwnableUpgradeable, EjectionManagerStorage {
2223
_disableInitializers();
2324
}
2425

25-
/**
26-
* @param _owner will hold the owner role
27-
* @param ejectors will hold the ejector role
28-
* @param _quorumEjectionParams are the ratelimit parameters for the quorum at each index
29-
*/
3026
function initialize(
3127
address _owner,
3228
address[] memory ejectors,
@@ -41,12 +37,7 @@ contract EjectionManager is OwnableUpgradeable, EjectionManagerStorage {
4137
}
4238
}
4339

44-
/**
45-
* @notice Ejects operators from the AVSs RegistryCoordinator under a ratelimit
46-
* @param operatorIds The ids of the operators 'j' to eject for each quorum 'i'
47-
* @dev This function will eject as many operators as possible prioritizing operators at the lower index
48-
* @dev The owner can eject operators without recording of stake ejection
49-
*/
40+
/// @inheritdoc IEjectionManager
5041
function ejectOperators(
5142
bytes32[][] memory operatorIds
5243
) external {
@@ -98,23 +89,15 @@ contract EjectionManager is OwnableUpgradeable, EjectionManagerStorage {
9889
}
9990
}
10091

101-
/**
102-
* @notice Sets the ratelimit parameters for a quorum
103-
* @param quorumNumber The quorum number to set the ratelimit parameters for
104-
* @param _quorumEjectionParams The quorum ratelimit parameters to set for the given quorum
105-
*/
92+
/// @inheritdoc IEjectionManager
10693
function setQuorumEjectionParams(
10794
uint8 quorumNumber,
10895
QuorumEjectionParams memory _quorumEjectionParams
10996
) external onlyOwner {
11097
_setQuorumEjectionParams(quorumNumber, _quorumEjectionParams);
11198
}
11299

113-
/**
114-
* @notice Sets the address permissioned to eject operators under a ratelimit
115-
* @param ejector The address to permission
116-
* @param status The status to set for the given address
117-
*/
100+
/// @inheritdoc IEjectionManager
118101
function setEjector(address ejector, bool status) external onlyOwner {
119102
_setEjector(ejector, status);
120103
}
@@ -139,10 +122,7 @@ contract EjectionManager is OwnableUpgradeable, EjectionManagerStorage {
139122
emit EjectorUpdated(ejector, status);
140123
}
141124

142-
/**
143-
* @notice Returns the amount of stake that can be ejected for a quorum at the current block.timestamp
144-
* @param quorumNumber The quorum number to view ejectable stake for
145-
*/
125+
/// @inheritdoc IEjectionManager
146126
function amountEjectableForQuorum(
147127
uint8 quorumNumber
148128
) public view returns (uint256) {

Diff for: src/IndexRegistry.sol

+23-41
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
99
* @author Layr Labs, Inc.
1010
*/
1111
contract IndexRegistry is IndexRegistryStorage {
12-
/// @notice when applied to a function, only allows the RegistryCoordinator to call it
1312
modifier onlyRegistryCoordinator() {
1413
_checkRegistryCoordinator();
1514
_;
1615
}
1716

18-
/// @notice sets the (immutable) `registryCoordinator` address
1917
constructor(
2018
IRegistryCoordinator _registryCoordinator
2119
) IndexRegistryStorage(_registryCoordinator) {}
@@ -104,9 +102,7 @@ contract IndexRegistry is IndexRegistryStorage {
104102
*
105103
*/
106104

107-
/**
108-
* @notice Increases the historical operator count by 1 and returns the new count
109-
*/
105+
/// @notice Increases the historical operator count by 1 and returns the new count.
110106
function _increaseOperatorCount(
111107
uint8 quorumNumber
112108
) internal returns (uint32) {
@@ -129,9 +125,7 @@ contract IndexRegistry is IndexRegistryStorage {
129125
return newOperatorCount;
130126
}
131127

132-
/**
133-
* @notice Decreases the historical operator count by 1 and returns the new count
134-
*/
128+
/// @notice Decreases the historical operator count by 1 and returns the new count.
135129
function _decreaseOperatorCount(
136130
uint8 quorumNumber
137131
) internal returns (uint32) {
@@ -143,11 +137,9 @@ contract IndexRegistry is IndexRegistryStorage {
143137
return newOperatorCount;
144138
}
145139

146-
/**
147-
* @notice Update `_operatorCountHistory` with a new operator count
148-
* @dev If the lastUpdate was made in the this block, update the entry.
149-
* Otherwise, push a new historical entry.
150-
*/
140+
/// @notice Updates `_operatorCountHistory` with a new operator count.
141+
/// @dev If the lastUpdate was made in this block, update the entry.
142+
/// Otherwise, push a new historical entry.
151143
function _updateOperatorCountHistory(
152144
uint8 quorumNumber,
153145
QuorumUpdate storage lastUpdate,
@@ -162,11 +154,9 @@ contract IndexRegistry is IndexRegistryStorage {
162154
}
163155
}
164156

165-
/**
166-
* @notice For a given quorum and operatorIndex, pop and return the last operatorId in the history
167-
* @dev The last entry's operatorId is updated to OPERATOR_DOES_NOT_EXIST_ID
168-
* @return The removed operatorId
169-
*/
157+
/// @notice For a given quorum and operatorIndex, pop and return the last operatorId in the history.
158+
/// @dev The last entry's operatorId is updated to OPERATOR_DOES_NOT_EXIST_ID.
159+
/// @return The removed operatorId.
170160
function _popLastOperator(
171161
uint8 quorumNumber,
172162
uint32 operatorIndex
@@ -182,12 +172,10 @@ contract IndexRegistry is IndexRegistryStorage {
182172
return removedOperatorId;
183173
}
184174

185-
/**
186-
* @notice Assign an operator to an index and update the index history
187-
* @param operatorId operatorId of the operator to update
188-
* @param quorumNumber quorumNumber of the operator to update
189-
* @param operatorIndex the latest index of that operator in the list of operators registered for this quorum
190-
*/
175+
/// @notice Assigns an operator to an index and updates the index history.
176+
/// @param operatorId operatorId of the operator to update.
177+
/// @param quorumNumber quorumNumber of the operator to update.
178+
/// @param operatorIndex the latest index of that operator in the list of operators registered for this quorum.
191179
function _assignOperatorToIndex(
192180
bytes32 operatorId,
193181
uint8 quorumNumber,
@@ -202,11 +190,9 @@ contract IndexRegistry is IndexRegistryStorage {
202190
emit QuorumIndexUpdate(operatorId, quorumNumber, operatorIndex);
203191
}
204192

205-
/**
206-
* @notice Update `_operatorIndexHistory` with a new operator id for the current block
207-
* @dev If the lastUpdate was made in the this block, update the entry.
208-
* Otherwise, push a new historical entry.
209-
*/
193+
/// @notice Updates `_operatorIndexHistory` with a new operator id for the current block.
194+
/// @dev If the lastUpdate was made in this block, update the entry.
195+
/// Otherwise, push a new historical entry.
210196
function _updateOperatorIndexHistory(
211197
uint8 quorumNumber,
212198
uint32 operatorIndex,
@@ -222,17 +208,17 @@ contract IndexRegistry is IndexRegistryStorage {
222208
}
223209
}
224210

225-
/// @notice Returns the most recent operator count update for a quorum
226-
/// @dev Reverts if the quorum does not exist (history length == 0)
211+
/// @notice Returns the most recent operator count update for a quorum.
212+
/// @dev Reverts if the quorum does not exist (history length == 0).
227213
function _latestQuorumUpdate(
228214
uint8 quorumNumber
229215
) internal view returns (QuorumUpdate storage) {
230216
uint256 historyLength = _operatorCountHistory[quorumNumber].length;
231217
return _operatorCountHistory[quorumNumber][historyLength - 1];
232218
}
233219

234-
/// @notice Returns the most recent operator id update for an index
235-
/// @dev Reverts if the index has never been used (history length == 0)
220+
/// @notice Returns the most recent operator id update for an index.
221+
/// @dev Reverts if the index has never been used (history length == 0).
236222
function _latestOperatorIndexUpdate(
237223
uint8 quorumNumber,
238224
uint32 operatorIndex
@@ -241,10 +227,8 @@ contract IndexRegistry is IndexRegistryStorage {
241227
return _operatorIndexHistory[quorumNumber][operatorIndex][historyLength - 1];
242228
}
243229

244-
/**
245-
* @notice Returns the total number of operators of the service for the given `quorumNumber` at the given `blockNumber`
246-
* @dev Reverts if the quorum does not exist, or if the blockNumber is from before the quorum existed
247-
*/
230+
/// @notice Returns the total number of operators of the service for the given `quorumNumber` at the given `blockNumber`.
231+
/// @dev Reverts if the quorum does not exist, or if the blockNumber is from before the quorum existed.
248232
function _operatorCountAtBlockNumber(
249233
uint8 quorumNumber,
250234
uint32 blockNumber
@@ -265,10 +249,8 @@ contract IndexRegistry is IndexRegistryStorage {
265249
);
266250
}
267251

268-
/**
269-
* @return operatorId at the given `operatorIndex` at the given `blockNumber` for the given `quorumNumber`
270-
* Precondition: requires that the operatorIndex was used active at the given block number for quorum
271-
*/
252+
/// @notice Returns the operatorId at the given `operatorIndex` at the given `blockNumber` for the given `quorumNumber`.
253+
/// @dev Requires that the operatorIndex was active at the given block number for quorum.
272254
function _operatorIdForIndexAtBlockNumber(
273255
uint8 quorumNumber,
274256
uint32 operatorIndex,

Diff for: src/interfaces/IServiceManager.sol

+41-61
Original file line numberDiff line numberDiff line change
@@ -13,93 +13,73 @@ import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy
1313
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol";
1414

1515
interface IServiceManagerErrors {
16-
/// @dev Thrown when a function is called by an address that is not the RegistryCoordinator
16+
/// @notice Thrown when a function is called by an address that is not the RegistryCoordinator.
1717
error OnlyRegistryCoordinator();
18-
/// @dev Thrown when a function is called by an address that is not the RewardsInitiator
18+
/// @notice Thrown when a function is called by an address that is not the RewardsInitiator.
1919
error OnlyRewardsInitiator();
20-
/// @dev Thrown when a function is called by an address that is not the Slasher
20+
/// @notice Thrown when a function is called by an address that is not the StakeRegistry.
2121
error OnlyStakeRegistry();
22-
/// @dev Thrown when a function is called by an address that is not the Slasher
22+
/// @notice Thrown when a function is called by an address that is not the Slasher.
2323
error OnlySlasher();
24-
/// @dev Thrown when a slashing proposal delay has not been met yet.
24+
/// @notice Thrown when a slashing proposal delay has not been met yet.
2525
error DelayPeriodNotPassed();
2626
}
2727

28-
/**
29-
* @title Minimal interface for a ServiceManager-type contract that forms the single point for an AVS to push updates to EigenLayer
30-
* @author Layr Labs, Inc.
31-
*/
32-
interface IServiceManager is IServiceManagerUI, IServiceManagerErrors {
33-
// EVENTS
28+
interface IServiceManagerEvents {
29+
/// @notice Emitted when the rewards initiator address is updated.
30+
/// @param prevRewardsInitiator The previous rewards initiator address.
31+
/// @param newRewardsInitiator The new rewards initiator address.
3432
event RewardsInitiatorUpdated(address prevRewardsInitiator, address newRewardsInitiator);
33+
}
3534

36-
/**
37-
* @notice Creates a new rewards submission to the EigenLayer RewardsCoordinator contract, to be split amongst the
38-
* set of stakers delegated to operators who are registered to this `avs`
39-
* @param rewardsSubmissions The rewards submissions being created
40-
* @dev Only callable by the permissioned rewardsInitiator address
41-
* @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION`
42-
* @dev The tokens are sent to the `RewardsCoordinator` contract
43-
* @dev Strategies must be in ascending order of addresses to check for duplicates
44-
* @dev This function will revert if the `rewardsSubmission` is malformed,
45-
* e.g. if the `strategies` and `weights` arrays are of non-equal lengths
46-
*/
35+
interface IServiceManager is IServiceManagerUI, IServiceManagerErrors, IServiceManagerEvents {
36+
/// @notice Creates a new rewards submission to the EigenLayer RewardsCoordinator contract.
37+
/// @dev Only callable by the permissioned rewardsInitiator address.
38+
/// @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION`.
39+
/// @dev The tokens are sent to the `RewardsCoordinator` contract.
40+
/// @dev Strategies must be in ascending order of addresses to check for duplicates.
41+
/// @dev This function will revert if the `rewardsSubmission` is malformed,
42+
/// e.g. if the `strategies` and `weights` arrays are of non-equal lengths.
43+
/// @param rewardsSubmissions The rewards submissions to be split amongst the set of stakers
44+
/// delegated to operators who are registered to this `avs`.
4745
function createAVSRewardsSubmission(
4846
IRewardsCoordinator.RewardsSubmission[] calldata rewardsSubmissions
4947
) external;
5048

51-
/**
52-
*
53-
* PERMISSIONCONTROLLER FUNCTIONS
54-
*
55-
*/
56-
/**
57-
* @notice Calls `addPendingAdmin` on the `PermissionController` contract
58-
* with `account` being the address of this contract.
59-
* @param admin The address of the admin to add
60-
* @dev Only callable by the owner of the contract
61-
*/
49+
/// @notice PERMISSIONCONTROLLER FUNCTIONS
50+
51+
/// @notice Calls `addPendingAdmin` on the `PermissionController` contract.
52+
/// @dev Only callable by the owner of the contract.
53+
/// @param admin The address of the admin to add.
6254
function addPendingAdmin(
6355
address admin
6456
) external;
6557

66-
/**
67-
* @notice Calls `removePendingAdmin` on the `PermissionController` contract
68-
* with `account` being the address of this contract.
69-
* @param pendingAdmin The address of the pending admin to remove
70-
* @dev Only callable by the owner of the contract
71-
*/
58+
/// @notice Calls `removePendingAdmin` on the `PermissionController` contract.
59+
/// @dev Only callable by the owner of the contract.
60+
/// @param pendingAdmin The address of the pending admin to remove.
7261
function removePendingAdmin(
7362
address pendingAdmin
7463
) external;
7564

76-
/**
77-
* @notice Calls `removeAdmin` on the `PermissionController` contract
78-
* with `account` being the address of this contract.
79-
* @param admin The address of the admin to remove
80-
* @dev Only callable by the owner of the contract
81-
*/
65+
/// @notice Calls `removeAdmin` on the `PermissionController` contract.
66+
/// @dev Only callable by the owner of the contract.
67+
/// @param admin The address of the admin to remove.
8268
function removeAdmin(
8369
address admin
8470
) external;
8571

86-
/**
87-
* @notice Calls `setAppointee` on the `PermissionController` contract
88-
* with `account` being the address of this contract.
89-
* @param appointee The address of the appointee to set
90-
* @param target The address of the target to set the appointee for
91-
* @param selector The function selector to set the appointee for
92-
* @dev Only callable by the owner of the contract
93-
*/
72+
/// @notice Calls `setAppointee` on the `PermissionController` contract.
73+
/// @dev Only callable by the owner of the contract.
74+
/// @param appointee The address of the appointee to set.
75+
/// @param target The address of the target to set the appointee for.
76+
/// @param selector The function selector to set the appointee for.
9477
function setAppointee(address appointee, address target, bytes4 selector) external;
9578

96-
/**
97-
* @notice Calls `removeAppointee` on the `PermissionController` contract
98-
* with `account` being the address of this contract.
99-
* @param appointee The address of the appointee to remove
100-
* @param target The address of the target to remove the appointee for
101-
* @param selector The function selector to remove the appointee for
102-
* @dev Only callable by the owner of the contract
103-
*/
79+
/// @notice Calls `removeAppointee` on the `PermissionController` contract.
80+
/// @dev Only callable by the owner of the contract.
81+
/// @param appointee The address of the appointee to remove.
82+
/// @param target The address of the target to remove the appointee for.
83+
/// @param selector The function selector to remove the appointee for.
10484
function removeAppointee(address appointee, address target, bytes4 selector) external;
10585
}

0 commit comments

Comments
 (0)