Skip to content

Commit c63974b

Browse files
authored
add: compute_cells for getBlobsV2 (#7056)
* add: compute_cells for getBlobsV2 * updated link
1 parent 1b33142 commit c63974b

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

AllTests-mainnet.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,17 @@ AllTests-mainnet
442442
```
443443
## EF - KZG - PeerDAS
444444
```diff
445+
+ KZG - Compute Cells - compute_cells_case_valid_419245fbfe69f145 OK
446+
+ KZG - Compute Cells - compute_cells_case_valid_4aedd1a2a3933c3e OK
447+
+ KZG - Compute Cells - compute_cells_case_valid_6e773f256383918c OK
448+
+ KZG - Compute Cells - compute_cells_case_valid_b0731ef77b166ca8 OK
449+
+ KZG - Compute Cells - compute_cells_case_valid_b81d309b22788820 OK
450+
+ KZG - Compute Cells - compute_cells_case_valid_ed8b5001151417d5 OK
451+
+ KZG - Compute Cells - compute_cells_case_valid_edeb8500a6507818 OK
452+
+ KZG - Compute Cells - compute_cells_invalid_blob_26555bdcbf18a267 OK
453+
+ KZG - Compute Cells - compute_cells_invalid_blob_79fb3cb1ef585a86 OK
454+
+ KZG - Compute Cells - compute_cells_invalid_blob_7e99dea8893c104a OK
455+
+ KZG - Compute Cells - compute_cells_invalid_blob_9d88c33852eb782d OK
445456
+ KZG - Compute Cells And Proofs - compute_cells_and_kzg_proofs_case_invalid_blob_26555bdcbf OK
446457
+ KZG - Compute Cells And Proofs - compute_cells_and_kzg_proofs_case_invalid_blob_79fb3cb1ef OK
447458
+ KZG - Compute Cells And Proofs - compute_cells_and_kzg_proofs_case_invalid_blob_7e99dea889 OK

tests/consensus_spec/test_fixture_kzg.nim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,26 @@ proc runComputeBlobKzgProofTest(suiteName, suitePath, path: string) =
201201
else:
202202
check p.get.bytes == fromHex[48](output.getStr).get
203203

204+
proc runComputeCellsTest(suiteName, suitePath, path: string) =
205+
let relativePathComponent = path.relativeTestPathComponent(suitePath)
206+
test "KZG - Compute Cells - " & relativePathComponent:
207+
let
208+
data = loadToJson(os_ops.readFile(path/"data.yaml"))[0]
209+
output = data["output"]
210+
blob = fromHex[131072](data["input"]["blob"].getStr)
211+
212+
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.4/tests/formats/kzg_7594/compute_cells.md#condition
213+
if blob.isNone:
214+
check output.kind == JNull
215+
else:
216+
let p = newClone computeCells(KzgBlob(bytes: blob.get))
217+
if p[].isErr:
218+
check output.kind == JNull
219+
else:
220+
let p_val = p[].get
221+
for i in 0..<len(p[].get):
222+
check p_val[i].bytes == fromHex[2048](output[i].getStr).get
223+
204224
proc runComputeCellsAndKzgProofsTest(suiteName, suitePath, path: string) =
205225
let relativePathComponent = path.relativeTestPathComponent(suitePath)
206226
test "KZG - Compute Cells And Proofs - " & relativePathComponent:
@@ -340,6 +360,11 @@ suite suiteName:
340360
["compute_cells", "compute_cells_and_kzg_proofs",
341361
"recover_cells_and_kzg_proofs", "verify_cell_kzg_proof_batch"]
342362

363+
block:
364+
let testsDir = suitePath/"compute_cells"/"kzg-mainnet"
365+
for kind, path in walkDir(testsDir, relative = true, checkDir = true):
366+
runComputeCellsTest(suiteName, testsDir, testsDir/path)
367+
343368
block:
344369
let testsDir = suitePath/"compute_cells_and_kzg_proofs"/"kzg-mainnet"
345370
for kind, path in walkDir(testsDir, relative = true, checkDir = true):

0 commit comments

Comments
 (0)