Skip to content

Commit 580bc22

Browse files
docs: update docs for registry contracts (#417)
**Motivation:** Registry contracts are out of date **Modifications:** Updated the existing registry docs and added `SocketRegistry.md` **Result:** --------- Co-authored-by: steven <[email protected]>
1 parent 58a9ac5 commit 580bc22

File tree

3 files changed

+139
-7
lines changed

3 files changed

+139
-7
lines changed

docs/registries/BLSApkRegistry.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This method validates a BLS signature over the `pubkeyRegistrationMessageHash`,
5454
* Registers the Operator's BLS pubkey for the first time, updating the following mappings:
5555
* `operatorToPubkey[operator]`
5656
* `operatorToPubkeyHash[operator]`
57+
* `operatorToPubKeyG2[operator]`
5758
* `pubkeyHashToOperator[pubkeyHash]`
5859

5960
*Requirements*:
@@ -129,6 +130,27 @@ This method is ONLY callable by the `RegistryCoordinator`, and is called when an
129130
* `operator` MUST already have a registered BLS pubkey (see `registerBLSPublicKey` above)
130131
* Each quorum in `quorumNumbers` MUST be initialized (see `initializeQuorum` below)
131132

133+
#### `verifyAndRegisterG2PubkeyForOperator`
134+
135+
```solidity
136+
function verifyAndRegisterG2PubkeyForOperator(
137+
address operator,
138+
BN254.G2Point calldata pubkeyG2
139+
)
140+
external
141+
onlyRegistryCoordinatorOwner
142+
```
143+
`verifyAndRegisterG2PubkeyForOperator` verifies and registers a G2 public key for an operator that already has a G1 key. This method is used to retrieve all information for the `checkSignatures` entry point from a view function, avoiding the need to index this information offchain. The method ensures that the BLS key pair is derived from the same secret key and stores the G2 key for the operator.
144+
145+
This method is only callable by the `RegistryCoordinatorOwner`, which is the account that has the `owner` role inside the `RegistryCoordinator`.
146+
147+
*Effects*
148+
* Stores the corresponding G2 public key of an operator's BLS keypair, based on their G1 public key, updating `operatorToPubkeyG2[operator]`.
149+
150+
*Requirements*
151+
* Caller MUST be the `RegistryCoordinatorOwner`
152+
* Operator must not have a G2 public key set
153+
* The G2 pubic key must form a valid BN254 pairing with the stored G1 key, in effect verifying that the keypair is derived from the same secret key
132154
---
133155

134156
### System Configuration

docs/registries/SocketRegistry.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## SocketRegistry
2+
3+
| File | Type | Proxy |
4+
| -------- | -------- | -------- |
5+
| [`SocketRegistry.sol`](../src/SocketRegistry.sol) | Singleton | Transparent proxy |
6+
7+
The `SocketRegistry` is a simple registry contract that keeps track of operator sockets (arbitrary strings). This socket could represent network connection information such as IP addresses, ports, or other connectivity details.
8+
9+
#### High-level Concepts
10+
11+
This registry maintains a mapping between operator IDs (represented as bytes32 values) and their corresponding socket information. The contract is designed to work in conjunction with the `SlashingRegistryCoordinator`, which is the only contract authorized to update socket information for operators.
12+
13+
This document organizes methods according to the following themes:
14+
* [Socket Management](#socket-management)
15+
16+
---
17+
18+
### Socket Management
19+
20+
These methods allow for managing operator socket information:
21+
* [`setOperatorSocket`](#setoperatorsocket)
22+
23+
#### `setOperatorSocket`
24+
25+
```solidity
26+
function setOperatorSocket(
27+
bytes32 _operatorId,
28+
string memory _socket
29+
)
30+
external
31+
onlySlashingRegistryCoordinator
32+
```
33+
34+
Sets a socket string with an operator ID (hash of the G1 BLS public key) in the registry. This function is called by the `SlashingRegistryCoordinator`.
35+
36+
*Entry Points:*
37+
Called by the `SlashingRegistryCoordinator` when an operator is registered or needs to update their socket information
38+
39+
*Effects:*
40+
* Sets operatorIdToSocket[_operatorId] to the provided `_socket` string
41+
42+
*Requirements:*
43+
* Caller MUST be the `SlashingRegistryCoordinator`

docs/registries/StakeRegistry.md

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,22 @@ These properties are enforced by the `RegistryCoordinator`.
172172

173173
### System Configuration
174174

175-
This method is used by the `RegistryCoordinator` to initialize new quorums in the `StakeRegistry`:
176-
* [`initializeQuorum`](#initializequorum)
175+
Two methods are used by the `RegistryCoordinator` to initialize new quorums in the `StakeRegistry`:
176+
* [`initializeDelegatedStakeQuorum`](#initializedelegatedstakequorum)
177+
* [`initializeSlashableStakeQuorum`](#initializeslashablestakequorum)
178+
177179

178180
These methods are used by the `RegistryCoordinator's` Owner to configure initialized quorums in the `StakeRegistry`. They are not expected to be called very often, and will require updating Operator stakes via `RegistryCoordinator.updateOperatorsForQuorum` to maintain up-to-date views on Operator stake weights. Methods follow:
179181
* [`setMinimumStakeForQuorum`](#setminimumstakeforquorum)
180182
* [`addStrategies`](#addstrategies)
183+
* [`setSlashableLookAhead`](#setslashablelookahead)
181184
* [`removeStrategies`](#removestrategies)
182185
* [`modifyStrategyParams`](#modifystrategyparams)
183186

184-
#### `initializeQuorum`
187+
#### `initializeDelegatedStakeQuorum`
185188

186189
```solidity
187-
function initializeQuorum(
190+
function initializeDelegatedStakeQuorum(
188191
uint8 quorumNumber,
189192
uint96 minimumStake,
190193
StrategyParams[] memory _strategyParams
@@ -199,20 +202,61 @@ struct StrategyParams {
199202
}
200203
```
201204

202-
This method is ONLY callable by the `RegistryCoordinator`, and is called when the `RegistryCoordinator` Owner creates a new quorum.
205+
This method is ONLY callable by the `RegistryCoordinator`, and is called when the `RegistryCoordinator` Owner creates a new delegated stake quorum.
203206

204-
`initializeQuorum` initializes a new quorum by pushing an initial `StakeUpdate` to `_totalStakeHistory[quorumNumber]`, with an initial stake of 0. Other methods can validate that a quorum exists by checking whether `_totalStakeHistory[quorumNumber]` has a nonzero length.
207+
`initializeDelegatedStakeQuorum` initializes a new delegated stake quorum by pushing an initial `StakeUpdate` to `_totalStakeHistory[quorumNumber]`, with an initial stake of 0. Other methods can validate that a quorum exists by checking whether `_totalStakeHistory[quorumNumber]` has a nonzero length.
205208

206209
Additionally, this method configures a `minimumStake` for the quorum, as well as the `StrategyParams` it considers when calculating stake weight.
207210

208211
*Entry Points*:
209-
* `RegistryCoordinator.createQuorum`
212+
* `RegistryCoordinator.createDelegatedStakeQuorum`
213+
214+
*Effects*:
215+
* See `addStrategies` below
216+
* See `setMinimumStakeForQuorum` below
217+
* Pushes a `StakeUpdate` to `_totalStakeHistory[quorumNumber]`. The update's `updateBlockNumber` is set to the current block, and `stake` is set to 0.
218+
219+
*Requirements*:
220+
* Caller MUST be the `RegistryCoordinator`
221+
* `quorumNumber` MUST NOT belong to an existing, initialized quorum
222+
* See `addStrategies` below
223+
* See `setMinimumStakeForQuorum` below
224+
225+
#### `initializeSlashableStakeQuorum`
226+
227+
```solidity
228+
function initializeSlashableStakeQuorum(
229+
uint8 quorumNumber,
230+
uint96 minimumStake,
231+
uint32 lookAheadPeriod,
232+
StrategyParams[] memory _strategyParams
233+
)
234+
public
235+
virtual
236+
onlyRegistryCoordinator
237+
238+
struct StrategyParams {
239+
IStrategy strategy;
240+
uint96 multiplier;
241+
}
242+
```
243+
244+
This method is ONLY callable by the `RegistryCoordinator`, and is called when the `RegistryCoordinator` Owner creates a new slashable stake quorum.
245+
246+
`initializeSlashableStakeQuorum` initializes a new quorum by pushing an initial `StakeUpdate` to `_totalStakeHistory[quorumNumber]`, with an initial stake of 0. Other methods can validate that a quorum exists by checking whether `_totalStakeHistory[quorumNumber]` has a nonzero length.
247+
248+
This method configures a `minimumStake` for the quorum, defines the `StrategyParams` used when calculating stake weight and sets the `lookAheadPeriod` which defines how many blocks ahead to when considering the minimum amount of slahable stake. Note that `lookAheadPeriod` should be less than the `DEALLOCATION_DELAY` (14 days within the `AllocationManager`) blocks in the future, to avoid calculating stake values that may not reflect the operators true allocated stake.
249+
250+
*Entry Points*:
251+
* `RegistryCoordinator.createSlashableStakeQuorum`
210252

211253
*Effects*:
212254
* See `addStrategies` below
213255
* See `setMinimumStakeForQuorum` below
256+
* See `setSlashableLookAhead` below
214257
* Pushes a `StakeUpdate` to `_totalStakeHistory[quorumNumber]`. The update's `updateBlockNumber` is set to the current block, and `stake` is set to 0.
215258

259+
216260
*Requirements*:
217261
* Caller MUST be the `RegistryCoordinator`
218262
* `quorumNumber` MUST NOT belong to an existing, initialized quorum
@@ -336,4 +380,27 @@ Allows the `RegistryCoordinator` Owner to modify the multipliers specified in a
336380
* `strategyIndices` MUST NOT be empty
337381
* `strategyIndices` and `newMultipliers` MUST have equal lengths
338382

383+
384+
#### `setSlashableLookAhead`
385+
386+
```solidity
387+
function setSlashableStakeLookahead(
388+
uint8 quorumNumber,
389+
uint32 _lookAheadBlocks
390+
)
391+
external
392+
onlyCoordinatorOwner
393+
quorumExists(quorumNumber)
394+
```
395+
396+
Allows the `RegistryCoordinator` Owner to modify the slashable lookahead for a slashable stake quorum.
397+
398+
*Effects*
399+
* The quorum's `SlashablableStakeLookAhead` is updated to `_lookAheadBlocks`
400+
401+
*Requirements*
402+
* Caller MUST be `RegistryCoordinator.owner()`
403+
* `quorumNumber` MUST belong to an existing initialized quorum
404+
* `quorumNumber` MUST map to a slashable stake quorum
405+
339406
---

0 commit comments

Comments
 (0)