@@ -244,31 +244,11 @@ contract SlashingRegistryCoordinator is
244
244
bytes memory quorumNumbers = currentBitmap.bitmapToBytesArray ();
245
245
for (uint256 j = 0 ; j < quorumNumbers.length ; j++ ) {
246
246
// update the operator's stake for each quorum
247
- uint8 quorumNumber = uint8 (quorumNumbers[j]);
248
- bool [] memory shouldBeDeregistered = stakeRegistry.updateOperatorsStake (
249
- singleOperator, singleOperatorId, quorumNumber
247
+ _updateStakesAndDeregisterLoiterers (
248
+ singleOperator,
249
+ singleOperatorId,
250
+ uint8 (quorumNumbers[j])
250
251
);
251
-
252
- // whether the operator is registered in the core EigenLayer contract AllocationManager
253
- bool registeredInCore = allocationManager.isMemberOfOperatorSet (
254
- operators[i], OperatorSet ({avs: accountIdentifier, id: uint32 (quorumNumber)})
255
- );
256
-
257
- // If the operator does not have the minimum stake, they need to be force deregistered.
258
- // Additionally, it is possible for an operator to have deregistered from an OperatorSet
259
- // in the core EigenLayer contract AllocationManager but not have the deregistration
260
- // callback succeed here in `deregisterOperator` due to out of gas errors. If that is the case,
261
- // we need to deregister the operator from the OperatorSet in this contract
262
- if (shouldBeDeregistered[0 ] || ! registeredInCore) {
263
- // The operator should be deregistered from this quorum
264
- bytes memory singleQuorumNumber = new bytes (1 );
265
- singleQuorumNumber[0 ] = quorumNumbers[j];
266
- _deregisterOperator ({
267
- operator: operators[i],
268
- quorumNumbers: singleQuorumNumber,
269
- shouldForceDeregister: registeredInCore
270
- });
271
- }
272
252
}
273
253
}
274
254
}
@@ -319,17 +299,11 @@ contract SlashingRegistryCoordinator is
319
299
prevOperatorAddress = operator;
320
300
}
321
301
322
- bool [] memory shouldBeDeregistered =
323
- stakeRegistry.updateOperatorsStake (currQuorumOperators, operatorIds, quorumNumber);
324
- for (uint256 j = 0 ; j < currQuorumOperators.length ; ++ j) {
325
- if (shouldBeDeregistered[j]) {
326
- _deregisterOperator ({
327
- operator: currQuorumOperators[j],
328
- quorumNumbers: quorumNumbers[i:i + 1 ],
329
- shouldForceDeregister: true
330
- });
331
- }
332
- }
302
+ _updateStakesAndDeregisterLoiterers (
303
+ currQuorumOperators,
304
+ operatorIds,
305
+ quorumNumber
306
+ );
333
307
334
308
// Update timestamp that all operators in quorum have been updated all at once
335
309
quorumUpdateBlockNumber[quorumNumber] = block .number ;
@@ -658,6 +632,36 @@ contract SlashingRegistryCoordinator is
658
632
);
659
633
}
660
634
635
+ function _updateStakesAndDeregisterLoiterers (
636
+ address [] memory operators ,
637
+ bytes32 [] memory operatorIds ,
638
+ uint8 quorumNumber
639
+ ) internal {
640
+ bytes memory singleQuorumNumber = new bytes (1 );
641
+ singleQuorumNumber[0 ] = bytes1 (quorumNumber);
642
+ bool [] memory doesNotMeetStakeThreshold =
643
+ stakeRegistry.updateOperatorsStake (operators, operatorIds, quorumNumber);
644
+ for (uint256 j = 0 ; j < operators.length ; ++ j) {
645
+ // whether the operator is registered in the core EigenLayer contract AllocationManager
646
+ bool registeredInCore = allocationManager.isMemberOfOperatorSet (
647
+ operators[j], OperatorSet ({avs: accountIdentifier, id: uint32 (quorumNumber)})
648
+ );
649
+
650
+ // If the operator does not have the minimum stake, they need to be force deregistered.
651
+ // Additionally, it is possible for an operator to have deregistered from an OperatorSet
652
+ // in the core EigenLayer contract AllocationManager but not have the deregistration
653
+ // callback succeed here in `deregisterOperator` due to out of gas errors. If that is the case,
654
+ // we need to deregister the operator from the OperatorSet in this contract
655
+ if (doesNotMeetStakeThreshold[j] || ! registeredInCore) {
656
+ _deregisterOperator ({
657
+ operator: operators[j],
658
+ quorumNumbers: singleQuorumNumber,
659
+ shouldForceDeregister: true
660
+ });
661
+ }
662
+ }
663
+ }
664
+
661
665
/**
662
666
* @notice Checks if the caller is the ejector
663
667
* @dev Reverts if the caller is not the ejector
0 commit comments