-
Notifications
You must be signed in to change notification settings - Fork 357
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
fix: complete withdrawals #962
Conversation
@@ -6619,6 +6539,8 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage | |||
strategyMock, | |||
depositSharesPerWithdrawal | |||
); | |||
withdrawal.nonce = nonce; | |||
nonce += 1; |
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.
Note: this was needed because it was looping over creating queuedWithdrawalParams but each one was having a nonce of 0 from reading directly off the contract. I overwrite this value here since the expectation is that the withdrawals are queued in order with nonces from 0-3 inclusive
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 nit, ci is failing too
// if the completion block is in the future, simply read current slashing factors | ||
// still possible however for the slashing factors to change before the withdrawal is completable | ||
// and the shares withdrawn to be less | ||
if (completableBlock > uint32(block.number)) { |
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: could be a ternary (no biggie tho)
noticed it's also failing upstream, can fix if needed |
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 simplify this PR?
if (completableBlock > uint32(block.number)) { | ||
slashingFactors = | ||
_getSlashingFactors({staker: staker, operator: operator, strategies: withdrawals[i].strategies}); | ||
// Read slashing factors at the completable block |
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 remove these from this PR
Closing in favor of #965 |
Decided on removing numToComplete interface and this PR also fixes some broken tests.
Also fixes a race condition bug where a staker's withdrawal is still slashable in the same block that the withdrawal is completable, leading to possible race conditions. The regression test
test_getQueuedWithdrawals_SlashAfterWithdrawalCompletion
on the view function found this and passes as a result of the fix.