Skip to content

Commit

Permalink
feat: ejection policy change (#313)
Browse files Browse the repository at this point in the history
* feat: ejection stake capping

* fix: behavior
  • Loading branch information
0x0aa0 authored Nov 13, 2024
1 parent 3603856 commit 67ae0ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
19 changes: 13 additions & 6 deletions src/EjectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,18 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
quorumEjectionParams[quorumNumber].rateLimitWindow > 0 &&
stakeForEjection + operatorStake > amountEjectable
){
stakeEjectedForQuorum[quorumNumber].push(StakeEjection({
timestamp: block.timestamp,
stakeEjected: stakeForEjection
}));
ratelimitHit = true;

stakeForEjection += operatorStake;
++ejectedOperators;

registryCoordinator.ejectOperator(
registryCoordinator.getOperatorFromId(_operatorIds[i][j]),
abi.encodePacked(quorumNumber)
);

emit OperatorEjected(_operatorIds[i][j], quorumNumber);

break;
}

Expand All @@ -103,7 +110,7 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
}

//record the stake ejected if ejector and ratelimit enforced
if(!ratelimitHit && isEjector[msg.sender]){
if(isEjector[msg.sender]){
stakeEjectedForQuorum[quorumNumber].push(StakeEjection({
timestamp: block.timestamp,
stakeEjected: stakeForEjection
Expand Down Expand Up @@ -172,4 +179,4 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
}
return totalEjectable - totalEjected;
}
}
}
2 changes: 1 addition & 1 deletion src/interfaces/IEjectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ interface IEjectionManager {
* @param _quorumNumber The quorum number to view ejectable stake for
*/
function amountEjectableForQuorum(uint8 _quorumNumber) external view returns (uint256);
}
}
4 changes: 2 additions & 2 deletions test/unit/EjectionManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ contract EjectionManagerUnitTests is MockAVSDeployer {
}

function testEjectOperators_MultipleOperatorOutsideRatelimit() public {
uint8 operatorsCanEject = 1;
uint8 operatorsCanEject = 2;
uint8 operatorsToEject = 10;
uint8 numOperators = 10;
uint96 stake = 1 ether;
Expand Down Expand Up @@ -396,4 +396,4 @@ contract EjectionManagerUnitTests is MockAVSDeployer {
_registerOperatorWithCoordinator(operator, MAX_QUORUM_BITMAP, pubKey, stake);
}
}
}
}

0 comments on commit 67ae0ef

Please sign in to comment.