mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 13:56:23 +00:00
descore on empty response for range w known block (#4050)
The sync protocol does not distinguish between: - All requested slots are empty - Peer does not have data available about requested range Therefore, we treat EOF for `beacon_blocks_by_range` and for `beacon_blocks_by_range` as valid responses, as if the entire epoch really contained no single block for any slot. Once a followup response provides new blocks, we detect that some blocks were missing and rewind. During backfill, we also request the known-to-exist `backfill.slot`, so we can actually detect whether an epoch really does not have blocks or whether a response is incomplete (`PeerScoreNoBlocks`).
This commit is contained in:
parent
301e5a919d
commit
8936212f93
@ -348,6 +348,20 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
|
|||||||
request = req
|
request = req
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if len(data) == 0 and man.direction == SyncQueueKind.Backward and
|
||||||
|
req.contains(man.getSafeSlot()):
|
||||||
|
# The sync protocol does not distinguish between:
|
||||||
|
# - All requested slots are empty
|
||||||
|
# - Peer does not have data available about requested range
|
||||||
|
#
|
||||||
|
# However, we include the `backfill` slot in backward sync requests.
|
||||||
|
# If we receive an empty response to a request covering that slot,
|
||||||
|
# we know that the response is incomplete and can descore.
|
||||||
|
peer.updateScore(PeerScoreNoBlocks)
|
||||||
|
man.queue.push(req)
|
||||||
|
debug "Response does not include known-to-exist block", request = req
|
||||||
|
return
|
||||||
|
|
||||||
# Scoring will happen in `syncUpdate`.
|
# Scoring will happen in `syncUpdate`.
|
||||||
man.workers[index].status = SyncWorkerStatus.Queueing
|
man.workers[index].status = SyncWorkerStatus.Queueing
|
||||||
await man.queue.push(req, data, proc() =
|
await man.queue.push(req, data, proc() =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user