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 withdraw() methods in nullifier contracts for not validating the root #41

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions solidity/contracts/zeto_anon_enc_nullifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ contract Zeto_AnonEncNullifier is
uint256 root,
Commonlib.Proof calldata proof
) public {
validateTransactionProposal(nullifiers, [output, 0], root);
_withdrawWithNullifiers(amount, nullifiers, output, root, proof);
processInputsAndOutputs(nullifiers, [output, 0]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ contract Zeto_AnonEncNullifierNonRepudiation is
uint256 root,
Commonlib.Proof calldata proof
) public {
validateTransactionProposal(nullifiers, [output, 0], root);
_withdrawWithNullifiers(amount, nullifiers, output, root, proof);
processInputsAndOutputs(nullifiers, [output, 0]);
}
Expand Down
1 change: 1 addition & 0 deletions solidity/contracts/zeto_anon_nullifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ contract Zeto_AnonNullifier is
uint256 root,
Commonlib.Proof calldata proof
) public {
validateTransactionProposal(nullifiers, [output, 0], root);
Copy link
Contributor

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?

Copy link
Contributor Author

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

_withdrawWithNullifiers(amount, nullifiers, output, root, proof);
processInputsAndOutputs(nullifiers, [output, 0]);
}
Expand Down
1 change: 1 addition & 0 deletions solidity/contracts/zeto_anon_nullifier_kyc.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ contract Zeto_AnonNullifierKyc is
uint256 root,
Commonlib.Proof calldata proof
) public {
validateTransactionProposal(nullifiers, [output, 0], root);
_withdrawWithNullifiers(amount, nullifiers, output, root, proof);
processInputsAndOutputs(nullifiers, [output, 0]);
}
Expand Down
Loading
Loading