@@ -74,36 +74,45 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
7474            uint32  ejectedOperators;
7575
7676            bool  ratelimitHit;
77-             for (uint8  j =  0 ; j <  _operatorIds[i].length ; ++ j) {
78-                 uint256  operatorStake =  stakeRegistry.getCurrentStake (_operatorIds[i][j], quorumNumber);
79- 
80-                 //if caller is ejector enforce ratelimit 
81-                 if (
82-                     isEjector[msg .sender ] && 
83-                     quorumEjectionParams[quorumNumber].rateLimitWindow >  0  && 
84-                     stakeForEjection +  operatorStake >  amountEjectable
85-                 ){
86-                     stakeEjectedForQuorum[quorumNumber].push (StakeEjection ({
87-                         timestamp: block .timestamp ,
88-                         stakeEjected: stakeForEjection
89-                     }));
90-                     ratelimitHit =  true ;
91-                     break ;
77+             if (amountEjectable >  0  ||  msg .sender  ==  owner ()){
78+                 for (uint8  j =  0 ; j <  _operatorIds[i].length ; ++ j) {
79+                     uint256  operatorStake =  stakeRegistry.getCurrentStake (_operatorIds[i][j], quorumNumber);
80+ 
81+                     //if caller is ejector enforce ratelimit 
82+                     if (
83+                         isEjector[msg .sender ] && 
84+                         quorumEjectionParams[quorumNumber].rateLimitWindow >  0  && 
85+                         stakeForEjection +  operatorStake >  amountEjectable
86+                     ){
87+                         ratelimitHit =  true ;
88+ 
89+                         stakeForEjection +=  operatorStake;
90+                         ++ ejectedOperators;
91+ 
92+                         registryCoordinator.ejectOperator (
93+                             registryCoordinator.getOperatorFromId (_operatorIds[i][j]),
94+                             abi.encodePacked (quorumNumber)
95+                         );
96+ 
97+                         emit  OperatorEjected (_operatorIds[i][j], quorumNumber);
98+ 
99+                         break ;
100+                     }
101+ 
102+                     stakeForEjection +=  operatorStake;
103+                     ++ ejectedOperators;
104+ 
105+                     registryCoordinator.ejectOperator (
106+                         registryCoordinator.getOperatorFromId (_operatorIds[i][j]),
107+                         abi.encodePacked (quorumNumber)
108+                     );
109+                     
110+                     emit  OperatorEjected (_operatorIds[i][j], quorumNumber);
92111                }
93- 
94-                 stakeForEjection +=  operatorStake;
95-                 ++ ejectedOperators;
96- 
97-                 registryCoordinator.ejectOperator (
98-                     registryCoordinator.getOperatorFromId (_operatorIds[i][j]),
99-                     abi.encodePacked (quorumNumber)
100-                 );
101-                 
102-                 emit  OperatorEjected (_operatorIds[i][j], quorumNumber);
103112            }
104113
105114            //record the stake ejected if ejector and ratelimit enforced 
106-             if (! ratelimitHit  &&   isEjector[msg .sender ]){
115+             if (isEjector[msg .sender ]  &&  stakeForEjection  >   0 ){
107116                stakeEjectedForQuorum[quorumNumber].push (StakeEjection ({
108117                    timestamp: block .timestamp ,
109118                    stakeEjected: stakeForEjection
@@ -150,7 +159,7 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
150159     */ 
151160    function amountEjectableForQuorum  (uint8  _quorumNumber ) public  view  returns  (uint256 ) {
152161        uint256  cutoffTime =  block .timestamp  -  quorumEjectionParams[_quorumNumber].rateLimitWindow;
153-         uint256  totalEjectable =  quorumEjectionParams[_quorumNumber].ejectableStakePercent *  stakeRegistry.getCurrentTotalStake (_quorumNumber) /  BIPS_DENOMINATOR;
162+         uint256  totalEjectable =  uint256 ( quorumEjectionParams[_quorumNumber].ejectableStakePercent)  *  uint256 ( stakeRegistry.getCurrentTotalStake (_quorumNumber))  /  uint256 ( BIPS_DENOMINATOR) ;
154163        uint256  totalEjected;
155164        uint256  i;
156165        if  (stakeEjectedForQuorum[_quorumNumber].length  ==  0 ) {
@@ -172,4 +181,4 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
172181        }
173182        return  totalEjectable -  totalEjected;
174183    }
175- }
184+ }
0 commit comments