From 2ecdb078b9607f03afa59e268b79a75f5c083f27 Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Wed, 2 Oct 2024 00:18:00 +0530 Subject: [PATCH] fixes --- beacon_chain/sync/sync_protocol.nim | 45 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/beacon_chain/sync/sync_protocol.nim b/beacon_chain/sync/sync_protocol.nim index 2cbd76431..017ac8d8f 100644 --- a/beacon_chain/sync/sync_protocol.nim +++ b/beacon_chain/sync/sync_protocol.nim @@ -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..= 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