Skip to content

Commit 8ec2640

Browse files
authored
Don't penalize peers if locally constructed light client data is stale (sigp#7996)
sigp#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 <[email protected]>
1 parent 9d2f55a commit 8ec2640

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

beacon_node/beacon_chain/src/light_client_finality_update_verification.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ impl<T: BeaconChainTypes> VerifiedLightClientFinalityUpdate<T> {
116116
// Verify that the gossiped finality update is the same as the locally constructed one.
117117
if latest_finality_update != rcv_finality_update {
118118
let signature_slot = latest_finality_update.signature_slot();
119+
119120
if signature_slot != rcv_finality_update.signature_slot() {
121+
// The locally constructed finality update is not up to date, probably
122+
// because the node has fallen behind and needs to sync.
123+
if rcv_finality_update.signature_slot() > signature_slot {
124+
return Err(Error::Ignore);
125+
}
120126
return Err(Error::MismatchedSignatureSlot {
121127
local: signature_slot,
122128
observed: rcv_finality_update.signature_slot(),

beacon_node/beacon_chain/src/light_client_optimistic_update_verification.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ impl<T: BeaconChainTypes> VerifiedLightClientOptimisticUpdate<T> {
118118
if latest_optimistic_update != rcv_optimistic_update {
119119
let signature_slot = latest_optimistic_update.signature_slot();
120120
if signature_slot != rcv_optimistic_update.signature_slot() {
121+
// The locally constructed optimistic update is not up to date, probably
122+
// because the node has fallen behind and needs to sync.
123+
if rcv_optimistic_update.signature_slot() > signature_slot {
124+
return Err(Error::Ignore);
125+
}
121126
return Err(Error::MismatchedSignatureSlot {
122127
local: signature_slot,
123128
observed: rcv_optimistic_update.signature_slot(),

0 commit comments

Comments
 (0)