pub trait EngineValidator<Types: EngineTypes>: PayloadValidator {
// Required methods
fn validate_version_specific_fields(
&self,
version: EngineApiMessageVersion,
payload_or_attrs: PayloadOrAttributes<'_, <Types as PayloadTypes>::PayloadAttributes>,
) -> Result<(), EngineObjectValidationError>;
fn ensure_well_formed_attributes(
&self,
version: EngineApiMessageVersion,
attributes: &<Types as PayloadTypes>::PayloadAttributes,
) -> Result<(), EngineObjectValidationError>;
// Provided method
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 the payloads processed by the engine.
Required Methods§
Sourcefn validate_version_specific_fields(
&self,
version: EngineApiMessageVersion,
payload_or_attrs: PayloadOrAttributes<'_, <Types as PayloadTypes>::PayloadAttributes>,
) -> Result<(), EngineObjectValidationError>
fn validate_version_specific_fields( &self, version: EngineApiMessageVersion, payload_or_attrs: PayloadOrAttributes<'_, <Types as PayloadTypes>::PayloadAttributes>, ) -> Result<(), EngineObjectValidationError>
Validates the presence or exclusion of fork-specific fields based on the payload attributes and the message version.
Sourcefn ensure_well_formed_attributes(
&self,
version: EngineApiMessageVersion,
attributes: &<Types as PayloadTypes>::PayloadAttributes,
) -> Result<(), EngineObjectValidationError>
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
.
Provided Methods§
Sourcefn 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 engine api spec