Skip to content

Commit dd48e63

Browse files
committed
docs: describe operator set registration / deregistration
1 parent 25562a7 commit dd48e63

File tree

2 files changed

+104
-43
lines changed

2 files changed

+104
-43
lines changed

docs/core/AllocationManager.md

Lines changed: 99 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,26 @@
66

77
## Prerequisites
88

9-
- [The Mechanics of Allocating and Slashing Unique Stake](https://forum.eigenlayer.xyz/t/the-mechanics-of-allocating-and-slashing-unique-stake/13870)
9+
* [The Mechanics of Allocating and Slashing Unique Stake](https://forum.eigenlayer.xyz/t/the-mechanics-of-allocating-and-slashing-unique-stake/13870)
1010

1111
## Overview
1212

1313
The AllocationManager contract manages the allocation and slashing of operators' slashable stake across various strategies and operator sets. It also enforces allocation and deallocation delays and handles the slashing process initiated by AVSs.
1414

15-
## Parameterization
16-
17-
- `ALLOCATION_CONFIGURATION_DELAY`: The delay in blocks (estimated) before allocations take effect.
18-
<!-- TODO: remove these "Very TBD" etc statements and get clarity here -->
19-
- Mainnet: `21 days`. Very TBD
20-
- Testnet: `1 hours`. Very TBD
21-
- Public Devnet: `10 minutes`
22-
- `DEALLOCATION_DELAY`: The delay in blocks (estimated) before deallocations take effect.
23-
- Mainnet: `17.5 days`. Slightly TBD
24-
- Testnet: `3 days`. Very TBD
25-
- Public Devnet: `1 days`
26-
27-
## Roles
28-
2915
Two types of users interact directly with the AllocationManager:
3016
* [Operators](#operators)
3117
* [AVSs](#avss)
3218

33-
---
19+
## Parameterization
20+
21+
* `ALLOCATION_CONFIGURATION_DELAY`: The delay in blocks (estimated) before allocations take effect.
22+
* Mainnet: `126000 blocks` (17.5 days).
23+
* Testnet: `90 blocks` (15 minutes).
24+
* Public Devnet: `90 blocks` (15 minutes).
25+
* `DEALLOCATION_DELAY`: The delay in blocks (estimated) before deallocations take effect.
26+
* Mainnet: `100800 blocks` (14 days).
27+
* Testnet: `60 blocks` (10 minutes).
28+
* Public Devnet: `60 blocks` (10 minutes).
3429

3530
## Operators
3631

@@ -41,31 +36,40 @@ Operators interact with the AllocationManager to join operator sets, modify thei
4136
An operator set is defined as below:
4237

4338
```solidity
39+
/**
40+
* @notice An operator set identified by the AVS address and an identifier
41+
* @param avs The address of the AVS this operator set belongs to
42+
* @param id The unique identifier for the operator set
43+
*/
4444
struct OperatorSet {
4545
address avs;
4646
uint32 id;
4747
}
4848
```
4949

50-
Every `operatorSet` corresponds to a single AVS, as indicated by the `avs` parameter. Each `operatorSet` is then given a specific `id` upon creation, which must be unique per `avs`. Together, the `avs` and `id` form the `key` that uniquely identifies a given `operatorSet`.
50+
Every `OperatorSet` corresponds to a single AVS, as indicated by the `avs` parameter. Each `OperatorSet` is then given a specific `id` upon creation, which must be unique per `avs`. Together, the `avs` and `id` form the `key` that uniquely identifies a given `OperatorSet`.
5151

52-
Operator registrations are tracked with the struct defined below:
52+
All members of an operator set are stored in the below mapping:
5353

5454
```solidity
55-
/**
56-
* @notice Parameters used to register for an AVS's operator sets
57-
* @param avs the AVS being registered for
58-
* @param operatorSetIds the operator sets within the AVS to register for
59-
* @param data extra data to be passed to the AVS to complete registration
60-
*/
61-
struct RegisterParams {
62-
address avs;
63-
uint32[] operatorSetIds;
64-
bytes data;
65-
}
55+
/// @dev Lists the members of an AVS's operator set
56+
mapping(bytes32 operatorSetKey => EnumerableSet.AddressSet) internal _operatorSetMembers;
6657
```
6758

68-
The registration for an operator as part of a given operator set is captured with the below struct:
59+
### Operator Set Registration
60+
61+
The following mapping tracks operator registrations for operator sets:
62+
63+
```solidity
64+
/// @dev Lists the operator sets the operator is registered for. Note that an operator
65+
/// can be registered without allocated stake. Likewise, an operator can allocate
66+
/// without being registered.
67+
mapping(address operator => EnumerableSet.Bytes32Set) internal registeredSets;
68+
```
69+
70+
The `Bytes32Set` value saves a list of `key` values from `OperatorSet` instances. Each operator [registration](#registerforoperatorsets) and [deregistration](#deregisterfromoperatorsets) respectively adds and removes the relevant `key` for a given operator.
71+
72+
The below struct captures the registration status for an operator regarding a given operator set:
6973

7074
```solidity
7175
/**
@@ -80,14 +84,17 @@ struct RegistrationStatus {
8084
}
8185
```
8286

83-
This data is split across two different mappings:
87+
Note that the `RegistrationStatus` for an operator of an operator set is expected to be in one of three states:
88+
* `registered: false` and `registeredUntil: 0`
89+
* Before any registrations or deregistrations.
90+
* `registered: true` and `registeredUntil: 0`
91+
* After an operator has successfully registered for an operator set.
92+
* `registered: false` and `registeredUntil: block.number + DEALLOCATION_DELAY`
93+
* A deregistered operator. Operators may be slashed for any slashable behavior until the delay has passed.
8494

85-
```solidity
86-
/// @dev Lists the operator sets the operator is registered for. Note that an operator
87-
/// can be registered without allocated stake. Likewise, an operator can allocate
88-
/// without being registered.
89-
mapping(address operator => EnumerableSet.Bytes32Set) internal registeredSets;
95+
The below mapping stores that data, where the `operatorSetKey` refers to the `key` described above for a given operator set:
9096

97+
```solidity
9198
/// @dev Contains the operator's registration status for an operator set.
9299
mapping(address operator => mapping(bytes32 operatorSetKey => RegistrationStatus)) internal registrationStatus;
93100
```
@@ -104,21 +111,70 @@ onlyWhenNotPaused(PAUSED_OPERATOR_SET_REGISTRATION_AND_DEREGISTRATION)
104111
checkCanCall(operator);
105112
```
106113

114+
An operator may call this function to register for any number of operator sets of a given AVS at once. Operator registrations are provided in the form of the struct defined below:
115+
116+
```solidity
117+
/**
118+
* @notice Parameters used to register for an AVS's operator sets
119+
* @param avs the AVS being registered for
120+
* @param operatorSetIds the operator sets within the AVS to register for
121+
* @param data extra data to be passed to the AVS to complete registration
122+
*/
123+
struct RegisterParams {
124+
address avs;
125+
uint32[] operatorSetIds;
126+
bytes data;
127+
}
128+
```
129+
130+
The `data` is arbitrary information passed onto the AVS's specific `AVSRegistrar` for the AVS's particular considerations for acceptance. If the AVS reverts, registration will fail.
131+
107132
*Effects*:
108-
* The proposed operator sets are added to the operator's list of registered sets
109-
* The operator is marked as registered for the given operator sets
133+
* The proposed operator sets are added to the operator's list of registered sets (`registeredSets`)
134+
* The operator is added to `_operatorSetMembers` for each operator set
135+
* The operator is marked as registered for the given operator sets (in `registrationStatus`)
136+
* The `params` for registration are passed to the AVS's `AVSRegistrar`, which can arbitrarily handle the registration request
110137

111138
*Requirements*:
139+
* Operator registration/deregistration MUST NOT be paused
112140
* Address MUST be registered as an operator
113141
* Caller MUST be the operator
114142
* An admin and/or appointee for the account can also call this function (see the [PermissionController](../permissions/PermissionController.md))
115-
* Function MUST NOT be paused
116-
* Proposed operator sets MUST be registered for a given AVS
117-
* Operator MUST NOT be registered for any given operator sets
143+
* Each operator set ID MUST exist for the given AVS
144+
* Operator MUST NOT already be registered for any proposed operator sets
145+
* The AVS's `AVSRegistrar` MUST NOT revert
146+
<!-- There is no explict check that the AVS exists -- presumably captured by checking that the opeartor set ID exists for the AVS? -->
118147

119148
#### `deregisterFromOperatorSets`
120149

121-
### Modify Allocations
150+
```solidity
151+
function deregisterFromOperatorSets(
152+
DeregisterParams calldata params
153+
)
154+
external
155+
onlyWhenNotPaused(PAUSED_OPERATOR_SET_REGISTRATION_AND_DEREGISTRATION)
156+
```
157+
158+
Operators may desire to deregister from operator sets; this function generally inverts the effects of `registerForOperatorSets` with some specific exceptions.
159+
160+
*Effects*:
161+
* The proposed operator sets are removed from the operator's list of registered sets (`registeredSets`)
162+
* The operator is removed from `_operatorSetMembers` for each operator set
163+
* The operator is marked as deregistered for the given operator sets (in `registrationStatus`)
164+
* The operator's `registeredUntil` value is set to `uint32(block.number) + DEALLOCATION_DELAY`
165+
* As mentioned above, this allows for AVSs to slash deregistered operators that performed slashable behavior, until the delay expires
166+
* The `params` for registration are passed to the AVS's `AVSRegistrar`, which can arbitrarily handle the registration request
167+
168+
*Requirements*:
169+
<!-- * Address MUST be registered as an operator -->
170+
* Operator registration/deregistration MUST NOT be paused
171+
* Caller MUST be the operator OR the AVS
172+
* An admin and/or appointee for either can also call this function (see the [PermissionController](../permissions/PermissionController.md))
173+
* Each operator set ID MUST exist for the given AVS
174+
* Operator MUST be registered for the given operator sets
175+
* Note that, unlike `registerForOperatorSets`, the AVS's `AVSRegistrar` MAY revert and the deregistration will still succeed
176+
177+
### Allocation Modifications
122178

123179
#### `modifyAllocations`
124180

@@ -182,7 +238,7 @@ This function is used to complete pending deallocations for a list of strategies
182238

183239
Completing a deallocation decreases the encumbered magnitude for the strategy, allowing them to make allocations with that magnitude. Encumbered magnitude must be decreased only upon completion because pending deallocations can be slashed before they are completable.
184240

185-
### Changing Allocation Delays
241+
### Allocation Delays Changes
186242

187243
#### `setAllocationDelay`
188244

src/contracts/libraries/OperatorSetLib.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// SPDX-License-Identifier: BUSL-1.1
22
pragma solidity ^0.8.27;
33

4+
/**
5+
* @notice An operator set identified by the AVS address and an identifier
6+
* @param avs The address of the AVS this operator set belongs to
7+
* @param id The unique identifier for the operator set
8+
*/
49
struct OperatorSet {
510
address avs;
611
uint32 id;

0 commit comments

Comments
 (0)