@@ -97,25 +97,31 @@ contract OperatorStateRetriever {
97
97
98
98
/**
99
99
* @notice This function is intended to to be called by AVS operators every time a new task is created (i.e.)
100
- * the AVS coordinator makes a request to AVS operators. Since all of the crucial information is kept onchain,
100
+ * the AVS coordinator makes a request to AVS operators. Since all of the crucial information is kept onchain,
101
101
* operators don't need to run indexers to fetch the data.
102
102
* @param registryCoordinator is the registry coordinator to fetch the AVS registry information from
103
- * @param operatorId the id of the operator to fetch the quorums lists
103
+ * @param operatorId the id of the operator to fetch the quorums lists
104
104
* @param blockNumber is the block number to get the operator state for
105
105
* @return quorumBitmap the quorumBitmap of the operator at the given blockNumber
106
106
* @return operators a 2d array of Operators. For each quorum, an ordered list of Operators
107
107
* @return sockets a 2d array of sockets. For each quorum, an ordered list of sockets
108
108
*/
109
109
function getOperatorStateWithSocket (
110
- ISlashingRegistryCoordinator registryCoordinator ,
111
- bytes32 operatorId ,
110
+ ISlashingRegistryCoordinator registryCoordinator ,
111
+ bytes32 operatorId ,
112
112
uint32 blockNumber
113
- ) external view returns (uint256 quorumBitmap , Operator[][] memory operators , string [][] memory sockets ) {
113
+ )
114
+ external
115
+ view
116
+ returns (uint256 quorumBitmap , Operator[][] memory operators , string [][] memory sockets )
117
+ {
114
118
bytes32 [] memory operatorIds = new bytes32 [](1 );
115
119
operatorIds[0 ] = operatorId;
116
- uint256 index = registryCoordinator.getQuorumBitmapIndicesAtBlockNumber (blockNumber, operatorIds)[0 ];
117
-
118
- quorumBitmap = registryCoordinator.getQuorumBitmapAtBlockNumberByIndex (operatorId, blockNumber, index);
120
+ uint256 index =
121
+ registryCoordinator.getQuorumBitmapIndicesAtBlockNumber (blockNumber, operatorIds)[0 ];
122
+
123
+ quorumBitmap =
124
+ registryCoordinator.getQuorumBitmapAtBlockNumberByIndex (operatorId, blockNumber, index);
119
125
120
126
bytes memory quorumNumbers = BitmapUtils.bitmapToBytesArray (quorumBitmap);
121
127
@@ -132,15 +138,15 @@ contract OperatorStateRetriever {
132
138
}
133
139
134
140
/**
135
- * @notice returns the ordered list of operators (id, stake, socket) for each quorum. The AVS coordinator
141
+ * @notice returns the ordered list of operators (id, stake, socket) for each quorum. The AVS coordinator
136
142
* may call this function directly to get the operator state for a given block number
137
143
* @param registryCoordinator is the registry coordinator to fetch the AVS registry information from
138
144
* @param quorumNumbers are the ids of the quorums to get the operator state for
139
145
* @param blockNumber is the block number to get the operator state for
140
146
* @return operators a 2d array of Operators. For each quorum, an ordered list of Operators
141
147
* @return sockets a 2d array of sockets. For each quorum, an ordered list of sockets
142
148
*/
143
- function getOperatorStateWithSocket (
149
+ function getOperatorStateWithSocket (
144
150
ISlashingRegistryCoordinator registryCoordinator ,
145
151
bytes memory quorumNumbers ,
146
152
uint32 blockNumber
@@ -156,14 +162,17 @@ contract OperatorStateRetriever {
156
162
sockets = new string [][](quorumNumbers.length );
157
163
for (uint256 i = 0 ; i < quorumNumbers.length ; i++ ) {
158
164
uint8 quorumNumber = uint8 (quorumNumbers[i]);
159
- bytes32 [] memory operatorIds = registries.indexRegistry.getOperatorListAtBlockNumber (quorumNumber, blockNumber);
165
+ bytes32 [] memory operatorIds =
166
+ registries.indexRegistry.getOperatorListAtBlockNumber (quorumNumber, blockNumber);
160
167
operators[i] = new Operator [](operatorIds.length );
161
168
sockets[i] = new string [](operatorIds.length );
162
169
for (uint256 j = 0 ; j < operatorIds.length ; j++ ) {
163
170
operators[i][j] = Operator ({
164
171
operator: registries.blsApkRegistry.getOperatorFromPubkeyHash (operatorIds[j]),
165
172
operatorId: bytes32 (operatorIds[j]),
166
- stake: registries.stakeRegistry.getStakeAtBlockNumber (bytes32 (operatorIds[j]), quorumNumber, blockNumber)
173
+ stake: registries.stakeRegistry.getStakeAtBlockNumber (
174
+ bytes32 (operatorIds[j]), quorumNumber, blockNumber
175
+ )
167
176
});
168
177
sockets[i][j] = registries.socketRegistry.getOperatorSocket (bytes32 (operatorIds[j]));
169
178
}
0 commit comments