add: checkpoints for debug support

This commit is contained in:
Agnish Ghosh 2024-07-07 03:01:32 +05:30
parent e5237d19a3
commit c14b59264c
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
3 changed files with 33 additions and 31 deletions

View File

@ -228,18 +228,19 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock |
var sidecars = newSeqOfCap[DataColumnSidecar](CELLS_PER_EXT_BLOB) var sidecars = newSeqOfCap[DataColumnSidecar](CELLS_PER_EXT_BLOB)
if blobs.len == 0: if blobs.len == 0:
debugEcho "Checkpoint 3"
return ok(sidecars) return ok(sidecars)
for blob in blobs: for blob in blobs:
let let
cell_and_proof = computeCellsAndProofs(blob) cell_and_proof = computeCellsAndProofs(blob)
debugEcho "Checkpoint 4"
if cell_and_proof.isErr(): if cell_and_proof.isErr():
return err("EIP7549: Could not compute cells") return err("EIP7549: Could not compute cells")
if cell_and_proof.isOk:
cellsAndProofs.add(cell_and_proof.get()) cellsAndProofs.add(cell_and_proof.get())
debugEcho "Checkpoint 5"
let blobCount = blobs.len let blobCount = blobs.len
var var
cells = newSeqOfCap[CellBytes](blobs.len) cells = newSeqOfCap[CellBytes](blobs.len)
@ -252,6 +253,8 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock |
for k in 0..<48: for k in 0..<48:
proofs[i][j][k] = (cellsAndProofs[i].proofs[j][k]) proofs[i][j][k] = (cellsAndProofs[i].proofs[j][k])
debugEcho "Checkpoint 7"
for columnIndex in 0..<CELLS_PER_EXT_BLOB: for columnIndex in 0..<CELLS_PER_EXT_BLOB:
var column: DataColumn var column: DataColumn
var kzgProofOfColumn: KzgProofs var kzgProofOfColumn: KzgProofs

View File

@ -336,14 +336,6 @@ proc handleLightClientUpdates*(node: BeaconNode, slot: Slot)
warn "LC optimistic update failed to send", warn "LC optimistic update failed to send",
error = sendResult.error() error = sendResult.error()
proc sendReconstructedDataColumns(node: BeaconNode,
blck: ForkySignedBeaconBlock)
{.async: (raises: [CancelledError]).} =
let res = await node.router.routeReconstructedDataColumns(blck)
if not res.isOk:
warn "Unable to send reconstructed data columns"
return
proc createAndSendAttestation(node: BeaconNode, proc createAndSendAttestation(node: BeaconNode,
fork: Fork, fork: Fork,
genesis_validators_root: Eth2Digest, genesis_validators_root: Eth2Digest,

View File

@ -167,25 +167,32 @@ proc routeSignedBeaconBlock*(
when typeof(blck).kind >= ConsensusFork.Deneb: when typeof(blck).kind >= ConsensusFork.Deneb:
if blobsOpt.isSome(): if blobsOpt.isSome():
let blobs = blobsOpt.get() let blobs = blobsOpt.get()
let dataColumnsOpt = get_data_column_sidecars(blck, blobs.mapIt(it.blob)) debugEcho "Checkpoint 1"
if not dataColumnsOpt.isOk: if blobs.len != 0:
debug "Issue with computing data column from blob bundle" let dataColumnsOpt = get_data_column_sidecars(blck, blobs.mapIt(it.blob))
let data_columns = dataColumnsOpt.get() debugEcho "Checkpoint 2"
var das_workers = newSeq[Future[SendResult]](len(data_columns)) if not dataColumnsOpt.isOk:
for i in 0..<data_columns.lenu64: debugEcho "Checkpoint 8"
let subnet_id = compute_subnet_for_data_column_sidecar(i) debug "Issue with computing data column from blob bundle"
das_workers[i] = let data_columns = dataColumnsOpt.get()
router[].network.broadcastDataColumnSidecar(subnet_id, data_columns[i]) var das_workers = newSeq[Future[SendResult]](len(data_columns))
let allres = await allFinished(das_workers) debugEcho "Checkpoint 9"
for i in 0..<allres.len: for i in 0..<data_columns.len:
let res = allres[i] let subnet_id = compute_subnet_for_data_column_sidecar(uint64(i))
doAssert res.finished() das_workers[i] =
if res.failed(): router[].network.broadcastDataColumnSidecar(subnet_id, data_columns[int(i)])
notice "Data Columns not sent", let allres = await allFinished(das_workers)
data_column = shortLog(data_columns[i]), error = res.error[] for i in 0..<allres.len:
else: let res = allres[i]
notice "Data columns sent", data_column = shortLog(data_columns[i]) doAssert res.finished()
dataColumnRefs = Opt.some(data_columns.mapIt(newClone(it))) if res.failed():
debugEcho "Checkpoint 11"
notice "Data Columns not sent",
data_column = shortLog(data_columns[i]), error = res.error[]
else:
debugEcho "Checkpoint 10"
notice "Data columns sent", data_column = shortLog(data_columns[i])
dataColumnRefs = Opt.some(data_columns.mapIt(newClone(it)))
let added = await router[].blockProcessor[].addBlock( let added = await router[].blockProcessor[].addBlock(
MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, dataColumnRefs) MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, dataColumnRefs)