File tree Expand file tree Collapse file tree 5 files changed +26
-0
lines changed
Expand file tree Collapse file tree 5 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,12 @@ proc rand[T](_: type seq[T]): seq[T] =
8989 for i in 0 ..< 3 :
9090 result [i] = rand (T)
9191
92+ proc rand [T](_: type openArray [T]): array [cellsPerExternalBlob, T] =
93+ var a: array [cellsPerExternalBlob, T]
94+ for i in 0 ..< a.len:
95+ a[i] = rand (T)
96+ a
97+
9298proc rand (_: type seq [seq [byte ]]): seq [seq [byte ]] =
9399 var z = newSeq [byte ](10 )
94100 discard randomBytes (z)
@@ -204,6 +210,7 @@ suite "JSON-RPC Quantity":
204210 checkRandomObject (ExecutionPayloadV3 )
205211 checkRandomObject (BlobsBundleV1 )
206212 checkRandomObject (BlobAndProofV1 )
213+ checkRandomObject (BlobAndProofV2 )
207214 checkRandomObject (ExecutionPayloadBodyV1 )
208215 checkRandomObject (PayloadAttributesV1 )
209216 checkRandomObject (PayloadAttributesV2 )
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ ExecutionPayloadV1OrV2.useDefaultSerializationIn JrpcConv
6060ExecutionPayloadV3 .useDefaultSerializationIn JrpcConv
6161BlobsBundleV1 .useDefaultSerializationIn JrpcConv
6262BlobAndProofV1 .useDefaultSerializationIn JrpcConv
63+ BlobAndProofV2 .useDefaultSerializationIn JrpcConv
6364ExecutionPayloadBodyV1 .useDefaultSerializationIn JrpcConv
6465PayloadAttributesV1 .useDefaultSerializationIn JrpcConv
6566PayloadAttributesV2 .useDefaultSerializationIn JrpcConv
Original file line number Diff line number Diff 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+
118126template newPayload * (
119127 rpcClient: RpcClient ,
120128 payload: ExecutionPayloadV1 ): Future [PayloadStatusV1 ] =
Original file line number Diff line number Diff line change @@ -127,10 +127,15 @@ type
127127 proofs* : seq [KzgProof ]
128128 blobs* : seq [Blob ]
129129
130+ # https://github.com/ethereum/execution-apis/blob/40088597b8b4f48c45184da002e27ffc3c37641f/src/engine/cancun.md#blobandproofv1
130131 BlobAndProofV1 * = object
131132 blob* : Blob
132133 proof* : KzgProof
133134
135+ BlobAndProofV2 * = object
136+ blob* : Blob
137+ proofs* : array [cellsPerExternalBlob, KzgProof ]
138+
134139 # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#executionpayloadbodyv1
135140 # For optional withdrawals field, see:
136141 # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1
223228
224229 GetBlobsV1Response * = seq [BlobAndProofV1 ]
225230
231+ GetBlobsV2Response * = seq [BlobAndProofV2 ]
232+
226233 SomeGetPayloadResponse * =
227234 ExecutionPayloadV1 |
228235 GetPayloadV2Response |
Original file line number Diff line number Diff line change 2929 # https://github.com/ethereum/execution-apis/blob/c4089414bbbe975bbc4bf1ccf0a3d31f76feb3e1/src/engine/cancun.md#blobsbundlev1
3030 fieldElementsPerBlob = 4096
3131
32+ # https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.4/specs/fulu/polynomial-commitments-sampling.md#cells
33+ cellsPerExternalBlob* = 128
34+
3235type
3336 # https://github.com/ethereum/execution-apis/blob/c4089414bbbe975bbc4bf1ccf0a3d31f76feb3e1/src/schemas/base-types.yaml
3437
You can’t perform that action at this time.
0 commit comments