Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 committed Nov 19, 2024
1 parent 66d4884 commit ee6610f
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/unit/EjectionManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,55 @@ contract EjectionManagerUnitTests is MockAVSDeployer {
}
}

function testEjectOperators_NoEjectionForNoEjectableStake() public {
uint8 operatorsCanEject = 2;
uint8 operatorsToEject = 10;
uint8 numOperators = 10;
uint96 stake = 1 ether;
_registerOperaters(numOperators, stake);

bytes32[][] memory operatorIds = new bytes32[][](numQuorums);
for (uint8 i = 0; i < numQuorums; i++) {
operatorIds[i] = new bytes32[](operatorsToEject);
for (uint j = 0; j < operatorsToEject; j++) {
operatorIds[i][j] = registryCoordinator.getOperatorId(_incrementAddress(defaultOperator, j));
}
}

for(uint8 i = 0; i < operatorsToEject; i++) {
assertEq(uint8(registryCoordinator.getOperatorStatus(_incrementAddress(defaultOperator, i))), uint8(IRegistryCoordinator.OperatorStatus.REGISTERED));
}

for(uint8 i = 0; i < numQuorums; i++) {
for(uint8 j = 0; j < operatorsCanEject; j++) {
cheats.expectEmit(true, true, true, true, address(ejectionManager));
emit OperatorEjected(operatorIds[i][j], i);
}
}

cheats.prank(ejector);
ejectionManager.ejectOperators(operatorIds);

for(uint8 i = 0; i < operatorsCanEject; i++) {
assertEq(uint8(registryCoordinator.getOperatorStatus(_incrementAddress(defaultOperator, i))), uint8(IRegistryCoordinator.OperatorStatus.DEREGISTERED));
}

for(uint8 i = operatorsCanEject; i < operatorsToEject; i++) {
assertEq(uint8(registryCoordinator.getOperatorStatus(_incrementAddress(defaultOperator, i))), uint8(IRegistryCoordinator.OperatorStatus.REGISTERED));
}

cheats.prank(ejector);
ejectionManager.ejectOperators(operatorIds);

for(uint8 i = 0; i < operatorsCanEject; i++) {
assertEq(uint8(registryCoordinator.getOperatorStatus(_incrementAddress(defaultOperator, i))), uint8(IRegistryCoordinator.OperatorStatus.DEREGISTERED));
}

for(uint8 i = operatorsCanEject; i < operatorsToEject; i++) {
assertEq(uint8(registryCoordinator.getOperatorStatus(_incrementAddress(defaultOperator, i))), uint8(IRegistryCoordinator.OperatorStatus.REGISTERED));
}
}

function testEjectOperators_MultipleOperatorMultipleTimesInsideRatelimit() public {
uint8 operatorsToEject = 4;
uint8 numOperators = 100;
Expand Down

0 comments on commit ee6610f

Please sign in to comment.