Skip to content

Conversation

@8sunyuan
Copy link
Contributor

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.

depositSharesPerWithdrawal
);
withdrawal.nonce = nonce;
nonce += 1;
Copy link
Contributor Author

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

Copy link
Member

@0xClandestine 0xClandestine left a 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)) {
Copy link
Member

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)

@0xClandestine
Copy link
Member

one nit, ci is failing too

noticed it's also failing upstream, can fix if needed

Copy link
Collaborator

@ypatil12 ypatil12 left a 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
Copy link
Collaborator

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

@ypatil12
Copy link
Collaborator

Closing in favor of #965

@ypatil12 ypatil12 closed this Dec 18, 2024
@github-actions github-actions bot deleted the fix/complete-withdrawals branch May 8, 2025 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants