From 479ca5c5811963f5a225ce0986cce7340df111a8 Mon Sep 17 00:00:00 2001 From: spencer-tb Date: Tue, 29 Apr 2025 18:05:31 +0100 Subject: [PATCH 1/5] chore: add osaka engine updates. --- src/ethereum_test_forks/forks/forks.py | 7 +++++++ src/ethereum_test_rpc/rpc.py | 16 ++++++++++++++++ src/ethereum_test_rpc/types.py | 13 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/ethereum_test_forks/forks/forks.py b/src/ethereum_test_forks/forks/forks.py index 59567fcff3e..be7deeaeb82 100644 --- a/src/ethereum_test_forks/forks/forks.py +++ b/src/ethereum_test_forks/forks/forks.py @@ -1284,6 +1284,13 @@ def engine_forkchoice_updated_version( class Osaka(Prague, solc_name="cancun"): """Osaka fork.""" + @classmethod + def engine_get_payload_version( + cls, block_number: int = 0, timestamp: int = 0 + ) -> Optional[int]: + """From Osaka, get payload calls must use version 5.""" + return 5 + @classmethod def evm_code_types(cls, block_number: int = 0, timestamp: int = 0) -> List[EVMCodeType]: """EOF V1 is supported starting from Osaka.""" diff --git a/src/ethereum_test_rpc/rpc.py b/src/ethereum_test_rpc/rpc.py index c1265a2140a..8a626cef1c9 100644 --- a/src/ethereum_test_rpc/rpc.py +++ b/src/ethereum_test_rpc/rpc.py @@ -15,6 +15,7 @@ from .types import ( ForkchoiceState, ForkchoiceUpdateResponse, + GetBlobsResponse, GetPayloadResponse, JSONRPCError, PayloadAttributes, @@ -344,3 +345,18 @@ def get_payload( ), context=self.response_validation_context, ) + + def get_blobs( + self, + params: List[Hash], + *, + version: int, + ) -> GetBlobsResponse: + """`engine_getBlobsVX`: Retrieves blobs from an execution layers tx pool.""" + return GetBlobsResponse.model_validate( + self.post_request( + f"getBlobsV{version}", + *[to_json(param) for param in params], + ), + context=self.response_validation_context, + ) diff --git a/src/ethereum_test_rpc/types.py b/src/ethereum_test_rpc/types.py index 6c1c154c657..c926a9e422b 100644 --- a/src/ethereum_test_rpc/types.py +++ b/src/ethereum_test_rpc/types.py @@ -136,9 +136,22 @@ def blob_versioned_hashes(self) -> List[Hash]: return [Hash(b"\1" + commitment[1:]) for commitment in self.commitments] +class BlobAndProof(CamelModel): + """Represents a blob and proof structure.""" + + blob: Bytes + proofs: List[Bytes] + + class GetPayloadResponse(CamelModel): """Represents the response of a get payload request.""" execution_payload: FixtureExecutionPayload blobs_bundle: BlobsBundle | None = None execution_requests: List[Bytes] | None = None + + +class GetBlobsResponse(CamelModel): + """Represents the response of a get blobs request.""" + + result: List[BlobAndProof] From 5a7a7c16db00aa26c7540cca61b3ad71fbcbab3e Mon Sep 17 00:00:00 2001 From: spencer-tb Date: Tue, 29 Apr 2025 18:12:18 +0100 Subject: [PATCH 2/5] chore(docs): add changelog. --- docs/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f16aaa5e904..69cefb1728a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -16,6 +16,8 @@ Test fixtures for use by clients are available for each release on the [Github r ### ๐Ÿ“‹ Misc +- โœจ Engine API updates for Osaka, add `get_blobs` rpc method ([#1510](https://github.com/ethereum/execution-spec-tests/pull/1510)). + ### ๐Ÿงช Test Cases ## [v4.4.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v4.4.0) - 2025-04-29 From 8c5381d8826597bc62c81780ffc56056fed4d7f8 Mon Sep 17 00:00:00 2001 From: spencer Date: Wed, 30 Apr 2025 17:29:49 +0100 Subject: [PATCH 3/5] Update src/ethereum_test_rpc/types.py Co-authored-by: Mario Vega --- src/ethereum_test_rpc/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ethereum_test_rpc/types.py b/src/ethereum_test_rpc/types.py index c926a9e422b..08f62b8d5d9 100644 --- a/src/ethereum_test_rpc/types.py +++ b/src/ethereum_test_rpc/types.py @@ -154,4 +154,4 @@ class GetPayloadResponse(CamelModel): class GetBlobsResponse(CamelModel): """Represents the response of a get blobs request.""" - result: List[BlobAndProof] + result: List[BlobAndProof | None] From fb423af0da271551fd5b15e6c67a66bb2d5a9aad Mon Sep 17 00:00:00 2001 From: spencer Date: Wed, 30 Apr 2025 17:31:02 +0100 Subject: [PATCH 4/5] Update src/ethereum_test_rpc/types.py Co-authored-by: Mario Vega --- src/ethereum_test_rpc/types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ethereum_test_rpc/types.py b/src/ethereum_test_rpc/types.py index 08f62b8d5d9..c186535f049 100644 --- a/src/ethereum_test_rpc/types.py +++ b/src/ethereum_test_rpc/types.py @@ -140,7 +140,8 @@ class BlobAndProof(CamelModel): """Represents a blob and proof structure.""" blob: Bytes - proofs: List[Bytes] + proofs: List[Bytes] | None = None + proof: Bytes | None= None class GetPayloadResponse(CamelModel): From 995a90588551713bf5e3913f6281f5d8036648fe Mon Sep 17 00:00:00 2001 From: spencer-tb Date: Wed, 30 Apr 2025 17:36:07 +0100 Subject: [PATCH 5/5] chore: tox fixes. --- src/ethereum_test_rpc/types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ethereum_test_rpc/types.py b/src/ethereum_test_rpc/types.py index c186535f049..5d5874432a8 100644 --- a/src/ethereum_test_rpc/types.py +++ b/src/ethereum_test_rpc/types.py @@ -140,8 +140,9 @@ class BlobAndProof(CamelModel): """Represents a blob and proof structure.""" blob: Bytes - proofs: List[Bytes] | None = None - proof: Bytes | None= None + proofs: List[Bytes] | None = None # >= Osaka (V2) + + proof: Bytes | None = None # <= Prague (V1) class GetPayloadResponse(CamelModel):