pub struct RangeProof<F: Graftable, D: Digest> {
pub proof: Proof<F, D>,
pub pending_chunk_digest: F::PendingChunk<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.
pending_chunk_digest: F::PendingChunk<D>The pending-chunk contribution, if any.
partial_chunk_digest: Option<D>Digest of the bitmap’s trailing partial chunk, if any.
ops_root: DThe ops-tree root digest.
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: &StandardHasher<H>,
status: &impl BitmapReadable<N>,
storage: &S,
inactivity_floor: Location<F>,
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: &StandardHasher<H>, status: &impl BitmapReadable<N>, storage: &S, inactivity_floor: Location<F>, 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: &StandardHasher<H>,
status: &impl BitmapReadable<N>,
storage: &S,
log: &C,
request: RangeProofSpec<F, 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: &StandardHasher<H>, status: &impl BitmapReadable<N>, storage: &S, log: &C, request: RangeProofSpec<F, 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 tree.
Sourcepub fn verify<H: CHasher<Digest = D>, O: Codec, const N: usize>(
&self,
root_hasher: &StandardHasher<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, root_hasher: &StandardHasher<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 + Graftable, D: Clone + Digest> Clone for RangeProof<F, D>where
F::PendingChunk<D>: Clone,
impl<F: Clone + Graftable, D: Clone + Digest> Clone for RangeProof<F, D>where
F::PendingChunk<D>: Clone,
Source§fn clone(&self) -> RangeProof<F, D>
fn clone(&self) -> RangeProof<F, D>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Debug + Graftable, D: Debug + Digest> Debug for RangeProof<F, D>where
F::PendingChunk<D>: Debug,
impl<F: Debug + Graftable, D: Debug + Digest> Debug for RangeProof<F, D>where
F::PendingChunk<D>: Debug,
Source§impl<F: Graftable, D: Digest> EncodeSize for RangeProof<F, D>
impl<F: Graftable, D: Digest> EncodeSize for RangeProof<F, D>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Source§fn encode_inline_size(&self) -> usize
fn encode_inline_size(&self) -> usize
BufsMut::push
during Write::write_bufs. Used to size the working buffer for inline
writes. Override alongside Write::write_bufs for types where large
Bytes fields go via push; failing to do so will over-allocate.Source§impl<F: PartialEq + Graftable, D: PartialEq + Digest> PartialEq for RangeProof<F, D>where
F::PendingChunk<D>: PartialEq,
impl<F: PartialEq + Graftable, D: PartialEq + Digest> PartialEq for RangeProof<F, D>where
F::PendingChunk<D>: PartialEq,
Source§fn eq(&self, other: &RangeProof<F, D>) -> bool
fn eq(&self, other: &RangeProof<F, D>) -> bool
self and other values to be equal, and is used by ==.Source§impl<F: Graftable, D: Digest> Write for RangeProof<F, D>
impl<F: Graftable, D: Digest> Write for RangeProof<F, D>
Source§fn write_bufs(&self, buf: &mut impl BufsMut)
fn write_bufs(&self, buf: &mut impl BufsMut)
BufsMut, allowing existing Bytes chunks to be
appended via BufsMut::push instead of written inline. Must encode
to the same format as Write::write. Defaults to Write::write.impl<F: Eq + Graftable, D: Eq + Digest> Eq for RangeProof<F, D>where
F::PendingChunk<D>: Eq,
impl<F: Graftable, D: Digest> StructuralPartialEq for RangeProof<F, D>
Auto Trait Implementations§
impl<F, D> Freeze for RangeProof<F, D>
impl<F, D> RefUnwindSafe for RangeProof<F, D>
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>
impl<F, D> UnwindSafe for RangeProof<F, D>
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<T> Encode for Twhere
T: Write + EncodeSize,
impl<T> Encode for Twhere
T: Write + EncodeSize,
Source§impl<T> EncodeExt for Twhere
T: EncodeSize + Write,
impl<T> EncodeExt for Twhere
T: EncodeSize + Write,
Source§fn encode_with_pool_mut(&self, pool: &BufferPool) -> IoBufMut
fn encode_with_pool_mut(&self, pool: &BufferPool) -> IoBufMut
Source§fn encode_with_pool(&self, pool: &BufferPool) -> IoBufs
fn encode_with_pool(&self, pool: &BufferPool) -> IoBufs
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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