add: checkpoints for debug support
This commit is contained in:
parent
e5237d19a3
commit
c14b59264c
|
@ -228,18 +228,19 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock |
|
|||
var sidecars = newSeqOfCap[DataColumnSidecar](CELLS_PER_EXT_BLOB)
|
||||
|
||||
if blobs.len == 0:
|
||||
debugEcho "Checkpoint 3"
|
||||
return ok(sidecars)
|
||||
|
||||
for blob in blobs:
|
||||
let
|
||||
cell_and_proof = computeCellsAndProofs(blob)
|
||||
|
||||
debugEcho "Checkpoint 4"
|
||||
if cell_and_proof.isErr():
|
||||
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
|
||||
var
|
||||
cells = newSeqOfCap[CellBytes](blobs.len)
|
||||
|
@ -252,6 +253,8 @@ proc get_data_column_sidecars*(signed_block: deneb.SignedBeaconBlock |
|
|||
for k in 0..<48:
|
||||
proofs[i][j][k] = (cellsAndProofs[i].proofs[j][k])
|
||||
|
||||
debugEcho "Checkpoint 7"
|
||||
|
||||
for columnIndex in 0..<CELLS_PER_EXT_BLOB:
|
||||
var column: DataColumn
|
||||
var kzgProofOfColumn: KzgProofs
|
||||
|
|
|
@ -336,14 +336,6 @@ proc handleLightClientUpdates*(node: BeaconNode, slot: Slot)
|
|||
warn "LC optimistic update failed to send",
|
||||
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,
|
||||
fork: Fork,
|
||||
genesis_validators_root: Eth2Digest,
|
||||
|
|
|
@ -167,25 +167,32 @@ proc routeSignedBeaconBlock*(
|
|||
when typeof(blck).kind >= ConsensusFork.Deneb:
|
||||
if blobsOpt.isSome():
|
||||
let blobs = blobsOpt.get()
|
||||
let dataColumnsOpt = get_data_column_sidecars(blck, blobs.mapIt(it.blob))
|
||||
if not dataColumnsOpt.isOk:
|
||||
debug "Issue with computing data column from blob bundle"
|
||||
let data_columns = dataColumnsOpt.get()
|
||||
var das_workers = newSeq[Future[SendResult]](len(data_columns))
|
||||
for i in 0..<data_columns.lenu64:
|
||||
let subnet_id = compute_subnet_for_data_column_sidecar(i)
|
||||
das_workers[i] =
|
||||
router[].network.broadcastDataColumnSidecar(subnet_id, data_columns[i])
|
||||
let allres = await allFinished(das_workers)
|
||||
for i in 0..<allres.len:
|
||||
let res = allres[i]
|
||||
doAssert res.finished()
|
||||
if res.failed():
|
||||
notice "Data Columns not sent",
|
||||
data_column = shortLog(data_columns[i]), error = res.error[]
|
||||
else:
|
||||
notice "Data columns sent", data_column = shortLog(data_columns[i])
|
||||
dataColumnRefs = Opt.some(data_columns.mapIt(newClone(it)))
|
||||
debugEcho "Checkpoint 1"
|
||||
if blobs.len != 0:
|
||||
let dataColumnsOpt = get_data_column_sidecars(blck, blobs.mapIt(it.blob))
|
||||
debugEcho "Checkpoint 2"
|
||||
if not dataColumnsOpt.isOk:
|
||||
debugEcho "Checkpoint 8"
|
||||
debug "Issue with computing data column from blob bundle"
|
||||
let data_columns = dataColumnsOpt.get()
|
||||
var das_workers = newSeq[Future[SendResult]](len(data_columns))
|
||||
debugEcho "Checkpoint 9"
|
||||
for i in 0..<data_columns.len:
|
||||
let subnet_id = compute_subnet_for_data_column_sidecar(uint64(i))
|
||||
das_workers[i] =
|
||||
router[].network.broadcastDataColumnSidecar(subnet_id, data_columns[int(i)])
|
||||
let allres = await allFinished(das_workers)
|
||||
for i in 0..<allres.len:
|
||||
let res = allres[i]
|
||||
doAssert res.finished()
|
||||
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(
|
||||
MsgSource.api, ForkedSignedBeaconBlock.init(blck), blobRefs, dataColumnRefs)
|
||||
|
|
Loading…
Reference in New Issue