referrerpolicy=no-referrer-when-downgrade
substrate_relay_helper::on_demand

Trait OnDemandRelay

Source
pub trait OnDemandRelay<SourceChain: Chain, TargetChain: Chain>: Send + Sync {
    // Required methods
    fn reconnect<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn require_more_headers<'life0, 'async_trait>(
        &'life0 self,
        required_header: BlockNumberOf<SourceChain>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn prove_header<'life0, 'async_trait>(
        &'life0 self,
        required_header: BlockNumberOf<SourceChain>,
    ) -> Pin<Box<dyn Future<Output = Result<(HeaderIdOf<SourceChain>, Vec<CallOf<TargetChain>>), SubstrateError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

On-demand headers relay that is relaying finalizing headers only when requested.

Required Methods§

Source

fn reconnect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), SubstrateError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reconnect to source and target nodes.

Source

fn require_more_headers<'life0, 'async_trait>( &'life0 self, required_header: BlockNumberOf<SourceChain>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ask relay to relay source header with given number to the target chain.

Depending on implementation, on-demand relay may also relay required_header ancestors (e.g. if they’re mandatory), or its descendants. The request is considered complete if the best avbailable header at the target chain has number that is larger than or equal to the required_header.

Source

fn prove_header<'life0, 'async_trait>( &'life0 self, required_header: BlockNumberOf<SourceChain>, ) -> Pin<Box<dyn Future<Output = Result<(HeaderIdOf<SourceChain>, Vec<CallOf<TargetChain>>), SubstrateError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ask relay to prove source required_header to the TargetChain.

Returns number of header that is proved (it may be the required_header or one of its descendants) and calls for delivering the proof.

Implementors§

Source§

impl<P: SubstrateFinalitySyncPipeline, SourceClnt: Client<P::SourceChain>, TargetClnt: Client<P::TargetChain>> OnDemandRelay<<P as SubstrateFinalityPipeline>::SourceChain, <P as SubstrateFinalityPipeline>::TargetChain> for OnDemandHeadersRelay<P, SourceClnt, TargetClnt>

Source§

impl<P: SubstrateParachainsPipeline, SourceRelayClnt, TargetClnt> OnDemandRelay<<P as SubstrateParachainsPipeline>::SourceParachain, <P as SubstrateParachainsPipeline>::TargetChain> for OnDemandParachainsRelay<P, SourceRelayClnt, TargetClnt>
where P::SourceParachain: Chain<Hash = ParaHash>, SourceRelayClnt: Client<P::SourceRelayChain>, TargetClnt: Client<P::TargetChain>,