Skip to content

Commit 7a6f8a6

Browse files
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 46c0cc5 commit 7a6f8a6

File tree

13 files changed

+281
-123
lines changed

13 files changed

+281
-123
lines changed

Diff for: docs/core/EigenPodManager.md

+247-99
Large diffs are not rendered by default.

Diff for: pkg/bindings/DelegationManager/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/EigenPod/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/EigenPodManager/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/EigenStrategy/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/RewardsCoordinator/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/StrategyBase/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/StrategyBaseTVLLimits/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/StrategyFactory/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/bindings/StrategyManager/binding.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/contracts/interfaces/IEigenPodManager.sol

+5-3
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ interface IEigenPodManager is
104104
function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable;
105105

106106
/**
107-
* @notice Changes the `podOwner`'s shares by `sharesDelta` and performs a call to the DelegationManager
108-
* to ensure that delegated shares are also tracked correctly
107+
* @notice Adds any positive share delta to the pod owner's deposit shares, and delegates them to the pod
108+
* owner's operator (if applicable). A negative share delta does NOT impact the pod owner's deposit shares,
109+
* but will reduce their beacon chain slashing factor and delegated shares accordingly.
109110
* @param podOwner is the pod owner whose balance is being updated.
110-
* @param prevRestakedBalanceWei is the total amount restaked through the pod before the balance update
111+
* @param prevRestakedBalanceWei is the total amount restaked through the pod before the balance update, including
112+
* any amount currently in the withdrawal queue.
111113
* @param balanceDeltaWei is the amount the balance changed
112114
* @dev Callable only by the podOwner's EigenPod contract.
113115
* @dev Reverts if `sharesDelta` is not a whole Gwei amount

Diff for: src/contracts/pods/EigenPodManager.sol

+2-4
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ contract EigenPodManager is
150150
}
151151

152152
/**
153-
* @notice Increases the `podOwner`'s shares by `shares`, paying off deficit if possible.
153+
* @notice Increases the `podOwner`'s shares by `shares`, paying off negative shares if needed.
154154
* Used by the DelegationManager to award a pod owner shares on exiting the withdrawal queue
155-
* @dev Reverts if `shares` is not a whole Gwei amount
156155
* @return existingDepositShares the pod owner's shares prior to any additions. Returns 0 if negative
157156
* @return addedShares the number of shares added to the staker's balance above 0. This means that if,
158157
* after shares are added, the staker's balance is non-positive, this will return 0.
@@ -168,9 +167,8 @@ contract EigenPodManager is
168167
}
169168

170169
/**
171-
* @notice Used by the DelegationManager to complete a withdrawal, sending tokens to some destination address
170+
* @notice Used by the DelegationManager to complete a withdrawal, sending tokens to the pod owner
172171
* @dev Prioritizes decreasing the podOwner's share deficit, if they have one
173-
* @dev Reverts if `shares` is not a whole Gwei amount
174172
* @dev This function assumes that `removeShares` has already been called by the delegationManager, hence why
175173
* we do not need to update the podOwnerDepositShares if `currentpodOwnerDepositShares` is positive
176174
*/

Diff for: src/contracts/pods/EigenPodManagerStorage.sol

+18-8
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,30 @@ abstract contract EigenPodManagerStorage is IEigenPodManager {
6262

6363
// BEGIN STORAGE VARIABLES ADDED AFTER MAINNET DEPLOYMENT -- DO NOT SUGGEST REORDERING TO CONVENTIONAL ORDER
6464
/**
65-
* // TODO: Update this comment
66-
* @notice Mapping from Pod owner owner to the number of deposit shares they have in the virtual beacon chain ETH strategy.
67-
* @dev The deposit share amount can become negative. This is necessary to accommodate the fact that a pod owner's virtual beacon chain ETH shares can
68-
* decrease between the pod owner queuing and completing a withdrawal.
69-
* When the pod owner's shares would otherwise increase, this "deficit" is decreased first _instead_.
70-
* Likewise, when a withdrawal is completed, this "deficit" is decreased and the withdrawal amount is decreased; We can think of this
71-
* as the withdrawal "paying off the deficit".
65+
* @notice mapping from pod owner to the deposit shares they have in the virtual beacon chain ETH strategy
66+
*
67+
* @dev When an EigenPod registers a balance increase, deposit shares are increased. When registering a balance
68+
* decrease, however, deposit shares are NOT decreased. Instead, the pod owner's beacon chain slashing factor
69+
* is decreased proportional to the balance decrease. This impacts the number of shares that will be withdrawn
70+
* when the deposit shares are queued for withdrawal in the DelegationManager.
71+
*
72+
* Note that prior to the slashing release, deposit shares were decreased when balance decreases occurred.
73+
* In certain cases, a combination of queueing a withdrawal plus registering a balance decrease could result
74+
* in a staker having negative deposit shares in this mapping. This negative value would be corrected when the
75+
* staker completes a withdrawal (as tokens or as shares).
76+
*
77+
* With the slashing release, negative shares are no longer possible. However, a staker can still have negative
78+
* shares if they met the conditions for them before the slashing release. If this is the case, that staker
79+
* should complete any outstanding queued withdrawal in the DelegationManager ("as shares"). This will correct
80+
* the negative share count and allow the staker to continue using their pod as normal.
7281
*/
7382
mapping(address podOwner => int256 shares) public podOwnerDepositShares;
7483

7584
uint64 internal __deprecated_denebForkTimestamp;
7685

7786
/// @notice Returns the slashing factor applied to the `staker` for the `beaconChainETHStrategy`
78-
/// Note: this is specifically updated when the staker's beacon chain balance decreases
87+
/// Note: this value starts at 1 WAD (1e18) for all stakers, and is updated when a staker's pod registers
88+
/// a balance decrease.
7989
mapping(address staker => BeaconChainSlashingFactor) internal _beaconChainSlashingFactor;
8090

8191
/// @notice Returns the amount of `shares` that have been slashed on EigenLayer but not burned yet.

0 commit comments

Comments
 (0)