Skip to content

Commit 58eda09

Browse files
committed
feat: add ejection to the ALM flows for quourms
1 parent 865b490 commit 58eda09

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/RegistryCoordinator.sol

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISi
66
import {IAVSDirectory } from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
77
import {IStrategy } from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
88
import { IAllocationManager, OperatorSet, IAllocationManagerTypes} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
9+
import { AllocationManager } from "eigenlayer-contracts/src/contracts/core/AllocationManager.sol";
910
import {ISocketUpdater} from "./interfaces/ISocketUpdater.sol";
1011
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
1112
import {IStakeRegistry, StakeType} from "./interfaces/IStakeRegistry.sol";
@@ -479,6 +480,40 @@ contract RegistryCoordinator is
479480
operatorInfo.status == OperatorStatus.REGISTERED && !quorumsToRemove.isEmpty()
480481
&& quorumsToRemove.isSubsetOf(currentBitmap)
481482
) {
483+
// If using operator sets, call out to AllocationManager to eject operator
484+
if (isUsingOperatorSets()) {
485+
// Count non-M2 quorums to size array
486+
uint256 operatorSetIdCount;
487+
for (uint256 i = 0; i < quorumNumbers.length; i++) {
488+
if (!isM2Quorum[uint8(quorumNumbers[i])]) {
489+
operatorSetIdCount++;
490+
}
491+
}
492+
493+
// Get operator sets for quorums being removed
494+
uint32[] memory operatorSetIds = new uint32[](quorumNumbers.length);
495+
uint256 operatorSetIndex = 0;
496+
for (uint256 i = 0; i < quorumNumbers.length; i++) {
497+
if (!isM2Quorum[uint8(quorumNumbers[i])]) {
498+
operatorSetIds[operatorSetIndex] = uint8(quorumNumbers[i]);
499+
operatorSetIndex++;
500+
}
501+
}
502+
503+
assembly {
504+
mstore(operatorSetIds, operatorSetIdCount)
505+
}
506+
507+
// Call AllocationManager to deregister operator from sets
508+
AllocationManager(serviceManager.allocationManager()).deregisterFromOperatorSets(
509+
IAllocationManagerTypes.DeregisterParams({
510+
operator: operator,
511+
avs: address(serviceManager),
512+
operatorSetIds: operatorSetIds
513+
})
514+
);
515+
}
516+
482517
_deregisterOperator({operator: operator, quorumNumbers: quorumNumbers});
483518
}
484519
}

0 commit comments

Comments
 (0)