-
Notifications
You must be signed in to change notification settings - Fork 16
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 withdraw() methods in nullifier contracts for not validating the root #41
Conversation
…root Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #41 +/- ##
==========================================
+ Coverage 70.44% 71.37% +0.92%
==========================================
Files 12 12
Lines 538 538
==========================================
+ Hits 379 384 +5
+ Misses 112 110 -2
+ Partials 47 44 -3 ☔ View full report in Codecov by Sentry. |
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.
@jimthematrix 👍 good catch, added a comment about testing.
Also, a minor point about the three functions in withdraw seem can be grouped into a _withdraw() function into zeto_nullifier like _mint.
@@ -122,6 +122,7 @@ contract Zeto_AnonNullifier is | |||
uint256 root, | |||
Commonlib.Proof calldata proof | |||
) public { | |||
validateTransactionProposal(nullifiers, [output, 0], root); |
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.
Should we also add a test for this scenario?
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.
good point. added failure tests for all of the nullifiers tokens attempting to withdraw using spent UTXOs
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 to me - agree on the point above from Cheng but understand they are similar flows and tests have been included
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
just added another commit to also validate the input from the withdraw() calls of the non-nullifier tokens, which turn out to have the same security hole. |
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
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.
Thanks @jimthematrix
It seems the security hole had to be patched to multiple contracts, so considering refactoring the check into the shared library will make it more reusable. But it's a minor comment for you to consider.
Regarding the idea to push the calls in the
|
No description provided.