This commit is contained in:
Agnish Ghosh 2024-10-02 00:18:00 +05:30
parent 0b9c48cadb
commit 2ecdb078b9
1 changed files with 22 additions and 23 deletions

View File

@ -24,7 +24,7 @@ const
## Allow syncing ~64 blocks/sec (minus request costs)
blobResponseCost = allowedOpsPerSecondCost(1000)
## Multiple can exist per block, they are much smaller than blocks
dataColumnResponseCost = allowedOpsPerSecondCost(250)
dataColumnResponseCost = allowedOpsPerSecondCost(4000)
## 1 blob has an equivalent memory of 8 data columns
type
@ -478,31 +478,30 @@ p2pProtocol BeaconSync(version = 1,
bytes: seq[byte]
for i in startIndex..endIndex:
for j in 0..<MAX_REQUEST_DATA_COLUMNS:
for k in reqColumns:
if dag.db.getDataColumnSidecarSZ(blockIds[i].root, ColumnIndex(k), bytes):
if blockIds[i].slot.epoch >= dag.cfg.DENEB_FORK_EPOCH and
not dag.head.executionValid:
continue
for k in reqColumns:
if dag.db.getDataColumnSidecarSZ(blockIds[i].root, ColumnIndex(k), bytes):
if blockIds[i].slot.epoch >= dag.cfg.DENEB_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
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")
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(k)
debug "Responded to DataColumnSidecar range request",
peer, blck = shortLog(blockIds[i]), columns = cols
else:
break
await response.writeBytesSZ(
uncompressedLen, bytes,
peer.network.forkDigestAtEpoch(blockIds[i].slot.epoch).data)
inc found
var cols: seq[ColumnIndex]
cols.add(k)
debug "Responded to DataColumnSidecar range request",
peer, blck = shortLog(blockIds[i]), columns = cols
else:
break
debug "DataColumnSidecar range request done",
peer, startSlot, count = reqCount, columns = reqColumns, found