From 8ec2640e04db4ebfb65eeea2ed6afb85085493fc Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Thu, 4 Sep 2025 20:23:34 -0700 Subject: [PATCH] Don't penalize peers if locally constructed light client data is stale (#7996) #7994 We seem to be penalizing peers in situations where locally constructed light client data is stale. This PR ignores incoming light client data if our locally constructed light client data isn't up to date. Co-Authored-By: Eitan Seri-Levi --- .../src/light_client_finality_update_verification.rs | 6 ++++++ .../src/light_client_optimistic_update_verification.rs | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs b/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs index 0d5a5425d5..fe62b8ef90 100644 --- a/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs +++ b/beacon_node/beacon_chain/src/light_client_finality_update_verification.rs @@ -116,7 +116,13 @@ impl VerifiedLightClientFinalityUpdate { // Verify that the gossiped finality update is the same as the locally constructed one. if latest_finality_update != rcv_finality_update { let signature_slot = latest_finality_update.signature_slot(); + if signature_slot != rcv_finality_update.signature_slot() { + // The locally constructed finality update is not up to date, probably + // because the node has fallen behind and needs to sync. + if rcv_finality_update.signature_slot() > signature_slot { + return Err(Error::Ignore); + } return Err(Error::MismatchedSignatureSlot { local: signature_slot, observed: rcv_finality_update.signature_slot(), diff --git a/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs b/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs index 4da6913443..b59390ea0c 100644 --- a/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs +++ b/beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs @@ -118,6 +118,11 @@ impl VerifiedLightClientOptimisticUpdate { if latest_optimistic_update != rcv_optimistic_update { let signature_slot = latest_optimistic_update.signature_slot(); if signature_slot != rcv_optimistic_update.signature_slot() { + // The locally constructed optimistic update is not up to date, probably + // because the node has fallen behind and needs to sync. + if rcv_optimistic_update.signature_slot() > signature_slot { + return Err(Error::Ignore); + } return Err(Error::MismatchedSignatureSlot { local: signature_slot, observed: rcv_optimistic_update.signature_slot(),