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

test: rewards v2 txs #339

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c29cf07
feat: automated ejector (#146)
0x0aa0 Apr 11, 2024
f224cf9
chore: bump forge-std and remove ds-test dependency (#227)
stevennevins Apr 13, 2024
6454c05
feat: allowlist mapping (#226)
0x0aa0 Apr 15, 2024
0328639
feat: return ops ejected (#228)
0x0aa0 Apr 16, 2024
59ebd32
Use uint32 for number of ejected operators (#232)
jianoaix Apr 17, 2024
e18c19e
feat: service manager payments (#242)
8sunyuan Apr 23, 2024
2b65511
fix: spacing (#244)
8sunyuan Apr 24, 2024
deebd4b
chore: rename audit report for clarity and consistency with core (#245)
wadealexc Apr 25, 2024
1feb6ae
feat: batch operator id conversions (#248)
0x0aa0 Apr 29, 2024
1703d25
fix: vm assume too many rejections (#247)
stevennevins Apr 29, 2024
74c86d2
feat: reregistration delay (#246)
0x0aa0 Apr 30, 2024
9968b1d
feat: ecdsa service manager (#234)
stevennevins May 1, 2024
8ed82a4
fix: add init function for staleStakesForbidden in BLSSignatureChecke…
stevennevins May 6, 2024
4ad5c85
feat: update core contracts submodule (#254)
8sunyuan May 7, 2024
c5b419a
fix: multiple rangepayments with same token (#257)
8sunyuan May 8, 2024
a23de11
test: fix flaky fuzz tests hitting the default operator who is alread…
stevennevins May 14, 2024
0351419
chore: update license (#259)
ChaoticWalrus May 21, 2024
afbcba8
feat: ecdsa key rotation (#252)
stevennevins May 23, 2024
1142437
fix: storage gap (#261)
stevennevins May 24, 2024
a7b1851
feat: `paymentInitiator` role in `ServiceManagerBase` (#260)
diyahir May 28, 2024
51e36f1
chore: refactor with RewardsCoordinator (#262)
8sunyuan May 30, 2024
c75eb8e
chore: rewards release submodule (#264)
8sunyuan Jun 5, 2024
b45dced
fix: deprecated struct field for earning receiver (#265)
stevennevins Jun 6, 2024
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
e2b71a8
feat: test rewards v2 init
0xrajath Dec 16, 2024
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
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
path = lib/eigenlayer-contracts
url = https://github.com/Layr-labs/eigenlayer-contracts
branch = dev
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/Openzeppelin/openzeppelin-contracts
Expand Down
32 changes: 29 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,35 @@ Licensor: Layr Labs, Inc.
Licensed Work: EigenLayer Middleware Contracts
The Licensed Work is (c) 2023 Layr Labs, Inc.

Additional Use Grant: None.

Change Date: 2025-10-16 (October 16th, 2025)
Additional Use Grant:

You may additionally use any of the software included in the following repositories
[here](https://docs.google.com/spreadsheets/d/1PlJRow5C0GMqXZlIxRm5CEnkhH-gMV1wIdq1pCfbZco/edit?usp=sharing)
(“Additional Use Grant Software”) for production commercial uses, but only if such
uses are (i) built on or using the EigenLayer Protocol or EigenDA, and (ii) not
Competing Uses.

“Competing Use” means any use of the Additional Use Grant Software in any product,
protocol, application or service that is made available to third parties and that
(i) substitutes for use of EigenLayer Protocol or EigenDA, (ii) offers the same or
substantially similar functionality as the EigenLayer Protocol or EigenDA or
(iii) is built on or using a protocol with substantially similar functionality as
the EigenLayer Protocol.

EigenLayer Protocol means the restaking protocol as further described in the
documentation [here](https://docs.eigenlayer.xyz/), as updated from time to time.

EigenDA means the data availability protocol built on top of the EigenLayer
Protocol as further described in the documentation
[here](https://docs.eigenlayer.xyz/eigenda/overview), as updated from time to time.

Change Dates:

- All commits at or prior to commit a23de118e7d16081d350c7f83c24261d1421b0ba
(i.e. committed to this repository on or before May 19, 2024, the date of) have a
change date of 2025-10-16 (October 16th, 2025)
- All commits after a23de118e7d16081d350c7f83c24261d1421b0ba (i.e. committed to this
repository after May 19, 2024) have a change date of 2027-05-01 (May 1st, 2027)

Change License: MIT

Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ EigenLayer AVSs ("actively validated services") are protocols that make use of E
**Currently, each AVS needs to implement one thing on-chain:** registration/deregistration conditions that define how an Operator registers for/deregisters from the AVS. This repo provides building blocks to support these functions.

*Eventually,* the core contracts and this repo will be extended to cover other conditions, including:
* payment conditions that define how an Operator is paid for the services it provides
* reward conditions that define how an Operator is rewarded for the services it provides
* slashing conditions that define "malicious behavior" in the context of the AVS, and the punishments for this behavior

*... however, the design for these conditions is still in progress.*
Expand Down Expand Up @@ -102,7 +102,7 @@ The main thing that links an AVS to the EigenLayer core contracts is that when E

These methods ensure that the Operator registering with the AVS is also registered as an Operator in EigenLayer core. In this repo, these methods are called by the `ServiceManagerBase`.

Eventually, Operator slashing and payment for services will be part of the middleware/core relationship, but these features aren't implemented yet and their design is a work in progress.
Eventually, Operator slashing and rewards for services will be part of the middleware/core relationship, but these features aren't implemented yet and their design is a work in progress.

### System Components

Expand Down
2 changes: 1 addition & 1 deletion docs/ServiceManagerBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
The `ServiceManagerBase` represents the AVS's address relative to EigenLayer core. When registering or deregistering an operator from an AVS, the AVS's `ServiceManagerBase` communicates this change to the core contracts, allowing the core contracts to maintain an up-to-date view on operator registration status with various AVSs.

*As of M2*:
* Currently, this contract is used by the `AVSDirectory` to keep track of operator registration and deregistration. Eventually, this relationship will be expanded to allow operators to opt in to slashing and payments for services.
* Currently, this contract is used by the `AVSDirectory` to keep track of operator registration and deregistration. Eventually, this relationship will be expanded to allow operators to opt in to slashing and rewards for services.

---

Expand Down
2 changes: 1 addition & 1 deletion docs/experimental/AVS-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This document aims to describe and summarize how actively validated services (AV
- enabling operators to continuously update their commitments to middlewares, and
- enabling AVS to freeze operators for the purpose of slashing (the corresponding unfreeze actions are determined by the veto committee).

We are currently in the process of implementing the API for payment flow from AVSs to operators in EigenLayer. Details of this API will be added to this document in the near future.
We are currently in the process of implementing the API for rewards flow from AVSs to operators in EigenLayer. Details of this API will be added to this document in the near future.

The following figure summarizes scope of this document:
![Doc Outline](../images/middleware_outline_doc.png)
Expand Down
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
1 change: 0 additions & 1 deletion lib/ds-test
Submodule ds-test deleted from e28215
2 changes: 1 addition & 1 deletion lib/eigenlayer-contracts
65 changes: 65 additions & 0 deletions script/TestRewardsV2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import {Script, stdJson} from "forge-std/Script.sol";

import {IRewardsCoordinator} from "lib/eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IServiceManager} from "src/interfaces/IServiceManager.sol";
import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {IStrategy} from "lib/eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";

contract TestRewardsV2 is Script {
IRewardsCoordinator rewardsCoordinator =
IRewardsCoordinator(0xAcc1fb458a1317E886dB376Fc8141540537E68fE);
IServiceManager eigenDAServiceManager =
IServiceManager(0xD4A7E1Bd8015057293f0D0A557088c286942e84b);

IERC20 WETH = IERC20(0x94373a4919B3240D86eA41593D5eBa789FEF3848);

// operators
address OPERATOR_STAKELY = 0x06Fb6C463cC68100355624B6006471A960704126;
address OPERATOR_EIGENYIELDS = 0x5ACCC90436492F24E6aF278569691e2c942A676d;
address OPERATOR_XYZ = 0x758E016468E5E90cDB42e743881C2e921d8e7bF8;
address OPERATOR_GALAXY = 0x0a3e3d83C99B27cA7540720b54105C79Cd58dbdD;
address OPERATOR_SINOPMM = 0xB25430A1Ba8F2033834Ba30AAB8279CB1Cb6c9a6;

//strategies
IStrategy STRATEGY_WETH =
IStrategy(0x80528D6e9A2BAbFc766965E0E26d5aB08D9CFaF9);
IStrategy STRATEGY_STETH =
IStrategy(0x7D704507b76571a51d9caE8AdDAbBFd0ba0e63d3);

IRewardsCoordinator.StrategyAndMultiplier[] defaultStrategyAndMultipliers;

function _setupStrategyAndMultiplier() internal {
defaultStrategyAndMultipliers = new IRewardsCoordinator.StrategyAndMultiplier[](
2
);

defaultStrategyAndMultipliers[0] = IRewardsCoordinator
.StrategyAndMultiplier({strategy: STRATEGY_WETH, multiplier: 2e18});

defaultStrategyAndMultipliers[1] = IRewardsCoordinator
.StrategyAndMultiplier({
strategy: STRATEGY_STETH,
multiplier: 1e18
});
}

function tx_1() public {
IRewardsCoordinator.RewardsSubmission[]
memory rewardsSubmissions = new IRewardsCoordinator.RewardsSubmission[](
1
);

rewardsSubmissions[0] = IRewardsCoordinator.RewardsSubmission({
strategiesAndMultipliers: defaultStrategyAndMultipliers,
token: WETH,
amount: 1e18,
startTimestamp: uint32(1734220800), // 2024-12-15 00:00:00 UTC
duration: uint32(86400) // 1 day
});

eigenDAServiceManager.createAVSRewardsSubmission(rewardsSubmissions);
}
}
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"
);
}
}
Loading
Loading