Commit Graph

202 Commits

Author SHA1 Message Date
zancas 99f21fc543
Make general statement about merkle trees more conservative 2022-08-08 17:34:11 -06:00
Kris Nuttycombe ab23aafe5a
Merge pull request #44 from nuttycom/improve_naming
Rework the API for move to the `bridgetree` crate.
2022-08-04 16:50:34 -06:00
Kris Nuttycombe a98875d196 Improve `BridgeTree` and `MerkleBridge` documentation.
Co-authored-by: ebfull <ewillbefull@gmail.com>
2022-08-04 13:00:58 -06:00
Kris Nuttycombe 95d95f46db Export position & hashing types from the top-level module. 2022-08-04 13:00:58 -06:00
Kris Nuttycombe ad2c751633 Improve reporting for errors that can be generated in witness creation. 2022-08-04 13:00:58 -06:00
Kris Nuttycombe 7556c04472 Update bridgetree root module documentation. 2022-08-04 13:00:58 -06:00
Kris Nuttycombe 1581ce6864 Update README 2022-08-04 13:00:58 -06:00
Kris Nuttycombe 4d35824257 Minimize scope of allowed deprecations in testing.rs 2022-08-04 13:00:58 -06:00
Kris Nuttycombe 693961be3f Remove codecov task (never worked) 2022-08-04 13:00:58 -06:00
Kris Nuttycombe 5e04301a4b Move documentation to top-level methods + minor cleanup. 2022-08-04 13:00:58 -06:00
Kris Nuttycombe adf9ba26e4 Move the BridgeTree type to the root module. 2022-08-04 13:00:58 -06:00
Kris Nuttycombe 6e97389d1b Move `Frontier` and `Tree` traits to testing module.
These traits are only used for comparison testing between
the CompleteTree and BridgeTree types; they don't represent
useful independent abstractions.
2022-08-04 13:00:58 -06:00
Kris Nuttycombe 55731de321 Move Hashable trait to hashing module 2022-08-04 13:00:58 -06:00
Kris Nuttycombe 2a19b40fc1 Move position types to position module. 2022-08-04 13:00:56 -06:00
Kris Nuttycombe d631b8278a Move common test code into the testing module. 2022-08-04 13:00:05 -06:00
Kris Nuttycombe e19446f8fd Make test utilities available under a test-dependencies feature. 2022-08-04 13:00:05 -06:00
Kris Nuttycombe 7331a8f458 Rename fragments -> ommers 2022-08-04 13:00:05 -06:00
Kris Nuttycombe 6b6548f02e Rename authentication_path -> witness 2022-08-04 13:00:05 -06:00
Kris Nuttycombe ee93cb8598 Rename witness->mark 2022-08-04 13:00:04 -06:00
Kris Nuttycombe 7bd1907451
Merge pull request #43 from nuttycom/fix_frontiers
Remove the `bridgetree::Leaf` type & make ommer levels start at 0
2022-07-22 16:14:02 -06:00
Kris Nuttycombe 40e31f340c
Merge pull request #42 from nuttycom/sharing_tree
Alter MerkleBridge to avoid storing duplicate ommers.
2022-07-22 12:46:07 -06:00
Kris Nuttycombe 3b08071125 Remove the `bridgetree::Leaf` type & make ommer levels start at 0
This is a major refactoring that gets rid of a significant wart
in the design of the `bridgetree::Frontier` type that has existed
since the the project's inception.

The `Leaf` type incorrectly treated the siblings of leaves at
odd positions as special, whereas they should have been simply
treated as ordinary entries in the frontier's ommers list. Correcting
this allows for the code to be significantly simplified in a number
of places.
2022-07-21 18:32:58 -06:00
Kris Nuttycombe 4973b6682f Alter MerkleBridge to avoid storing duplicate ommers.
Prior to this change, each position being tracked would
require an entry in the `auth_fragments` map for each
bridge in a BridgeTree. However, very frequently, these
entries would duplicate storage of nodes higher up in the
tree, wherever a single node in the was an ancestor of
a leaf being tracked.

This commit restructures the tracking of auth data to
avoid this duplication of data, as well as the redundant
work that was required to produce each copy of the duplicated
nodes.
2022-07-21 18:27:09 -06:00
Kris Nuttycombe f081cfc81e Factor out bridge-level auth path construction. 2022-07-14 14:22:59 -06:00
ebfull 070a7588ae
Merge pull request #39 from zcash/release-0.3.0
Release 0.3.0
2022-05-10 09:39:36 -06:00
Sean Bowe c7e3ae7283
Release 0.3.0 2022-05-10 09:05:22 -06:00
Kris Nuttycombe f23e3d8950
Merge pull request #38 from nuttycom/authpath_anchor_depth
Add as_of_root argument to Tree::authentication_path
2022-04-22 10:55:26 -06:00
Kris Nuttycombe 9d94e9d6e8
Apply suggestions from code review
Co-authored-by: ebfull <ewillbefull@gmail.com>
2022-04-22 09:57:23 -06:00
Kris Nuttycombe 06728b9499 Add an as_of_root argument to Tree::authentication_path
This requires a user of this API to specify a root of the tree
that identifies the state of the tree at which the user wishes
to construct an authentication path. This must be equal to either
the current root of the tree, or to the root of the tree at a
previous checkpoint.
2022-04-20 14:13:12 -06:00
Kris Nuttycombe fef054d43a Move-only: group witness/remove_witness code together. 2022-04-15 10:00:03 -06:00
Kris Nuttycombe acbf32d077
Merge pull request #37 from zcash/release-0.3.0-beta.2
Release 0.3.0-beta.2
2022-04-06 11:47:04 -06:00
Jack Grigg 14386d14b1 incrementalmerkletree 0.3.0-beta.2 2022-04-06 17:45:17 +00:00
Kris Nuttycombe f55dafd596
Merge pull request #34 from nuttycom/add_changelog
Add changelog
2022-04-06 11:36:44 -06:00
Kris Nuttycombe 27723b395a Fix a few more changelog style consistency issues. 2022-04-06 11:35:06 -06:00
Kris Nuttycombe 7feaddd8e2 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-04-06 11:18:01 -06:00
ebfull 5d5439261f
Merge pull request #35 from nuttycom/rewind_retain_order
Fix an off-by-one error in BridgeTree garbage collection.
2022-04-05 16:31:22 -06:00
Kris Nuttycombe a4aa2bf204 Fix an off-by-one error in BridgeTree garbage collection. 2022-04-05 16:16:41 -06:00
Kris Nuttycombe 10e531d088 Restore forgotten witnesses before pruning to bridges length in rewind. 2022-04-05 16:15:41 -06:00
Kris Nuttycombe f9c12e37aa Add witnessed_positions and garbage_collect methods to the `Tree` trait.
* `witnessed_positions` returns the set of positions that have been
  witnessed in the tree.
* `garbage_collect` makes the garbage collection operation of
  `bridgetree::BridgeTree` publicly accessible. It is always safe to
  implement this method as a no-op.
2022-04-05 16:15:41 -06:00
Kris Nuttycombe 647ff944ad
Merge pull request #36 from nuttycom/bridgetree_from_frontier
Allow construction of incrementalmerkletree starting from a frontier.
2022-04-05 16:13:24 -06:00
Kris Nuttycombe ea258b1e8f Add CHANGELOG.md, documenting all changes since v0.2.0 2022-03-31 14:24:21 -06:00
Kris Nuttycombe f19cf9c381 Add `BridgeTree::from_frontier`
Add a constructor to allow a BridgeTree to be built starting at an
existing frontier.
2022-03-31 11:38:28 -06:00
Kris Nuttycombe 279331e4f3 Fix an error in `MerkleBridge::can_follow`
The subsequent bridge's prior position was incorrectly allowed to
be `None`.
2022-03-31 11:38:28 -06:00
Kris Nuttycombe 924db920e7
Merge pull request #32 from nuttycom/query_by_position
Always query the tree by position, not hash.
2022-03-31 11:38:06 -06:00
Kris Nuttycombe 027a98e53a Remove redundant documentation on trait impls. 2022-03-31 08:21:33 -06:00
Kris Nuttycombe 244fa7b73c Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-31 07:10:02 -06:00
Kris Nuttycombe a858de06d8 Always query the tree by position, not hash.
This modifies the `Tree::authentication_path` and `Tree::remove_witness`
methods to only operate in terms of the tree position, rather than both
the position and the hash that is expected to be the leaf at that
position.

Positions in the tree are always unique, and the tree already contains
the leaf information corresponding to each position, so the existing API
previously required the storage of redundant information. This change
streamlines the API without loss of power.

This also adds additional consistency checks to the property tests.
2022-03-30 22:16:31 -06:00
Kris Nuttycombe 413ed2e70a
Merge pull request #31 from nuttycom/bridgetree_separate_tip
Track the mutable tip of the bridgetree separate from the prior bridges.
2022-03-30 21:33:25 -06:00
Kris Nuttycombe d4d4950d31 Use existing current_leaf method rather than introducing "tip" 2022-03-30 18:09:50 -06:00
Kris Nuttycombe 12187dc0a4 Remove inaccurate test comment. 2022-03-30 17:57:18 -06:00