1
1
// SPDX-License-Identifier: BUSL-1.1
2
2
pragma solidity ^ 0.8.27 ;
3
3
4
- import {BLSApkRegistryStorage} from "./BLSApkRegistryStorage.sol " ;
4
+ import {BLSApkRegistryStorage, IBLSApkRegistry } from "./BLSApkRegistryStorage.sol " ;
5
5
6
6
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol " ;
7
7
@@ -27,17 +27,7 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
27
27
*
28
28
*/
29
29
30
- /**
31
- * @notice Registers the `operator`'s pubkey for the specified `quorumNumbers`.
32
- * @param operator The address of the operator to register.
33
- * @param quorumNumbers The quorum numbers the operator is registering for, where each byte is an 8 bit integer quorumNumber.
34
- * @dev access restricted to the RegistryCoordinator
35
- * @dev Preconditions (these are assumed, not validated in this contract):
36
- * 1) `quorumNumbers` has no duplicates
37
- * 2) `quorumNumbers.length` != 0
38
- * 3) `quorumNumbers` is ordered in ascending order
39
- * 4) the operator is not already registered
40
- */
30
+ /// @inheritdoc IBLSApkRegistry
41
31
function registerOperator (
42
32
address operator ,
43
33
bytes memory quorumNumbers
@@ -49,21 +39,10 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
49
39
_processQuorumApkUpdate (quorumNumbers, pubkey);
50
40
51
41
// Return pubkeyHash, which will become the operator's unique id
52
- emit OperatorAddedToQuorums (operator, getOperatorId ( operator) , quorumNumbers);
42
+ emit OperatorAddedToQuorums (operator, operatorToPubkeyHash[ operator] , quorumNumbers);
53
43
}
54
44
55
- /**
56
- * @notice Deregisters the `operator`'s pubkey for the specified `quorumNumbers`.
57
- * @param operator The address of the operator to deregister.
58
- * @param quorumNumbers The quorum numbers the operator is deregistering from, where each byte is an 8 bit integer quorumNumber.
59
- * @dev access restricted to the RegistryCoordinator
60
- * @dev Preconditions (these are assumed, not validated in this contract):
61
- * 1) `quorumNumbers` has no duplicates
62
- * 2) `quorumNumbers.length` != 0
63
- * 3) `quorumNumbers` is ordered in ascending order
64
- * 4) the operator is not already deregistered
65
- * 5) `quorumNumbers` is a subset of the quorumNumbers that the operator is registered for
66
- */
45
+ /// @inheritdoc IBLSApkRegistry
67
46
function deregisterOperator (
68
47
address operator ,
69
48
bytes memory quorumNumbers
@@ -73,13 +52,10 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
73
52
74
53
// Update each quorum's aggregate pubkey
75
54
_processQuorumApkUpdate (quorumNumbers, pubkey.negate ());
76
- emit OperatorRemovedFromQuorums (operator, getOperatorId ( operator) , quorumNumbers);
55
+ emit OperatorRemovedFromQuorums (operator, operatorToPubkeyHash[ operator] , quorumNumbers);
77
56
}
78
57
79
- /**
80
- * @notice Initializes a new quorum by pushing its first apk update
81
- * @param quorumNumber The number of the new quorum
82
- */
58
+ /// @inheritdoc IBLSApkRegistry
83
59
function initializeQuorum (
84
60
uint8 quorumNumber
85
61
) public virtual onlyRegistryCoordinator {
@@ -94,12 +70,7 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
94
70
);
95
71
}
96
72
97
- /**
98
- * @notice Called by the RegistryCoordinator register an operator as the owner of a BLS public key.
99
- * @param operator is the operator for whom the key is being registered
100
- * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership
101
- * @param pubkeyRegistrationMessageHash is a hash that the operator must sign to prove key ownership
102
- */
73
+ /// @inheritdoc IBLSApkRegistry
103
74
function registerBLSPublicKey (
104
75
address operator ,
105
76
PubkeyRegistrationParams calldata params ,
@@ -190,10 +161,8 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
190
161
* VIEW FUNCTIONS
191
162
*
192
163
*/
193
- /**
194
- * @notice Returns the pubkey and pubkey hash of an operator
195
- * @dev Reverts if the operator has not registered a valid pubkey
196
- */
164
+
165
+ /// @inheritdoc IBLSApkRegistry
197
166
function getRegisteredPubkey (
198
167
address operator
199
168
) public view returns (BN254.G1Point memory , bytes32 ) {
@@ -205,10 +174,7 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
205
174
return (pubkey, pubkeyHash);
206
175
}
207
176
208
- /**
209
- * @notice Returns the indices of the quorumApks index at `blockNumber` for the provided `quorumNumbers`
210
- * @dev Returns the current indices if `blockNumber >= block.number`
211
- */
177
+ /// @inheritdoc IBLSApkRegistry
212
178
function getApkIndicesAtBlockNumber (
213
179
bytes calldata quorumNumbers ,
214
180
uint256 blockNumber
@@ -239,28 +205,22 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
239
205
return indices;
240
206
}
241
207
242
- /// @notice Returns the current APK for the provided `quorumNumber `
208
+ /// @inheritdoc IBLSApkRegistry
243
209
function getApk (
244
210
uint8 quorumNumber
245
211
) external view returns (BN254.G1Point memory ) {
246
212
return currentApk[quorumNumber];
247
213
}
248
214
249
- /// @notice Returns the `ApkUpdate` struct at `index` in the list of APK updates for the `quorumNumber`
215
+ /// @inheritdoc IBLSApkRegistry
250
216
function getApkUpdateAtIndex (
251
217
uint8 quorumNumber ,
252
218
uint256 index
253
219
) external view returns (ApkUpdate memory ) {
254
220
return apkHistory[quorumNumber][index];
255
221
}
256
222
257
- /**
258
- * @notice get hash of the apk of `quorumNumber` at `blockNumber` using the provided `index`;
259
- * called by checkSignatures in BLSSignatureChecker.sol.
260
- * @param quorumNumber is the quorum whose ApkHash is being retrieved
261
- * @param blockNumber is the number of the block for which the latest ApkHash will be retrieved
262
- * @param index is the index of the apkUpdate being retrieved from the list of quorum apkUpdates in storage
263
- */
223
+ /// @inheritdoc IBLSApkRegistry
264
224
function getApkHashAtBlockNumberAndIndex (
265
225
uint8 quorumNumber ,
266
226
uint32 blockNumber ,
@@ -283,22 +243,21 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
283
243
return quorumApkUpdate.apkHash;
284
244
}
285
245
286
- /// @notice Returns the length of ApkUpdates for the provided `quorumNumber`
246
+ /// @inheritdoc IBLSApkRegistry
287
247
function getApkHistoryLength (
288
248
uint8 quorumNumber
289
249
) external view returns (uint32 ) {
290
250
return uint32 (apkHistory[quorumNumber].length );
291
251
}
292
252
293
- /// @notice Returns the operator address for the given `pubkeyHash`
253
+ /// @inheritdoc IBLSApkRegistry
294
254
function getOperatorFromPubkeyHash (
295
255
bytes32 pubkeyHash
296
256
) public view returns (address ) {
297
257
return pubkeyHashToOperator[pubkeyHash];
298
258
}
299
259
300
- /// @notice returns the ID used to identify the `operator` within this AVS
301
- /// @dev Returns zero in the event that the `operator` has never registered for the AVS
260
+ /// @inheritdoc IBLSApkRegistry
302
261
function getOperatorId (
303
262
address operator
304
263
) public view returns (bytes32 ) {
0 commit comments