pub struct RangeProof<F: Family, D: Digest> {
pub proof: Proof<F, D>,
pub pre_prefix_acc: Option<D>,
pub unfolded_prefix_peaks: Vec<D>,
pub partial_chunk_digest: Option<D>,
pub ops_root: D,
}Expand description
A proof that a range of operations exist in the database.
Fields§
§proof: Proof<F, D>The Merkle digest material required to verify the proof.
pre_prefix_acc: Option<D>The single folded accumulator of all aligned prefix peaks that do not require unfolding.
unfolded_prefix_peaks: Vec<D>Individual fold-prefix peak digests, in peak order, when the generic proof’s single folded prefix accumulator would otherwise hide multi-peak chunk structure needed for grafted-root reconstruction.
partial_chunk_digest: Option<D>The partial chunk digest from the status bitmap at the time of proof generation, if any.
ops_root: DThe ops-tree root at the time of proof generation. Needed by the verifier to reconstruct the canonical root.
Implementations§
Source§impl<F: Graftable, D: Digest> RangeProof<F, D>
impl<F: Graftable, D: Digest> RangeProof<F, D>
Sourcepub async fn new<H: CHasher<Digest = D>, S: Storage<F, Digest = D>, const N: usize>(
hasher: &mut H,
status: &impl BitmapReadable<N>,
storage: &S,
range: Range<Location<F>>,
ops_root: D,
) -> Result<Self, Error<F>>
pub async fn new<H: CHasher<Digest = D>, S: Storage<F, Digest = D>, const N: usize>( hasher: &mut H, status: &impl BitmapReadable<N>, storage: &S, range: Range<Location<F>>, ops_root: D, ) -> Result<Self, Error<F>>
Create a new range proof for the provided range of operations.
Sourcepub async fn new_with_ops<H: CHasher<Digest = D>, C: Contiguous, S: Storage<F, Digest = D>, const N: usize>(
hasher: &mut H,
status: &impl BitmapReadable<N>,
storage: &S,
log: &C,
start_loc: Location<F>,
max_ops: NonZeroU64,
ops_root: D,
) -> Result<(Self, Vec<C::Item>, Vec<[u8; N]>), Error<F>>
pub async fn new_with_ops<H: CHasher<Digest = D>, C: Contiguous, S: Storage<F, Digest = D>, const N: usize>( hasher: &mut H, status: &impl BitmapReadable<N>, storage: &S, log: &C, start_loc: Location<F>, max_ops: NonZeroU64, ops_root: D, ) -> Result<(Self, Vec<C::Item>, Vec<[u8; N]>), Error<F>>
Returns a proof that the specified range of operations are part of the database, along with the operations from the range and their activity status chunks. A truncated range (from hitting the max) can be detected by looking at the length of the returned operations vector.
§Errors
Returns Error::OperationPruned if start_loc falls in a pruned bitmap chunk.
Returns merkle::Error::LocationOverflow if start_loc > merkle::Family::MAX_LEAVES.
Returns merkle::Error::RangeOutOfBounds if start_loc >= number of leaves in the MMR.
Source§impl<F: Graftable, D: Digest> RangeProof<F, D>
impl<F: Graftable, D: Digest> RangeProof<F, D>
Sourcepub fn verify<H: CHasher<Digest = D>, O: Codec, const N: usize>(
&self,
hasher: &mut H,
start_loc: Location<F>,
ops: &[O],
chunks: &[[u8; N]],
root: &H::Digest,
) -> bool
pub fn verify<H: CHasher<Digest = D>, O: Codec, const N: usize>( &self, hasher: &mut H, start_loc: Location<F>, ops: &[O], chunks: &[[u8; N]], root: &H::Digest, ) -> bool
Return true if the given sequence of ops were applied starting at location start_loc in
the db with the provided root, and having the activity status described by chunks.
Trait Implementations§
Source§impl<F: Clone + Family, D: Clone + Digest> Clone for RangeProof<F, D>
impl<F: Clone + Family, D: Clone + Digest> Clone for RangeProof<F, D>
Source§fn clone(&self) -> RangeProof<F, D>
fn clone(&self) -> RangeProof<F, D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<F: Eq + Family, D: Eq + Digest> Eq for RangeProof<F, D>
impl<F: Family, D: Digest> StructuralPartialEq for RangeProof<F, D>
Auto Trait Implementations§
impl<F, D> Freeze for RangeProof<F, D>where
D: Freeze,
impl<F, D> RefUnwindSafe for RangeProof<F, D>where
D: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, D> Send for RangeProof<F, D>
impl<F, D> Sync for RangeProof<F, D>
impl<F, D> Unpin for RangeProof<F, D>
impl<F, D> UnsafeUnpin for RangeProof<F, D>where
D: UnsafeUnpin,
impl<F, D> UnwindSafe for RangeProof<F, D>where
D: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more