Blacklist invalid block root in block verification and blacklist invalid finalized epochs in sync.

This commit is contained in:
Jimmy Chen
2025-02-25 18:08:44 +11:00
parent 2883429f69
commit c61cf26622
2 changed files with 43 additions and 6 deletions

View File

@@ -120,6 +120,19 @@ where
.finalized_epoch
.start_slot(T::EthSpec::slots_per_epoch());
// Prevent syncing from peers that had finalized an invalid chain on Holesky.
let non_finality_start_epoch = Epoch::new(115969);
let possible_finality_start_epoch = Epoch::new(116052);
if remote_info.finalized_epoch >= non_finality_start_epoch
&& remote_info.finalized_epoch <= possible_finality_start_epoch
{
if !self.failed_chains.contains(&remote_info.finalized_root) {
self.failed_chains.insert(remote_info.finalized_root);
}
network.goodbye_peer(peer_id, GoodbyeReason::IrrelevantNetwork);
return;
}
// NOTE: A peer that has been re-status'd may now exist in multiple finalized chains. This
// is OK since we since only one finalized chain at a time.