PayloadValidator

Trait PayloadValidator 

pub trait PayloadValidator<Types>:
    Send
    + Sync
    + Unpin
    + 'static
where Types: PayloadTypes,
{ type Block: Block; // Required method fn ensure_well_formed_payload( &self, payload: <Types as PayloadTypes>::ExecutionData, ) -> Result<RecoveredBlock<Self::Block>, NewPayloadError>; // Provided methods fn validate_block_post_execution_with_hashed_state( &self, _state_updates: &HashedPostState, _block: &RecoveredBlock<Self::Block>, ) -> Result<(), ConsensusError> { ... } fn validate_payload_attributes_against_header( &self, attr: &<Types as PayloadTypes>::PayloadAttributes, header: &<Self::Block as Block>::Header, ) -> Result<(), InvalidPayloadAttributesError> { ... } }
Expand description

Type that validates an ExecutionPayload.

Required Associated Types§

type Block: Block

The block type used by the engine.

Required Methods§

fn ensure_well_formed_payload( &self, payload: <Types as PayloadTypes>::ExecutionData, ) -> Result<RecoveredBlock<Self::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.

Provided Methods§

fn validate_block_post_execution_with_hashed_state( &self, _state_updates: &HashedPostState, _block: &RecoveredBlock<Self::Block>, ) -> Result<(), ConsensusError>

Verifies payload post-execution w.r.t. hashed state updates.

fn validate_payload_attributes_against_header( &self, attr: &<Types as PayloadTypes>::PayloadAttributes, header: &<Self::Block as Block>::Header, ) -> 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

Implementations on Foreign Types§

§

impl<'a, Types, T> PayloadValidator<Types> for &'a T
where Types: PayloadTypes, T: 'a + PayloadValidator<Types> + ?Sized, &'a T: Send + Sync + Unpin + 'static,

§

impl<ChainSpec, Types> PayloadValidator<Types> for EthereumEngineValidator<ChainSpec>
where ChainSpec: EthChainSpec + EthereumHardforks + 'static, Types: PayloadTypes<ExecutionData = ExecutionData>,

§

type Block = Block<EthereumTxEnvelope<TxEip4844>>

§

fn ensure_well_formed_payload( &self, payload: ExecutionData, ) -> Result<RecoveredBlock<<EthereumEngineValidator<ChainSpec> as PayloadValidator<Types>>::Block>, NewPayloadError>

§

impl<Types, T> PayloadValidator<Types> for Arc<T>
where Types: PayloadTypes, T: PayloadValidator<Types> + ?Sized, Arc<T>: Send + Sync + Unpin + 'static,

Implementors§