pub trait Network: Send + Sync {
    type ValidatorId: ValidatorId;
    type SignatureScheme: SignatureScheme<ValidatorId = Self::ValidatorId>;
    type Weights: Weights<ValidatorId = Self::ValidatorId>;
    type Block: Block;

    const BLOCK_TIME: u32;

    fn signer(&self) -> <Self::SignatureScheme as SignatureScheme>::Signer;
    fn signature_scheme(&self) -> Self::SignatureScheme;
    fn weights(&self) -> Self::Weights;
    fn broadcast<'life0, 'async_trait>(
        &'life0 mut self,
        msg: SignedMessage<Self::ValidatorId, Self::Block, <Self::SignatureScheme as SignatureScheme>::Signature>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn slash<'life0, 'async_trait>(
        &'life0 mut self,
        validator: Self::ValidatorId
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn validate<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        block: &'life1 Self::Block
    ) -> Pin<Box<dyn Future<Output = Result<(), BlockError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn add_block<'life0, 'async_trait>(
        &'life0 mut self,
        block: Self::Block,
        commit: Commit<Self::SignatureScheme>
    ) -> Pin<Box<dyn Future<Output = Self::Block> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn verify_commit(
        &self,
        id: <Self::Block as Block>::Id,
        commit: &Commit<Self::SignatureScheme>
    ) -> bool { ... } }
Expand description

Trait representing the distributed system Tendermint is providing consensus over.

Required Associated Types

Signature scheme used by validators.

Object representing the weights of validators.

Type used for ordered blocks of information.

Required Associated Constants

Required Methods

Return a handle on the signer in use, usable for the entire lifetime of the machine.

Return a handle on the signing scheme in use, usable for the entire lifetime of the machine.

Return a handle on the validators’ weights, usable for the entire lifetime of the machine.

Broadcast a message to the other validators. If authenticated channels have already been established, this will double-authenticate. Switching to unauthenticated channels in a system already providing authenticated channels is not recommended as this is a minor, temporal inefficiency while downgrading channels may have wider implications.

Trigger a slash for the validator in question who was definitively malicious. The exact process of triggering a slash is undefined and left to the network as a whole.

Validate a block.

Add a block, returning the proposal for the next one. It’s possible a block, which was never validated or even failed validation, may be passed here if a supermajority of validators did consider it valid and created a commit for it. This deviates from the paper which will have a local node refuse to decide on a block it considers invalid. This library acknowledges the network did decide on it, leaving handling of it to the network, and outside of this scope.

Provided Methods

Verify a commit for a given block. Intended for use when syncing or when not an active validator.

Implementors