@@ -152,7 +152,8 @@ contract EjectionManagerUnitTests is MockAVSDeployer {
152152 }
153153
154154 function testEjectOperators_MultipleOperatorOutsideRatelimit () public {
155- uint8 operatorsCanEject = 2 ;
155+ /// @dev Since the `ejectableStakePercent` is 10%, only 1 operator can be ejected
156+ uint8 operatorsCanEject = 1 ;
156157 uint8 operatorsToEject = 10 ;
157158 uint8 numOperators = 10 ;
158159 uint96 stake = 1 ether ;
@@ -199,8 +200,46 @@ contract EjectionManagerUnitTests is MockAVSDeployer {
199200 }
200201 }
201202
203+ /// @dev Regression test for Hexens Slashing EG2-2
204+ /// @dev The quorum ejection params are set to 10%. Previously an operator would have been ejected due to
205+ /// @dev a bug that allowed an ejection to occur if there was at least 1 operator to eject, regardless of the limit.
206+ function testEjectOperators_regression_inclusiveRateLimit () public {
207+ /// @dev The quorum ejection params are set to 10%, which does not need to be updated
208+ uint8 numOperators = 1 ;
209+ uint96 stake = 1 ether ;
210+
211+ _registerOperators (numOperators, stake);
212+
213+ bytes32 [][] memory operatorIds = new bytes32 [][](numQuorums);
214+ for (uint8 i = 0 ; i < numQuorums; i++ ) {
215+ operatorIds[i] = new bytes32 [](numOperators);
216+ for (uint256 j = 0 ; j < numOperators; j++ ) {
217+ operatorIds[i][j] =
218+ registryCoordinator.getOperatorId (_incrementAddress (defaultOperator, j));
219+ }
220+ }
221+
222+ for (uint8 i = 0 ; i < numOperators; i++ ) {
223+ assertEq (
224+ uint8 (registryCoordinator.getOperatorStatus (_incrementAddress (defaultOperator, i))),
225+ uint8 (ISlashingRegistryCoordinatorTypes.OperatorStatus.REGISTERED)
226+ );
227+ }
228+
229+ cheats.prank (ejector);
230+ ejectionManager.ejectOperators (operatorIds);
231+
232+ /// @dev The operator should not be ejected due to the rate limit
233+ for (uint8 i = 0 ; i < numOperators; i++ ) {
234+ assertEq (
235+ uint8 (registryCoordinator.getOperatorStatus (_incrementAddress (defaultOperator, i))),
236+ uint8 (ISlashingRegistryCoordinatorTypes.OperatorStatus.REGISTERED)
237+ );
238+ }
239+ }
240+
202241 function testEjectOperators_NoEjectionForNoEjectableStake () public {
203- uint8 operatorsCanEject = 2 ;
242+ uint8 operatorsCanEject = 1 ;
204243 uint8 operatorsToEject = 10 ;
205244 uint8 numOperators = 10 ;
206245 uint96 stake = 1 ether ;
0 commit comments