EngineValidator

Trait EngineValidator 

pub trait EngineValidator<Types, N = <<Types as PayloadTypes>::BuiltPayload as BuiltPayload>::Primitives>:
    Send
    + Sync
    + 'static
where Types: PayloadTypes, N: NodePrimitives,
{ // Required methods fn validate_payload_attributes_against_header( &self, attr: &<Types as PayloadTypes>::PayloadAttributes, header: &<N as NodePrimitives>::BlockHeader, ) -> Result<(), InvalidPayloadAttributesError>; fn ensure_well_formed_payload( &self, payload: <Types as PayloadTypes>::ExecutionData, ) -> Result<RecoveredBlock<<N as NodePrimitives>::Block>, NewPayloadError>; fn validate_payload( &mut self, payload: <Types as PayloadTypes>::ExecutionData, ctx: TreeCtx<'_, N>, ) -> Result<ExecutedBlockWithTrieUpdates<N>, InsertPayloadError<<N as NodePrimitives>::Block>>; fn validate_block( &mut self, block: RecoveredBlock<<N as NodePrimitives>::Block>, ctx: TreeCtx<'_, N>, ) -> Result<ExecutedBlockWithTrieUpdates<N>, InsertPayloadError<<N as NodePrimitives>::Block>>; }
Expand description

Type that validates the payloads processed by the engine.

This provides the necessary functions for validating/executing payloads/blocks.

Required Methods§

fn validate_payload_attributes_against_header( &self, attr: &<Types as PayloadTypes>::PayloadAttributes, header: &<N as NodePrimitives>::BlockHeader, ) -> Result<(), InvalidPayloadAttributesError>

Validates the payload attributes with respect to the header.

By default, this enforces that the payload attributes timestamp is greater than the timestamp according to:

  1. Client software MUST ensure that payloadAttributes.timestamp is greater than timestamp of a block referenced by forkchoiceState.headBlockHash.

See also: https://github.com/ethereum/execution-apis/blob/main/src/engine/common.md#specification-1

fn ensure_well_formed_payload( &self, payload: <Types as PayloadTypes>::ExecutionData, ) -> Result<RecoveredBlock<<N as NodePrimitives>::Block>, NewPayloadError>

Ensures that the given payload does not violate any consensus rules that concern the block’s layout.

This function must convert the payload into the executable block and pre-validate its fields.

Implementers should ensure that the checks are done in the order that conforms with the engine-API specification.

fn validate_payload( &mut self, payload: <Types as PayloadTypes>::ExecutionData, ctx: TreeCtx<'_, N>, ) -> Result<ExecutedBlockWithTrieUpdates<N>, InsertPayloadError<<N as NodePrimitives>::Block>>

Validates a payload received from engine API.

fn validate_block( &mut self, block: RecoveredBlock<<N as NodePrimitives>::Block>, ctx: TreeCtx<'_, N>, ) -> Result<ExecutedBlockWithTrieUpdates<N>, InsertPayloadError<<N as NodePrimitives>::Block>>

Validates a block downloaded from the network.

Implementors§

§

impl<N, Types, P, Evm, V> EngineValidator<Types> for BasicEngineValidator<P, Evm, V>
where P: DatabaseProviderFactory + BlockReader<Header = <N as NodePrimitives>::BlockHeader> + StateProviderFactory + StateReader + HashedPostStateProvider + Clone + 'static, <P as DatabaseProviderFactory>::Provider: BlockReader, N: NodePrimitives, V: PayloadValidator<Types, Block = <N as NodePrimitives>::Block>, Evm: ConfigureEngineEvm<<Types as PayloadTypes>::ExecutionData, Primitives = N> + 'static, Types: PayloadTypes, <Types as PayloadTypes>::BuiltPayload: BuiltPayload<Primitives = N>,