Commit Graph

43 Commits

Author SHA1 Message Date
Kris Nuttycombe 4c79a7d065 Release incrementalmerkletree-v0.4.0 and bridgetree-v0.3.0 2023-06-05 19:39:49 -06:00
Kris Nuttycombe 87007ec69b Remove the `Debug` bound from `Hashable`
The `Debug` bound here is handy but not required for the operations
on the trait.
2023-06-05 16:52:54 -06:00
Kris Nuttycombe 51c3997ee6 Fix incorrect documentation and `cargo doc` issues. 2023-05-24 14:50:52 -06:00
Kris Nuttycombe 62f0c9039b
Merge pull request #73 from nuttycom/frontier_witness
Add the ability to compute a `MerklePath` from a Frontier
2023-05-24 14:10:46 -06:00
Kris Nuttycombe b43902f0e6 Add the ability to compute a `MerklePath` from a Frontier
This adds a thin wrapper around `NonEmptyWitness::Frontier` that uses
the Frontier's statically known depth to be able to compute a
`MerklePath` with the same statically known depth.
2023-05-24 12:37:28 -06:00
Kris Nuttycombe 4efe39eaa6 Remove initial checkpoints.
The choice to use an initial checkpoint as an anchor for removals in
`unmark` operations produced an awkward situation where it was necessary
to choose a checkpoint identifier just to construct an empty tree. This
removes that decision in favor of eagerly removing data if there is no
checkpoint to tie the removal to.
2023-05-22 12:11:34 -06:00
Kris Nuttycombe f292a271ac Return owned types from `ShardStore` getter methods.
The primary implementations of `ShardStore` will be constructing
owned values from an underlying persistence layer, and it is not
possible to return a reference to an owned value.
2023-05-19 15:43:06 -06:00
Kris Nuttycombe 34d9aa25bc Use `u64` for the internal state of `Position` and `Address::index` 2023-05-10 16:46:23 -06:00
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 30a1b7b62b Fix clippy complaints. 2023-03-21 12:15:22 -06:00
Kris Nuttycombe 71557cc0e3 Expose operations on `legacy-api` types required for serialization & testing. 2023-03-21 12:15:22 -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 0cb1cec21f Add `shardtree` witness operation & implement property tests. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe ebe3efa135 Add ShardTree types & implement append operation. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe 8864a84d19 Introduce a simple binary tree type. 2023-03-08 11:07:58 -07:00
Kris Nuttycombe 1db85f347e Merge remote-tracking branch 'upstream/master' into witness_at_depth 2023-03-03 17:06:36 -07:00
Kris Nuttycombe 0697df7d95 Fix documentation errors. 2023-03-03 17:02:03 -07:00
Kris Nuttycombe d467a6163d Merge remote-tracking branch 'upstream/master' into release-0.3.1 2023-02-28 14:14:35 -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 6867240e5a Remove the `current_leaf` method from `Tree`
The notion of `current` doesn't make a lot of sense in the context of
out-of-order insertion.
2023-02-16 15:01:53 -07:00
Kris Nuttycombe 0e2329cebc Fix a missed Authpath -> Witness rename. 2023-02-16 15:01:53 -07: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 dff6be7221 Update MSRV to 1.60
The transitive dependency we have on `unarray` is forcing this update.
Also, update CI actions to eliminate dependencies on the unmaintained
`actions-rs` Rust CI tools.
2023-02-16 10:51:41 -07:00
Kris Nuttycombe 8998f839ce Change `append` to take ownership of the value being appended.
It is now up to the caller to clone the value if necessary.
2023-01-04 14:08:11 -07:00
Kris Nuttycombe 0dde92c699 Move `testing::lazy_root` to `testing::complete_tree::root` & make crate-private
The former name didnt make sense anyway, because there's nothing lazy
about the result.
2022-12-21 14:48:53 -07:00
Kris Nuttycombe 4e2883c707 Move CombinedTree to incrementalmerkletree::testing 2022-12-21 12:53:17 -07:00
Kris Nuttycombe 3f88ac3af2 Move complete_tree testing module to incrementalmerkletree 2022-12-21 12:53:17 -07:00
Kris Nuttycombe a8c5ce1c98 Move `check_operations` to `incrementalmerkletree::testing` 2022-12-21 12:53:17 -07:00
Kris Nuttycombe 6b4bcda423 Move shared example tests to incrementalmerkletree::testing 2022-12-21 12:53:17 -07:00
Kris Nuttycombe 6b6d108de6 Move randomized test generators to incrementalmerkletree 2022-12-21 12:53:17 -07:00
Kris Nuttycombe eb3413837e Move `Tree` and `Frontier` traits to `incementalmerkletree::testing` 2022-12-21 12:53:17 -07:00
Kris Nuttycombe c5c6c65799 Move position & hashable types to incrementalmerkletree root. 2022-12-21 12:52:57 -07:00
Kris Nuttycombe b2a68215a0 Move the `bridgetree` crate to a workspace. 2022-12-21 11:59:43 -07:00