Skip to content

fix(block_import): pipeline FCU for far-ahead NewBlock sync#351

Open
tsutsu wants to merge 1 commit into
bnb-chain:developfrom
tsutsu:fix/bsc-newblock-syncing-pipeline-fcu
Open

fix(block_import): pipeline FCU for far-ahead NewBlock sync#351
tsutsu wants to merge 1 commit into
bnb-chain:developfrom
tsutsu:fix/bsc-newblock-syncing-pipeline-fcu

Conversation

@tsutsu
Copy link
Copy Markdown

@tsutsu tsutsu commented May 11, 2026

Resolves #350.

Description

When new_payload returns Syncing for a full NewBlock, before spawning recover_ancestors, checks whether the announced head exceeds the local tip by at least MAX_FORK_DEPTH.

If the gap is too large, doesn't attempt recover_ancestors; instead, dispatches a pipeline-trigger forkchoiceUpdated (i.e. the same path that on_new_block_hashes already uses) so that the engine-tree can start staged backfill.

Rationale

The on_new_block_hashes path already had this guard (introduced in #334), but bsc-reth's primary gossip mechanism propagates full NewBlock bodies — which hits the Syncing branch of new_payload directly, bypassing the hash-based check.

On a far-behind node, this causes recover_ancestors to spin on every slot, always hitting ForkTooDeep, with per-hash cooldown ineffective against the ~450ms block cadence.

When new_payload returns Syncing, skip fork_recover if the announced head
is more than MAX_FORK_DEPTH above local tip—same threshold as
NewBlockHashes. Otherwise recover_ancestors always hits ForkTooDeep while
gossip advances the head hash, bypassing per-hash cooldown and stalling
sync. Extract spawn_pipeline_trigger_fcu_task for reuse.
@tsutsu tsutsu requested a review from joey0612 as a code owner May 11, 2026 16:16
@hashdit-bot
Copy link
Copy Markdown

hashdit-bot Bot commented May 11, 2026

Pull Request Review

This PR updates the block import flow for far-behind sync scenarios by adding a shared helper that dispatches a pipeline-triggered forkchoiceUpdated call. Specifically, when new_payload returns Syncing for full NewBlock messages and the head is beyond MAX_FORK_DEPTH from local tip, it now skips recover_ancestors and triggers the pipeline path instead. It also refactors existing FCU dispatch logic to reuse the new helper function, reducing duplication and aligning behavior between on_new_block_hashes and full NewBlock handling.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant