Skip to content

fix(engine): apply finalized state after syncing FCU head import#23838

Merged
klkvr merged 3 commits into
mainfrom
agent-fix-fcu-syncing-finalized-pr
Apr 29, 2026
Merged

fix(engine): apply finalized state after syncing FCU head import#23838
klkvr merged 3 commits into
mainfrom
agent-fix-fcu-syncing-finalized-pr

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented Apr 29, 2026

Summary

  • apply the tracked forkchoice state after a sync-target head becomes canonical via the downloaded-block path
  • promote the tracked FCU from SYNCING to VALID once safe and finalized can be applied
  • add a regression test covering a SYNCING FCU whose head is later imported and canonicalized from p2p

Root Cause

When engine_forkchoiceUpdated returned SYNCING, the engine stored the FCU in the tracker and later canonicalized the target head through TreeAction::MakeCanonical once the block arrived from p2p.

That canonicalization path updated the canonical chain, but it did not re-run ensure_consistent_forkchoice_state(...) for the tracked FCU, so the safe / finalized pointers could remain stale even after the head became canonical.

Testing

  • Added test_canonicalizing_downloaded_sync_target_head_updates_finalized

Copy link
Copy Markdown
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes a lot of sense, this is basically a fast path towards making the most recent fcu valid

Comment on lines +1928 to +1935
let Some(sync_target_state) = self
.state
.forkchoice_state_tracker
.sync_target_state()
.filter(|state| state.head_block_hash == target)
else {
return;
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes sense

@github-project-automation github-project-automation Bot moved this from Backlog to In Progress in Reth Tracker Apr 29, 2026
@klkvr klkvr enabled auto-merge April 29, 2026 15:20
@klkvr klkvr added this pull request to the merge queue Apr 29, 2026
Merged via the queue into main with commit 4ffde69 Apr 29, 2026
34 checks passed
@klkvr klkvr deleted the agent-fix-fcu-syncing-finalized-pr branch April 29, 2026 15:41
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Reth Tracker Apr 29, 2026
Thegreatsura pushed a commit to Thegreatsura/tempo that referenced this pull request May 1, 2026
Automated nightly update of reth dependencies from `paradigmxyz/reth`
main branch.

## Upstream reth changes


[`077e5ee...fcfa828`](paradigmxyz/reth@077e5ee...fcfa828)

🔗 Amp thread:
https://ampcode.com/threads/T-019ddc9d-1d46-75e9-b9e8-644c7bd4c595
- **Engine**: Apply finalized state after syncing FCU head import
([#23838](paradigmxyz/reth#23838))
- **Networking**: Customizable discovery defaults
([#23843](paradigmxyz/reth#23843))
- **DB**: Replace deprecated `MDBX_NOTLS` with `MDBX_NOSTICKYTHREADS`
([#23378](paradigmxyz/reth#23378))

## Migrations

🔗 Amp thread:
https://ampcode.com/threads/T-019ddc9d-2d98-72cb-aac1-a4da293cbabf
- Bumped all `reth-*` git dependencies in `Cargo.toml` from rev
`077e5ee` to `fcfa828` to pull in the latest upstream Reth SDK changes.

[GitHub
Workflow](https://github.com/tempoxyz/tempo/actions/runs/25147002830)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants