Trait PayloadValidator
pub trait PayloadValidator<Types>:
Send
+ Sync
+ Unpin
+ 'staticwhere
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§
Required Methods§
fn ensure_well_formed_payload(
&self,
payload: <Types as PayloadTypes>::ExecutionData,
) -> Result<RecoveredBlock<Self::Block>, NewPayloadError>
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>
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>
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:
- 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