Skip to content

Commit 3fffb22

Browse files
committed
accomodate getBlobsV2
1 parent faf3ac6 commit 3fffb22

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

tests/test_json_marshalling.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ suite "JSON-RPC Quantity":
204204
checkRandomObject(ExecutionPayloadV3)
205205
checkRandomObject(BlobsBundleV1)
206206
checkRandomObject(BlobAndProofV1)
207+
checkRandomObject(BlobAndProofV2)
207208
checkRandomObject(ExecutionPayloadBodyV1)
208209
checkRandomObject(PayloadAttributesV1)
209210
checkRandomObject(PayloadAttributesV2)

web3/conversions.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ ExecutionPayloadV1OrV2.useDefaultSerializationIn JrpcConv
6060
ExecutionPayloadV3.useDefaultSerializationIn JrpcConv
6161
BlobsBundleV1.useDefaultSerializationIn JrpcConv
6262
BlobAndProofV1.useDefaultSerializationIn JrpcConv
63+
BlobAndProofV2.useDefaultSerializationFor JrpcConv
6364
ExecutionPayloadBodyV1.useDefaultSerializationIn JrpcConv
6465
PayloadAttributesV1.useDefaultSerializationIn JrpcConv
6566
PayloadAttributesV2.useDefaultSerializationIn JrpcConv

web3/engine_api.nim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ createRpcSigsFromNim(RpcClient):
3939
proc engine_getPayloadBodiesByHashV1(hashes: seq[Hash32]): seq[Opt[ExecutionPayloadBodyV1]]
4040
proc engine_getPayloadBodiesByRangeV1(start: Quantity, count: Quantity): seq[Opt[ExecutionPayloadBodyV1]]
4141
proc engine_getBlobsV1(blob_versioned_hashes: seq[VersionedHash]): GetBlobsV1Response
42+
proc engine_getBlobsV2(blob_versioned_hashes: seq[VersionedHash]): GetBlobsV2Response
4243

4344
# https://github.com/ethereum/execution-apis/blob/9301c0697e4c7566f0929147112f6d91f65180f6/src/engine/common.md
4445
proc engine_exchangeCapabilities(methods: seq[string]): seq[string]
@@ -115,6 +116,13 @@ template getBlobs*(
115116
Future[GetBlobsV1Response] =
116117
engine_getBlobsV1(rpcClient, blob_versioned_hashes)
117118

119+
template getBlobs*(
120+
rpcClient: RpcClient,
121+
T: type GetBlobsV2Response,
122+
blob_versioned_hashes: seq[VersionedHash]):
123+
Future[GetBlobsV2Response] =
124+
engine_getBlobsV2(rpcClient, blob_versioned_hashes)
125+
118126
template newPayload*(
119127
rpcClient: RpcClient,
120128
payload: ExecutionPayloadV1): Future[PayloadStatusV1] =

web3/engine_api_types.nim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ type
131131
blob*: Blob
132132
proof*: KzgProof
133133

134+
BlobAndProofV2* = object
135+
blob*: Blob
136+
proofs*: array[cellsPerExternalBlob, KzgProof]
137+
134138
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#executionpayloadbodyv1
135139
# For optional withdrawals field, see:
136140
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1
@@ -223,6 +227,8 @@ type
223227

224228
GetBlobsV1Response* = seq[BlobAndProofV1]
225229

230+
GetBlobsV2Response* = seq[BlobAndProofV2]
231+
226232
SomeGetPayloadResponse* =
227233
ExecutionPayloadV1 |
228234
GetPayloadV2Response |

web3/primitives.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const
2929
# https://github.com/ethereum/execution-apis/blob/c4089414bbbe975bbc4bf1ccf0a3d31f76feb3e1/src/engine/cancun.md#blobsbundlev1
3030
fieldElementsPerBlob = 4096
3131

32+
# https://github.com/0x00101010/execution-apis/blob/eip-7594/src/engine/osaka.md#blobandproofv2
33+
cellsPerExternalBlob* = 128
34+
3235
type
3336
# https://github.com/ethereum/execution-apis/blob/c4089414bbbe975bbc4bf1ccf0a3d31f76feb3e1/src/schemas/base-types.yaml
3437

0 commit comments

Comments
 (0)