enable better logging for dc by range

This commit is contained in:
Agnish Ghosh 2024-09-30 20:19:05 +05:30
parent bef7d07105
commit 9cab15e2cf
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8

View File

@ -479,26 +479,28 @@ p2pProtocol BeaconSync(version = 1,
for i in startIndex..endIndex:
for j in 0..<MAX_REQUEST_DATA_COLUMNS:
if dag.db.getDataColumnSidecarSZ(blockIds[i].root, ColumnIndex(j), bytes):
if blockIds[i].slot.epoch >= dag.cfg.BELLATRIX_FORK_EPOCH and
not dag.head.executionValid:
continue
if ColumnIndex(j) in reqColumns:
if dag.db.getDataColumnSidecarSZ(blockIds[i].root, ColumnIndex(j), bytes):
if blockIds[i].slot.epoch >= dag.cfg.BELLATRIX_FORK_EPOCH and
not dag.head.executionValid:
continue
let uncompressedLen = uncompressedLenFramed(bytes).valueOr:
warn "Cannot read data column sidecar size, database, corrupt",
bytes = bytes.len(), blck = shortLog(blockIds[i])
continue
peer.awaitQuota(dataColumnResponseCost, "data_column_sidecars_by_range/1")
peer.network.awaitQuota(dataColumnResponseCost, "data_column_sidecars_by_range/1")
await response.writeBytesSZ(
uncompressedLen, bytes,
peer.network.forkDigestAtEpoch(blockIds[i].slot.epoch).data)
inc found
var cols: seq[ColumnIndex]
cols.add(j)
debug "Responded to DataColumnSidecar range request",
peer, blck = shortLog(blockIds[i]), columns = cols
else:
break
let uncompressedLen = uncompressedLenFramed(bytes).valueOr:
warn "Cannot read data column sidecar size, database, corrupt",
bytes = bytes.len(), blck = shortLog(blockIds[i])
continue
peer.awaitQuota(dataColumnResponseCost, "data_column_sidecars_by_range/1")
peer.network.awaitQuota(dataColumnResponseCost, "data_column_sidecars_by_range/1")
await response.writeBytesSZ(
uncompressedLen, bytes,
peer.network.forkDigestAtEpoch(blockIds[i].slot.epoch).data)
inc found
debug "Responded to DataColumnSidecar range request",
peer, blck = shortLog(blockIds[i])
else:
break