Trait mmr_rpc::MmrRuntimeApi
source · pub trait MmrRuntimeApi<Block, Hash, BlockNumber>: Core<Block>where
Block: Block,
Hash: Codec,
BlockNumber: Codec,{
// Provided methods
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 mmr_leaf_count(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Result<u64, Error>, ApiError> { ... }
fn mmr_leaf_count_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext
) -> Result<Result<u64, Error>, ApiError> { ... }
fn generate_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
block_numbers: Vec<BlockNumber, Global>,
best_known_block_number: Option<BlockNumber>
) -> Result<Result<(Vec<EncodableOpaqueLeaf, Global>, Proof<Hash>), Error>, ApiError> { ... }
fn generate_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
block_numbers: Vec<BlockNumber, Global>,
best_known_block_number: Option<BlockNumber>
) -> Result<Result<(Vec<EncodableOpaqueLeaf, Global>, Proof<Hash>), Error>, ApiError> { ... }
fn verify_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
fn verify_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError> { ... }
}
Expand description
API to interact with MMR pallet.
Provided Methods§
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 mmr_leaf_count(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Result<u64, Error>, ApiError>
fn mmr_leaf_count( &self, __runtime_api_at_param__: &BlockId<Block> ) -> Result<Result<u64, Error>, ApiError>
Return the number of MMR blocks in the chain.
sourcefn mmr_leaf_count_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext
) -> Result<Result<u64, Error>, ApiError>
fn mmr_leaf_count_with_context( &self, __runtime_api_at_param__: &BlockId<Block>, context: ExecutionContext ) -> Result<Result<u64, Error>, ApiError>
Return the number of MMR blocks in the chain.
sourcefn generate_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
block_numbers: Vec<BlockNumber, Global>,
best_known_block_number: Option<BlockNumber>
) -> Result<Result<(Vec<EncodableOpaqueLeaf, Global>, Proof<Hash>), Error>, ApiError>
fn generate_proof( &self, __runtime_api_at_param__: &BlockId<Block>, block_numbers: Vec<BlockNumber, Global>, best_known_block_number: Option<BlockNumber> ) -> Result<Result<(Vec<EncodableOpaqueLeaf, Global>, Proof<Hash>), Error>, ApiError>
Generate MMR proof for a series of block numbers. If best_known_block_number = Some(n)
,
use historical MMR state at given block height n
. Else, use current MMR state.
sourcefn generate_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
block_numbers: Vec<BlockNumber, Global>,
best_known_block_number: Option<BlockNumber>
) -> Result<Result<(Vec<EncodableOpaqueLeaf, Global>, Proof<Hash>), Error>, ApiError>
fn generate_proof_with_context( &self, __runtime_api_at_param__: &BlockId<Block>, context: ExecutionContext, block_numbers: Vec<BlockNumber, Global>, best_known_block_number: Option<BlockNumber> ) -> Result<Result<(Vec<EncodableOpaqueLeaf, Global>, Proof<Hash>), Error>, ApiError>
Generate MMR proof for a series of block numbers. If best_known_block_number = Some(n)
,
use historical MMR state at given block height n
. Else, use current MMR state.
sourcefn verify_proof(
&self,
__runtime_api_at_param__: &BlockId<Block>,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof( &self, __runtime_api_at_param__: &BlockId<Block>, leaves: Vec<EncodableOpaqueLeaf, Global>, proof: Proof<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 Proof
sourcefn verify_proof_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof_with_context( &self, __runtime_api_at_param__: &BlockId<Block>, context: ExecutionContext, leaves: Vec<EncodableOpaqueLeaf, Global>, proof: Proof<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 Proof
sourcefn verify_proof_stateless(
&self,
__runtime_api_at_param__: &BlockId<Block>,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof_stateless( &self, __runtime_api_at_param__: &BlockId<Block>, root: Hash, leaves: Vec<EncodableOpaqueLeaf, Global>, proof: Proof<Hash> ) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against given root hash for 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 Proof
sourcefn verify_proof_stateless_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext,
root: Hash,
leaves: Vec<EncodableOpaqueLeaf, Global>,
proof: Proof<Hash>
) -> Result<Result<(), Error>, ApiError>
fn verify_proof_stateless_with_context( &self, __runtime_api_at_param__: &BlockId<Block>, context: ExecutionContext, root: Hash, leaves: Vec<EncodableOpaqueLeaf, Global>, proof: Proof<Hash> ) -> Result<Result<(), Error>, ApiError>
Verify MMR proof against given root hash for 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 Proof