pub struct RangeProof<D: Digest> {
pub proof: Proof<D>,
pub partial_chunk_digest: Option<D>,
}Expand description
A proof that a range of operations exist in the database.
Fields§
§proof: Proof<D>The MMR digest material required to verify the proof.
partial_chunk_digest: Option<D>The partial chunk digest from the status bitmap at the time of proof generation, if any.
Implementations§
Source§impl<D: Digest> RangeProof<D>
impl<D: Digest> RangeProof<D>
Sourcepub async fn new<H: CHasher<Digest = D>, S: Storage<D>, const N: usize>(
hasher: &mut H,
status: &CleanBitMap<D, N>,
grafting_height: u32,
mmr: &S,
range: Range<Location>,
) -> Result<Self, Error>
pub async fn new<H: CHasher<Digest = D>, S: Storage<D>, const N: usize>( hasher: &mut H, status: &CleanBitMap<D, N>, grafting_height: u32, mmr: &S, range: Range<Location>, ) -> Result<Self, Error>
Create a new range proof for the provided range of operations.
Sourcepub async fn new_with_ops<E: RStorage + Clock + Metrics, H: CHasher<Digest = D>, C: Contiguous, const N: usize>(
hasher: &mut H,
status: &CleanBitMap<D, N>,
height: u32,
mmr: &Mmr<E, D, Clean<D>>,
log: &C,
start_loc: Location,
max_ops: NonZeroU64,
) -> Result<(Self, Vec<C::Item>, Vec<[u8; N]>), Error>
pub async fn new_with_ops<E: RStorage + Clock + Metrics, H: CHasher<Digest = D>, C: Contiguous, const N: usize>( hasher: &mut H, status: &CleanBitMap<D, N>, height: u32, mmr: &Mmr<E, D, Clean<D>>, log: &C, start_loc: Location, max_ops: NonZeroU64, ) -> Result<(Self, Vec<C::Item>, Vec<[u8; N]>), Error>
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 crate::mmr::Error::LocationOverflow if start_loc > crate::mmr::MAX_LOCATION.
Returns crate::mmr::Error::RangeOutOfBounds if start_loc >= number of leaves in the MMR.
Sourcepub fn verify<H: CHasher<Digest = D>, O: Codec, const N: usize>(
&self,
hasher: &mut H,
grafting_height: u32,
start_loc: Location,
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, grafting_height: u32, start_loc: Location, 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<D: Clone + Digest> Clone for RangeProof<D>
impl<D: Clone + Digest> Clone for RangeProof<D>
Source§fn clone(&self) -> RangeProof<D>
fn clone(&self) -> RangeProof<D>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<D: Eq + Digest> Eq for RangeProof<D>
impl<D: Digest> StructuralPartialEq for RangeProof<D>
Auto Trait Implementations§
impl<D> Freeze for RangeProof<D>where
D: Freeze,
impl<D> RefUnwindSafe for RangeProof<D>where
D: RefUnwindSafe,
impl<D> Send for RangeProof<D>
impl<D> Sync for RangeProof<D>
impl<D> Unpin for RangeProof<D>where
D: Unpin,
impl<D> UnwindSafe for RangeProof<D>where
D: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)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