Summary
BlockSync performs expensive validation on headers and payloads received from peers, but it does
not score, quarantine, or deprioritize peers that repeatedly send invalid data.
Details
Unexpected or malicious responses still trigger verification work. When validation fails, the node increments metrics and retries with another peer, but the offender remains fully eligible for future selection.
if Self::verify_block_headers(block_range, block_headers.as_slice()) { entry.remove(); self.metrics.blocksync_events.headers_response_successful += 1;} else { debug!(?sender, ?block_range, "blocksync: headers response verifcation failed"); assert!(sender.is_some()); self.metrics.blocksync_events.headers_validation_failed += 1; // headers response from peer is invalid, re-request after timeout}fn pick_peer( self_node_id: &NodeId<CertificateSignaturePubKey<ST>>, current_epoch: Epoch, val_epoch_map: &ValidatorsEpochMapping<VTF, SCT>, override_peers: &[NodeId<CertificateSignaturePubKey<ST>>], rng: &mut ChaCha8Rng,) -> NodeId<CertificateSignaturePubKey<ST>> {Impact
An attacker can repeatedly feed invalid responses and force CPU and bandwidth expenditure while remaining in the candidate set for retries.
Recommendation
Introduce lightweight peer scoring with temporary penalties for invalid responses.