fix: call validate_execution_requests from validate_version_specific_fields for ethereum engine validator (#14932)

This commit is contained in:
Federico Gimenez
2025-03-11 13:33:51 +01:00
committed by GitHub
parent eaa45abb98
commit e536fbce95
6 changed files with 33 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
use crate::{MessageValidationKind, PayloadAttributes};
use alloc::vec::Vec;
use alloy_eips::eip4895::Withdrawal;
use alloy_eips::{eip4895::Withdrawal, eip7685::Requests};
use alloy_primitives::B256;
use alloy_rpc_types_engine::ExecutionData;
use core::fmt::Debug;
@@ -164,3 +164,25 @@ impl ExecutionPayload for op_alloy_rpc_types_engine::OpExecutionData {
self.payload.as_v1().gas_used
}
}
/// Special implementation for Ethereum types that provides additional helper methods
impl<'a, Attributes> PayloadOrAttributes<'a, ExecutionData, Attributes>
where
Attributes: PayloadAttributes,
{
/// Return the execution requests from the payload, if available.
///
/// This will return `Some(requests)` only if:
/// - The payload is an `ExecutionData` (not `PayloadAttributes`)
/// - The payload has Prague payload fields
/// - The Prague fields contain requests (not a hash)
///
/// Returns `None` in all other cases.
pub fn execution_requests(&self) -> Option<&Requests> {
if let Self::ExecutionPayload(payload) = self {
payload.sidecar.requests()
} else {
None
}
}
}