-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add SlashingWithdrawalRouter
#5
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: add SlashingWithdrawalRouter
#5
Conversation
SlashingWithdrawalRouter
non-fungible-nelson
left a comment
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.
Some comments and clarifications -- looks good for a first cut. Thanks!
| // Assert that the redistribution is not paused. | ||
| require(!escrow.paused, RedistributionCurrentlyPaused()); | ||
|
|
||
| // QUESTION: How do we want to check maturity? Are we storing it during initiation or parsing JIT? |
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.
@ypatil12 @0xClandestine I think its OK to just store during initiation some future a block number. We are anticipating a programmatic call here from the ALM right? if so, we can just parse against the maturity block number >= some number of days in blocks (4)
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.
We want to store the block that it was queued and then read the delay. We should have a function where the delay can be set by the ops multisig
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.
This delay applies to a list of strategies passed in. The delay can be set on a per strategy basis, if not set use the global
|
Another note we need to discern on immutability:
|
| // Assert that the redistribution is not paused. | ||
| require(!escrow.paused, RedistributionCurrentlyPaused()); | ||
|
|
||
| // QUESTION: How do we want to check maturity? Are we storing it during initiation or parsing JIT? |
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.
We want to store the block that it was queued and then read the delay. We should have a function where the delay can be set by the ops multisig
| // Assert that the redistribution is not paused. | ||
| require(!escrow.paused, RedistributionCurrentlyPaused()); | ||
|
|
||
| // QUESTION: How do we want to check maturity? Are we storing it during initiation or parsing JIT? |
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.
This delay applies to a list of strategies passed in. The delay can be set on a per strategy basis, if not set use the global
ypatil12
left a comment
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.
Can we add introspection on:
- List of redistributions for an opSet/slashID
- Whether the redistribution is completable
ypatil12
left a comment
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.
We also need a way for us to introspect storage to get the slashes that need to be burnt (send to 0xEigen)
| mapping(bytes32 operatorSetKey => mapping(uint256 slashId => RedistributionEscrow escrow)) internal _escrow; | ||
|
|
||
| /// @notice Returns the paused status for a given operator set and slash ID. | ||
| mapping(bytes32 operatorSetKey => mapping(uint256 slashId => bool paused)) internal _paused; |
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.
Feel like this could be improved, thinking we pass in a range of slashIds as upper and lower bounds, can pass type(uint).max in to pause an entire operator set.
ypatil12
left a comment
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.
One pass, will review again once we have escrow logic
| // EnumerableMap.set(burnableShares, address(strategy), currentShares + addedSharesToBurn); | ||
| emit BurnableSharesIncreased(operatorSet, slashId, strategy, addedSharesToBurn); | ||
| emit BurnableSharesIncreased(operatorSet, slashId, strategy, sharesToBurn); | ||
|
|
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.
One thing I noticed is that we have 1 call from ALM to DM if multiple strategies are burned, but n calls from DM to SM. Just pointing out - I do think the pattern is fine
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.
Yeah originally we had n calls from ALM to DM too, originally planned to optimize both to reduce external calls with but later found out it's not possible for the DM to SM call. Should reduce the complexity of logs a bit, and make them more readable.
ypatil12
left a comment
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.
Style comments
|
LGTM |
SlashingWithdrawalRouterSlashingWithdrawalRouter
60fb3f5
into
feat/sm-redistribution-2
* wip * wip * feat: add `SlashingWithdrawalRouter` * perf: optimize `Pausable` for codesize * chore: renaming * refactor: use `Pauseable` instead of OZ `AccessControl` * perf: reduce `Pauseble` codesize * refactor: arrayified inputs * wip * refactor: make struct params arrays * fix: remove unused import * refactor: `redistributionRecipient` == `releaser` * refactor: cleanup * wip * wip * refactor: cleanup * refactor: remove uneeded code * refactor: remove unused error * wip * refactor: review changes * feat: add `getPendingSlashIdsForOperatorSet` * test: wip * test: wip * test: wip * doc: todos * test: wip * refactor: iterate in reverse order to avoid skipping elements * test: passing * feat: add `getPendingBurnOrRedistributions` nested alias * chore: renaming * fix: update gap * fix: dm mock * feat: full introspection * fix: `pendingOperatorSets` removal * fix: update visibility * feat: add delay logic * fix: enforce minimum delay * refactor: review changes * refactor: remove `_checkBurnOrRedistributionDelay` * fix: gap * nit: natspec style * refactor: update headers * refactor: review changes
Motivation:
We want to hold slashed funds in escrow temporarily to maintain protocol security (prevent malicious actors from draining the contracts).
Modifications:
SlashingWithdrawalRouter.Result:
The
SlashingWithdrawalRoutercontract is added for managing slashed funds in the EigenLayer protocol. It provides a mechanism to handle the burning or redistribution of slashed shares after a delay period, ensuring proper handling of slashed funds while maintaining protocol security.