-
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
Stop double-spends by checking nullifiers in the finalized state #2230
Labels
A-consensus
Area: Consensus rule updates
A-rust
Area: Updates to Rust code
C-enhancement
Category: This is an improvement
NU Sprout
Network Upgrade: Sprout specific tasks (before Overwinter)
NU-1 Sapling
Network Upgrade: Sapling specific tasks
NU-5
Network Upgrade: NU5 specific tasks
Comments
teor2345
added
A-consensus
Area: Consensus rule updates
NU-1 Sapling
Network Upgrade: Sapling specific tasks
NU Sprout
Network Upgrade: Sprout specific tasks (before Overwinter)
A-rust
Area: Updates to Rust code
C-enhancement
Category: This is an improvement
S-needs-triage
Status: A bug report needs triage
NU-5
Network Upgrade: NU5 specific tasks
P-Medium
labels
Jun 1, 2021
teor2345
changed the title
Stop double-spends by checking nullifiers in the finalized state
Stop double-spends by checking nullifiers and UTXOs in the finalized state
Jun 24, 2021
teor2345
changed the title
Stop double-spends by checking nullifiers and UTXOs in the finalized state
Stop double-spends by checking nullifiers in the finalized state
Jun 24, 2021
teor2345
changed the title
Stop double-spends by checking nullifiers in the finalized state
Stop double-spends by checking nullifiers and UTXO spends in the finalized state
Jun 24, 2021
This ticket is blocked by #2301, because they both want to return errors from the |
1 task
teor2345
changed the title
Stop double-spends by checking nullifiers and UTXO spends in the finalized state
Stop double-spends by checking nullifiers in the finalized state
Jun 30, 2021
8 tasks
This ticket is actually a duplicate of #2231 - if we check for duplicates when adding a block to a non-finalized chain, we don't need to check again in the finalized state. |
6 tasks
mpguerra
added a commit
that referenced
this issue
May 19, 2023
mergify bot
pushed a commit
that referenced
this issue
May 23, 2023
* ZIPs were updated to remove ambiguity, this was tracked in #1267. * #2105 was fixed by #3039 and #2379 was closed by #3069 * #2230 was a duplicate of #2231 which was closed by #2511 * #3235 was obsoleted by #2156 which was fixed by #3505 * #1850 was fixed by #2944, #1851 was fixed by #2961 and #2902 was fixed by #2969 * We migrated to Rust 2021 edition in Jan 2022 with #3332 * #1631 was closed as not needed * #338 was fixed by #3040 and #1162 was fixed by #3067 * #2079 was fixed by #2445 * #4794 was fixed by #6122 * #1678 stopped being an issue * #3151 was fixed by #3934 * #3204 was closed as not needed * #1213 was fixed by #4586 * #1774 was closed as not needed * #4633 was closed as not needed * Clarify behaviour of difficulty spacing Co-authored-by: teor <teor@riseup.net> * Update comment to reflect implemented behaviour Co-authored-by: teor <teor@riseup.net> * Update comment to reflect implemented behaviour when retrying block downloads Co-authored-by: teor <teor@riseup.net> * Update `TODO` to remove closed issue and clarify when we might want to fix Co-authored-by: teor <teor@riseup.net> * Update `TODO` to remove closed issue and clarify what we might want to change in future Co-authored-by: teor <teor@riseup.net> * Clarify benefits of how we do block verification Co-authored-by: teor <teor@riseup.net> * Fix rustfmt errors --------- Co-authored-by: teor <teor@riseup.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-consensus
Area: Consensus rule updates
A-rust
Area: Updates to Rust code
C-enhancement
Category: This is an improvement
NU Sprout
Network Upgrade: Sprout specific tasks (before Overwinter)
NU-1 Sapling
Network Upgrade: Sapling specific tasks
NU-5
Network Upgrade: NU5 specific tasks
Motivation
Zebra needs to check the double-spend consensus rule for shielded spends in the finalized state.
Consensus Rule
Nullifiers
https://zips.z.cash/protocol/nu5.pdf#nullifierset
https://zips.z.cash/protocol/nu5.pdf#commitmentsandnullifiers
Existing Design
https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/rfcs/0005-state-updates.md#pubsuper-fn-queue_and_commit_finalized_blocksmut-self-queued_block-queuedblock
Solution
Design Change
This design change enforces the double-spend rules for each shielded pool.
It also enforces single writes of the other 8 column families in the data structure (as of 1 June 2021):
https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/rfcs/0005-state-updates.md#rocksdb-data-structures
Implementation Change
FinalizedState::new
usingset_merge_operator_associative
Here's the RocksDB
merge
feature documentation:https://github.com/facebook/rocksdb/wiki/Merge-Operator#what
Testing
Optional:
Alternatives
We could try to fetch each value before writing it, but that's error-prone. We'd probably forget to do the check somewhere in the code.
The text was updated successfully, but these errors were encountered: