ZcashFoundation / zebra

Zcash - Financial Privacy in Rust 🦓
https://zfnd.org/zebra/
Apache License 2.0
413 stars 106 forks source link

Add hashes of transactions that reveal a nullifier in the `{sprout, sapling, orchard}_nullifiers` column families as values #8838

Open arya2 opened 2 months ago

arya2 commented 2 months ago

Motivation

This is needed for the zcashd replacement wallet.

Design

The transaction hash of the transaction revealing a nullifier can be added as the value as these column families currently only store keys.

Zebra is writing revealed nullifiers to the finalized state here. Zebra is not using TypedColumnFamily or TypedWriteBatch for the the nullifier column families, so the transaction hashes can be added as values when writing to the finalized state without any other changes. It will also need a db format upgrade that goes through all of the transactions and rewrites the nullifiers with transaction hashes.

Revealed nullifiers in the non-finalized chains are stored here, where the field types can be updated to HashMap<Nullifier, transaction::Hash>s, and the transaction hashes can be added here where the nullifier sets are updated.