Skip to content

Commit e54c5e8

Browse files
committed
feat: implement pepe
* move state into Storage contract * remove withdrawal proof method * feat: poc for partial withdrawal batching * feat: remove beaconChainOracle in favor of 4788 * modify verifyStaleBalance to use plural form * add pause flags for new methods * deprecate old state variables * minor cleanup and commenting * chore: get things compiling * i commented out/deleted a bajillion tests * fix: adjust storage footprint to be consistent with m2 * feat: adjust verifyStaleBalance to allow anyone to start a checkpoint * removes staleness concept from pod and manager state * clean: clean up start checkpoint logic * clean: remove comments * clean: remove outdated comment and rename proofs method * fix: remove unused variable and deprecate another * chore: rename lastFinalizedCheckpoint to lastCheckpointTimestamp * feat: add events for checkpoint creation and progression * feat: remove unneeded oracle interface from EigenPodManager * feat: remove unnecessary state root caching and add ValidatorWithdrawn event * feat: remove all use of the delayed withdrawal router (#524) * modify activateRestaking flow to use checkpointing * remove withdrawNonBeaconChainETHBalanceWei in favor of checkpointing * feat: remove staleness grace period * feat: add flag to startCheckpoint to prevent 0-balance checkpoints * chore: move currentCheckpoint to a public getter and update IEigenPod interface * chore: fix comment, update interfaces, add event * chore: clarify comment on activateRestaking * feat: skip validator if already checkpointed * fix: finish rebase * chore: make bindings * fix: swap inequality check to correctly skip duplicate proofs * chore: make bindings * test: modify integration test framework to support pepe (#563) * test: basic epoch processing * wip: balance proofs somewhat functional * test: flesh out beacon chain abi and test workflow * test: cleanup * test: add basic invariant checks for checkpoint proofs * test: add tests for full exits * feat: checkpoint proofs use balance container root * also refactors and cleans up BeaconChainProofs * more refactor/cleanup to come * chore: more proof library cleanup, removing unused constants * chore: additional cleanup and renaming of proof constants for consistency * chore: clean comments and reorganize constants * chore: remove delayedWithdrawalRouter from EigenPod * feat: adjust storage sizes for fields in checkpoint struct * feat: remove activateRestaking in favor of startCheckpoint (#577) * see PR comment for details * test: add proofgen test contract * fix: rename and add balance proof * feat: track balance exited for checkpoints * chore: deprecate deneb fork timestamp functions in EigenPodManager * test: fix existing integration tests * test: fix some unit tests and remove many outdated tests * test: start setting up new integration tests * fix: fixes two issues with verifyWC timing * verifyWC -> startCheckpoint in the same block no longer results in a bricked checkpoint * verifyWC using a timestamp older than the current checkpoint no longer allows you to submit a checkpoint proof for the new validator * chore: fix outdated comment * test: fleshed out eigenpod test flows * also reduced number of validators being generated by tests (for speed) * test: flesh out additional pod flows * chore: make bindings * test: add checks for several integration tests * fix: add additional pause condition for verifyStaleBalance * docs: add initial EigenPod docs * docs: clean and update EigenPodManager docs * chore: small wip to eigenpod docs and contract comment cleanup * chore: fix gas metering test to be consistent * also minor clarity tweak in verifyCheckpointProofs * test: eigenpod unit tests with checkpointing (#591) * test: testings init * test: eigenpod unit tests refactor * test: startCheckpoint unit tests * test: pod unit tests * fix: rebase changes * chore: make bindings * chore: revert pod changes * test: add several tests and checks --------- Co-authored-by: wadealexc <[email protected]> * chore: cleanup dwr and unused code (#593) * chore: cleanup dwr and unused code * chore: comment out pod specs * feat: remove staleness timing window * chore: update IEigenPod interface with updated comments * chore: fix bindings * test: finish verify start complete flow for pepe integration tests * chore: fix bindings * test: add slashing and native eth integration tests * build: partial withdrawal batching upgrade scripts (#598) * build: preprod pod upgrade scripts * chore: cleanup unused files * chore: add pepe deployment output * docs: finish main eigenpod docs and improve commenting * docs: finish main eigenpod docs * feat: remove hasRestaked and lastCheckpointTimestamp checks * test: add tests for constructor and initialize * test: fix mainnet fork tests and compiler warnings * docs: update diagrams for pepe * chore: upgrade preprod eigenpods (#611) * chore: upgrade preprod eigenpods * chore: remove unneeded logs * chore: deploy and update deployment addresses * feat: public block root getter (#612) * docs: update user flow diagrams to mention supported tokens * also increases resolution * feat: add proof submitter address (#629) * feat: add proof submitter address * test: add event emission test * docs: fix comments and add proof submitter to docs * chore: add sigma prime audit * feat: deploy new pods to holesky preprod * includes proofSubmitter address * feat: update PEPE events (#632) * feat: mock out new events for EigenPodManager * chore: make bindings * feat: remove unneeded event change and update tests * chore: make bindings * fix: final event versions * chore: upgrade preprod with new PEPE events * docs: update audit report
1 parent 3b47ccf commit e54c5e8

File tree

141 files changed

+10228
-13392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+10228
-13392
lines changed
Binary file not shown.

certora/harnesses/EigenPodHarness.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ contract EigenPodHarness is EigenPod {
77

88
constructor(
99
IETHPOSDeposit _ethPOS,
10-
IDelayedWithdrawalRouter _delayedWithdrawalRouter,
1110
IEigenPodManager _eigenPodManager,
1211
uint64 _MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR,
1312
uint64 _GENESIS_TIME
1413
)
15-
EigenPod(_ethPOS, _delayedWithdrawalRouter, _eigenPodManager, _MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR, _GENESIS_TIME) {}
14+
EigenPod(_ethPOS, _eigenPodManager, _MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR, _GENESIS_TIME) {}
1615

1716
function get_validatorIndex(bytes32 pubkeyHash) public view returns (uint64) {
1817
return _validatorPubkeyHashToInfo[pubkeyHash].validatorIndex;

certora/scripts/core/verifyStrategyManager.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ solc-select use 0.8.12
77

88
certoraRun certora/harnesses/StrategyManagerHarness.sol \
99
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol \
10-
src/contracts/pods/EigenPodManager.sol src/contracts/pods/EigenPod.sol src/contracts/pods/DelayedWithdrawalRouter.sol \
10+
src/contracts/pods/EigenPodManager.sol src/contracts/pods/EigenPod.sol \
1111
src/contracts/strategies/StrategyBase.sol src/contracts/core/DelegationManager.sol \
1212
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
1313
--verify StrategyManagerHarness:certora/specs/core/StrategyManager.spec \

certora/scripts/pods/verifyEigenPod.sh

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@ then
33
RULE="--rule $2"
44
fi
55

6-
solc-select use 0.8.12
6+
# solc-select use 0.8.12
77

8-
certoraRun certora/harnesses/EigenPodHarness.sol \
9-
src/contracts/core/DelegationManager.sol src/contracts/pods/EigenPodManager.sol \
10-
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
11-
src/contracts/core/StrategyManager.sol \
12-
src/contracts/strategies/StrategyBase.sol \
13-
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol \
14-
lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol \
15-
--verify EigenPodHarness:certora/specs/pods/EigenPod.spec \
16-
--solc_via_ir \
17-
--solc_optimize 1 \
18-
--optimistic_loop \
19-
--prover_args '-recursionEntryLimit 3' \
20-
--optimistic_hashing \
21-
--parametric_contracts EigenPodHarness \
22-
$RULE \
23-
--loop_iter 1 \
24-
--packages @openzeppelin=lib/openzeppelin-contracts @openzeppelin-upgrades=lib/openzeppelin-contracts-upgradeable \
25-
--msg "EigenPod $1 $2" \
8+
# certoraRun certora/harnesses/EigenPodHarness.sol \
9+
# src/contracts/core/DelegationManager.sol src/contracts/pods/EigenPodManager.sol \
10+
# src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
11+
# src/contracts/core/StrategyManager.sol \
12+
# src/contracts/strategies/StrategyBase.sol \
13+
# lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol \
14+
# lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol \
15+
# --verify EigenPodHarness:certora/specs/pods/EigenPod.spec \
16+
# --optimistic_loop \
17+
# --prover_args '-recursionEntryLimit 3' \
18+
# --optimistic_hashing \
19+
# --parametric_contracts EigenPodHarness \
20+
# $RULE \
21+
# --loop_iter 1 \
22+
# --packages @openzeppelin=lib/openzeppelin-contracts @openzeppelin-upgrades=lib/openzeppelin-contracts-upgradeable \
23+
# --msg "EigenPod $1 $2" \

certora/scripts/pods/verifyEigenPodManager.sh

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ then
33
RULE="--rule $2"
44
fi
55

6-
solc-select use 0.8.12
6+
# solc-select use 0.8.12
77

8-
certoraRun certora/harnesses/EigenPodManagerHarness.sol \
9-
src/contracts/core/DelegationManager.sol src/contracts/pods/EigenPod.sol src/contracts/strategies/StrategyBase.sol src/contracts/core/StrategyManager.sol \
10-
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
11-
--verify EigenPodManagerHarness:certora/specs/pods/EigenPodManager.spec \
12-
--solc_via_ir \
13-
--solc_optimize 1 \
14-
--optimistic_loop \
15-
--optimistic_fallback \
16-
--optimistic_hashing \
17-
--parametric_contracts EigenPodManagerHarness \
18-
$RULE \
19-
--loop_iter 3 \
20-
--packages @openzeppelin=lib/openzeppelin-contracts @openzeppelin-upgrades=lib/openzeppelin-contracts-upgradeable \
21-
--msg "EigenPodManager $1 $2" \
8+
# certoraRun certora/harnesses/EigenPodManagerHarness.sol \
9+
# src/contracts/core/DelegationManager.sol src/contracts/pods/EigenPod.sol src/contracts/strategies/StrategyBase.sol src/contracts/core/StrategyManager.sol \
10+
# src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
11+
# --verify EigenPodManagerHarness:certora/specs/pods/EigenPodManager.spec \
12+
# --optimistic_loop \
13+
# --optimistic_fallback \
14+
# --optimistic_hashing \
15+
# --parametric_contracts EigenPodManagerHarness \
16+
# $RULE \
17+
# --loop_iter 3 \
18+
# --packages @openzeppelin=lib/openzeppelin-contracts @openzeppelin-upgrades=lib/openzeppelin-contracts-upgradeable \
19+
# --msg "EigenPodManager $1 $2" \

certora/specs/core/Slasher.spec

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ methods {
2727
// external calls to EigenPod
2828
function _.withdrawRestakedBeaconChainETH(address,uint256) external => DISPATCHER(true);
2929

30-
// external calls to DelayedWithdrawalRouter (from EigenPod)
31-
function _.createDelayedWithdrawal(address, address) external => DISPATCHER(true);
32-
3330
// external calls to PauserRegistry
3431
function _.isPauser(address) external => DISPATCHER(true);
3532
function _.unpauser() external => DISPATCHER(true);

certora/specs/core/StrategyManager.spec

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ methods {
3131

3232
// external calls to EigenPod
3333
function _.withdrawRestakedBeaconChainETH(address,uint256) external => DISPATCHER(true);
34-
35-
// external calls to DelayedWithdrawalRouter (from EigenPod)
36-
function _.createDelayedWithdrawal(address, address) external => DISPATCHER(true);
3734

3835
// external calls to PauserRegistry
3936
function _.isPauser(address) external => DISPATCHER(true);

certora/specs/pods/EigenPod.spec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ methods {
7171
function validatorPubkeyHashToInfo(bytes32 validatorPubkeyHash) external returns (IEigenPod.ValidatorInfo) envfree;
7272
function provenWithdrawal(bytes32 validatorPubkeyHash, uint64 slot) external returns (bool) envfree;
7373
function validatorStatus(bytes32 pubkeyHash) external returns (IEigenPod.VALIDATOR_STATUS) envfree;
74-
function delayedWithdrawalRouter() external returns (address) envfree;
7574
function nonBeaconChainETHBalanceWei() external returns (uint256) envfree;
7675

7776
// harnessed functions

certora/specs/pods/EigenPodManager.spec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ methods {
2626

2727
// external calls to EigenPod
2828
function _.withdrawRestakedBeaconChainETH(address,uint256) external => DISPATCHER(true);
29-
3029
// external calls to PauserRegistry
3130
function _.isPauser(address) external => DISPATCHER(true);
3231
function _.unpauser() external => DISPATCHER(true);
@@ -36,7 +35,6 @@ methods {
3635
function getPod(address podOwner) external returns (address) envfree;
3736
function ethPOS() external returns (address) envfree;
3837
function eigenPodBeacon() external returns (address) envfree;
39-
function beaconChainOracle() external returns (address) envfree;
4038
function getBlockRootAtTimestamp(uint64 timestamp) external returns (bytes32) envfree;
4139
function strategyManager() external returns (address) envfree;
4240
function slasher() external returns (address) envfree;

docs/README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[middleware-repo]: https://github.com/Layr-Labs/eigenlayer-middleware/
22

3-
## EigenLayer M2 Docs
3+
## EigenLayer Docs - v0.4.0 Release
44

55
This repo contains the EigenLayer core contracts, which enable restaking of liquid staking tokens (LSTs) and beacon chain ETH to secure new services, called AVSs (actively validated services). For more info on AVSs, check out the EigenLayer middleware contracts [here][middleware-repo].
66

@@ -33,16 +33,14 @@ This document provides an overview of system components, contracts, and user rol
3333
| -------- | -------- | -------- |
3434
| [`EigenPodManager.sol`](../src/contracts/pods/EigenPodManager.sol) | Singleton | Transparent proxy |
3535
| [`EigenPod.sol`](../src/contracts/pods/EigenPod.sol) | Instanced, deployed per-user | Beacon proxy |
36-
| [`DelayedWithdrawalRouter.sol`](../src/contracts/pods/DelayedWithdrawalRouter.sol) | Singleton | Transparent proxy |
37-
| [`succinctlabs/EigenLayerBeaconOracle.sol`](https://github.com/succinctlabs/telepathy-contracts/blob/main/external/integrations/eigenlayer/EigenLayerBeaconOracle.sol) | Singleton | UUPS proxy | [`0x40B1...9f2c`](https://goerli.etherscan.io/address/0x40B10ddD29a2cfF33DBC420AE5bbDa0649049f2c) |
3836

3937
These contracts work together to enable native ETH restaking:
40-
* Users deploy `EigenPods` via the `EigenPodManager`, which contain beacon chain state proof logic used to verify a validator's withdrawal credentials, balance, and exit. An `EigenPod's` main role is to serve as the withdrawal address for one or more of a user's validators.
38+
* Users deploy `EigenPods` via the `EigenPodManager`, which contain beacon chain state proof logic used to verify a validator's withdrawal credentials and current balances. An `EigenPod's` main role is to serve as the fee recipient and/or withdrawal credentials for one or more of a user's validators.
4139
* The `EigenPodManager` handles `EigenPod` creation and accounting+interactions between users with restaked native ETH and the `DelegationManager`.
42-
* The `DelayedWithdrawalRouter` imposes a 7-day delay on completing partial beacon chain withdrawals from an `EigenPod`. This is primarily to add a stopgap against a hack being able to instantly withdraw funds (note that all withdrawals from EigenLayer -- other than partial withdrawals earned by validators -- are initiated via the `DelegationManager`).
43-
* The `EigenLayerBeaconOracle` provides beacon chain block roots for use in various proofs. The oracle is supplied by Succinct's Telepathy protocol ([docs link](https://docs.telepathy.xyz/)).
4440

45-
See full documentation in [`/core/EigenPodManager.md`](./core/EigenPodManager.md).
41+
See full documentation in:
42+
* [`/core/EigenPodManager.md`](./core/EigenPodManager.md)
43+
* [`/core/EigenPod.md`](./core/EigenPod.md)
4644

4745
#### StrategyManager
4846

@@ -123,8 +121,7 @@ Stakers can restake any combination of these: a Staker may hold ALL of these ass
123121
* Stakers **withdraw** assets via the DelegationManager, *no matter what assets they're withdrawing*
124122
* Stakers **delegate** to an Operator via the DelegationManager
125123

126-
Unimplemented as of M2:
127-
* Stakers earn yield by delegating to an Operator as the Operator provides services to an AVS
124+
*Unimplemented as of v0.4.0:*
128125
* Stakers are at risk of being slashed if the Operator misbehaves
129126

130127
##### Operator
@@ -136,8 +133,7 @@ An Operator is a user who helps run the software built on top of EigenLayer (AVS
136133
* Operators can **deposit** and **withdraw** assets just like Stakers can
137134
* Operators can opt in to providing services for an AVS using that AVS's middleware contracts. See the [EigenLayer middleware][middleware-repo] repo for more details.
138135

139-
*Unimplemented as of M2:*
140-
* Operators earn fees as part of the services they provide
136+
*Unimplemented as of v0.4.0:*
141137
* Operators may be slashed by the services they register with (if they misbehave)
142138

143139
---
@@ -170,18 +166,18 @@ This flow is mostly useful if a Staker wants to change which Operator they are d
170166

171167
Completing a queued withdrawal as tokens is roughly the same for both native ETH and LSTs.
172168

173-
However, note that *before* a withdrawal can be completed, native ETH stakers will need to perform additional steps, detailed in the "Withdrawal Processing" diagrams below.
169+
However, note that *before* a withdrawal can be completed, native ETH stakers will need to perform additional steps, detailed in the diagrams below.
174170

175171
![.](./images/Staker%20Flow%20Diagrams/Complete%20Withdrawal%20as%20Tokens.png)
176172

177-
##### Withdrawal Processing: Validator Exits
173+
##### `EigenPods`: Processing Validator Exits
178174

179175
If a Staker wants to fully withdraw from the beacon chain, they need to perform these additional steps before their withdrawal is completable:
180176

181177
![.](./images/Staker%20Flow%20Diagrams/Validator%20Exits.png)
182178

183-
##### Withdrawal Processing: Partial Beacon Chain Withdrawals
179+
##### `EigenPods`: Processing Validator Yield
184180

185-
If a Staker wants to withdraw consensus rewards from the beacon chain, they do NOT go through the `DelegationManager`. This is the only withdrawal type that is not initiated in the `DelegationManager`:
181+
As the Staker's `EigenPod` accumulates consensus layer or execution layer yield, the `EigenPod's` balance will increase. The Staker can Checkpoint their validator to claim this yield as shares, which can either remain staked in EigenLayer or be withdrawn via the `DelegationManager` withdrawal queue:
186182

187-
![.](./images/Staker%20Flow%20Diagrams/Partial%20Withdrawals.png)
183+
![.](./images/Staker%20Flow%20Diagrams/Validator%20Yield.png)

0 commit comments

Comments
 (0)