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 <eserilev@ucsc.edu>
This commit is contained in:
Eitan Seri-Levi
2025-09-04 20:23:34 -07:00
committed by GitHub
parent 9d2f55a399
commit 8ec2640e04
2 changed files with 11 additions and 0 deletions

View File

@@ -116,7 +116,13 @@ impl<T: BeaconChainTypes> VerifiedLightClientFinalityUpdate<T> {
// 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(),

View File

@@ -118,6 +118,11 @@ impl<T: BeaconChainTypes> VerifiedLightClientOptimisticUpdate<T> {
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(),