@@ -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+
204224proc 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