attempt to recover columns while backfilling

This commit is contained in:
Agnish Ghosh 2024-10-12 03:41:23 +05:30
parent 6ae1418e91
commit 18fe511cc2
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
3 changed files with 20 additions and 3 deletions

View File

@ -212,7 +212,8 @@ proc storeBackfillBlock(
# if not blobsOk:
# return err(VerifierError.Invalid)
var malformed_cols: seq[int]
when typeof(signedBlock).kind >= ConsensusFork.Deneb:
if dataColumnsOpt.isSome:
let data_columns = dataColumnsOpt.get()
@ -221,6 +222,7 @@ proc storeBackfillBlock(
for i in 0..<data_columns.len:
let r = verify_data_column_sidecar_kzg_proofs(data_columns[i][])
if r.isErr():
malformed_cols.add(i)
debug "backfill data column validation failed",
blockRoot = shortLog(signedBlock.root),
column_sidecar = shortLog(data_columns[i][]),
@ -229,8 +231,20 @@ proc storeBackfillBlock(
msg = r.error()
columnsOk = r.isOk()
if not columnsOk:
if dataColumnsOpt.isSome:
let
data_columns = dataColumnsOpt.get
recovered_cps =
recover_cells_and_proofs(data_columns.mapIt(it[]), signedBlock)
recovered_cols = signedBlock.get_data_column_sidecars(recovered_cps.get)
for mc in malformed_cols:
data_columns[mc][] = recovered_cols[mc]
columnsOk = true
if not columnsOk:
return err(VerifierError.Invalid)
return err(VerifierError.Invalid)
let res = self.consensusManager.dag.addBackfillBlock(signedBlock)

View File

@ -407,7 +407,8 @@ proc processDataColumnSidecar*(
reconstructed_columns =
self.processReconstructionFromGossip(forkyBlck, columns)
for rc in reconstructed_columns.get:
self.dataColumnQuarantine[].put(newClone(rc))
if rc notin self.dataColumnQuarantine[].gatherDataColumns(forkyBlck):
self.dataColumnQuarantine[].put(newClone(rc))
self.blockProcessor[].enqueueBlock(
MsgSource.gossip, columnless,
Opt.none(BlobSidecars),

View File

@ -360,6 +360,8 @@ proc get_data_column_sidecars*(signed_beacon_block: deneb.SignedBeaconBlock |
column_cells.add(flattened_cells[row_index][column_index])
column_proofs.add(flattened_proofs[row_index][column_index])
column_proofs.setLen(blck.body.blob_kzg_commitments.len)
var sidecar = DataColumnSidecar(
index: ColumnIndex(column_index),
column: DataColumn.init(column_cells),