Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions AllTests-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,17 @@ AllTests-mainnet
```
## EF - KZG - PeerDAS
```diff
+ KZG - Compute Cells - compute_cells_case_valid_419245fbfe69f145 OK
+ KZG - Compute Cells - compute_cells_case_valid_4aedd1a2a3933c3e OK
+ KZG - Compute Cells - compute_cells_case_valid_6e773f256383918c OK
+ KZG - Compute Cells - compute_cells_case_valid_b0731ef77b166ca8 OK
+ KZG - Compute Cells - compute_cells_case_valid_b81d309b22788820 OK
+ KZG - Compute Cells - compute_cells_case_valid_ed8b5001151417d5 OK
+ KZG - Compute Cells - compute_cells_case_valid_edeb8500a6507818 OK
+ KZG - Compute Cells - compute_cells_invalid_blob_26555bdcbf18a267 OK
+ KZG - Compute Cells - compute_cells_invalid_blob_79fb3cb1ef585a86 OK
+ KZG - Compute Cells - compute_cells_invalid_blob_7e99dea8893c104a OK
+ KZG - Compute Cells - compute_cells_invalid_blob_9d88c33852eb782d OK
+ KZG - Compute Cells And Proofs - compute_cells_and_kzg_proofs_case_invalid_blob_26555bdcbf OK
+ KZG - Compute Cells And Proofs - compute_cells_and_kzg_proofs_case_invalid_blob_79fb3cb1ef OK
+ KZG - Compute Cells And Proofs - compute_cells_and_kzg_proofs_case_invalid_blob_7e99dea889 OK
Expand Down
25 changes: 25 additions & 0 deletions tests/consensus_spec/test_fixture_kzg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,26 @@ proc runComputeBlobKzgProofTest(suiteName, suitePath, path: string) =
else:
check p.get.bytes == fromHex[48](output.getStr).get

proc runComputeCellsTest(suiteName, suitePath, path: string) =
let relativePathComponent = path.relativeTestPathComponent(suitePath)
test "KZG - Compute Cells - " & relativePathComponent:
let
data = loadToJson(os_ops.readFile(path/"data.yaml"))[0]
output = data["output"]
blob = fromHex[131072](data["input"]["blob"].getStr)

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.4/tests/formats/kzg_7594/compute_cells.md#condition
if blob.isNone:
check output.kind == JNull
else:
let p = newClone computeCells(KzgBlob(bytes: blob.get))
if p[].isErr:
check output.kind == JNull
else:
let p_val = p[].get
for i in 0..<len(p[].get):
check p_val[i].bytes == fromHex[2048](output[i].getStr).get

proc runComputeCellsAndKzgProofsTest(suiteName, suitePath, path: string) =
let relativePathComponent = path.relativeTestPathComponent(suitePath)
test "KZG - Compute Cells And Proofs - " & relativePathComponent:
Expand Down Expand Up @@ -340,6 +360,11 @@ suite suiteName:
["compute_cells", "compute_cells_and_kzg_proofs",
"recover_cells_and_kzg_proofs", "verify_cell_kzg_proof_batch"]

block:
let testsDir = suitePath/"compute_cells"/"kzg-mainnet"
for kind, path in walkDir(testsDir, relative = true, checkDir = true):
runComputeCellsTest(suiteName, testsDir, testsDir/path)

block:
let testsDir = suitePath/"compute_cells_and_kzg_proofs"/"kzg-mainnet"
for kind, path in walkDir(testsDir, relative = true, checkDir = true):
Expand Down
Loading