-
Notifications
You must be signed in to change notification settings - Fork 107
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
Reject duplicate Sapling and Orchard nullifiers #2497
Conversation
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.
Everything looks good. There are only a few questions I'm a bit unsure of. Two are in the code, and another follows below. I also ended up adding too many optional suggestions. Feel free to ignore them, I don't know why but for some reason I'm feeling more creative than normal. I apologize for any noise this creates 😅
I'm not sure this is a valid question, but would it make sense to add another test that adds two different nullifiers? The current acceptance tests only add one nullifier 🤔
This could go further and mirror all of the rejection tests but with different nullifiers to check if they are accepted. That's a lot of tests, so if this is something that's useful, it could be done in a separate PR.
The integration tests already add thousands of nullifiers. So I'm not sure if adding two nullifiers in the unit tests gives us significantly better test coverage. (There are already ~15 tests across the 3 shielded pools.) |
Reject duplicate sapling and orchard nullifiers in a new block, when the block is added to a non-finalized chain, and the duplicate nullifier is already in the finalized state.
Reject duplicate sapling and orchard nullifiers in a new block, when the block is added to a non-finalized chain, and the duplicate nullifier is in: * the same shielded data, * the same transaction, * the same block, or * an earlier block in the non-finalized chain.
Test that the state rejects duplicate sapling nullifiers in a new block, when the block is added to a non-finalized chain, and the duplicate nullifier is in: * the same shielded data, * the same transaction, * the same block, * an earlier block in the non-finalized chain, or * the finalized state.
Test that the state rejects duplicate orchard nullifiers in a new block, when the block is added to a non-finalized chain, and the duplicate nullifier is in: * the same shielded data, * the same transaction, * the same block, * an earlier block in the non-finalized chain, or * the finalized state.
53a115b
to
e6ba566
Compare
Co-authored-by: Janito Vaqueiro Ferreira Filho <[email protected]>
* Draft CHANGELOG for Zebra 1.0.0-alpha.14 * Add PR #2533 to CHANGELOG * Apply suggestions from code review Co-authored-by: teor <[email protected]> * Remove entry about updating the changelog * move #2497 * add #2529 * Add a missing space * Add #2458, #2525, #2486, #2542 and #2539 to CHANGELOG Co-authored-by: teor <[email protected]> Co-authored-by: Deirdre Connolly <[email protected]>
Motivation
Zebra needs to reject duplicate sapling and orchard nullifiers, to prevent double-spends.
See #2231 for details.
This PR finishes the shielded part of #2231, but does not close that ticket.
Solution
This code is almost identical to the sprout code in the previous PR:
These tests are based on the previous PR, with sapling and orchard-specific changes:
The specific test changes are:
Spend
/Action
, so there is no need for "sameSpend
/Action
" testsReview
@jvff can review this PR - it's not urgent at all.
This code is unlikely to conflict with any other code.
Reviewer Checklist
Follow Up Work
Prevent transparent double-spends #2231