This contract assigns each operator an index (0 indexed) within each of its quorums. If a quorum has
The RegistryCoordinator for the AVS makes call to the IndexRegistry to register an operator for a certain set of quorums. The IndexRegistry will assign the next index in each of the quorums the operator is registering for to the operator storing the following struct:
// struct used to give definitive ordering to operators at each blockNumber.
struct OperatorIndexUpdate {
// blockNumber number from which `index` was the operators index
// the operator's index is the first entry such that `blockNumber >= entry.fromBlockNumber`
uint32 fromBlockNumber;
// index of the operator in array of operators
// index = type(uint32).max = OPERATOR_DEREGISTERED_INDEX implies the operator was deregistered
uint32 index;
}
The IndexRegistry also adds the operator's id to the append only list of operators that have registered for the middleware and it stores the total number of operators after the registering operator has registered for each of the quorums the operator is registering for by pushing the below struct to a growing array.
// struct used to denote the number of operators in a quorum at a given blockNumber
struct QuorumUpdate {
// The total number of operators at a `blockNumber` is the first entry such that `blockNumber >= entry.fromBlockNumber`
uint32 fromBlockNumber;
// The number of operators at `fromBlockNumber`
uint32 numOperators;
}
The RegistryCoordinator for the AVS makes call to the IndexRegistry to deregister an operator for a certain set of quorums. The RegistryCoordinator provides a witness of the ids of the operators that have the greatest index in each of the quorums that the operator is deregistering from. The IndexRegistry then, for each quorum the operator is deregistering from,
- Decrements the total number of operators in the quorum
- Makes sure the provided "greatest index operator id" in fact has the greatest index in the quorum by checking it against the total number of operators in the quorum
- Sets the index of the "greatest index operator" to the index of the deregistering operator
- Sets the index of the deregistering operator to
OPERATOR_DEREGISTERED_INDEX = type(uint32).max
Steps 3 and 4 are done via pushing the above struct to a growing array that is kept track of for each operator.
Note that the contract does not check that the quorums that the operator is being deregistered from are a subset of the quorums the operator is registered for, that logic is expected to be done in the RegistryCoordinator.
The BLSOperatorStateRetriever uses the globally ordered list of all operators every registered for the AVS to serve information about the active operator set for the AVS to offchain nodes.