Skip to content

Commit eb1d5bd

Browse files
8sunyuanwadealexc
authored andcommitted
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 <[email protected]> Co-authored-by: davidironblocks <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]>
1 parent 7792c29 commit eb1d5bd

File tree

102 files changed

+4966
-3405
lines changed

Some content is hidden

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

102 files changed

+4966
-3405
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: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This document provides an overview of system components, contracts, and user rol
1616
* [`RewardsCoordinator`](#rewardscoordinator)
1717
* [`AVSDirectory`](#avsdirectory)
1818
* [`AllocationManager`](#allocationmanager)
19+
* [`PermissionController`](#permissioncontroller)
1920
* [Roles and Actors](#roles-and-actors)
2021
* [Common User Flows](#common-user-flows)
2122
* [Depositing Into EigenLayer](#depositing-into-eigenlayer)
@@ -64,10 +65,13 @@ See full documentation in [`/core/StrategyManager.md`](./core/StrategyManager.md
6465
| -------- | -------- | -------- |
6566
| [`DelegationManager.sol`](../src/contracts/core/DelegationManager.sol) | Singleton | Transparent proxy |
6667

67-
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 delegated shares to Operators across different strategies, and to manage withdrawals on behalf of the `EigenPodManager` and `StrategyManager`.
68-
The `DelegationManager` is tightly coupled with the `AllocationManager` as withdrawable shares for a Staker is dependent on reading state from the `AllocationManager`. That is, a staker's withdrawable shares is decreased in the event their delegated Operator was slashed by an AVS (more specifically an operatorSet but more on this later).
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`.
6969

70-
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)
7175

7276
#### RewardsCoordinator
7377

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

7882
The `RewardsCoordinator` is the main entry point of submission and claiming of ERC20 rewards in EigenLayer. It carries out three basic functions:
79-
* AVSs (via the AVS's contracts) submit "rewards submissions" to their registered Operators and Stakers over a specific time period
80-
* *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.
81-
* 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.
8286

8387
See full documentation in [`/core/RewardsCoordinator.md`](./core/RewardsCoordinator.md).
8488

@@ -88,9 +92,9 @@ See full documentation in [`/core/RewardsCoordinator.md`](./core/RewardsCoordina
8892
| -------- | -------- | -------- |
8993
| [`AVSDirectory.sol`](../src/contracts/core/AVSDirectory.sol) | Singleton | Transparent proxy |
9094

91-
##### 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(no longer indexed) in a future release.
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.
9296

93-
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`.
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).
9498

9599
See full documentation in [`/core/AVSDirectory.md`](./core/AVSDirectory.md).
96100

@@ -102,19 +106,28 @@ For more information on AVS contracts, see the [middleware repo][middleware-repo
102106
| -------- | -------- | -------- |
103107
| [`AllocationManager.sol`](../src/contracts/core/AllocationManager.sol) | Singleton | Transparent proxy |
104108

105-
The `AllocationManager` is meant to replace the AVSDirectory with the introduction of OperatorSets as well as introduce the core functionality of Slashing. It handles several use cases:
106-
* AVSs can create OperatorSets and can define the EigenLayer Strategies within them
107-
* Operators can register/deregister with AVS operatorSets
108-
* Operators can make slashable security commitments to an operatorSet 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 stETH to be slashable by a specific OperatorSet
109-
* AVSs can slash an operator (without being objectively attributable) who has slashable allocations to the AVS's corresponding OperatorSet.
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
110114

111115
See full documentation in [`/core/AllocationManager.md`](./core/AllocationManager.md).
112116

113-
---
117+
#### PermissionController
118+
119+
| File | Type | Proxy |
120+
| -------- | -------- | -------- |
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.
114124

115-
#### Shares Accounting
125+
The following core contracts use the `PermissionController` in certain methods:
126+
* `DelegationManager`
127+
* `AllocationManager`
128+
* `RewardsCoordinator`
116129

117-
TODO
130+
See full documentation in [`/permissions/PermissionController.md`](./permissions/PermissionController.md).
118131

119132
---
120133

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

125138
##### Staker
126139

127-
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:
128141
* Native beacon chain ETH (via the EigenPodManager)
129-
* Liquid staking tokens (via the StrategyManager): cbETH, rETH, stETH, ankrETH, OETH, osETH, swETH, wBETH
142+
* Arbitrary ERC20s (via the StrategyManager)
130143

131-
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.
132145

133146
*Flows:*
134-
* 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)
135148
* Stakers **withdraw** assets via the DelegationManager, *no matter what assets they're withdrawing*
136-
* Stakers **delegate** to an Operator via the DelegationManager
137-
138-
*Unimplemented as of v0.4.0:*
139-
* Stakers are at risk of being slashed if the Operator misbehaves
149+
* Stakers **delegate** to an operator via the DelegationManager
140150

141151
##### Operator
142152

143-
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.
144154

145155
*Flows:*
146-
* User can **register** as an Operator via the DelegationManager
147-
* 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
148158
* 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.
149159

150-
*Unimplemented as of v0.4.0:*
151-
* Operators may be slashed by the services they register with (if they misbehave)
152-
153160
---
154161

155162
#### Common User Flows
156163

157164
##### Depositing Into EigenLayer
158165

159-
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:
160167

161168
![.](./images/Staker%20Flow%20Diagrams/Depositing.png)
162169

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

167174
##### Undelegating or Queueing a Withdrawal
168175

169-
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.
170177

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

173180
##### Completing a Withdrawal as Shares
174181

175-
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":
176183

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

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

187194
##### `EigenPods`: Processing Validator Exits
188195

189-
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:
190197

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

193200
##### `EigenPods`: Processing Validator Yield
194201

195-
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:
196203

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

docs/core/AllocationManager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ Once slashing is processed for a strategy, [slashed stake is burned via the `Del
623623
* If the `allocation` now has a `currentMagnitude` of 0:
624624
* Removes `strategy` from the `allocatedStrategies[operator][operatorSetKey]` list
625625
* If this list now has a length of 0, remove `operatorSetKey` from `allocatedSets[operator]`
626-
* Calls [`DelegationManager.burnOperatorShares`](./DelegationManager.md#burnoperatorshares)
626+
* Calls [`DelegationManager.slashOperatorShares`](./DelegationManager.md#slashoperatorshares)
627627
* Emit an `OperatorSlashed` event
628628

629629
*Requirements*:

0 commit comments

Comments
 (0)