* `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.
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.
This was just entirely wrong; it will often be the case that we've
observed several altitudes but have an empty list of values within
a particular fragment.
In practice, when performing a rewind we don't want to have to
do the additional bookkeeping keeping the leaf position and
value around just to be able to remove the witnesses. After
this change, `rewind` will always succeed unless there are
no checkpoints.
While these additional bounds are often used with hashable
types, they are not necessary for the construction of `Frontier`
values, and so should not be required everywhere.
This adds a garbage collection method to BridgeTree that
can be used to eliminate checkpoints and removed witnesses
that are no longer reachable for possible rewinds. It also
prunes unnecessary auth fragments from the tree.
It's possible to figure out whether or not a checkpoint is a duplicate
just by looking at the list of checkpoints; the checkpoint doesn't
need to carry that data internally.
Removal of witnesses is now recorded on a per-checkpoint
level, so that rewinding the tree state now restores any
witnesses that were removed since the checkpoint.
A number of internal consistency checks previously enforced
by the property tests have been removed as they did not
correctly implement this semantic, and reimplementing these
consistency checks would be equivalent to reimplementing the
sample tree, so these checks are now performed simply by
comparison against the reference implentation.