Skip to content

Commit

Permalink
Dev (#9)
Browse files Browse the repository at this point in the history
* perf: refactor to modifers to use internal functions (Layr-Labs#272)

* perf: refactor index registry to use internal functions for modifier (Layr-Labs#269)

* fix: deprecated struct field for earning receiver

* perf: move modifier logic to internal function

* perf: refactor apk modifiers to use internal functions (Layr-Labs#268)

* fix: deprecated struct field for earning receiver

* perf: move modifier logic to internal function

* perf: refactor modifiers to use internal functions for stake registry (Layr-Labs#266)

* fix: deprecated struct field for earning receiver

* refactor: require statements to internal functions

* test: update revert reason strings

* fix: storage layout (Layr-Labs#275)

updated inheritance to allow the EigenDAServiceManager to maintain its current storage layout

* feat: reward initiator for ECDSAServiceManagerBase (Layr-Labs#274)

* feat: reward initiator for ECDSAServiceManagerBase

* fix: update gap

* feat: changes to onlyRewardsInitiator modifier

* fix: error code

* fix: comment typos in IServiceManagerUI (Layr-Labs#278)

* fix: correct index get operator restakable strategies (Layr-Labs#280)

* fix: add unit tests for ECDSAServiceManager and fix index in getOperatorRestakableStrategies

* chore: formatter

* chore: formatter

* chore: update dev to eigenlayer contracts dev (Layr-Labs#282)

* chore: update to latest eigenlayer-contracts dev

* fix: update mocks

* fix: increase gas limit

* fix: overflow (Layr-Labs#290)

* feat: mainnet rewards release tag (Layr-Labs#297)

* build: update core submodule to new release (Layr-Labs#298)

* build: update core submodule to new release

* fix: flakey tests from pepe upgrade

* add overrides (Layr-Labs#302)

Co-authored-by: steven <[email protected]>

* onchain socket (Layr-Labs#307)

* feat: onchain socket

moves sockets onchain to SM

* feat: socket registry

- move storage to new registry
- leave event in RegCoord
- trim bytecode from error strings

* fix: internal function

internal function to update socket

* chore: bump dependency with core to v0.4.3-mainnet-rewards-programmatic-incentives (Layr-Labs#314)

* chore: bump core dep

* fix: intefface changes from dependency bump

* test: vm.skip stale stake case

* feat: ejection policy change (Layr-Labs#313)

* feat: ejection stake capping

* fix: behavior

* feat: Rewards v2 (Layr-Labs#315)

* chore: bump up eigenlayer contracts dependency

* feat: createAVSPerformanceRewardsSubmission in AVSServiceManager

* feat: setClaimerFor

* feat: updated IServiceManager

* fix: onlyOwner for setClaimerFor

* refactor: commission to split terminology

* test: not owner

* test: erc20 not approved

* test: single submission

* test: multiple submissions

* test: setClaimer

* chore: updated events

* chore: updated submodules

* ejector fix (Layr-Labs#322)

* fix: ejector

* fix: ejector

* fix: nit

* fix: for real this time

* test: fix

* fix: ejector owner (Layr-Labs#326)

* test: socket registry (Layr-Labs#327)

* docs: fix typos and add note that large array may cause revert (Layr-Labs#323)

---------

Co-authored-by: steven <[email protected]>
Co-authored-by: quaq <[email protected]>
Co-authored-by: Gajesh Naik <[email protected]>
Co-authored-by: Samuel Laferriere <[email protected]>
Co-authored-by: Madhur Shrimal <[email protected]>
Co-authored-by: Michael Sun <[email protected]>
Co-authored-by: Gautham Anant <[email protected]>
Co-authored-by: Rajath Alex <[email protected]>
Co-authored-by: Nadir Akhtar <[email protected]>
  • Loading branch information
10 people authored Jan 2, 2025
1 parent 88c320f commit 9a0c717
Show file tree
Hide file tree
Showing 40 changed files with 2,858 additions and 951 deletions.
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

0 comments on commit 9a0c717

Please sign in to comment.