pub trait MerkleTreeProver<T> {
type Scheme: MerkleTreeScheme<T>;
type Committed;
// Required methods
fn scheme(&self) -> &Self::Scheme;
fn commit(
&self,
data: &[T],
batch_size: usize,
) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>;
fn commit_iterated<ParIter>(
&self,
iterated_chunks: ParIter,
log_len: usize,
) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>
where ParIter: IndexedParallelIterator<Item: IntoIterator<Item = T>>;
fn layer<'a>(
&self,
committed: &'a Self::Committed,
layer_depth: usize,
) -> Result<&'a [<Self::Scheme as MerkleTreeScheme<T>>::Digest], Error>;
fn prove_opening(
&self,
committed: &Self::Committed,
layer_depth: usize,
index: usize,
) -> Result<<Self::Scheme as MerkleTreeScheme<T>>::Proof, Error>;
}
Expand description
A Merkle tree prover for a particular scheme.
This is separate from MerkleTreeScheme
so that it may be implemented using a
hardware-accelerated backend.
Required Associated Types§
type Scheme: MerkleTreeScheme<T>
Required Methods§
sourcefn commit(
&self,
data: &[T],
batch_size: usize,
) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>
fn commit( &self, data: &[T], batch_size: usize, ) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>
Commit a vector of values.
sourcefn commit_iterated<ParIter>(
&self,
iterated_chunks: ParIter,
log_len: usize,
) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>where
ParIter: IndexedParallelIterator<Item: IntoIterator<Item = T>>,
fn commit_iterated<ParIter>(
&self,
iterated_chunks: ParIter,
log_len: usize,
) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>where
ParIter: IndexedParallelIterator<Item: IntoIterator<Item = T>>,
Commit interleaved elements from iterator by val
sourcefn layer<'a>(
&self,
committed: &'a Self::Committed,
layer_depth: usize,
) -> Result<&'a [<Self::Scheme as MerkleTreeScheme<T>>::Digest], Error>
fn layer<'a>( &self, committed: &'a Self::Committed, layer_depth: usize, ) -> Result<&'a [<Self::Scheme as MerkleTreeScheme<T>>::Digest], Error>
Returns the internal digest layer at the given depth.
sourcefn prove_opening(
&self,
committed: &Self::Committed,
layer_depth: usize,
index: usize,
) -> Result<<Self::Scheme as MerkleTreeScheme<T>>::Proof, Error>
fn prove_opening( &self, committed: &Self::Committed, layer_depth: usize, index: usize, ) -> Result<<Self::Scheme as MerkleTreeScheme<T>>::Proof, Error>
Generate an opening proof for an entry in a committed vector at the given index.
§Arguments
committed
- helper data generated during commitmentlayer_depth
- depth of the layer to prove inclusion inindex
- the entry index
Object Safety§
This trait is not object safe.