enable stricter downscoring for bad data columns while syncing

This commit is contained in:
Agnish Ghosh 2024-10-22 19:18:40 +05:30
parent 05435e5237
commit ba58e89ea5
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
3 changed files with 8 additions and 3 deletions

View File

@ -36,6 +36,9 @@ const
PeerScoreBadValues* = -1000 PeerScoreBadValues* = -1000
## Peer's response contains incorrect data. ## Peer's response contains incorrect data.
PeerScoreBadResponse* = -1000 PeerScoreBadResponse* = -1000
## Peer's column responses are invalid
## Specifically a peerdas devnet setting
PeerScoreBadColumns* = -100000
## Peer's response is not in requested range. ## Peer's response is not in requested range.
PeerScoreMissingValues* = -25 PeerScoreMissingValues* = -25
## Peer response contains too much missing data - this can happen either ## Peer response contains too much missing data - this can happen either

View File

@ -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() data_columns_map = getShortMap(req, dataColumnData), request = req, msg=groupedDataColumns.error()
return return
if (let checkRes = groupedDataColumns.get.checkDataColumns(); checkRes.isErr): if (let checkRes = groupedDataColumns.get.checkDataColumns(); checkRes.isErr):
peer.updateScore(PeerScoreBadResponse) peer.updateScore(PeerScoreBadColumns)
man.queue.push(req) man.queue.push(req)
warn "Received data columns is invalid", warn "Received data columns is invalid",
data_columns_count = len(dataColumnData), data_columns_count = len(dataColumnData),

View File

@ -457,11 +457,13 @@ p2pProtocol BeaconSync(version = 1,
let let
dag = peer.networkState.dag 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 = 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 GENESIS_EPOCH
else: 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: if startSlot.epoch < epochBoundary:
raise newException(ResourceUnavailableError, DataColumnsOutOfRange) raise newException(ResourceUnavailableError, DataColumnsOutOfRange)