referrerpolicy=no-referrer-when-downgrade

ServiceInterface

Trait ServiceInterface 

Source
pub trait ServiceInterface<Block: BlockT> {
    // Required methods
    fn check_block_status(
        &self,
        hash: Block::Hash,
        header: &Block::Header,
    ) -> bool;
    fn build_collation(
        &self,
        parent_header: &Block::Header,
        block_hash: Block::Hash,
        candidate: ParachainCandidate<Block>,
        scheduling_proof: Option<SchedulingProof>,
    ) -> Option<(Collation, ParachainBlockData<Block>)>;
    fn build_multi_block_collation(
        &self,
        parent_header: &Block::Header,
        blocks: Vec<Block>,
        proof: StorageProof,
        scheduling_proof: Option<SchedulingProof>,
    ) -> Option<(Collation, ParachainBlockData<Block>)>;
    fn announce_with_barrier(
        &self,
        block_hash: Block::Hash,
    ) -> Sender<CollationSecondedSignal>;
    fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>);
}
Expand description

Utility functions generally applicable to writing collators for Cumulus.

Required Methods§

Source

fn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool

Checks the status of the given block hash in the Parachain.

Returns true if the block could be found and is good to be build on.

Source

fn build_collation( &self, parent_header: &Block::Header, block_hash: Block::Hash, candidate: ParachainCandidate<Block>, scheduling_proof: Option<SchedulingProof>, ) -> Option<(Collation, ParachainBlockData<Block>)>

Build a full Collation from a given [ParachainCandidate]. This requires that the underlying block has been fully imported into the underlying client, as implementations will fetch underlying runtime API data.

scheduling_proof is Some for V3 candidates (produces ParachainBlockData::V2) and None for legacy candidates (produces ParachainBlockData::V1).

This also returns the unencoded parachain block data, in case that is desired.

Source

fn build_multi_block_collation( &self, parent_header: &Block::Header, blocks: Vec<Block>, proof: StorageProof, scheduling_proof: Option<SchedulingProof>, ) -> Option<(Collation, ParachainBlockData<Block>)>

Build a multi-block collation.

Does the same as Self::build_collation, but includes multiple blocks into one collation. The given parent_header should be the header from the parent of the first block.

scheduling_proof is Some for V3 candidates (produces ParachainBlockData::V2) and None for legacy candidates (produces ParachainBlockData::V1).

Source

fn announce_with_barrier( &self, block_hash: Block::Hash, ) -> Sender<CollationSecondedSignal>

Inform networking systems that the block should be announced after a signal has been received to indicate the block has been seconded by a relay-chain validator.

This sets up the barrier and returns the sending side of a channel, for the signal to be passed through.

Source

fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>)

Directly announce a block on the network.

Implementors§

Source§

impl<Block, BS, RA> ServiceInterface<Block> for CollatorService<Block, BS, RA>
where Block: BlockT, BS: BlockBackend<Block>, RA: ProvideRuntimeApi<Block>, RA::Api: CollectCollationInfo<Block>,