Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #12

Merged
merged 22 commits into from
Jan 6, 2025
Merged

Dev #12

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
da5cf42
perf: refactor to modifers to use internal functions (#272)
stevennevins Jun 14, 2024
9f92f72
perf: refactor index registry to use internal functions for modifier …
stevennevins Jun 14, 2024
b1f706b
perf: refactor apk modifiers to use internal functions (#268)
stevennevins Jun 14, 2024
89cbd3c
perf: refactor modifiers to use internal functions for stake registry…
stevennevins Jun 14, 2024
dc5385e
fix: storage layout (#275)
0x0aa0 Jun 20, 2024
b816138
feat: reward initiator for ECDSAServiceManagerBase (#274)
Gajesh2007 Jun 22, 2024
d643f3b
fix: comment typos in IServiceManagerUI (#278)
samlaf Jun 25, 2024
c00aad7
fix: correct index get operator restakable strategies (#280)
stevennevins Jul 1, 2024
3b96caf
chore: update dev to eigenlayer contracts dev (#282)
shrimalmadhur Jul 10, 2024
17b1f44
fix: overflow (#290)
0x0aa0 Jul 26, 2024
a9c1aa7
feat: mainnet rewards release tag (#297)
8sunyuan Aug 13, 2024
74438b7
build: update core submodule to new release (#298)
8sunyuan Aug 15, 2024
cb2b334
add overrides (#302)
gpsanant Aug 20, 2024
b42aa0b
onchain socket (#307)
0x0aa0 Oct 11, 2024
3603856
chore: bump dependency with core to v0.4.3-mainnet-rewards-programmat…
stevennevins Oct 28, 2024
67ae0ef
feat: ejection policy change (#313)
0x0aa0 Nov 13, 2024
1dff320
feat: Rewards v2 (#315)
0xrajath Nov 15, 2024
0045229
ejector fix (#322)
0x0aa0 Nov 20, 2024
a80bfe9
fix: ejector owner (#326)
0x0aa0 Dec 4, 2024
80f0f84
test: socket registry (#327)
0x0aa0 Dec 5, 2024
91400d9
docs: fix typos and add note that large array may cause revert (#323)
nadir-akhtar Dec 5, 2024
027226b
fix: Rewards v2 audit fixes (#346)
0xrajath Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ src = "src"
out = "out"
libs = ["lib"]
fs_permissions = [{ access = "read-write", path = "./" }]
gas_limit = 5000000000

ffi = true
no-match-contract = "FFI"
Expand Down
2 changes: 1 addition & 1 deletion lib/eigenlayer-contracts
12 changes: 8 additions & 4 deletions src/BLSApkRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ contract BLSApkRegistry is BLSApkRegistryStorage {

/// @notice when applied to a function, only allows the RegistryCoordinator to call it
modifier onlyRegistryCoordinator() {
require(
msg.sender == address(registryCoordinator),
"BLSApkRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"
);
_checkRegistryCoordinator();
_;
}

Expand Down Expand Up @@ -281,4 +278,11 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
function getOperatorId(address operator) public view returns (bytes32) {
return operatorToPubkeyHash[operator];
}

function _checkRegistryCoordinator() internal view {
require(
msg.sender == address(registryCoordinator),
"BLSApkRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"
);
}
}
65 changes: 37 additions & 28 deletions src/EjectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,45 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
uint32 ejectedOperators;

bool ratelimitHit;
for(uint8 j = 0; j < _operatorIds[i].length; ++j) {
uint256 operatorStake = stakeRegistry.getCurrentStake(_operatorIds[i][j], quorumNumber);

//if caller is ejector enforce ratelimit
if(
isEjector[msg.sender] &&
quorumEjectionParams[quorumNumber].rateLimitWindow > 0 &&
stakeForEjection + operatorStake > amountEjectable
){
stakeEjectedForQuorum[quorumNumber].push(StakeEjection({
timestamp: block.timestamp,
stakeEjected: stakeForEjection
}));
ratelimitHit = true;
break;
if(amountEjectable > 0 || msg.sender == owner()){
for(uint8 j = 0; j < _operatorIds[i].length; ++j) {
uint256 operatorStake = stakeRegistry.getCurrentStake(_operatorIds[i][j], quorumNumber);

//if caller is ejector enforce ratelimit
if(
isEjector[msg.sender] &&
quorumEjectionParams[quorumNumber].rateLimitWindow > 0 &&
stakeForEjection + operatorStake > amountEjectable
){
ratelimitHit = true;

stakeForEjection += operatorStake;
++ejectedOperators;

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

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

break;
}

stakeForEjection += operatorStake;
++ejectedOperators;

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

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

stakeForEjection += operatorStake;
++ejectedOperators;

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

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

//record the stake ejected if ejector and ratelimit enforced
if(!ratelimitHit && isEjector[msg.sender]){
if(isEjector[msg.sender] && stakeForEjection > 0){
stakeEjectedForQuorum[quorumNumber].push(StakeEjection({
timestamp: block.timestamp,
stakeEjected: stakeForEjection
Expand Down Expand Up @@ -150,7 +159,7 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
*/
function amountEjectableForQuorum(uint8 _quorumNumber) public view returns (uint256) {
uint256 cutoffTime = block.timestamp - quorumEjectionParams[_quorumNumber].rateLimitWindow;
uint256 totalEjectable = quorumEjectionParams[_quorumNumber].ejectableStakePercent * stakeRegistry.getCurrentTotalStake(_quorumNumber) / BIPS_DENOMINATOR;
uint256 totalEjectable = uint256(quorumEjectionParams[_quorumNumber].ejectableStakePercent) * uint256(stakeRegistry.getCurrentTotalStake(_quorumNumber)) / uint256(BIPS_DENOMINATOR);
uint256 totalEjected;
uint256 i;
if (stakeEjectedForQuorum[_quorumNumber].length == 0) {
Expand All @@ -172,4 +181,4 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable{
}
return totalEjectable - totalEjected;
}
}
}
6 changes: 5 additions & 1 deletion src/IndexRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract IndexRegistry is IndexRegistryStorage {

/// @notice when applied to a function, only allows the RegistryCoordinator to call it
modifier onlyRegistryCoordinator() {
require(msg.sender == address(registryCoordinator), "IndexRegistry.onlyRegistryCoordinator: caller is not the registry coordinator");
_checkRegistryCoordinator();
_;
}

Expand Down Expand Up @@ -340,4 +340,8 @@ contract IndexRegistry is IndexRegistryStorage {
function totalOperatorsForQuorum(uint8 quorumNumber) external view returns (uint32){
return _latestQuorumUpdate(quorumNumber).numOperators;
}

function _checkRegistryCoordinator() internal view {
require(msg.sender == address(registryCoordinator), "IndexRegistry.onlyRegistryCoordinator: caller is not the registry coordinator");
}
}
Loading
Loading