fix: suggested fixes

This commit is contained in:
Agnish Ghosh 2024-06-13 16:48:28 +05:30
parent 2615514909
commit 96b3e95f8e
No known key found for this signature in database
GPG Key ID: 7E927C221EBA4F6E
3 changed files with 9 additions and 12 deletions

View File

@ -87,9 +87,10 @@ proc recover_matrix*(cells_dict: Table[(BlobIndex, CellID), Cell], blobCount: ui
var extended_matrix: ExtendedMatrix var extended_matrix: ExtendedMatrix
for blobIndex in 0'u64..<blobCount: for blobIndex in 0'u64..<blobCount:
var cellIds: seq[CellID] = @[] var
var blIdx: BlobIndex cellIds: seq[CellID] = @[]
var cellId: CellID blIdx: BlobIndex
cellId: CellID
let key = (blIdx, cellId) let key = (blIdx, cellId)
for key, cell in pairs(cells_dict): for key, cell in pairs(cells_dict):
@ -126,7 +127,7 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock, blobs: seq
computed_cell = computeCellsAndKzgProofs(blob) computed_cell = computeCellsAndKzgProofs(blob)
if computed_cell.isErr(): if computed_cell.isErr():
fatal "EIP7549: Could not compute cells" return err("EIP7549: Could not compute cells")
cellsAndProofs.add(computed_cell.get()) cellsAndProofs.add(computed_cell.get())

View File

@ -212,7 +212,7 @@ proc runComputeCellsTest(suiteName, suitePath, path: string) =
if p.isErr: if p.isErr:
check output.kind == JNull check output.kind == JNull
else: else:
for i in 0..<128: for i in 0..<len(p.get):
check p.get[i] == fromHex[2048](output[i].getStr).get check p.get[i] == fromHex[2048](output[i].getStr).get
proc runComputeCellsAndProofsTest(suiteName, suitePath, path: string) = proc runComputeCellsAndProofsTest(suiteName, suitePath, path: string) =
@ -234,7 +234,7 @@ proc runComputeCellsAndProofsTest(suiteName, suitePath, path: string) =
if p.isErr: if p.isErr:
check output.kind == JNull check output.kind == JNull
else: else:
for i in 0..<128: for i in 0..<CELLS_PER_EXT_BLOB:
check p.get.cells[i] == fromHex[2048](output[0][i].getStr).get check p.get.cells[i] == fromHex[2048](output[0][i].getStr).get
check p.get.proofs[i] == fromHex[48](output[1][i].getStr).get check p.get.proofs[i] == fromHex[48](output[1][i].getStr).get
@ -316,7 +316,7 @@ proc runRecoverAllCellsTest(suiteName, suitePath, path: string) =
if v.isErr: if v.isErr:
check output.kind == JNull check output.kind == JNull
else: else:
for i in 0..<128: for i in 0..<CELLS_PER_EXT_BLOB:
check v.get[i] == fromHex[2048](output[i].getStr).get check v.get[i] == fromHex[2048](output[i].getStr).get
from std/algorithm import sorted from std/algorithm import sorted

View File

@ -76,8 +76,4 @@ suite "EF - EIP7594 - Networking" & preset():
let basePath = let basePath =
presetPath/"eip7594"/"networking"/"get_custody_columns"/"pyspec_tests" presetPath/"eip7594"/"networking"/"get_custody_columns"/"pyspec_tests"
for kind, path in walkDir(basePath, relative = true, checkDir = true): for kind, path in walkDir(basePath, relative = true, checkDir = true):
runGetCustodyColumns(suiteName, basePath/path) runGetCustodyColumns(suiteName, basePath/path)