-
Notifications
You must be signed in to change notification settings - Fork 364
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
feat: slashing release #679
Conversation
f2a7515
to
f0873d1
Compare
9f91f03
to
b9fe3e5
Compare
This comment was marked as spam.
This comment was marked as spam.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review on alloc/dealloc
Would it be bad / hard / undesirable to enforce this ordering on the checkpoints history level? I would suggest that if an attempt is made to push an entry with a timestamp that is earlier than the timestamp of the previous entry, either (a) it's simply not allowed or (b) the new entry has its timestamp modified to match (or be 1 higher? not sure if the ascending ordering you have is strict or non-strict). Perhaps some option (c) could work where you keep the original timestamp but overwrite the intentions of the other entry? IDK if that would be incompatible with other aspects of the storage model though. I was initially thinking option (b) was the most logical but modifying entries before pushing them can be messy, especially if the entry or its contents is used elsewhere (e.g. if the timestamp is emitted in events, its hard to make sure the event emits the correct timestamp when you have conditional logic for modifying it). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor slashing comments
678f212
to
e70e85d
Compare
* 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 <[email protected]>
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
* feat: initial deploy * feat: slashing patch
* 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: add slashing docs * chore: bindings * docs: fixed commenting and updated queue withdrawal docs * docs: minor cleanup --------- Co-authored-by: Nadir Akhtar <[email protected]>
* fix: correct expected share calc * chore: bindings * fix: rounding on failing unit test
* 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
* fix: initialization params * fix: roll blocks usage
* 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 * chore: forge fmt
* 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 delay bound * test: remove unnecessary roll
* 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: burning * chore: fmt * chore: update storage report * chore: update readme * refactor: add burnableShares for epm storage * chore: update storage report
* 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: 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: complete EigenPodManager for slashing * docs: add in _beaconChainSlashingFactor state variable note * docs: finish epm docs * chore: make bindings --------- Co-authored-by: wadealexc <[email protected]>
7a6f8a6
to
fbe5ee2
Compare
Updated 1/03/2025
Contract Descriptions
AVSDirectory
New Core contract: AllocationManager! (basically the Slasher contract)
modifyAllocations
can be called by an operator to configure for a given operatorSet, the slashable proportions for each Strategies in the operatorSet. Ex. If an AVS operatorSet has stETH and rETH Strategies in their operatorSet, as an operator I can allocate 50% of my delegated stETH shares and 25% of my delegated rETH shares to be slashable by this operatorSet. An allocation can be thought of as the slashable proportion defined over the tuple (operator, operatorSet, Strategy).slashOperator
, called by an AVS, slashes an operator for the specific operatorSet. The AVS will pass in as calldata an array of Strategies and wadsToSlash respsectively to slash the operator for. Note that the Strategies passed in must already be in the operatorSet’s list of Strategies. This function slashes from current magnitude as well as queued deallocations. Whatever magnitude is slashed is also decremented from the maxMagnitude from the (operator, Strategy) tuple.encumberedMagnitude
value, increasing on any allocations, which can go up to a maximum of your maxMagnitude(by default maxMagnitude is 1e18, but decreases every time slashed).StrategyManager/EigenPodManager/DelegationManager - Changes to Deposits/Withdrawals
Shares are changed in a lot of ways with the introduction of Slashing with a lot more complex accounting, most of which can be found in SlashingLib.sol and the deposit/withdrawal flows. Below is an explanation on the types of 'shares' in the system.
depositShares
: These are the shares representing the amount of Strategy shares a staker has added to the system, either through deposits in the StrategyManager or positive shares increases in the EigenPodManager. Note that these can be compared 1:1 with the shares of the underlying Strategies. If you are delegated and deposit or you delegate with existing shares, then your operator shares will increase by the exact amount of these depositShares.The amount you can withdraw is dependent however on
withdrawableShares
, see more below...Location: StrategyManager -
stakerDepositShares
mappingEigenPodManager -
podOwnerDepositShares
mappingoperatorShares
: This is the delegated stake an operator has from all their delegated stakers; this can also be termed 'delegated' shares. An operator's operatorShares is also the summation of all their delegated stakers withdrawable shares. This is because operatorShares increase on each delegated staker deposit and decreases from withdrawals and slashed shares. The amount decreased from withdrawals are also scaled down depending on if any slashing has applied to the staker and their depositShares.Location: DelegationManager -
operatorShares
mappingwithdrawableShares
: This is the amount of withdrawable shares a staker can queue withdraw. Now if a staker is not delegated, then the following is truewithdrawableShares == depositShares
because they cannot be slashed. However if they are delegated to an operator and their operator got slashed while they had depositShares delegated to them, then their withdrawableShares are less than their depositShares. This value is not in storage but read by taking the staker's depositShares and scaling it down depending on if any slashing has affected their stake.Location: DelegationManager -
getWithdrawableShares()
function3a.
scaledShares
: You can see this instruct Withdrawal
when queuing a withdrawal. We calculatewithdrawableShares
by some clever scaling factors and accounting but one thing we want to ensure is that withdrawals are still slashable while in the queue. This is done by dividingwithdrawableShares
at queue time by the delegated operator's maxMagnitude, and upon completion multiplying it by the maxMagnitude at the earliest withdrawal completion time. This will account for the proportional amount of shares slashed and decrement from withdrawn shares accordingly.Since we read the maxMagnitude while queuing the withdrawal, this design is more for convenience and optimizing reads.
Note: If the strategy is the beaconChainStrategy this is also accounted for in a similar way.
Location: IDelegationManager -
struct Withdrawal
Additional Notes:
IShareManager
interfacedepositScalingFactor
is the k value used in the accounting docsstakerDepositShares
is soperatorShares
is opmaxMagnitude
is m read from the AllocationManagerthirdPartyTransfersForbidden
is removed entirely. This mapping will be deprecated and never read from again.TODOs: