mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
add engine_getPayloadV6
This commit is contained in:
@@ -156,7 +156,7 @@ pub(crate) fn block_to_new_payload(
|
||||
if let Some(prague) = sidecar.prague() {
|
||||
if is_optimism {
|
||||
(
|
||||
EngineApiMessageVersion::V5,
|
||||
EngineApiMessageVersion::V4,
|
||||
serde_json::to_value((
|
||||
OpExecutionPayloadV4 {
|
||||
payload_inner: payload.payload_inner,
|
||||
@@ -169,7 +169,7 @@ pub(crate) fn block_to_new_payload(
|
||||
)
|
||||
} else {
|
||||
(
|
||||
EngineApiMessageVersion::V5,
|
||||
EngineApiMessageVersion::V4,
|
||||
serde_json::to_value((
|
||||
payload,
|
||||
cancun.versioned_hashes.clone(),
|
||||
@@ -180,12 +180,11 @@ pub(crate) fn block_to_new_payload(
|
||||
}
|
||||
} else {
|
||||
(
|
||||
EngineApiMessageVersion::V4,
|
||||
EngineApiMessageVersion::V3,
|
||||
serde_json::to_value((
|
||||
payload,
|
||||
cancun.versioned_hashes.clone(),
|
||||
cancun.parent_beacon_block_root,
|
||||
prague.requests.requests_hash(),
|
||||
))?,
|
||||
)
|
||||
}
|
||||
@@ -284,7 +283,10 @@ pub(crate) async fn call_forkchoice_updated<N, P: EngineApiValidWaitExt<N>>(
|
||||
payload_attributes: Option<PayloadAttributes>,
|
||||
) -> TransportResult<ForkchoiceUpdated> {
|
||||
match message_version {
|
||||
EngineApiMessageVersion::V3 | EngineApiMessageVersion::V4 | EngineApiMessageVersion::V5 => {
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 |
|
||||
EngineApiMessageVersion::V6 => {
|
||||
provider.fork_choice_updated_v3_wait(forkchoice_state, payload_attributes).await
|
||||
}
|
||||
EngineApiMessageVersion::V2 => {
|
||||
|
||||
@@ -154,7 +154,19 @@ pub fn validate_payload_timestamp(
|
||||
//
|
||||
// 1. Client software MUST return -38005: Unsupported fork error if the timestamp of the
|
||||
// built payload does not fall within the time frame of the Osaka fork.
|
||||
return Err(EngineObjectValidationError::UnsupportedFork) // TODO Rimeeeeee / Soubhik-10
|
||||
return Err(EngineObjectValidationError::UnsupportedFork)
|
||||
}
|
||||
|
||||
let is_amsterdam = true; /* ///todo chain_spec.is_amstardam_active_at_timestamp(timestamp); */
|
||||
if version.is_v6() && !is_amsterdam {
|
||||
// From the Engine API spec:
|
||||
// <https://github.com/ethereum/execution-apis/blob/15399c2e2f16a5f800bf3f285640357e2c245ad9/src/engine/osaka.md#specification>
|
||||
//
|
||||
// For `engine_getPayloadV5`
|
||||
//
|
||||
// 1. Client software MUST return -38005: Unsupported fork error if the timestamp of the
|
||||
// built payload does not fall within the time frame of the Amsterdam fork.
|
||||
return Err(EngineObjectValidationError::UnsupportedFork)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -182,7 +194,8 @@ pub fn validate_withdrawals_presence<T: EthereumHardforks>(
|
||||
EngineApiMessageVersion::V2 |
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 => {
|
||||
EngineApiMessageVersion::V5 |
|
||||
EngineApiMessageVersion::V6 => {
|
||||
if is_shanghai_active && !has_withdrawals {
|
||||
return Err(message_validation_kind
|
||||
.to_error(VersionSpecificValidationError::NoWithdrawalsPostShanghai))
|
||||
@@ -283,7 +296,10 @@ pub fn validate_parent_beacon_block_root_presence<T: EthereumHardforks>(
|
||||
))
|
||||
}
|
||||
}
|
||||
EngineApiMessageVersion::V3 | EngineApiMessageVersion::V4 | EngineApiMessageVersion::V5 => {
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 |
|
||||
EngineApiMessageVersion::V6 => {
|
||||
if !has_parent_beacon_block_root {
|
||||
return Err(validation_kind
|
||||
.to_error(VersionSpecificValidationError::NoParentBeaconBlockRootPostCancun))
|
||||
@@ -387,6 +403,10 @@ pub enum EngineApiMessageVersion {
|
||||
///
|
||||
/// Added in the Osaka hardfork.
|
||||
V5 = 5,
|
||||
/// Version 6
|
||||
///
|
||||
/// Added in the Amsterdam hardfork
|
||||
V6 = 6,
|
||||
}
|
||||
|
||||
impl EngineApiMessageVersion {
|
||||
@@ -415,6 +435,11 @@ impl EngineApiMessageVersion {
|
||||
matches!(self, Self::V5)
|
||||
}
|
||||
|
||||
/// Returns true if version is V6
|
||||
pub const fn is_v6(&self) -> bool {
|
||||
matches!(self, Self::V6)
|
||||
}
|
||||
|
||||
/// Returns the method name for the given version.
|
||||
pub const fn method_name(&self) -> &'static str {
|
||||
match self {
|
||||
@@ -423,6 +448,7 @@ impl EngineApiMessageVersion {
|
||||
Self::V3 => "engine_newPayloadV3",
|
||||
Self::V4 => "engine_newPayloadV4",
|
||||
Self::V5 => "engine_newPayloadV5",
|
||||
Self::V6 => "engine_newPayloadV6",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ pub const CAPABILITIES: &[&str] = &[
|
||||
"engine_newPayloadV2",
|
||||
"engine_newPayloadV3",
|
||||
"engine_newPayloadV4",
|
||||
"engine_newPayloadV5",
|
||||
"engine_getPayloadBodiesByHashV1",
|
||||
"engine_getPayloadBodiesByRangeV1",
|
||||
"engine_getBlobsV1",
|
||||
|
||||
@@ -582,6 +582,16 @@ where
|
||||
res
|
||||
}
|
||||
|
||||
/// Handler for `engine_getPayloadV6`
|
||||
///
|
||||
/// For BAL
|
||||
pub async fn get_payload_v6(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadEnvelopeV5> {
|
||||
self.get_payload_inner(payload_id, EngineApiMessageVersion::V6).await
|
||||
}
|
||||
|
||||
/// Fetches all the blocks for the provided range starting at `start`, containing `count`
|
||||
/// blocks and returns the mapped payload bodies.
|
||||
pub async fn get_payload_bodies_by_range_with<F, R>(
|
||||
|
||||
Reference in New Issue
Block a user