PayloadValidator

Trait PayloadValidator 

Source
pub trait PayloadValidator<Types: PayloadTypes>:
    Send
    + Sync
    + Unpin
    + 'static {
    type Block: Block;

    // Required method
    fn ensure_well_formed_payload(
        &self,
        payload: Types::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::PayloadAttributes,
        header: &<Self::Block as Block>::Header,
    ) -> Result<(), InvalidPayloadAttributesError> { ... }
}
Expand description

Type that validates an ExecutionPayload.

Required Associated Types§

Source

type Block: Block

The block type used by the engine.

Required Methods§

Source

fn ensure_well_formed_payload( &self, payload: Types::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§

Source

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.

Source

fn validate_payload_attributes_against_header( &self, attr: &Types::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§

Source§

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

Source§

type Block = <T as PayloadValidator<Types>>::Block

Source§

fn ensure_well_formed_payload( &self, payload: Types::ExecutionData, ) -> Result<RecoveredBlock<Self::Block>, NewPayloadError>

Source§

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

Source§

fn validate_payload_attributes_against_header( &self, attr: &Types::PayloadAttributes, header: &<Self::Block as Block>::Header, ) -> Result<(), InvalidPayloadAttributesError>

Source§

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

Source§

type Block = <T as PayloadValidator<Types>>::Block

Source§

fn ensure_well_formed_payload( &self, payload: Types::ExecutionData, ) -> Result<RecoveredBlock<Self::Block>, NewPayloadError>

Source§

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

Source§

fn validate_payload_attributes_against_header( &self, attr: &Types::PayloadAttributes, header: &<Self::Block as Block>::Header, ) -> Result<(), InvalidPayloadAttributesError>

Implementors§