made some fixes to logic

This commit is contained in:
Agnish Ghosh 2024-11-28 18:37:42 +05:30
parent ec898ca371
commit 5d10725737
No known key found for this signature in database
GPG Key ID: 95F7C8CCFED6BD9F
2 changed files with 9 additions and 3 deletions

View File

@ -12,7 +12,6 @@ import
"."/[altair, base, deneb], "."/[altair, base, deneb],
kzg4844 kzg4844
from std/sequtils import mapIt
from std/strutils import join from std/strutils import join
export base export base

View File

@ -180,14 +180,20 @@ proc reconstruction_terms*(blobIdx: int,
cell_ids = newSeqOfCap[CellID](columnCount) cell_ids = newSeqOfCap[CellID](columnCount)
ckzgCells = newSeqOfCap[KzgCell](columnCount) ckzgCells = newSeqOfCap[KzgCell](columnCount)
cell_ids.setLen(0)
ckzgCells.setLen(0)
for col in data_columns: for col in data_columns:
cell_ids.add col.index cell_ids.add col.index
let cell = col.column[blobIdx] let cell = col.column[blobIdx]
ckzgCells.add cell ckzgCells.add cell
debugEcho "for blob index"
debugEcho blobIdx
# Call the recovery function and handle results # Call the recovery function and handle results
let recovered_cell_and_proof = recoverCellsAndKzgProofs(cell_ids, ckzgCells) let recovered_cell_and_proof = recoverCellsAndKzgProofs(cell_ids, ckzgCells)
if not recovered_cell_and_proof.isOk: if recovered_cell_and_proof.isErr:
return err("Issue with computing cells and proofs!") return err("Issue with computing cells and proofs!")
ok(recovered_cell_and_proof.get) ok(recovered_cell_and_proof.get)
@ -212,6 +218,7 @@ proc recover_cells_and_proofs_parallel*(
recovered_cps = newSeq[CellsAndProofs](blobCount) recovered_cps = newSeq[CellsAndProofs](blobCount)
# Schedule tasks on the threadpool # Schedule tasks on the threadpool
debugEcho "Scheduling tasks on the threadpool..."
for blobIdx in 0..<blobCount: for blobIdx in 0..<blobCount:
pendingFuts[blobIdx] = pendingFuts[blobIdx] =
tp.spawn reconstruction_terms(blobIdx, columnCount, data_columns) tp.spawn reconstruction_terms(blobIdx, columnCount, data_columns)
@ -235,7 +242,7 @@ proc parallelColumnReconstruction*(
Taskpool.new() Taskpool.new()
except Exception: except Exception:
return err("Failed to initialize Taskpool") return err("Failed to initialize Taskpool")
debugEcho "first call to recover c and p parallel"
let res = tp.recover_cells_and_proofs_parallel(data_columns) let res = tp.recover_cells_and_proofs_parallel(data_columns)
ok(res.get) ok(res.get)