Commit Graph

229 Commits

Author SHA1 Message Date
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
Kris Nuttycombe 02341ece26 Ensure that `BridgeTree` state is checkpointed when constructing from a frontier. 2023-03-27 09:54:21 -06:00
Kris Nuttycombe 739441a892
Merge pull request #63 from nuttycom/bridgetree_checkpoint_id
Make `bridgetree` polymorphic in checkpoint identifier type.
2023-03-24 09:00:25 -06:00
Kris Nuttycombe f7931ec31f Apply suggestions from code review. 2023-03-24 08:38:11 -06:00
Kris Nuttycombe 0d1c3e6512
Merge pull request #59 from nuttycom/fix_premature_tracking
Do not eagerly track marked nodes in the current bridge.
2023-03-24 08:29:38 -06:00
Kris Nuttycombe 978da59c67 Merge branch 'bridgetree_checkpoint_id' into add_librustzcash_types 2023-03-23 16:18:32 -06:00
Kris Nuttycombe 650edd0fc7 Make `bridgetree` polymorphic in checkpoint identifier type. 2023-03-23 16:02:40 -06:00
Kris Nuttycombe 53139f4f9c
Merge pull request #50 from nuttycom/shardtree
Add `shardtree` crate.
2023-03-23 13:12:00 -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 3077e94301 Merge branch 'fix_premature_tracking' 2023-03-21 12:14:54 -06:00
Kris Nuttycombe 22c2c019cc Do not eagerly track marked nodes in the current bridge.
This fixes a minor compatibility issue with respect to possible
deserialization of the `incrementalmerkletree-0.3.0` `MerkleBridge`
type. It is not necessary to track a marked leaf in the current
bridge *unless* the marked position is the bridge's starting position
and the prior bridge ended at a checkpoint.
2023-03-21 11:59:36 -06:00
Kris Nuttycombe 257402db53 Address comments from review. 2023-03-20 16:12:30 -06:00
Kris Nuttycombe d7a04122ea Fix clippy complaints. 2023-03-13 11:42:57 -06:00
Kris Nuttycombe ac6e8e8212 Use direct recursion in shardtree instead of reduce/try_reduce
These more general functions weren't carrying their weight.
2023-03-09 16:29:24 -07:00
Kris Nuttycombe 664cead68b Use `bitflags` crate instead of hand-rolled `RetentionFlags` bit flags. 2023-03-09 13:51:56 -07:00
Kris Nuttycombe 37be939c0f Apply suggestions from code review
Co-authored-by: ebfull <ewillbefull@gmail.com>
2023-03-09 13:37:22 -07:00
Kris Nuttycombe fa7c6673fd Make `LocatedTree` and `LocatedPrunableTree` type aliases public. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe 0cb1cec21f Add `shardtree` witness operation & implement property tests. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe a7bb8bb749 Add `shardtree` batch insertion. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe e209f3bf20 Add `shardtree` checkpointing & root computation. 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 dc5a3ed0e7 Add types & operations for individual shards.
This adds the `LocatedPrunableTree` type, which provides the complete
set of operations for individual shards within a larger tree.
2023-03-08 11:11:16 -07:00
Kris Nuttycombe 34f6bd7ce5 Add a `LocatedTree` type that pairs tree roots with address information. 2023-03-08 11:09:43 -07:00
Kris Nuttycombe 8644372c4e Add types and methods to support tree pruning.
Each leaf of the tree is annotated with retention metadata, and
ephemeral leaves can be aggressively pruned when performing insertions
into the tree.
2023-03-08 11:08:59 -07:00
Kris Nuttycombe 8864a84d19 Introduce a simple binary tree type. 2023-03-08 11:07:58 -07:00
Kris Nuttycombe 0ae9b499cc Introduce the `shardtree` crate: a sparse Merkle tree type. 2023-03-07 12:11:48 -07:00
Kris Nuttycombe 9a0e39af3a
Merge pull request #52 from nuttycom/witness_at_depth
Compute witnesses as of checkpoint depth rather than as of a root hash.
2023-03-07 12:11:07 -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
Greg Pfeil 42dfd970b5
Merge pull request #60 from zcash/release-0.3.1
Merge hotfix branch for v0.3.1 back to `master`.
2023-02-28 16:03:23 -07:00
Kris Nuttycombe d467a6163d Merge remote-tracking branch 'upstream/master' into release-0.3.1 2023-02-28 14:14:35 -07:00
Kris Nuttycombe d91890d440 Release incrementalmerkletree v0.3.1 2023-02-28 14:08:25 -07:00
Kris Nuttycombe 06af5ac324
Merge pull request #57 from daira/max-altitude-bug
[0.3.1] Fix a bug on 32-bit platforms that caused `Position::max_altitude` to return the wrong value
2023-02-23 15:17:01 -07:00
Kris Nuttycombe f127aab803
Merge pull request #58 from daira/root-level-bug
Fix a bug on 32-bit platforms that caused `Position::root_level` to return the wrong value
2023-02-23 14:54:48 -07:00
Kris Nuttycombe 34551a00a7 Pin proptest dependency to 1.0.0 to avoid unstable `unarray` dep. 2023-02-23 14:52:29 -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
Daira Hopwood 86f0903c46 Fix a bug on 32-bit platforms that caused `Position::max_altitude` 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:15:57 +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