pub trait Consensus<T: Codec>: Send + Sync {
    fn get_block<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64
    ) -> Pin<Box<dyn Future<Output = Result<(T, Hash), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn check_block<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64,
        hash: Hash,
        block: T
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn commit<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64,
        commit: Commit<T>
    ) -> Pin<Box<dyn Future<Output = Result<Status, Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn get_authority_list<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        height: u64
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Node>, Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn broadcast_to_other<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        msg: OverlordMsg<T>
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn transmit_to_relayer<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context,
        addr: Address,
        msg: OverlordMsg<T>
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn report_error(&self, ctx: Context, error: ConsensusError); fn report_view_change(
        &self,
        ctx: Context,
        height: u64,
        round: u64,
        reason: ViewChangeReason
    ); }
Expand description

Trait for some functions that consensus needs.

Required Methods

Get a block of the given height and return the block with its hash.

Check the correctness of a block. If is passed, return the integrated transcations to do data persistence.

Commit a given height to execute and return the rich status.

Get an authority list of the given height.

Broadcast a message to other replicas.

Transmit a message to the Relayer, the third argument is the relayer’s address.

Report the overlord error with the corresponding context.

Report the overlord view change reason.

Implementors