Trait sp_mmr_primitives::MmrApi
source · pub trait MmrApi<Block: BlockT, Hash: Codec>: Core<Block> {
Show 14 methods
fn generate_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf_index: LeafIndex
) -> Result<Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>, ApiError> { ... }
fn generate_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf_index: LeafIndex
) -> Result<Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>, ApiError> { ... }
fn verify_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn mmr_root(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Result<Hash, Error>, ApiError> { ... }
fn mmr_root_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext
) -> Result<Result<Hash, Error>, ApiError> { ... }
fn generate_batch_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf_indices: Vec<LeafIndex>
) -> Result<Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>, ApiError> { ... }
fn generate_batch_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf_indices: Vec<LeafIndex>
) -> Result<Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>, ApiError> { ... }
fn verify_batch_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_batch_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_batch_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_batch_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
}
Expand description
API to interact with MMR pallet.
Provided Methods§
sourcefn generate_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf_index: LeafIndex
) -> Result<Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>, ApiError>
fn generate_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf_index: LeafIndex
) -> Result<Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>, ApiError>
Generate MMR proof for a leaf under given index.
sourcefn generate_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf_index: LeafIndex
) -> Result<Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>, ApiError>
fn generate_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf_index: LeafIndex
) -> Result<Result<(EncodableOpaqueLeaf, Proof<Hash>), Error>, ApiError>
Generate MMR proof for a leaf under given index.
sourcefn verify_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against on-chain MMR.
Note this function will use on-chain MMR root hash and check if the proof matches the hash. See Self::verify_proof_stateless for a stateless verifier.
sourcefn verify_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against on-chain MMR.
Note this function will use on-chain MMR root hash and check if the proof matches the hash. See Self::verify_proof_stateless for a stateless verifier.
sourcefn verify_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against given root hash.
Note this function does not require any on-chain storage - the proof is verified against given MMR root hash.
The leaf data is expected to be encoded in its compact form.
sourcefn verify_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaf: EncodableOpaqueLeaf,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against given root hash.
Note this function does not require any on-chain storage - the proof is verified against given MMR root hash.
The leaf data is expected to be encoded in its compact form.
sourcefn mmr_root(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Result<Hash, Error>, ApiError>
fn mmr_root(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Result<Hash, Error>, ApiError>
Return the on-chain MMR root hash.
sourcefn mmr_root_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext
) -> Result<Result<Hash, Error>, ApiError>
fn mmr_root_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext
) -> Result<Result<Hash, Error>, ApiError>
Return the on-chain MMR root hash.
sourcefn generate_batch_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf_indices: Vec<LeafIndex>
) -> Result<Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>, ApiError>
fn generate_batch_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaf_indices: Vec<LeafIndex>
) -> Result<Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>, ApiError>
Generate MMR proof for a series of leaves under given indices.
sourcefn generate_batch_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf_indices: Vec<LeafIndex>
) -> Result<Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>, ApiError>
fn generate_batch_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaf_indices: Vec<LeafIndex>
) -> Result<Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>, ApiError>
Generate MMR proof for a series of leaves under given indices.
sourcefn verify_batch_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_batch_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against on-chain MMR for a batch of leaves.
Note this function will use on-chain MMR root hash and check if the proof
matches the hash.
Note, the leaves should be sorted such that corresponding leaves and leaf indices have the
same position in both the leaves
vector and the leaf_indices
vector contained in the BatchProof
sourcefn verify_batch_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_batch_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against on-chain MMR for a batch of leaves.
Note this function will use on-chain MMR root hash and check if the proof
matches the hash.
Note, the leaves should be sorted such that corresponding leaves and leaf indices have the
same position in both the leaves
vector and the leaf_indices
vector contained in the BatchProof
sourcefn verify_batch_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_batch_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against given root hash or a batch of leaves.
Note this function does not require any on-chain storage - the proof is verified against given MMR root hash.
Note, the leaves should be sorted such that corresponding leaves and leaf indices have the
same position in both the leaves
vector and the leaf_indices
vector contained in the BatchProof
sourcefn verify_batch_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_batch_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf>,
proof: BatchProof<Hash>
) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against given root hash or a batch of leaves.
Note this function does not require any on-chain storage - the proof is verified against given MMR root hash.
Note, the leaves should be sorted such that corresponding leaves and leaf indices have the
same position in both the leaves
vector and the leaf_indices
vector contained in the BatchProof