mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
refactor
This commit is contained in:
@@ -157,17 +157,17 @@ pub fn validate_payload_timestamp(
|
||||
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)
|
||||
// }
|
||||
let is_amsterdam = chain_spec.is_amsterdam_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_getPayloadV6`
|
||||
//
|
||||
// 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(())
|
||||
}
|
||||
|
||||
@@ -594,6 +594,17 @@ where
|
||||
self.get_payload_inner(payload_id, EngineApiMessageVersion::V6).await
|
||||
}
|
||||
|
||||
/// Metrics version of `get_payload_v6`
|
||||
pub async fn get_payload_v6_metered(
|
||||
&self,
|
||||
payload_id: PayloadId,
|
||||
) -> EngineApiResult<EngineT::ExecutionPayloadEnvelopeV6> {
|
||||
let start = Instant::now();
|
||||
let res = Self::get_payload_v6(self, payload_id).await;
|
||||
self.inner.metrics.latency.get_payload_v6.record(start.elapsed());
|
||||
res
|
||||
}
|
||||
|
||||
/// 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>(
|
||||
|
||||
@@ -50,6 +50,8 @@ pub(crate) struct EngineApiLatencyMetrics {
|
||||
pub(crate) get_payload_v4: Histogram,
|
||||
/// Latency for `engine_getPayloadV5`
|
||||
pub(crate) get_payload_v5: Histogram,
|
||||
/// Latency for `engine_getPayloadV6`
|
||||
pub(crate) get_payload_v6: Histogram,
|
||||
/// Latency for `engine_getPayloadBodiesByRangeV1`
|
||||
pub(crate) get_payload_bodies_by_range_v1: Histogram,
|
||||
/// Latency for `engine_getPayloadBodiesByHashV1`
|
||||
|
||||
Reference in New Issue
Block a user