diff --git a/execution_chain/beacon/api_handler.nim b/execution_chain/beacon/api_handler.nim index 5a45378b40..be0965c8f2 100644 --- a/execution_chain/beacon/api_handler.nim +++ b/execution_chain/beacon/api_handler.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2023-2025 Status Research & Development GmbH +# Copyright (c) 2023-2026 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -30,4 +30,5 @@ export newPayload, forkchoiceUpdated, getBlobsV1, - getBlobsV2 + getBlobsV2, + getBlobsV3 diff --git a/execution_chain/beacon/api_handler/api_getblobs.nim b/execution_chain/beacon/api_handler/api_getblobs.nim index 62e98fcdcb..bf3bba6b2f 100644 --- a/execution_chain/beacon/api_handler/api_getblobs.nim +++ b/execution_chain/beacon/api_handler/api_getblobs.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2025 Status Research & Development GmbH +# Copyright (c) 2025-2026 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -8,6 +8,7 @@ # those terms. import + std/sequtils, results, json_rpc/errors, web3/engine_api_types, @@ -50,3 +51,18 @@ proc getBlobsV2*(ben: BeaconEngineRef, list.add blobAndProof ok(list) + +proc getBlobsV3*(ben: BeaconEngineRef, + versionedHashes: openArray[VersionedHash]): + seq[Opt[BlobAndProofV2]] = + # https://github.com/ethereum/execution-apis/pull/719 + if versionedHashes.len > 128: + raise tooLargeRequest("the number of requested blobs is too large") + + if ben.latestFork < Osaka: + raise unsupportedFork( + "getBlobsV3 called before Osaka has been activated") + + versionedHashes.mapIt( + ben.txPool.getBlobAndProofV2(it) + ) diff --git a/execution_chain/rpc/engine_api.nim b/execution_chain/rpc/engine_api.nim index c2ed3fbec4..4ef4841ecd 100644 --- a/execution_chain/rpc/engine_api.nim +++ b/execution_chain/rpc/engine_api.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2021-2025 Status Research & Development GmbH +# Copyright (c) 2021-2026 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -38,6 +38,7 @@ const supportedMethods: HashSet[string] = "engine_getClientVersionV1", "engine_getBlobsV1", "engine_getBlobsV2", + "engine_getBlobsV3" ]) # I'm trying to keep the handlers below very thin, and move the @@ -118,3 +119,7 @@ proc setupEngineAPI*(engine: BeaconEngineRef, server: RpcServer) = server.rpc("engine_getBlobsV2") do(versionedHashes: seq[VersionedHash]) -> Opt[seq[BlobAndProofV2]]: return engine.getBlobsV2(versionedHashes) + + server.rpc("engine_getBlobsV3") do(versionedHashes: seq[VersionedHash]) -> + seq[Opt[BlobAndProofV2]]: + return engine.getBlobsV3(versionedHashes)