-
Notifications
You must be signed in to change notification settings - Fork 329
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
slashing: fully slashed strategies #850
Conversation
|
3ddef4b
to
f939ead
Compare
2307456
to
c224c7a
Compare
|
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 looks good for strategies, will need to figure out the EP edge cases in separate PR
* if this is the beaconChain strategy | ||
* @return bool True if the maxMagnitude is not 0 and the staker's beaconChainScalingFactor is not 0 | ||
*/ | ||
function _verifyMaxMagnitudeAndScalingFactor( |
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.
Nit: Perhaps call this hasNonZeroScalingFactors
since it returns a bool
/// Slashing | ||
|
||
/// @dev Thrown when an operator has been fully slashed(maxMagnitude is 0) for a strategy. | ||
/// or if the staker has had been natively slashed to the point of their beaconChainScalingFactor equalling 0. |
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 to documentation somewhere that:
- A staker can always redelegate for any strategy if the
maxMagnitude
is 0 - A staker can never delegate for beacon chain strategy if they are fully slashed on the beacon chain.
|
This handles edge cases of 100% slashed scenarios where an operator is fully slashed for a strategy(maxMagnitude = 0)
and also when a native restaker has had enough accrued delta decreases in their beacon chain shares to the point where their beaconChainScalingFactor is 0. Either of these situations will result in a divide by 0 and has more transparent error revert checks when this occurs.
Changes:
increaseDelegatedShares
) to an operator for a strategy that is fully slashed will revertNote: Complete queued withdrawals are unchanged but perhaps should revert if they were slashed during queue delay. It would avoid wasted gas for withdrawing 0 shares.
Tests:
increaseDelegatedShares
) will revertincreaseDelegatedShares
for other strategies with non-zero maxMagnitude for the operator.