Skip to content

Add optimistic sync so the node can sync faster#1395

Closed
alok-108 wants to merge 1 commit into
ReamLabs:masterfrom
alok-108:feature/optimistic-sync
Closed

Add optimistic sync so the node can sync faster#1395
alok-108 wants to merge 1 commit into
ReamLabs:masterfrom
alok-108:feature/optimistic-sync

Conversation

@alok-108

@alok-108 alok-108 commented May 24, 2026

Copy link
Copy Markdown

What was wrong?

Before, the node had to fully verify every block’s execution payload before moving to the next one. This made syncing slow because it waited for the execution engine every time.

How was it fixed?

I added optimistic sync, following the Ethereum spec. Now the node can quickly import blocks by checking only basic things like signatures and slots. The full execution check happens later in the background. If a block turns out to be invalid later, the node automatically removes it and the blocks that came after it, then goes back to the last valid one.

This is all behind a --optimistic-sync flag which is turned on by default.

Closes #395

@alok-108
alok-108 marked this pull request as ready for review May 24, 2026 11:03
@alok-108
alok-108 marked this pull request as draft May 24, 2026 11:05
- Add skip_execution_validation parameter to on_block
- Introduce OptimisticRootsTable for tracking optimistic blocks
- Implement process_block_optimistic and handle_invalid_payload
- Add is_optimistic_candidate_block helper (SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY = 128)
- Extend BlockRangeSyncer with optimistic_mode and new_optimistic constructor
- Wire --optimistic-sync CLI flag (default true) into ManagerConfig and service
- Hook PayloadStatus::Invalid to handle_invalid_payload for chain backtracking
@alok-108
alok-108 force-pushed the feature/optimistic-sync branch from dce8861 to 3f4d7f8 Compare May 24, 2026 11:13
@alok-108
alok-108 marked this pull request as ready for review May 28, 2026 07:23
@alok-108
alok-108 marked this pull request as draft May 28, 2026 07:24
@alok-108
alok-108 marked this pull request as ready for review June 11, 2026 09:25
@shariqnaiyer

Copy link
Copy Markdown
Collaborator

Closing this as it is stale. Please feel free to rebase and let me know if you're still interested in taking this up.

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.

Implement Optimistic Sync

2 participants