From ba58e89ea52495935c82ddd51c70d3d99a8714a5 Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Tue, 22 Oct 2024 19:18:40 +0530 Subject: [PATCH] enable stricter downscoring for bad data columns while syncing --- beacon_chain/networking/peer_scores.nim | 3 +++ beacon_chain/sync/sync_manager.nim | 2 +- beacon_chain/sync/sync_protocol.nim | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/beacon_chain/networking/peer_scores.nim b/beacon_chain/networking/peer_scores.nim index c6f2c10bd..1d90a198b 100644 --- a/beacon_chain/networking/peer_scores.nim +++ b/beacon_chain/networking/peer_scores.nim @@ -36,6 +36,9 @@ const PeerScoreBadValues* = -1000 ## Peer's response contains incorrect data. PeerScoreBadResponse* = -1000 + ## Peer's column responses are invalid + ## Specifically a peerdas devnet setting + PeerScoreBadColumns* = -100000 ## Peer's response is not in requested range. PeerScoreMissingValues* = -25 ## Peer response contains too much missing data - this can happen either diff --git a/beacon_chain/sync/sync_manager.nim b/beacon_chain/sync/sync_manager.nim index 43764ebab..eddba2a2e 100644 --- a/beacon_chain/sync/sync_manager.nim +++ b/beacon_chain/sync/sync_manager.nim @@ -678,7 +678,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) data_columns_map = getShortMap(req, dataColumnData), request = req, msg=groupedDataColumns.error() return if (let checkRes = groupedDataColumns.get.checkDataColumns(); checkRes.isErr): - peer.updateScore(PeerScoreBadResponse) + peer.updateScore(PeerScoreBadColumns) man.queue.push(req) warn "Received data columns is invalid", data_columns_count = len(dataColumnData), diff --git a/beacon_chain/sync/sync_protocol.nim b/beacon_chain/sync/sync_protocol.nim index f89a715c4..438096075 100644 --- a/beacon_chain/sync/sync_protocol.nim +++ b/beacon_chain/sync/sync_protocol.nim @@ -457,11 +457,13 @@ p2pProtocol BeaconSync(version = 1, let dag = peer.networkState.dag + # Using MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS for now, as cfg yaml + # isn't properly configured in this branch yet. epochBoundary = - if dag.cfg.MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS >= dag.head.slot.epoch: + if dag.cfg.MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS >= dag.head.slot.epoch: GENESIS_EPOCH else: - dag.head.slot.epoch - dag.cfg.MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS + dag.head.slot.epoch - dag.cfg.MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS if startSlot.epoch < epochBoundary: raise newException(ResourceUnavailableError, DataColumnsOutOfRange)