Commit Graph

16 Commits

Author SHA1 Message Date
Kris Nuttycombe 667c57a835 Avoid a few usize-u8 comparisons. 2023-05-04 12:49:16 -06:00
Kris Nuttycombe 69d444c439 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-04-10 21:05:22 -06:00
Kris Nuttycombe d2d945edcb Expose `MerklePath` type without a feature flag. 2023-04-06 17:07:20 -06:00
Kris Nuttycombe ebbd2e3d2d Apply suggestions from code review.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-03-31 19:43:25 -06:00
Kris Nuttycombe 9c0c9aa245 Merge remote-tracking branch 'upstream/master' into add_librustzcash_types 2023-03-31 16:02:59 -06:00
Kris Nuttycombe 7cb2bdcc8f Add legacy `CommitmentTree` and `IncrementalWitness` types.
These types were previously part of the `zcash_primitives` crate and are
being included here to provide a migration path for when these types are
removed from `zcash_primitives`.
2023-03-21 12:15:22 -06:00
Kris Nuttycombe 4e3c6a6378 Move frontier types from `bridgetree` to `incrementalmerkletree`
These types are reusable outside of the context of the `bridgetree`
crate.
2023-03-21 12:15:22 -06:00
Kris Nuttycombe ff8095b7ed Remove `serde` serialization & deserialization
The structure of the `incrementalmerkletree` and `bridgetree` types has
not historically been stable, and as such it is not appropriate to
automatically derive serialization for these types.
2023-03-21 12:15:22 -06:00
Kris Nuttycombe d7a04122ea Fix clippy complaints. 2023-03-13 11:42:57 -06:00
Kris Nuttycombe 1db85f347e Merge remote-tracking branch 'upstream/master' into witness_at_depth 2023-03-03 17:06:36 -07:00
Daira Hopwood a44c2c7dbf Merge branch 'max-altitude-bug'. This fixes a bug on 32-bit platforms
that caused `Position::root_level` to return the wrong value, as a result
of assuming that `usize` is 64 bits.
fixes #56

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2023-02-23 21:32:18 +00:00
Kris Nuttycombe 14bb9c6b1b Modify test infrastructure to allow shardtree testing.
This removes the `mark` function from the `tree` interface, in favor
of always appending nodes as marked, as that's what's needed in
practice, rather than the ability to mutably mark the latest position at
arbitrary states of the tree.

This removal does mean that a few patterns of interleaved mark and
checkpoint operations are no longer being tested in the shared test
suite; however, such interleaving of operations is not something that
we should need to support anyway.
2023-02-16 15:01:53 -07:00
Kris Nuttycombe 07a88c34ac Adds a `Retention` enum to the `incrementalmerkletree` crate.
This will be necessary in order to make the testing infrastructure
reusable for shardtree.
2023-02-16 15:01:53 -07:00
Kris Nuttycombe aa1d59f47a `witness` now witnesses at a checkpoint, rather than a root.
This change exposed an inconsistency in how `BridgeTree` and
`CompleteTree` were tracking `Mark` operations, which has now also been
fixed.

The behavior of the "unmark" operation has been simplified, such that it
now ensures that a marked node will be made eligible for garbage
collection when the checkpoint for the tree state in which the mark was
forgotten rolls off the back of the checkpoint queue.
2023-02-16 15:01:53 -07:00
Kris Nuttycombe 2e9043ef82 Add `Address` methods to facilitate tree traversal. 2023-02-16 14:32:54 -07:00
Kris Nuttycombe c5c6c65799 Move position & hashable types to incrementalmerkletree root. 2022-12-21 12:52:57 -07:00