Trait Consensus
pub trait Consensus<B>: HeaderValidator<<B as Block>::Header>where
B: Block,{
type Error;
// Required methods
fn validate_body_against_header(
&self,
body: &<B as Block>::Body,
header: &SealedHeader<<B as Block>::Header>,
) -> Result<(), Self::Error>;
fn validate_block_pre_execution(
&self,
block: &SealedBlock<B>,
) -> Result<(), Self::Error>;
}
Expand description
Consensus is a protocol that chooses canonical chain.
Required Associated Types§
type Error
type Error
The error type related to consensus.
Required Methods§
fn validate_body_against_header(
&self,
body: &<B as Block>::Body,
header: &SealedHeader<<B as Block>::Header>,
) -> Result<(), Self::Error>
fn validate_body_against_header( &self, body: &<B as Block>::Body, header: &SealedHeader<<B as Block>::Header>, ) -> Result<(), Self::Error>
Ensures that body field values match the header.
fn validate_block_pre_execution(
&self,
block: &SealedBlock<B>,
) -> Result<(), Self::Error>
fn validate_block_pre_execution( &self, block: &SealedBlock<B>, ) -> Result<(), Self::Error>
Validate a block disregarding world state, i.e. things that can be checked before sender recovery and execution.
See the Yellow Paper sections 4.4.2 “Holistic Validity”, 4.4.4 “Block Header Validity”. Note: Ommer Validation (previously section 11.1) has been deprecated since the Paris hard fork transition to proof of stake.
This should not be called for the genesis block.
Note: validating blocks does not include other validations of the Consensus