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 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..5d5874432a8 100644 --- a/src/ethereum_test_rpc/types.py +++ b/src/ethereum_test_rpc/types.py @@ -136,9 +136,24 @@ 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] | None = None # >= Osaka (V2) + + proof: Bytes | None = None # <= Prague (V1) + + 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 | None]