ensure_well_formed_payload

Function ensure_well_formed_payload 

Source
pub fn ensure_well_formed_payload<ChainSpec, T>(
    chain_spec: ChainSpec,
    payload: OpExecutionData,
) -> Result<SealedBlock<Block<T>>, OpPayloadError>
where ChainSpec: OpHardforks, T: SignedTransaction,
Expand description

Ensures that the given payload does not violate any consensus rules that concern the block’s layout, like:

  • missing or invalid base fee
  • invalid extra data
  • invalid transactions
  • incorrect hash
  • block contains blob transactions or blob versioned hashes
  • block contains l1 withdrawals

The checks are done in the order that conforms with the engine-API specification.

This is intended to be invoked after receiving the payload from the CLI. The additional fields, starting with MaybeCancunPayloadFields, are not part of the payload, but are additional fields starting in the engine_newPayloadV3 RPC call, See also https://specs.optimism.io/protocol/exec-engine.html#engine_newpayloadv3

If the cancun fields are provided this also validates that the versioned hashes in the block are empty as well as those passed in the sidecar. If the payload fields are not provided.

Validation according to specs https://specs.optimism.io/protocol/exec-engine.html#engine-api.