sp_subspace_mmr::host_functions

Trait SubspaceMmrHostFunctions

source
pub trait SubspaceMmrHostFunctions: Send + Sync {
    // Required methods
    fn get_mmr_leaf_data(&self, consensus_block_hash: H256) -> Option<LeafData>;
    fn verify_mmr_proof(
        &self,
        leaves: Vec<EncodableOpaqueLeaf>,
        encoded_proof: Vec<u8>,
    ) -> bool;
    fn consensus_block_hash(&self, block_number: BlockNumber) -> Option<H256>;
    fn is_consensus_block_finalized(&self, block_number: BlockNumber) -> bool;
}
Expand description

Trait to query MMR specific data through host function..

Required Methods§

source

fn get_mmr_leaf_data(&self, consensus_block_hash: H256) -> Option<LeafData>

Returns the MMR Leaf data for given consensus block hash

source

fn verify_mmr_proof( &self, leaves: Vec<EncodableOpaqueLeaf>, encoded_proof: Vec<u8>, ) -> bool

Verifies the mmr proof using consensus chain.

source

fn consensus_block_hash(&self, block_number: BlockNumber) -> Option<H256>

Returns the consensus block hash for given block number.

source

fn is_consensus_block_finalized(&self, block_number: BlockNumber) -> bool

Implementors§

source§

impl<Block, Client> SubspaceMmrHostFunctions for SubspaceMmrHostFunctionsImpl<Block, Client>
where Block: BlockT, Block::Hash: From<H256> + Into<H256>, Client: HeaderBackend<Block> + ProvideRuntimeApi<Block>, Client::Api: MmrApi<Block, H256, NumberFor<Block>>,