Commit Graph

421 Commits

Author SHA1 Message Date
Kris Nuttycombe 4a871a5840 Add LocatedTree::from_parts 2023-06-06 16:50:27 -06:00
Kris Nuttycombe a397ba9d46 There is no longer a distinction between `ShardTree::empty` and `ShardTree::load`. 2023-06-06 16:50:27 -06:00
Kris Nuttycombe 1721d46571 Wrap ShardTree errors explicitly, instead of relying on `From` impls.
This introduces a `ShardTreeError` type that is used to wrap errors
that arise from the undelying `ShardStore` when used in `ShardTree`
methods. The previous approach that relied on `From<QueryError> +
From<InsertionError>` bounds resulted in a situation where the shard
store error was forced to encompass the bounds of these types, even
though the methods on the `ShardStore` itself could never generate them.
This resulted in a number of awkward problems for error conversion.
2023-06-06 16:50:27 -06:00
Kris Nuttycombe 290b66d5c8 Add caching of the "cap" to root & witness computation. 2023-06-06 16:50:27 -06:00
Kris Nuttycombe f8c13d17de Add insertion of legacy incremental witness data to `ShardTree` 2023-06-06 16:50:27 -06:00
Kris Nuttycombe f5b06c8e8b Add construction of `LocatedPrunableTree` from `IncrementalWitness` 2023-06-06 16:50:27 -06:00
Kris Nuttycombe d350d43fd7 Add "shardtree cap" support to `ShardStore` and `ShardTree`.
The cap is a truncated tree that can be used to cache precomputed
subtree roots at tree heights greater than `SHARD_HEIGHT`. Only roots
whose hashes cannot be altered by rewinds or by the addition of data to
the tree may be persisted to the cap.
2023-06-06 16:50:27 -06:00
Kris Nuttycombe 19c514b8cf Add insertion of frontier nodes into a `ShardTree` 2023-06-06 16:50:27 -06:00
Kris Nuttycombe aab7c969b3 Add a mechanism to insert the nodes from a `Frontier` into a `LocatedPrunableTree` 2023-06-06 16:50:27 -06:00
Kris Nuttycombe 75cd519646
Merge pull request #77 from zcash/release-incrementalmerkletree-v0.4.0
Release incrementalmerkletree v0.4.0 & bridgetree v0.3.0
2023-06-06 10:05:52 -06:00
Kris Nuttycombe e8dcfe5b4c Update changelog for bridgetree-v0.3.0 release 2023-06-06 09:20:39 -06:00
Kris Nuttycombe 4c79a7d065 Release incrementalmerkletree-v0.4.0 and bridgetree-v0.3.0 2023-06-05 19:39:49 -06:00
Kris Nuttycombe 66cf091b97 Merge branch 'release-bridgetree-v0.2.1' into HEAD 2023-06-05 19:39:43 -06:00
Kris Nuttycombe b2077aa105
Merge pull request #76 from nuttycom/narrow_hashable_constraint
Remove the `Debug` bound from `Hashable`
2023-06-05 18:09:48 -06:00
Kris Nuttycombe a1dec495de Release of `bridgetree` v0.2.1
The `bridgetree-v0.2.0` tag was created with respect to an invalid
repository state, which did not actually contain the `bridgetree`
sources after they were factored out from the `incrementalmerkletree`
crate.
2023-06-05 17:14:09 -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
Nate Wilcox be1f673cd8 Add crate-level `incrementalmerkletree` docs defining navigational abstractions w/ an ASCII diagram. 2023-06-02 13:49:46 -06:00
Kris Nuttycombe 69c9690bb6
Merge pull request #74 from nuttycom/docfix
Fix incorrect documentation and `cargo doc` issues.
2023-05-30 13:37:22 -06:00
Kris Nuttycombe 2f65d483ee
Update shardtree/src/lib.rs
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-05-30 12:40:11 -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 beb6ead57f
Merge pull request #72 from nuttycom/no_initial_checkpoint
Remove initial checkpoints.
2023-05-24 12:57:02 -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 2b8e2d62fa Address comments from code review.
This also provides a minor performance and correctness improvement to
`remove_mark`.
2023-05-24 09:30:14 -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 a26844a451
Merge pull request #71 from nuttycom/shardstore_return_owned_types
Improvements required for implementing `ShardStore` atop a persistent store.
2023-05-22 12:08:11 -06:00
Kris Nuttycombe 5691b70947 Restore the relevant part of a deleted comment. 2023-05-22 10:29:40 -06:00
Kris Nuttycombe e2fa0a44c7 Make all `ShardStore` methods return `Result`
When implementing `ShardStore` atop a persistent data store, we need to
be able to reflect failures of the storage layer that are independent of
the presence or absence of data.
2023-05-19 15:45:03 -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 15623973e4
Merge pull request #67 from nuttycom/shardstore_checkpoint_api
Add methods for managing checkpoint data to the ShardStore API.
2023-05-11 12:34:52 -06:00
Kris Nuttycombe dbb2a8f9c5 Make hash and checkpoint ID type parameters associated types of `ShardStore` 2023-05-11 12:04:37 -06:00
Kris Nuttycombe 666e72482a Address Clippy lints. 2023-05-10 20:44:58 -06:00
Kris Nuttycombe 247b38f336 Invert the relationship between shardtree errors and storage errors. 2023-05-10 20:44:57 -06:00
Kris Nuttycombe 0e502e3832 Add `Display` impl for `shardtree::InsertionError` 2023-05-10 20:43:56 -06:00
Kris Nuttycombe 10e5ee59a4 Distinguish between creating a new empty tree and loading data for an existing tree. 2023-05-10 20:43:20 -06:00
Kris Nuttycombe e15440bd37 Add checkpoint management APIs to `ShardStore`. 2023-05-10 20:43:20 -06:00
Kris Nuttycombe ed78bc2e56 Add dedicated `MemoryShardStore` type. 2023-05-10 20:43:18 -06:00
Kris Nuttycombe 62acf235a7
Merge pull request #68 from nuttycom/u64_positions
Use `u64` for the internal state of `Position` and `Address::index`
2023-05-10 20:34:59 -06:00
Kris Nuttycombe 951d61b27b
Merge pull request #66 from nuttycom/shardstore_blanket_mut_impl
Add a blanket implementation of ShardStore for mutable references to ShardStores
2023-05-10 20:34:49 -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 465f2ff0d8 Add a blanket implementation of ShardStore for mutable references to ShardStores. 2023-05-04 13:46:02 -06:00
Kris Nuttycombe b4bebd497e
Merge pull request #65 from nuttycom/improve_enumerate
Avoid a few usize->u8 comparisons.
2023-05-04 13:20:30 -06:00
Kris Nuttycombe 667c57a835 Avoid a few usize-u8 comparisons. 2023-05-04 12:49:16 -06:00
Kris Nuttycombe ea1686e8f8
Merge pull request #64 from nuttycom/typed_merkle_path
Use `MerklePath` when returning witnesses.
2023-04-11 09:40:27 -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 873a72ff98 Return `MerklePath` from `ShardTree::witness` 2023-04-06 19:48:10 -06:00
Kris Nuttycombe d2d945edcb Expose `MerklePath` type without a feature flag. 2023-04-06 17:07:20 -06:00
Kris Nuttycombe be81d67cef
Merge pull request #62 from nuttycom/add_librustzcash_types
Move `bridgetree::Frontier` to `incrementalmerkletree` and add `librustzcash` types.
2023-04-04 10:37:16 -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