zebra/zebra-chain/src/sapling
Deirdre Connolly e719c46b1b
Track anchors and note commitment trees in zebra-state (#2458)
* Tidy chain Cargo.toml

* Organize imports

* Add method to get note commitments from all Actions in Orchard shielded data

* Add method to get note commitments from all JoinSplits in Sprout JoinSplitData

* Add Request and Response variants for awaiting anchors

* Add anchors and note commitment trees to finalized state db

* Add (From|Into)Disk impls for tree::Roots and stubs for NoteCommitmentTrees

* Track anchors and note commitment trees in Chain

Append note commitments to their trees when doing update_chain_state_with,
then use the resulting Sapling and Orchard roots to pass to history_tree, and add
new roots to the anchor sets.

* Handle errors when appending to note commitment trees

* Add comments explaining why note commitment are not removed from the tree in revert_chain_state_with

* Implementing note commitments in finalized state

* Finish serialization of Orchard tree; remove old tree when updating finalize state

* Add serialization and finalized state updates for Sprout and Sapling trees

* Partially handle trees in non-finalized state. Use Option for trees in Chain

* Rebuild trees when forking; change finalized state tree getters to not require height

* Pass empty trees to tests; use empty trees by default in Chain

* Also rebuild anchor sets when forking

* Use empty tree as default in finalized state tree getters (for now)

* Use HashMultiSet for anchors in order to make pop_root() work correctly

* Reduce DEFAULT_PARTIAL_CHAIN_PROPTEST_CASES and MAX_PARTIAL_CHAIN_BLOCKS

* Reduce DEFAULT_PARTIAL_CHAIN_PROPTEST_CASES and MAX_PARTIAL_CHAIN_BLOCKS even more

* Apply suggestions from code review

* Add comments about order of note commitments and related methods/fields

* Don't use Option for trees

* Set DEFAULT_PARTIAL_CHAIN_PROPTEST_CASES=1 and restore MAX_PARTIAL_CHAIN_BLOCKS

* Remove unneeded anchor set rebuilding in fork()

* Improve proptest formatting

* Add missing comparisons to eq_internal_state

* Renamed sprout::tree::NoteCommitmentTree::hash() to root()

* Improve comments

* Add asserts, add issues to TODOs

* Remove impl Default for Chain since it was only used by tests

* Improve documentation and assertions; add tree serialization tests

* Remove Sprout code, which will be moved to another branch

* Add todo! in Sprout tree append()

* Remove stub request, response *Anchor* handling for now

* Add test for validating Sapling note commitment tree using test blocks

* Increase database version (new columns added for note commitment trees and anchors)

* Update test to make sure the order of sapling_note_commitments() is being tested

* Improve comments and structure of the test

* Improve variable names again

* Rustfmt

Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
Co-authored-by: Conrado P. L. Gouvea <conradoplg@gmail.com>
Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
Co-authored-by: teor <teor@riseup.net>
2021-07-29 09:37:18 -04:00
..
commitment Update multiple crates to ensure bitvec 0.22.3 is being used (#2351) 2021-06-23 13:16:22 +10:00
keys Call `zebra_test::init` where needed. (#1227) 2020-11-10 10:29:25 +10:00
note Revert making sapling::note::Nullifier inner value private 2021-04-30 00:48:23 -04:00
tests Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00
address.rs Use new bech32 methods that expect a Variant enum variant 2021-02-21 20:51:43 -05:00
arbitrary.rs Add ZIP-0244 TxId Digest support (#2129) 2021-07-06 09:58:22 -03:00
commitment.rs Update multiple crates to ensure bitvec 0.22.3 is being used (#2351) 2021-06-23 13:16:22 +10:00
keys.rs Fix clippy::cmp_owned for (sapling, orchard)::keys with `ConstantTimeEq` (#2184) 2021-05-22 09:40:49 -03:00
note.rs Replace smart quotes with ascii quotes 2021-03-15 03:18:10 -04:00
output.rs Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
shielded_data.rs Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00
spend.rs Redesign Transaction V5 serialization, impl trusted vector security, nullifier utility functions (#1996) 2021-04-16 08:19:28 +10:00
tests.rs Calculate incremental note commitment trees (#2407) 2021-07-15 13:58:36 +00:00
tree.rs Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00