Skip to content

Commit

Permalink
docs: get docs to a good ish state
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Dec 12, 2023
1 parent cd4d3e0 commit c3c3292
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ The main thing that links an AVS to the EigenLayer core contracts is that when E

These methods ensure that the operator registering with the AVS is also registered as an operator in EigenLayer core. In this repo, these methods are called by the `RegistryCoordinator`.

Eventually, operator slashing and payment for services will be part of the middleware/core relationship, but these features aren't implemented yet and their design is a work in progress.

### System Components

#### Registries
Expand Down
56 changes: 48 additions & 8 deletions docs/RegistryCoordinator.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[core-dmgr-docs]: https://github.com/Layr-Labs/eigenlayer-contracts/blob/m2-mainnet/docs/core/DelegationManager.md
[core-dmgr-register]: https://github.com/Layr-Labs/eigenlayer-contracts/blob/m2-mainnet/docs/core/DelegationManager.md#registeroperatortoavs
[core-dmgr-deregister]: https://github.com/Layr-Labs/eigenlayer-contracts/blob/m2-mainnet/docs/core/DelegationManager.md#deregisteroperatorfromavs

## RegistryCoordinator

| File | Type | Proxy? |
Expand All @@ -18,11 +22,9 @@ This document organizes methods according to the following themes (click each to

#### Roles

TODO

* Owner
* Ejector
* Churn Approver
* Owner: a permissioned role that can create and configure quorums as well as manage other roles
* Ejector: a permissioned role that can forcibly eject an operator from a quorum via `RegistryCoordinator.ejectOperator`
* Churn Approver: a permissioned role that signs off on operation churn in `RegistryCoordinator.registerOperatorWithChurn`

---

Expand All @@ -39,7 +41,8 @@ These methods allow operators to register for/deregister from one or more quorum
```solidity
function registerOperator(
bytes calldata quorumNumbers,
string calldata socket
string calldata socket,
SignatureWithSaltAndExpiry memory operatorSignature
)
external
onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR)
Expand All @@ -50,8 +53,12 @@ Registers the caller as an Operator for one or more quorums, as long as registra
* `StakeRegistry.registerOperator`
* `IndexRegistry.registerOperator`

If the Operator was not currently registered for any quorums, this method will register the Operator to the AVS in the EigenLayer core contracts (`DelegationManager.registerOperatorToAVS`), passing in the provided `operatorSignature`. See the [`DelegationManager` docs][core-dmgr-docs] for more details.

*Effects*:
* If the Operator was not currently registered for any quorums, updates their status to `REGISTERED`
* If the Operator was not currently registered for any quorums:
* Updates their status to `REGISTERED`
* Registers them in the core contracts (see [`DelegationManager.registerOperatorToAVS`][core-dmgr-register])
* Adds the new quorums to the Operator's current registered quorums, and updates the Operator's bitmap history
* See [`BLSApkRegistry.registerOperator`](./registries/BLSApkRegistry.md#registeroperator)
* See [`StakeRegistry.registerOperator`](./registries/StakeRegistry.md#registeroperator)
Expand All @@ -63,6 +70,8 @@ Registers the caller as an Operator for one or more quorums, as long as registra
* `quorumNumbers` MUST be an ordered array of quorum numbers, with no entry exceeding the current `quorumCount`
* `quorumNumbers` MUST contain at least one valid quorum
* `quorumNumbers` MUST NOT contain any quorums the Operator is already registered for
* If the Operator was not currently registered for any quorums:
* See [`DelegationManager.registerOperatorToAVS`][core-dmgr-register]
* See [`BLSApkRegistry.registerOperator`](./registries/BLSApkRegistry.md#registeroperator)
* See [`StakeRegistry.registerOperator`](./registries/StakeRegistry.md#registeroperator)
* See [`IndexRegistry.registerOperator`](./registries/IndexRegistry.md#registeroperator)
Expand All @@ -75,7 +84,8 @@ function registerOperatorWithChurn(
bytes calldata quorumNumbers,
string calldata socket,
OperatorKickParam[] calldata operatorKickParams,
SignatureWithSaltAndExpiry memory churnApproverSignature
SignatureWithSaltAndExpiry memory churnApproverSignature,
SignatureWithSaltAndExpiry memory operatorSignature
)
external
onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR)
Expand Down Expand Up @@ -153,6 +163,7 @@ Allows the Ejector to forcibly deregister an Operator from one or more quorums.

These methods concern Operators that are currently registered for at least one quorum:
* [`updateOperators`](#updateoperators)
* [`updateOperatorsForQuorum`](#updateoperatorsforquorum)
* [`updateSocket`](#updatesocket)

#### `updateOperators`
Expand All @@ -177,6 +188,35 @@ The `StakeRegistry` returns a bitmap of quorums where the Operator no longer mee
* Pause status MUST NOT be set: `PAUSED_UPDATE_OPERATOR`
* See [`StakeRegistry.updateOperatorStake`](./registries/StakeRegistry.md#updateoperatorstake)

#### `updateOperatorsForQuorum`

```solidity
function updateOperatorsForQuorum(
address[][] calldata operatorsPerQuorum,
bytes calldata quorumNumbers
)
external
onlyWhenNotPaused(PAUSED_UPDATE_OPERATOR)
```

Can be called by anyone to update the stake of ALL Operators in one or more quorums simultaneously. This method works similarly to `updateOperators` above, but with the requirement that, for each quorum being updated, the respective `operatorsPerQuorum` passed in is the complete set of Operators currently registered for that quorum.

This method also updates each quorum's `quorumUpdateBlockNumber`, signifying that the quorum's entire Operator set was updated at the current block number. (This is used by the `BLSSignatureChecker` to ensure that signature and stake validation is performed on up-to-date stake.)

*Effects*:
* See `updateOperators` above
* Updates each quorum's `quorumUpdateBlockNumber` to the current block
* For any quorums where the Operator no longer meets the minimum stake, they are deregistered (see `deregisterOperator` above).

*Requirements*:
* Pause status MUST NOT be set: `PAUSED_UPDATE_OPERATOR`
* See `updateOperators` above
* `quorumNumbers` MUST be an ordered array of quorum numbers, with no entry exceeding the current `quorumCount`
* All `quorumNumbers` MUST correspond to valid, initialized quorums
* `operatorsPerQuorum` and `quorumNumbers` MUST have the same lengths
* Each entry in `operatorsPerQuorum` MUST contain an order list of the currently-registered Operator addresses in the corresponding quorum
* See [`StakeRegistry.updateOperatorStake`](./registries/StakeRegistry.md#updateoperatorstake)

#### `updateSocket`

```solidity
Expand Down
4 changes: 2 additions & 2 deletions src/RegistryCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ contract RegistryCoordinator is

/**
* @notice Updates the stakes of all operators for each of the specified quorums in the StakeRegistry. Each quorum also
* has their StakeRegistry.quorumTimestamp updated. which is meant to keep track of when operators were last all updated at once.
* has their quorumUpdateBlockNumber updated. which is meant to keep track of when operators were last all updated at once.
* @param operatorsPerQuorum is an array of arrays of operators to update for each quorum. Note that each nested array
* of operators must be sorted in ascending address order to ensure that all operators in the quorum are updated
* @param quorumNumbers is an array of quorum numbers to update
Expand All @@ -298,7 +298,7 @@ contract RegistryCoordinator is
address[][] calldata operatorsPerQuorum,
bytes calldata quorumNumbers
) external onlyWhenNotPaused(PAUSED_UPDATE_OPERATOR) {
uint192 quorumBitmap = uint192(BitmapUtils.orderedBytesArrayToBitmap(quorumNumbers));
uint192 quorumBitmap = uint192(BitmapUtils.orderedBytesArrayToBitmap(quorumNumbers, quorumCount));
require(_quorumsAllExist(quorumBitmap), "RegistryCoordinator.updateOperatorsForQuorum: some quorums do not exist");
require(
operatorsPerQuorum.length == quorumNumbers.length,
Expand Down

0 comments on commit c3c3292

Please sign in to comment.