Skip to content

Commit 415170a

Browse files
gpsanantwadealexc
authored andcommitted
feat: add share helpers (#964)
* feat: add share helpers * fix: add deposit scaling factor * fix: rebase fix: slashable window boundaries (#965) * fix: slashable window boundaries * test: regression for alm * test: update withdrawal delay not passed reversion * test: burning indices * refactor: switch conditionals * fix: added unit tests * test: assert slashable shares in queue * fix: typos --------- Co-authored-by: Yash Patil <ypatil12@gmail.com> refactor: small cleanup (#959) refactor small cleanup chore: `forge fmt` fix: `getQueuedWithdrawals` + test fix: add constructor back test: `totalQueued` > `withdrawal.strategies.length` test(wip): `completeQueuedWithdrawals` currently failing fix: effectBlock test(wip): @8sunyuan patch fix: one flaky test fix: second flaky test refactor: remove max strats list (#968) feat: slashing patch upgrade script (#967) * feat: initial deploy * feat: slashing patch fix non-present upgrade.json chore: bindings (#969) fix: try catch out of gas edge case (#971) chore: slashing consolidated script (#972) test: more slashing integration todos (#961) * test(wip): todos * fix: dealloc issue * fix: remaining * fix: forktest upgrade issue * test: add `check_Withdrawal_AsShares_State_AfterSlash` * refactor: cleanup * fix: ci * refactor: review changes docs: wip slashing docs (#925) * docs: add slashing docs * chore: bindings * docs: fixed commenting and updated queue withdrawal docs * docs: minor cleanup --------- Co-authored-by: Nadir Akhtar <nadirakhtar123@gmail.com> refactor: scaled shares accounting (#975) * fix: correct expected share calc * chore: bindings * fix: rounding on failing unit test refactor: final slashing cleanup (#982) * chore: clean comments and naming in dm * refactor: simplify undelegate method * feat: removed 0 address check because 0 stakers cant be delegated * feat: condensed non-staker caller logic * refactor: remove unnecessary check * feat: use checks-effects-interactions when completing withdrawals * feat: remove implicit public method for queuedWithdrawals and impl dedicated getter * feat: deprecate withdrawer field * chore: make bindings and clean compile errors * refactor: redelegate reuses delegateTo and undelegate * fix: broken integration test * docs: update to reflect deprecated field * feat: add getter for stakers withdrawal roots chore: remove unused avsd events (#984) fix: integration test initialization params (#978) * fix: initialization params * fix: roll blocks usage fix: `SignatureUtils` construction (#990) * fix: integration test initialization params (#978) * fix: initialization params * fix: roll blocks usage * fix: `SignatureUtils` construction --------- Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: davidironblocks <david@ironblocks.com> fix: readd manual checks (#996) * fix: readd manual checks * chore: forge fmt feat: slashing 1.0.3 upgrade script (#995) * feat: add step 1 * feat: step 1 & 2 complete; pending step 3 sanity * test: add `_validateProxyDomainSeparators` * feat: add rc validation --------- Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com> fix: update alloc config delay bound (#985) * fix: update alloc delay bound * test: remove unnecessary roll chore: storage report (#1000) docs: shares accounting (#997) * docs: shares accounting * docs: fix gh markdown view * docs: try fix gh again * docs: cleanup * docs: edit share accounting * docs: wrap up share accounting doc * docs: edit edge cases --------- Co-authored-by: wadealexc <pragma-services@proton.me> refactor: async burning (#1001) * refactor: burning * chore: fmt * chore: update storage report * chore: update readme * refactor: add burnableShares for epm storage * chore: update storage report test: `Snapshots` lib (#1002) docs: finish delegation manager docs (#1004) * docs: finish delegation manager docs * docs: update docs readme * docs: permission controller * fix: small typos * docs: address feedback * docs: nit --------- Co-authored-by: Michael Sun <michaelsun97@gmail.com> docs: Strategy Manager slashing updates (#999) * docs: update StrategyManager docs with slashing delta * docs: remove references to thirdPartyTransfersForbidden * docs: update strategy docs to latest * also various edits to docs and natspec * chore: fmt and make bindings --------- Co-authored-by: wadealexc <pragma-services@proton.me> docs: EigenPod Manager slashing updates (#1005) * docs: complete EigenPodManager for slashing * docs: add in _beaconChainSlashingFactor state variable note * docs: finish epm docs * chore: make bindings --------- Co-authored-by: wadealexc <pragma-services@proton.me>
1 parent 106f12e commit 415170a

File tree

142 files changed

+20128
-4141
lines changed

Some content is hidden

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

142 files changed

+20128
-4141
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ surya mdreport surya_report.md ./src/contracts/**/*.sol
102102
make bindings
103103
```
104104

105+
### Generate updated Storage Report
106+
107+
To update the storage reports in `/docs/storage-report` run:
108+
109+
```bash
110+
make storage-report
111+
```
112+
105113
## Deployments
106114

107115
### Current Mainnet Deployment

docs/README.md

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[middleware-repo]: https://github.com/Layr-Labs/eigenlayer-middleware/
2+
[elip-002]: https://github.com/eigenfoundation/ELIPs/blob/main/ELIPs/ELIP-002.md
23

3-
## EigenLayer Docs - v0.4.0 Release
4+
## EigenLayer Docs - v1.0.0 Release
45

5-
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].
6+
This repo contains the EigenLayer core contracts, which enable restaking of liquid staking tokens (LSTs), beacon chain ETH, and permissionlessly deployed ERC20 Strategies to secure new services called AVSs (actively validated services). For more info on AVSs, check out the EigenLayer middleware contracts [here][middleware-repo].
67

7-
This document provides an overview of system components, contracts, and user roles. Further documentation on the major system contracts can be found in [/core](./core/).
8+
This document provides an overview of system components, contracts, and user roles and is up-to-date with the latest [ELIP-002][elip-002]. Further documentation on the major system contracts can be found in [/core](./core/).
89

910
#### Contents
1011

@@ -14,7 +15,8 @@ This document provides an overview of system components, contracts, and user rol
1415
* [`DelegationManager`](#delegationmanager)
1516
* [`RewardsCoordinator`](#rewardscoordinator)
1617
* [`AVSDirectory`](#avsdirectory)
17-
* [`Slasher`](#slasher)
18+
* [`AllocationManager`](#allocationmanager)
19+
* [`PermissionController`](#permissioncontroller)
1820
* [Roles and Actors](#roles-and-actors)
1921
* [Common User Flows](#common-user-flows)
2022
* [Depositing Into EigenLayer](#depositing-into-eigenlayer)
@@ -53,7 +55,7 @@ See full documentation in:
5355
These contracts work together to enable restaking for ERC20 tokens supported by EigenLayer:
5456
* The `StrategyManager` acts as the entry and exit point for any supported tokens in EigenLayer. It handles deposits into LST-specific strategies, and manages accounting+interactions between users with restaked LSTs and the `DelegationManager`.
5557
* `StrategyFactory` allows anyone to deploy strategies to support deposits/withdrawals for new ERC20 tokens
56-
* `StrategyBaseTVLLimits` is deployed as multiple separate instances, one for each supported token. When a user deposits into a strategy through the `StrategyManager`, this contract receives the tokens and awards the user with a proportional quantity of shares in the strategy. When a user withdraws, the strategy contract sends the LSTs back to the user.
58+
* `StrategyBaseTVLLimits` is deployed as multiple separate instances, one for each supported token. When a user deposits into a strategy through the `StrategyManager`, this contract receives the tokens and awards the user with a proportional quantity of deposit shares in the strategy. When a user withdraws, the strategy contract sends the LSTs back to the user.
5759

5860
See full documentation in [`/core/StrategyManager.md`](./core/StrategyManager.md).
5961

@@ -63,9 +65,13 @@ See full documentation in [`/core/StrategyManager.md`](./core/StrategyManager.md
6365
| -------- | -------- | -------- |
6466
| [`DelegationManager.sol`](../src/contracts/core/DelegationManager.sol) | Singleton | Transparent proxy |
6567

66-
The `DelegationManager` sits between the `EigenPodManager` and `StrategyManager` to manage delegation and undelegation of Stakers to Operators. Its primary features are to allow Operators to register as Operators (`registerAsOperator`), to keep track of shares being delegated to Operators across different strategies, and to manage withdrawals on behalf of the `EigenPodManager` and `StrategyManager`.
68+
The `DelegationManager` sits between the `EigenPodManager` and `StrategyManager` to manage delegation and undelegation of stakers to operators. Its primary features are to allow users to become operators, to keep track of delegated shares to operators across different strategies, and to manage withdrawals on behalf of stakers via the `EigenPodManager` and `StrategyManager`.
6769

68-
See full documentation in [`/core/DelegationManager.md`](./core/DelegationManager.md).
70+
The `DelegationManager` is tightly coupled with the `AllocationManager`. The `DelegationManager` ingests information about slashing as part of managing share accounting for stakers whose operators have been slashed. It also receives directives to slash/burn operator shares when an AVS slashes an operator.
71+
72+
See:
73+
* full documentation in [`/core/DelegationManager.md`](./core/DelegationManager.md)
74+
* share accounting documentation in [`/core/accounting/SharesAccounting.md`](./core/accounting/SharesAccounting.md)
6975

7076
#### RewardsCoordinator
7177

@@ -74,9 +80,9 @@ See full documentation in [`/core/DelegationManager.md`](./core/DelegationManage
7480
| [`RewardsCoordinator.sol`](../src/contracts/core/RewardsCoordinator.sol) | Singleton | Transparent proxy |
7581

7682
The `RewardsCoordinator` is the main entry point of submission and claiming of ERC20 rewards in EigenLayer. It carries out three basic functions:
77-
* AVSs (via the AVS's contracts) submit "rewards submissions" to their registered Operators and Stakers over a specific time period
78-
* *Off-chain*, the rewards updater will use each RewardsSubmission time period to apply reward amounts to historical Staker/Operator stake weights. This is consolidated into a merkle root that is posted *on-chain* to the `RewardsCoordinator`, allowing Stakers/Operators to claim their allocated rewards.
79-
* Stakers/Operators can claim rewards posted by the rewards updater.
83+
* AVSs (via the AVS's contracts) submit "rewards submissions" to their registered operators and stakers over a specific time period
84+
* *Off-chain*, the rewards updater will use each RewardsSubmission time period to apply reward amounts to historical staker/operator stake weights. This is consolidated into a merkle root that is posted *on-chain* to the `RewardsCoordinator`, allowing stakers/operators to claim their allocated rewards.
85+
* Stakers/operators can claim rewards posted by the rewards updater.
8086

8187
See full documentation in [`/core/RewardsCoordinator.md`](./core/RewardsCoordinator.md).
8288

@@ -86,21 +92,42 @@ See full documentation in [`/core/RewardsCoordinator.md`](./core/RewardsCoordina
8692
| -------- | -------- | -------- |
8793
| [`AVSDirectory.sol`](../src/contracts/core/AVSDirectory.sol) | Singleton | Transparent proxy |
8894

89-
The `AVSDirectory` handles interactions between AVSs and the EigenLayer core contracts. Once registered as an Operator in EigenLayer core (via the `DelegationManager`), Operators can register with one or more AVSs (via the AVS's contracts) to begin providing services to them offchain. As a part of registering with an AVS, the AVS will record this registration in the core contracts by calling into the `AVSDirectory`.
95+
##### Note: This contract is left unchanged for backwards compatability. Operator<>AVS Registrations are to be replaced entirely with the `AllocationManager` and this contract will be deprecated in a future release.
96+
97+
Previously, the `AVSDirectory` handled interactions between AVSs and the EigenLayer core contracts. Once registered as an operator in EigenLayer core (via the `DelegationManager`), operators could register with one or more AVSs (via the AVS's contracts) to begin providing services to them offchain. As a part of registering with an AVS, the AVS would record this registration in the core contracts by calling into the `AVSDirectory`. As of the slashing release, this process is now managed by the [`AllocationManager`](#allocationmanager).
9098

9199
See full documentation in [`/core/AVSDirectory.md`](./core/AVSDirectory.md).
92100

93101
For more information on AVS contracts, see the [middleware repo][middleware-repo].
94102

95-
#### Slasher
103+
#### AllocationManager
104+
105+
| File | Type | Proxy |
106+
| -------- | -------- | -------- |
107+
| [`AllocationManager.sol`](../src/contracts/core/AllocationManager.sol) | Singleton | Transparent proxy |
108+
109+
The `AllocationManager` is replaces the AVSDirectory with the introduction of _operator sets_ and slashing. It handles several use cases:
110+
* AVSs can create operator sets and can define the EigenLayer Strategies within them
111+
* Operators can register to or deregister from an AVS's operator sets
112+
* Operators can make slashable security commitments to an operator set by allocating a proportion of their total delegated stake for a Strategy to be slashable. Ex. As an operator, I can allocate 50% of my delegated stETH to be slashable by a specific operator set
113+
* AVSs can slash an operator who has allocated to and is registered for one of the AVS's operator sets
114+
115+
See full documentation in [`/core/AllocationManager.md`](./core/AllocationManager.md).
116+
117+
#### PermissionController
96118

97119
| File | Type | Proxy |
98120
| -------- | -------- | -------- |
99-
| [`Slasher.sol`](../src/contracts/core/Slasher.sol) | - | - |
121+
| [`PermissionController.sol`](../src/contracts/permissions/PermissionController.sol) | Singleton | Transparent proxy |
122+
123+
The `PermissionController` allows AVSs and operators to delegate the ability to call certain core contract functions to other addresses. This delegation ability is not available to stakers, and is not available in ALL core contract functions.
100124

101-
<p align="center"><b>
102-
🚧 The Slasher contract is under active development and its interface expected to change. We recommend writing slashing logic without integrating with the Slasher at this point in time. Although the Slasher is deployed, it will remain completely paused/unusable during M2. No contracts interact with it, and its design is not finalized. 🚧
103-
</b><p>
125+
The following core contracts use the `PermissionController` in certain methods:
126+
* `DelegationManager`
127+
* `AllocationManager`
128+
* `RewardsCoordinator`
129+
130+
See full documentation in [`/permissions/PermissionController.md`](./permissions/PermissionController.md).
104131

105132
---
106133

@@ -110,39 +137,33 @@ To see an example of the user flows described in this section, check out our int
110137

111138
##### Staker
112139

113-
A Staker is any party who has assets deposited (or "restaked") into EigenLayer. Currently, these assets can be:
140+
A staker is any party who has assets deposited (or "restaked") into EigenLayer. Currently, these assets can be:
114141
* Native beacon chain ETH (via the EigenPodManager)
115-
* Liquid staking tokens (via the StrategyManager): cbETH, rETH, stETH, ankrETH, OETH, osETH, swETH, wBETH
142+
* Arbitrary ERC20s (via the StrategyManager)
116143

117-
Stakers can restake any combination of these: a Staker may hold ALL of these assets, or only one of them.
144+
Stakers can restake any combination of these: a staker may hold ALL of these assets, or only one of them.
118145

119146
*Flows:*
120-
* Stakers **deposit** assets into EigenLayer via either the StrategyManager (for LSTs) or EigenPodManager (for beacon chain ETH)
147+
* Stakers **deposit** assets into EigenLayer via either the StrategyManager (for ERC20s) or the EigenPodManager (for beacon chain ETH)
121148
* Stakers **withdraw** assets via the DelegationManager, *no matter what assets they're withdrawing*
122-
* Stakers **delegate** to an Operator via the DelegationManager
123-
124-
*Unimplemented as of v0.4.0:*
125-
* Stakers are at risk of being slashed if the Operator misbehaves
149+
* Stakers **delegate** to an operator via the DelegationManager
126150

127151
##### Operator
128152

129-
An Operator is a user who helps run the software built on top of EigenLayer (AVSs). Operators register in EigenLayer and allow Stakers to delegate to them, then opt in to provide various services built on top of EigenLayer. Operators may themselves be Stakers; these are not mutually exclusive.
153+
An operator is a user who helps run the software built on top of EigenLayer (AVSs). operators register in EigenLayer and allow stakers to delegate to them, then opt in to provide various services built on top of EigenLayer. operators may themselves be stakers; these are not mutually exclusive.
130154

131155
*Flows:*
132-
* User can **register** as an Operator via the DelegationManager
133-
* Operators can **deposit** and **withdraw** assets just like Stakers can
156+
* Users can **register** as an operator via the DelegationManager
157+
* Operators can **deposit** and **withdraw** assets just like stakers can
134158
* 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.
135159

136-
*Unimplemented as of v0.4.0:*
137-
* Operators may be slashed by the services they register with (if they misbehave)
138-
139160
---
140161

141162
#### Common User Flows
142163

143164
##### Depositing Into EigenLayer
144165

145-
Depositing into EigenLayer varies depending on whether the Staker is depositing Native ETH or LSTs:
166+
Depositing into EigenLayer varies depending on whether the staker is depositing Native ETH or LSTs:
146167

147168
![.](./images/Staker%20Flow%20Diagrams/Depositing.png)
148169

@@ -152,13 +173,13 @@ Depositing into EigenLayer varies depending on whether the Staker is depositing
152173

153174
##### Undelegating or Queueing a Withdrawal
154175

155-
Undelegating from an Operator automatically queues a withdrawal that needs to go through the `DelegationManager's` withdrawal delay. Stakers that want to withdraw can choose to `undelegate`, or can simply call `queueWithdrawals` directly.
176+
Undelegating from an operator automatically queues a withdrawal that needs to go through the `DelegationManager's` withdrawal delay. Stakers that want to withdraw can choose to `undelegate`, or can simply call `queueWithdrawals` directly.
156177

157178
![.](./images/Staker%20Flow%20Diagrams/Queue%20Withdrawal.png)
158179

159180
##### Completing a Withdrawal as Shares
160181

161-
This flow is mostly useful if a Staker wants to change which Operator they are delegated to. The Staker first needs to undelegate (see above). At this point, they can delegate to a different Operator. However, the new Operator will only be awarded shares once the Staker completes their queued withdrawal "as shares":
182+
This flow is mostly useful if a staker wants to change which operator they are delegated to. The staker first needs to undelegate (see above). At this point, they can delegate to a different operator. However, the new operator will only be awarded shares once the staker completes their queued withdrawal "as shares":
162183

163184
![.](./images/Staker%20Flow%20Diagrams/Complete%20Withdrawal%20as%20Shares.png)
164185

@@ -172,12 +193,12 @@ However, note that *before* a withdrawal can be completed, native ETH stakers wi
172193

173194
##### `EigenPods`: Processing Validator Exits
174195

175-
If a Staker wants to fully withdraw from the beacon chain, they need to perform these additional steps before their withdrawal is completable:
196+
If a staker wants to fully withdraw from the beacon chain, they need to perform these additional steps before their withdrawal is completable:
176197

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

179200
##### `EigenPods`: Processing Validator Yield
180201

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:
202+
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:
182203

183204
![.](./images/Staker%20Flow%20Diagrams/Validator%20Yield.png)

0 commit comments

Comments
 (0)