Skip to content
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 forced exit re-use #87

Merged
merged 1 commit into from
Sep 16, 2023
Merged

Fix forced exit re-use #87

merged 1 commit into from
Sep 16, 2023

Conversation

k1rill-fedoseev
Copy link
Collaborator

Previous implementation contained a bug, allowing anyone to infinitely resubmit the same forced exit proof again and again, effectively preventing exiting party from ever finalizing the withdrawal.

One way to fix that - disallow forced exit submission for nullifiers for which forced exists already exist. However, in order for exiting party to still be able to re-submit their forced exit after 24 hours, extra cancellation method is needed.


skip(24 hours);

pool.cancelForcedExit(nullifier, user2, user2, 0.4 ether / D / denominator, exitStart, exitEnd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it also be tested that executeForcedExit is not possible after cancelation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it will be already expired by then, it will be rejected anyway at the timestamp check, so this test won't add any new coverage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got you, thanks! If it is assumed that the cancelation happens in order to commit the proof one more time, does it make sense to extend the method with the proof and if the proof/index/out_commit is not empty, the force exit will be re-commited? It will allow users to save on gas fees a bit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-worked code a bit, so it's no longer that simple. But anyway I think it should be possible to make cancel and commit in the same transaction using any multicall available on-chain, since they both do not depend on msg.sender.

@akolotov akolotov merged commit 9b54085 into develop Sep 16, 2023
3 checks passed
@akolotov akolotov deleted the fix/forced-exit branch September 16, 2023 11:57
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.

2 participants