Zebra/zebra-chain/src/block
Marek d8f5d6b6f1
change(state): Deduplicate note commitment trees stored in the finalized state (#7312)
* Add support for deleting the trees

* Prune the trees

* Remove `Network` from `DiskWriteBatch`

Removing the `Network` from `DiskWriteBatch` makes it easy to
instantiate `DiskWriteBatch`es in `ZebraDb` that remove individual note
commitment trees.

The `Network` from `DiskWriteBatch` was used only for transparent
addresses, so the refactor isn't large. After removing it from
`DiskWriteBatch`, I passed it as a function argument instead. However,
we should simplify the parameter lists because at least two functions
have more than seven parameters now.

* Support individual tree removal in `ZebraDb`

* Refactor the tree removal task

* Prune old comments

* Remove redundant code

* Batch the removals

* delete ranges before relevant network upgrades

* moves prev_tree inits

* add iterator methods for reading note commitment trees

* Sets up skeleton of sapling pipeline

* Replaces .filter with .take_while

Fills in pipeline

Reuses zs_range_iter instead of repeating that code

Updates logic to stop at initial tip height

* uses std threads

* delete_range excludes end key

* fixes off by one bugs

* Log warning when a send fails

* Removes progress logs

* Log join errors instead of panicking

* Revert: Make the `db` field of `ZebraDb` private

* Move `delete_range_sapling_tree`

* Remove a redundant `else if` branch

Rationale:

The condition `n == 1` for the removed branch is true for a subset of
values of `n` in the preceding condition `n >= 1`.

* Use more specific error messages

* Revert: Remove redundant methods for tree removal

* Suggestions for Deduplicate note commitment trees stored in the finalized state (#7330)

* Add TODOs to some `Height` methods

* Add methods for deleting individual trees

* Refactor the tasks for deleting trees

---------

Co-authored-by: arya2 <aryasolhi@gmail.com>
2023-08-17 00:41:11 +00:00
..
height change(utils): Add a direct connection mode to zebra-checkpoints (#6516) 2023-04-26 23:35:53 +00:00
tests fix(chain): Validate header versions when serializing blocks (#6475) 2023-04-12 04:54:02 +00:00
arbitrary.rs change(test): Refactor the tests of non-finalized state (#7262) 2023-07-19 21:20:37 +00:00
commitment.rs fix(diagnostics): Hex-encode debug format of commitments, nonces, and nullifiers (#5960) 2023-01-17 13:57:22 +00:00
error.rs remove dead code from zebra-chain (#5464) 2022-10-25 03:23:50 +00:00
hash.rs change(rpc): Refactor get block template RPC into stages (#5837) 2022-12-13 21:25:04 +00:00
header.rs fix(diagnostics): Hex-encode debug format of commitments, nonces, and nullifiers (#5960) 2023-01-17 13:57:22 +00:00
height.rs change(state): Deduplicate note commitment trees stored in the finalized state (#7312) 2023-08-17 00:41:11 +00:00
merkle.rs cleanup(rust): Fix new nightly clippy warnings (#7135) 2023-07-05 07:11:27 +00:00
serialize.rs fix(chain): Validate header versions when serializing blocks (#6475) 2023-04-12 04:54:02 +00:00
tests.rs change(docs): Replaces XXX with TODO (#6417) 2023-03-28 04:13:04 +00:00