Skip to main content

EngineApiValidator

Trait EngineApiValidator 

Source
pub trait EngineApiValidator<Types>:
    Send
    + Sync
    + Unpin
    + 'static
where Types: PayloadTypes,
{ // Required methods fn validate_version_specific_fields( &self, version: EngineApiMessageVersion, payload_or_attrs: PayloadOrAttributes<'_, <Types as PayloadTypes>::ExecutionData, <Types as PayloadTypes>::PayloadAttributes>, ) -> Result<(), EngineObjectValidationError>; fn ensure_well_formed_attributes( &self, version: EngineApiMessageVersion, attributes: &<Types as PayloadTypes>::PayloadAttributes, ) -> Result<(), EngineObjectValidationError>; }
Available on crate feature node-api only.
Expand description

Validates engine API requests at the RPC layer, before payloads and attributes are forwarded to the engine for processing.

  • validate_version_specific_fields: Enforced in each engine_newPayloadVN RPC handler to verify the payload contains the correct fields for the engine API version (e.g., blob fields in V3+, requests in V4+).

  • ensure_well_formed_attributes: Enforced in engine_forkchoiceUpdatedVN RPC handlers to validate payload attributes are well-formed for the given version before forwarding to the engine.

After this validation passes, the engine performs the full consensus validation pipeline (header, pre-execution, execution, post-execution).

Required Methods§

Source

fn validate_version_specific_fields( &self, version: EngineApiMessageVersion, payload_or_attrs: PayloadOrAttributes<'_, <Types as PayloadTypes>::ExecutionData, <Types as PayloadTypes>::PayloadAttributes>, ) -> Result<(), EngineObjectValidationError>

Validates the presence or exclusion of fork-specific fields based on the payload attributes and the message version.

Source

fn ensure_well_formed_attributes( &self, version: EngineApiMessageVersion, attributes: &<Types as PayloadTypes>::PayloadAttributes, ) -> Result<(), EngineObjectValidationError>

Ensures that the payload attributes are valid for the given EngineApiMessageVersion.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

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