From 121c49b287ea39797e43c3b0b120f53021312a42 Mon Sep 17 00:00:00 2001 From: fmoletta Date: Tue, 21 Oct 2025 16:00:26 -0300 Subject: [PATCH 1/3] fix(l1): do not trigger snap sync if fcu head is already canonical --- crates/networking/rpc/engine/fork_choice.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/networking/rpc/engine/fork_choice.rs b/crates/networking/rpc/engine/fork_choice.rs index 81632613f7c..4cb833ac283 100644 --- a/crates/networking/rpc/engine/fork_choice.rs +++ b/crates/networking/rpc/engine/fork_choice.rs @@ -215,7 +215,12 @@ async fn handle_forkchoice( )); } - if context.syncer.sync_mode() == SyncMode::Snap { + // Don't trigger a sync if the block is already canonical + if context.syncer.sync_mode() == SyncMode::Snap + && !context + .storage + .is_canonical_sync(fork_choice_state.head_block_hash)? + { context .syncer .sync_to_head(fork_choice_state.head_block_hash); From a24286d21b04ccc80f7c494cee27ef3057cbf8b2 Mon Sep 17 00:00:00 2001 From: fmoletta Date: Wed, 22 Oct 2025 15:12:41 -0300 Subject: [PATCH 2/3] Disable snapsync after fcu to canonical head --- crates/networking/p2p/sync_manager.rs | 5 +++++ crates/networking/rpc/engine/fork_choice.rs | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/crates/networking/p2p/sync_manager.rs b/crates/networking/p2p/sync_manager.rs index 6ed52054853..314bb5230d8 100644 --- a/crates/networking/p2p/sync_manager.rs +++ b/crates/networking/p2p/sync_manager.rs @@ -96,6 +96,11 @@ impl SyncManager { } } + /// Disables snapsync mode + pub fn disable_snap(&self) { + self.snap_enabled.store(false, Ordering::Relaxed); + } + /// Updates the last fcu head. This may be used on the next sync cycle if needed fn set_head(&self, fcu_head: H256) { if let Ok(mut latest_fcu_head) = self.last_fcu_head.try_lock() { diff --git a/crates/networking/rpc/engine/fork_choice.rs b/crates/networking/rpc/engine/fork_choice.rs index 4cb833ac283..49df7436576 100644 --- a/crates/networking/rpc/engine/fork_choice.rs +++ b/crates/networking/rpc/engine/fork_choice.rs @@ -216,15 +216,18 @@ async fn handle_forkchoice( } // Don't trigger a sync if the block is already canonical - if context.syncer.sync_mode() == SyncMode::Snap - && !context + if context.syncer.sync_mode() == SyncMode::Snap { + if context .storage .is_canonical_sync(fork_choice_state.head_block_hash)? - { - context - .syncer - .sync_to_head(fork_choice_state.head_block_hash); - return Ok((None, PayloadStatus::syncing().into())); + { + context.syncer.disable_snap(); + } else { + context + .syncer + .sync_to_head(fork_choice_state.head_block_hash); + return Ok((None, PayloadStatus::syncing().into())); + } } match apply_fork_choice( From 093f1fb6e8454e6b36557147c8b0a04238b9c60b Mon Sep 17 00:00:00 2001 From: fmoletta Date: Wed, 22 Oct 2025 15:17:44 -0300 Subject: [PATCH 3/3] fix doc --- crates/networking/rpc/engine/fork_choice.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/networking/rpc/engine/fork_choice.rs b/crates/networking/rpc/engine/fork_choice.rs index 49df7436576..6805cd8da59 100644 --- a/crates/networking/rpc/engine/fork_choice.rs +++ b/crates/networking/rpc/engine/fork_choice.rs @@ -215,12 +215,13 @@ async fn handle_forkchoice( )); } - // Don't trigger a sync if the block is already canonical if context.syncer.sync_mode() == SyncMode::Snap { + // Don't trigger a sync if the block is already canonical if context .storage .is_canonical_sync(fork_choice_state.head_block_hash)? { + // Disable snapsync mode so we can process incoming payloads context.syncer.disable_snap(); } else { context