From 0706e62f528f6176b094deb4ab838e8e86deecf2 Mon Sep 17 00:00:00 2001 From: 0xMushow <105550256+0xMushow@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:17:46 +0400 Subject: [PATCH] fix(peerdb): use start_slot instead of end_slot for safer actions (#8498) Which issue # does this PR address? None Discussed in private with @jimmygchen, Lighthouse's `earliest_available_slot` is guaranteed to always align with epoch boundaries, but as a safety implementation, we should use `start_slot` just in case other clients differ in their implementations. At least we agreed it would be safer for `synced_peers_for_epoch`, I also made the change in `has_good_custody_range_sync_peer`, but this is to be reviewed please. Co-Authored-By: Antoine James Co-Authored-By: Jimmy Chen --- beacon_node/lighthouse_network/src/peer_manager/peerdb.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/peerdb.rs b/beacon_node/lighthouse_network/src/peer_manager/peerdb.rs index 87337cafcf..dc1686523f 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/peerdb.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/peerdb.rs @@ -259,10 +259,10 @@ impl PeerDB { info.is_connected() && match info.sync_status() { SyncStatus::Synced { info } => { - info.has_slot(epoch.end_slot(E::slots_per_epoch())) + info.has_slot(epoch.start_slot(E::slots_per_epoch())) } SyncStatus::Advanced { info } => { - info.has_slot(epoch.end_slot(E::slots_per_epoch())) + info.has_slot(epoch.start_slot(E::slots_per_epoch())) } SyncStatus::IrrelevantPeer | SyncStatus::Behind { .. } @@ -332,7 +332,7 @@ impl PeerDB { info.is_connected() && match info.sync_status() { SyncStatus::Synced { info } | SyncStatus::Advanced { info } => { - info.has_slot(epoch.end_slot(E::slots_per_epoch())) + info.has_slot(epoch.start_slot(E::slots_per_epoch())) } SyncStatus::IrrelevantPeer | SyncStatus::Behind { .. }