Skip to content

Commit 488b54a

Browse files
committed
chore: fix test
1 parent ef6fa6d commit 488b54a

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

src/SlashingRegistryCoordinator.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,11 @@ contract SlashingRegistryCoordinator is
705705
bytes32 idToKick = _operatorInfo[operatorToKick].operatorId;
706706
require(newOperator != operatorToKick, CannotChurnSelf());
707707
require(kickParams.quorumNumber == quorumNumber, QuorumOperatorCountMismatch());
708+
709+
uint192 quorumBitmap;
710+
quorumBitmap = uint192(BitmapUtils.setBit(quorumBitmap, quorumNumber));
708711
require(
709-
quorumNumber.isSubsetOf(_currentOperatorBitmap(idToKick)),
712+
quorumBitmap.isSubsetOf(_currentOperatorBitmap(idToKick)),
710713
OperatorNotRegisteredForQuorum()
711714
);
712715

test/unit/SlashingRegistryCoordinatorUnit.t.sol

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,6 @@ contract SlashingRegistryCoordinator_RegisterWithChurn is
19381938
}
19391939

19401940
/// @dev Asserts that an operator cannot be churned out if it is not registered for the quorum
1941-
/// @dev We register the operator to kick in quorum 2 so that it is still registered after deregistration
19421941
function test_registerOperatorWithChurn_revert_notRegisteredForQuorum() public {
19431942
_setOperatorWeight(testOperator.key.addr, registeringStake);
19441943
_setOperatorWeight(operatorToKick.key.addr, operatorToKickStake);
@@ -1949,6 +1948,12 @@ contract SlashingRegistryCoordinator_RegisterWithChurn is
19491948
strategyParams[0] =
19501949
IStakeRegistryTypes.StrategyParams({strategy: mockStrategy, multiplier: 1 ether});
19511950

1951+
operatorSetParams = ISlashingRegistryCoordinatorTypes.OperatorSetParam({
1952+
maxOperatorCount: 1,
1953+
kickBIPsOfOperatorStake: 5000,
1954+
kickBIPsOfTotalStake: 5000
1955+
});
1956+
19521957
vm.startPrank(proxyAdminOwner);
19531958
slashingRegistryCoordinator.createTotalDelegatedStakeQuorum(
19541959
operatorSetParams,
@@ -1957,38 +1962,24 @@ contract SlashingRegistryCoordinator_RegisterWithChurn is
19571962
);
19581963
vm.stopPrank();
19591964

1960-
// Register the operatorToKick in the new quorum
1961-
uint32[] memory operatorSetIds = new uint32[](1);
1962-
operatorSetIds[0] = 2;
1963-
registerOperatorInSlashingRegistryCoordinator(operatorToKick, "socket:8545", operatorSetIds);
1965+
// Register extra operator in the new quorum
1966+
registerOperatorInSlashingRegistryCoordinator(extraOperator1, "socket:8545", uint32(2));
19641967

1965-
// Deregister the operatorToKick from quorum 1
1966-
IAllocationManagerTypes.DeregisterParams memory deregisterParams = IAllocationManagerTypes
1967-
.DeregisterParams({
1968-
operator: operatorToKick.key.addr,
1969-
avs: address(serviceManager),
1970-
operatorSetIds: operatorSetIds
1971-
});
1972-
1973-
vm.prank(operatorToKick.key.addr);
1974-
IAllocationManager(coreDeployment.allocationManager).deregisterFromOperatorSets(
1975-
deregisterParams
1976-
);
19771968

1978-
// Try to churn the operator
1969+
// Setup churn data
19791970
ISlashingRegistryCoordinatorTypes.OperatorKickParam[] memory operatorKickParams =
19801971
new ISlashingRegistryCoordinatorTypes.OperatorKickParam[](quorumNumbers.length);
19811972
operatorKickParams[0] = ISlashingRegistryCoordinatorTypes.OperatorKickParam({
19821973
operator: operatorToKick.key.addr,
1983-
quorumNumber: uint8(quorumNumbers[0])
1974+
quorumNumber: uint8(2) // 3rd quorum
19841975
});
19851976

19861977
ISignatureUtilsMixinTypes.SignatureWithSaltAndExpiry memory churnApproverSignature =
19871978
_signChurnApproval(
19881979
testOperator.key.addr,
19891980
testOperatorId,
19901981
operatorKickParams,
1991-
bytes32(uint256(3)), // Different salt from previous tests
1982+
bytes32(uint256(4)),
19921983
defaultExpiry
19931984
);
19941985

@@ -1998,7 +1989,7 @@ contract SlashingRegistryCoordinator_RegisterWithChurn is
19981989
IAllocationManagerTypes.RegisterParams memory registerParams = IAllocationManagerTypes
19991990
.RegisterParams({
20001991
avs: address(serviceManager),
2001-
operatorSetIds: new uint32[](quorumNumbers.length),
1992+
operatorSetIds: new uint32[](1),
20021993
data: abi.encode(
20031994
ISlashingRegistryCoordinatorTypes.RegistrationType.CHURN,
20041995
"socket:8545",
@@ -2008,9 +1999,7 @@ contract SlashingRegistryCoordinator_RegisterWithChurn is
20081999
)
20092000
});
20102001

2011-
for (uint256 i = 0; i < quorumNumbers.length; i++) {
2012-
registerParams.operatorSetIds[i] = uint8(quorumNumbers[i]);
2013-
}
2002+
registerParams.operatorSetIds[0] = uint32(2);
20142003

20152004
vm.prank(testOperator.key.addr);
20162005
vm.expectRevert(abi.encodeWithSignature("OperatorNotRegisteredForQuorum()"));

0 commit comments

Comments
 (0)