@@ -232,27 +232,6 @@ contract SlashingRegistryCoordinator is
232
232
_deregisterOperator (operator, quorumNumbers);
233
233
}
234
234
235
- /**
236
- * @notice Updates the StakeRegistry's view of one or more operators' stakes. If any operator
237
- * is found to be below the minimum stake for the quorum, they are deregistered.
238
- * @dev stakes are queried from the Eigenlayer core DelegationManager contract
239
- * @param operators a list of operator addresses to update
240
- */
241
- function updateOperators (
242
- address [] memory operators
243
- ) external onlyWhenNotPaused (PAUSED_UPDATE_OPERATOR) {
244
- for (uint256 i = 0 ; i < operators.length ; i++ ) {
245
- address operator = operators[i];
246
- OperatorInfo memory operatorInfo = _operatorInfo[operator];
247
- bytes32 operatorId = operatorInfo.operatorId;
248
-
249
- // Update the operator's stake for their active quorums
250
- uint192 currentBitmap = _currentOperatorBitmap (operatorId);
251
- bytes memory quorumsToUpdate = BitmapUtils.bitmapToBytesArray (currentBitmap);
252
- _updateOperator (operator, operatorInfo, quorumsToUpdate);
253
- }
254
- }
255
-
256
235
/**
257
236
* @notice For each quorum in `quorumNumbers`, updates the StakeRegistry's view of ALL its registered operators' stakes.
258
237
* Each quorum's `quorumUpdateBlockNumber` is also updated, which tracks the most recent block number when ALL registered
@@ -289,6 +268,7 @@ contract SlashingRegistryCoordinator is
289
268
QuorumOperatorCountMismatch ()
290
269
);
291
270
271
+ bytes32 [] memory operatorIds = new bytes32 [](currQuorumOperators.length );
292
272
address prevOperatorAddress = address (0 );
293
273
// For each operator:
294
274
// - check that they are registered for this quorum
@@ -297,11 +277,9 @@ contract SlashingRegistryCoordinator is
297
277
for (uint256 j = 0 ; j < currQuorumOperators.length ; ++ j) {
298
278
address operator = currQuorumOperators[j];
299
279
300
- OperatorInfo memory operatorInfo = _operatorInfo[operator];
301
- bytes32 operatorId = operatorInfo.operatorId;
302
-
280
+ operatorIds[j] = _operatorInfo[operator].operatorId;
303
281
{
304
- uint192 currentBitmap = _currentOperatorBitmap (operatorId );
282
+ uint192 currentBitmap = _currentOperatorBitmap (operatorIds[j] );
305
283
// Check that the operator is registered
306
284
require (
307
285
BitmapUtils.isSet (currentBitmap, quorumNumber), NotRegisteredForQuorum ()
@@ -310,10 +288,17 @@ contract SlashingRegistryCoordinator is
310
288
require (operator > prevOperatorAddress, NotSorted ());
311
289
}
312
290
313
- // Update the operator
314
- _updateOperator (operator, operatorInfo, quorumNumbers[i:i + 1 ]);
315
291
prevOperatorAddress = operator;
316
292
}
293
+ bytes memory quorumNumberBytes = new bytes (1 );
294
+ quorumNumberBytes[0 ] = bytes1 (quorumNumber);
295
+ bool [] memory shouldBeDeregistered =
296
+ stakeRegistry.updateOperatorsStake (currQuorumOperators, operatorIds, quorumNumber);
297
+ for (uint256 j = 0 ; j < currQuorumOperators.length ; ++ j) {
298
+ if (shouldBeDeregistered[j]) {
299
+ _deregisterOperator (currQuorumOperators[j], quorumNumberBytes);
300
+ }
301
+ }
317
302
318
303
// Update timestamp that all operators in quorum have been updated all at once
319
304
quorumUpdateBlockNumber[quorumNumber] = block .number ;
@@ -491,7 +476,10 @@ contract SlashingRegistryCoordinator is
491
476
if (checkMaxOperatorCount) {
492
477
for (uint256 i = 0 ; i < quorumNumbers.length ; i++ ) {
493
478
OperatorSetParam memory operatorSetParams = _quorumParams[uint8 (quorumNumbers[i])];
494
- require (results.numOperatorsPerQuorum[i] <= operatorSetParams.maxOperatorCount, MaxQuorumsReached ());
479
+ require (
480
+ results.numOperatorsPerQuorum[i] <= operatorSetParams.maxOperatorCount,
481
+ MaxQuorumsReached ()
482
+ );
495
483
}
496
484
}
497
485
@@ -521,14 +509,13 @@ contract SlashingRegistryCoordinator is
521
509
522
510
// Register the operator in each of the registry contracts and update the operator's
523
511
// quorum bitmap and registration status
524
- RegisterResults memory results =
525
- _registerOperator ({
526
- operator: operator,
527
- operatorId: operatorId,
528
- quorumNumbers: quorumNumbers,
529
- socket: socket,
530
- checkMaxOperatorCount: false
531
- });
512
+ RegisterResults memory results = _registerOperator ({
513
+ operator: operator,
514
+ operatorId: operatorId,
515
+ quorumNumbers: quorumNumbers,
516
+ socket: socket,
517
+ checkMaxOperatorCount: false
518
+ });
532
519
533
520
// Check that each quorum's operator count is below the configured maximum. If the max
534
521
// is exceeded, use `operatorKickParams` to deregister an existing operator to make space
@@ -615,7 +602,10 @@ contract SlashingRegistryCoordinator is
615
602
* @param operator The operator to deregister
616
603
* @param quorumNumbers The quorum numbers the operator is force-deregistered from
617
604
*/
618
- function _forceDeregisterOperator (address operator , bytes memory quorumNumbers ) internal virtual {
605
+ function _forceDeregisterOperator (
606
+ address operator ,
607
+ bytes memory quorumNumbers
608
+ ) internal virtual {
619
609
allocationManager.deregisterFromOperatorSets (
620
610
IAllocationManagerTypes.DeregisterParams ({
621
611
operator: operator,
@@ -712,32 +702,6 @@ contract SlashingRegistryCoordinator is
712
702
);
713
703
}
714
704
715
- /**
716
- * @notice Updates the StakeRegistry's view of the operator's stake in one or more quorums.
717
- * For any quorums where the StakeRegistry finds the operator is under the configured minimum
718
- * stake, `quorumsToRemove` is returned and used to deregister the operator from those quorums
719
- * @dev does nothing if operator is not registered for any quorums.
720
- */
721
- function _updateOperator (
722
- address operator ,
723
- OperatorInfo memory operatorInfo ,
724
- bytes memory quorumsToUpdate
725
- ) internal {
726
- if (operatorInfo.status != OperatorStatus.REGISTERED) {
727
- return ;
728
- }
729
- bytes32 operatorId = operatorInfo.operatorId;
730
- uint192 quorumsToRemove =
731
- stakeRegistry.updateOperatorStake (operator, operatorId, quorumsToUpdate);
732
-
733
- if (! quorumsToRemove.isEmpty ()) {
734
- _deregisterOperator ({
735
- operator: operator,
736
- quorumNumbers: BitmapUtils.bitmapToBytesArray (quorumsToRemove)
737
- });
738
- }
739
- }
740
-
741
705
/**
742
706
* @notice Returns the stake threshold required for an incoming operator to replace an existing operator
743
707
* The incoming operator must have more stake than the return value.
@@ -950,7 +914,7 @@ contract SlashingRegistryCoordinator is
950
914
function _afterCreateQuorum (
951
915
uint8 quorumNumber
952
916
) internal virtual {}
953
-
917
+
954
918
/// @dev Hook to allow for any pre-register logic in `_registerOperator`
955
919
function _beforeRegisterOperator (
956
920
address operator ,
0 commit comments