zebra/zebra-chain/src
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
..
block Validate spends of transparent coinbase outputs (#2525) 2021-07-29 14:23:50 +10:00
orchard Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00
parameters Legacy chain check and tests (#2366) 2021-06-29 15:03:51 +10:00
primitives Revert "ZIP-221: Validate chain history commitments in the non-finalized state (#2301)" (#2464) 2021-07-08 09:25:49 -03:00
sapling Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00
serialization Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
sprout Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00
transaction Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00
transparent Validate spends of transparent coinbase outputs (#2525) 2021-07-29 14:23:50 +10:00
value_balance Add a `ValueBalance` type (#2505) 2021-07-22 12:49:18 +00:00
work Replace primitives_types with uint (#2350) 2021-06-18 15:35:05 -03:00
amount.rs Calculate the remaining value in the transparent transaction value pool (#2486) 2021-07-29 13:49:36 +10:00
block.rs Validate spends of transparent coinbase outputs (#2525) 2021-07-29 14:23:50 +10:00
fmt.rs Add a TypeNameToDebug formatter to zebra_chain (#2466) 2021-07-09 12:40:19 +10:00
history_tree.rs Revert "ZIP-221: Validate chain history commitments in the non-finalized state (#2301)" (#2464) 2021-07-08 09:25:49 -03:00
lib.rs Add a `ValueBalance` type (#2505) 2021-07-22 12:49:18 +00:00
orchard.rs Orchard data in V5 parsing (#2116) 2021-05-21 00:42:06 +00:00
parameters.rs Cleanup a few arbitrary impls (#2222) 2021-05-28 09:49:28 -03:00
primitives.rs Add ZIP-244 signature hash support (#2165) 2021-07-07 08:27:10 +10:00
sapling.rs Update multiple crates to ensure bitvec 0.22.3 is being used (#2351) 2021-06-23 13:16:22 +10:00
serialization.rs Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
shutdown.rs Fix shutdown panics (#1637) 2021-02-03 19:03:28 +10:00
sprout.rs Move the preallocate tests into their own files (#1977) 2021-04-07 12:32:27 +10:00
transaction.rs Track anchors and note commitment trees in zebra-state (#2458) 2021-07-29 09:37:18 -04:00
transparent.rs Validate spends of transparent coinbase outputs (#2525) 2021-07-29 14:23:50 +10:00
value_balance.rs Calculate the remaining value in the transparent transaction value pool (#2486) 2021-07-29 13:49:36 +10:00
work.rs Replace primitives_types with uint (#2350) 2021-06-18 15:35:05 -03:00