-
Notifications
You must be signed in to change notification settings - Fork 112
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
WIP: Reject double-spends of shielded nullifiers and UTXOs #2420
Conversation
273165f
to
d7f33dc
Compare
The macOS failure is unrelated, it looks like #2163. Most of the first ~30 peers we tried failed, and took up the entire timeout. That will get better when each initial handshake is in its own task. |
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.
Looks good, but I did add a warning note about possibly making the code more cautious of any future rocksdb
changes. As far as I can tell, this is just an extra precaution, and it would still work if left as is 👍
This PR got a lot more complicated than I expected. The code works, but the check is in the wrong place in the finalized state. I need to move the check to the non-finalized state, and probably split the UTXO and nullifier changes. |
8639df5
to
815268a
Compare
09c3180
to
c7ee621
Compare
c7ee621
to
f46b030
Compare
We need to keep the order of UTXOs when we're verifying a single block, but the block order is irrelevant for UTXOs stored in the state.
Reject transparent output double-spends - Check that transparent spends use outputs from earlier in their block Document how duplicate nullifiers are rejected by the finalized state. Tests for duplicate sprout nullifiers at different levels Nullifiers can be duplicated within the same JoinSplit, transaction, block, or chain. And disable a failing test.
f46b030
to
950d6ef
Compare
I'm going to open a PR that obsoletes this PR some time over the next day or two. |
Motivation
Zebra needs to check the double-spend consensus rule for shielded spends in the finalized state.
Specifications
See #2231
Designs
The state RFC is updated by this PR:
https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/rfcs/0005-state-updates.md#rocksdb-data-structures
Solution
Closes #2231.
Before adding a block to a non-finalized chain:
Testing
I've started a cached state test for commit be39530 here:
https://github.com/ZcashFoundation/zebra/actions/runs/985595375
Review
@jvff can do the initial review on this PR.
It's somewhat urgent, because the design and code changes will conflict with the new column families for anchors, history, and value pools.
Reviewer Checklist