mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-19 19:09:08 +00:00
fix: recover cells and proofs
This commit is contained in:
parent
f71354b307
commit
61033ed99b
@ -180,34 +180,30 @@ proc recover_cells_and_proofs*(
|
|||||||
if not (blobCount == data_column.column.len):
|
if not (blobCount == data_column.column.len):
|
||||||
return err ("DataColumns do not have the same length")
|
return err ("DataColumns do not have the same length")
|
||||||
|
|
||||||
var recovered_cps = newSeqOfCap[CellsAndProofs](blobCount)
|
var
|
||||||
|
recovered_cps = newSeq[CellsAndProofs](blobCount)
|
||||||
|
|
||||||
for blobIdx in 0 ..< blobCount:
|
for blobIdx in 0 ..< blobCount:
|
||||||
var
|
var
|
||||||
cell_ids = newSeqOfCap[CellID](columnCount)
|
bIdx = blobIdx
|
||||||
ckzgCells = newSeqOfCap[KzgCell](columnCount)
|
cell_ids = newSeq[CellID](columnCount)
|
||||||
|
ckzgCells = newSeq[KzgCell](columnCount)
|
||||||
|
|
||||||
for data_column in data_columns:
|
for i in 0..<data_columns.len:
|
||||||
cell_ids.add(data_column.index)
|
cell_ids[i] = data_columns[i].index
|
||||||
|
|
||||||
let
|
let
|
||||||
column = data_column.column
|
column = data_columns[i].column
|
||||||
cell = column[blobIdx]
|
cell = column[bIdx]
|
||||||
|
|
||||||
# Transform the cell as a ckzg cell
|
ckzgCells[i] = cell
|
||||||
var ckzgCell: array[BYTES_PER_CELL, byte]
|
|
||||||
for i in 0 ..< int(FIELD_ELEMENTS_PER_CELL):
|
|
||||||
var start = 32 * i
|
|
||||||
for j in 0 ..< 32:
|
|
||||||
var inter = cell.bytes
|
|
||||||
ckzgCell[start + j] = inter[start+j].byte
|
|
||||||
|
|
||||||
ckzgCells.add(KzgCell(bytes: ckzgCell))
|
|
||||||
|
|
||||||
# Recovering the cells and proofs
|
# Recovering the cells and proofs
|
||||||
let recovered_cells_and_proofs = recoverCellsAndKzgProofs(cell_ids, ckzgCells)
|
let recovered_cells_and_proofs = recoverCellsAndKzgProofs(cell_ids, ckzgCells)
|
||||||
|
if not recovered_cells_and_proofs.isOk:
|
||||||
|
return err("Issue with computing cells and proofs!")
|
||||||
|
|
||||||
recovered_cps.add(recovered_cells_and_proofs.get)
|
recovered_cps[blobIdx] = recovered_cells_and_proofs.get
|
||||||
|
|
||||||
ok(recovered_cps)
|
ok(recovered_cps)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user