@@ -225,22 +225,6 @@ contract SlashingRegistryCoordinator is
225
225
_deregisterOperator (operator, quorumNumbers);
226
226
}
227
227
228
- /// @inheritdoc ISlashingRegistryCoordinator
229
- function updateOperators (
230
- address [] memory operators
231
- ) external onlyWhenNotPaused (PAUSED_UPDATE_OPERATOR) {
232
- for (uint256 i = 0 ; i < operators.length ; i++ ) {
233
- address operator = operators[i];
234
- OperatorInfo memory operatorInfo = _operatorInfo[operator];
235
- bytes32 operatorId = operatorInfo.operatorId;
236
-
237
- // Update the operator's stake for their active quorums
238
- uint192 currentBitmap = _currentOperatorBitmap (operatorId);
239
- bytes memory quorumsToUpdate = BitmapUtils.bitmapToBytesArray (currentBitmap);
240
- _updateOperator (operator, operatorInfo, quorumsToUpdate);
241
- }
242
- }
243
-
244
228
/// @inheritdoc ISlashingRegistryCoordinator
245
229
function updateOperatorsForQuorum (
246
230
address [][] memory operatorsPerQuorum ,
@@ -264,6 +248,7 @@ contract SlashingRegistryCoordinator is
264
248
QuorumOperatorCountMismatch ()
265
249
);
266
250
251
+ bytes32 [] memory operatorIds = new bytes32 [](currQuorumOperators.length );
267
252
address prevOperatorAddress = address (0 );
268
253
// For each operator:
269
254
// - check that they are registered for this quorum
@@ -272,11 +257,9 @@ contract SlashingRegistryCoordinator is
272
257
for (uint256 j = 0 ; j < currQuorumOperators.length ; ++ j) {
273
258
address operator = currQuorumOperators[j];
274
259
275
- OperatorInfo memory operatorInfo = _operatorInfo[operator];
276
- bytes32 operatorId = operatorInfo.operatorId;
277
-
260
+ operatorIds[j] = _operatorInfo[operator].operatorId;
278
261
{
279
- uint192 currentBitmap = _currentOperatorBitmap (operatorId );
262
+ uint192 currentBitmap = _currentOperatorBitmap (operatorIds[j] );
280
263
// Check that the operator is registered
281
264
require (
282
265
BitmapUtils.isSet (currentBitmap, quorumNumber), NotRegisteredForQuorum ()
@@ -285,10 +268,17 @@ contract SlashingRegistryCoordinator is
285
268
require (operator > prevOperatorAddress, NotSorted ());
286
269
}
287
270
288
- // Update the operator
289
- _updateOperator (operator, operatorInfo, quorumNumbers[i:i + 1 ]);
290
271
prevOperatorAddress = operator;
291
272
}
273
+ bytes memory quorumNumberBytes = new bytes (1 );
274
+ quorumNumberBytes[0 ] = bytes1 (quorumNumber);
275
+ bool [] memory shouldBeDeregistered =
276
+ stakeRegistry.updateOperatorsStake (currQuorumOperators, operatorIds, quorumNumber);
277
+ for (uint256 j = 0 ; j < currQuorumOperators.length ; ++ j) {
278
+ if (shouldBeDeregistered[j]) {
279
+ _deregisterOperator (currQuorumOperators[j], quorumNumberBytes);
280
+ }
281
+ }
292
282
293
283
// Update timestamp that all operators in quorum have been updated all at once
294
284
quorumUpdateBlockNumber[quorumNumber] = block .number ;
@@ -439,7 +429,10 @@ contract SlashingRegistryCoordinator is
439
429
if (checkMaxOperatorCount) {
440
430
for (uint256 i = 0 ; i < quorumNumbers.length ; i++ ) {
441
431
OperatorSetParam memory operatorSetParams = _quorumParams[uint8 (quorumNumbers[i])];
442
- require (results.numOperatorsPerQuorum[i] <= operatorSetParams.maxOperatorCount, MaxQuorumsReached ());
432
+ require (
433
+ results.numOperatorsPerQuorum[i] <= operatorSetParams.maxOperatorCount,
434
+ MaxQuorumsReached ()
435
+ );
443
436
}
444
437
}
445
438
@@ -469,14 +462,13 @@ contract SlashingRegistryCoordinator is
469
462
470
463
// Register the operator in each of the registry contracts and update the operator's
471
464
// quorum bitmap and registration status
472
- RegisterResults memory results =
473
- _registerOperator ({
474
- operator: operator,
475
- operatorId: operatorId,
476
- quorumNumbers: quorumNumbers,
477
- socket: socket,
478
- checkMaxOperatorCount: false
479
- });
465
+ RegisterResults memory results = _registerOperator ({
466
+ operator: operator,
467
+ operatorId: operatorId,
468
+ quorumNumbers: quorumNumbers,
469
+ socket: socket,
470
+ checkMaxOperatorCount: false
471
+ });
480
472
481
473
// Check that each quorum's operator count is below the configured maximum. If the max
482
474
// is exceeded, use `operatorKickParams` to deregister an existing operator to make space
@@ -563,7 +555,10 @@ contract SlashingRegistryCoordinator is
563
555
* @param operator The operator to deregister
564
556
* @param quorumNumbers The quorum numbers the operator is force-deregistered from
565
557
*/
566
- function _forceDeregisterOperator (address operator , bytes memory quorumNumbers ) internal virtual {
558
+ function _forceDeregisterOperator (
559
+ address operator ,
560
+ bytes memory quorumNumbers
561
+ ) internal virtual {
567
562
allocationManager.deregisterFromOperatorSets (
568
563
IAllocationManagerTypes.DeregisterParams ({
569
564
operator: operator,
@@ -660,32 +655,6 @@ contract SlashingRegistryCoordinator is
660
655
);
661
656
}
662
657
663
- /**
664
- * @notice Updates the StakeRegistry's view of the operator's stake in one or more quorums.
665
- * For any quorums where the StakeRegistry finds the operator is under the configured minimum
666
- * stake, `quorumsToRemove` is returned and used to deregister the operator from those quorums
667
- * @dev does nothing if operator is not registered for any quorums.
668
- */
669
- function _updateOperator (
670
- address operator ,
671
- OperatorInfo memory operatorInfo ,
672
- bytes memory quorumsToUpdate
673
- ) internal {
674
- if (operatorInfo.status != OperatorStatus.REGISTERED) {
675
- return ;
676
- }
677
- bytes32 operatorId = operatorInfo.operatorId;
678
- uint192 quorumsToRemove =
679
- stakeRegistry.updateOperatorStake (operator, operatorId, quorumsToUpdate);
680
-
681
- if (! quorumsToRemove.isEmpty ()) {
682
- _deregisterOperator ({
683
- operator: operator,
684
- quorumNumbers: BitmapUtils.bitmapToBytesArray (quorumsToRemove)
685
- });
686
- }
687
- }
688
-
689
658
/**
690
659
* @notice Returns the stake threshold required for an incoming operator to replace an existing operator
691
660
* The incoming operator must have more stake than the return value.
@@ -898,7 +867,7 @@ contract SlashingRegistryCoordinator is
898
867
function _afterCreateQuorum (
899
868
uint8 quorumNumber
900
869
) internal virtual {}
901
-
870
+
902
871
/// @dev Hook to allow for any pre-register logic in `_registerOperator`
903
872
function _beforeRegisterOperator (
904
873
address operator ,
0 commit comments