Trait MmrApi

Source
pub trait MmrApi: RuntimeApi {
    type Error;
    type BlockNumber;
    type EncodableOpaqueLeaf;
    type Proof;

    // Required methods
    fn generate_proof<'life0, 'async_trait>(
        &'life0 self,
        block_numbers: Vec<Self::BlockNumber>,
        best_known_block_number: Option<Self::BlockNumber>,
        at_block: Option<Self::Hash>,
    ) -> Pin<Box<dyn Future<Output = Result<StdResult<(Vec<Self::EncodableOpaqueLeaf>, Self::Proof), Self::Error>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn root<'life0, 'async_trait>(
        &'life0 self,
        at_block: Option<Self::Hash>,
    ) -> Pin<Box<dyn Future<Output = Result<StdResult<Vec<Self::Hash>, Self::Error>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn verify_proof<'life0, 'async_trait>(
        &'life0 self,
        leaves: Vec<Self::EncodableOpaqueLeaf>,
        proof: Self::Proof,
        at_block: Option<Self::Hash>,
    ) -> Pin<Box<dyn Future<Output = Result<StdResult<(), Self::Error>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn verify_proof_stateless<'life0, 'async_trait>(
        &'life0 self,
        root: Self::Hash,
        leaves: Vec<Self::EncodableOpaqueLeaf>,
        proof: Self::Proof,
        at_block: Option<Self::Hash>,
    ) -> Pin<Box<dyn Future<Output = Result<StdResult<(), Self::Error>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Associated Types§

Required Methods§

Source

fn generate_proof<'life0, 'async_trait>( &'life0 self, block_numbers: Vec<Self::BlockNumber>, best_known_block_number: Option<Self::BlockNumber>, at_block: Option<Self::Hash>, ) -> Pin<Box<dyn Future<Output = Result<StdResult<(Vec<Self::EncodableOpaqueLeaf>, Self::Proof), Self::Error>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate MMR proof for the given block numbers.

Source

fn root<'life0, 'async_trait>( &'life0 self, at_block: Option<Self::Hash>, ) -> Pin<Box<dyn Future<Output = Result<StdResult<Vec<Self::Hash>, Self::Error>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the on-chain MMR root hash.

Source

fn verify_proof<'life0, 'async_trait>( &'life0 self, leaves: Vec<Self::EncodableOpaqueLeaf>, proof: Self::Proof, at_block: Option<Self::Hash>, ) -> Pin<Box<dyn Future<Output = Result<StdResult<(), Self::Error>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify MMR proof against on-chain MMR.

Source

fn verify_proof_stateless<'life0, 'async_trait>( &'life0 self, root: Self::Hash, leaves: Vec<Self::EncodableOpaqueLeaf>, proof: Self::Proof, at_block: Option<Self::Hash>, ) -> Pin<Box<dyn Future<Output = Result<StdResult<(), Self::Error>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify MMR proof against given root hash.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§