fix: enforce unsupported fork rules on get_payload_v3 (#4562)

This commit is contained in:
Dan Cline
2023-09-12 13:07:52 -04:00
committed by GitHub
parent 261a9f9499
commit c4956143b0
6 changed files with 74 additions and 0 deletions

View File

@@ -208,6 +208,24 @@ where
&self,
payload_id: PayloadId,
) -> EngineApiResult<ExecutionPayloadEnvelopeV3> {
// First we fetch the payload attributes to check the timestamp
let attributes = self
.inner
.payload_store
.payload_attributes(payload_id)
.await
.ok_or(EngineApiError::UnknownPayload)??;
// From the Engine API spec:
// <https://github.com/ethereum/execution-apis/blob/ff43500e653abde45aec0f545564abfb648317af/src/engine/cancun.md#specification-2>
//
// 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 Cancun fork.
if !self.inner.chain_spec.is_cancun_activated_at_timestamp(attributes.timestamp) {
return Err(EngineApiError::UnsupportedFork)
}
// Now resolve the payload
Ok(self
.inner
.payload_store