Skip to content

feat(flashblocks-rpc): Revamp worker, add state root strategies into flashblocks sequence validation#205

Merged
sieniven merged 4 commits intoniven/cleanup-flashblocks-rpcfrom
niven/flashblocks-validation
Mar 19, 2026
Merged

feat(flashblocks-rpc): Revamp worker, add state root strategies into flashblocks sequence validation#205
sieniven merged 4 commits intoniven/cleanup-flashblocks-rpcfrom
niven/flashblocks-validation

Conversation

@sieniven
Copy link
Contributor

@sieniven sieniven commented Mar 18, 2026

Summary

This PR contains the flashblocks RPC layer revamp optimizations on the execution validation layer, and aligns to the upstream reth's payload validator logic. The old flashblocks RPC worker logic was vastly over-complicated, and this PR revamps the version entirely. Note that the PR is separated from the revamp PR #176 for better clarity on the validation optimizations.

The PR adds the new FlashblockSequenceValidator which encapsulates the entire flashblocks sequence validation logic. It aligns the sequence validation logic to the highly optimized upstream reth's engine payload validator.
Ref: https://github.com/paradigmxyz/reth/blob/main/crates/engine/tree/src/tree/payload_validator.rs

Below are some of the key optimizations:

  1. Change logic to by default always calculate state root. Merklization on payload validation has been optimized greatly on reth's v1.11 release onwards with the new sparse trie implementation (feat: sparse trie as cache paradigmxyz/reth#21583) and is no longer a bottleneck here
  2. Sequence validator uses the upstream reth's payload processor which encapsulates the merklization optimization and payload validation logic. This includes:
    • State root strategies (sparse trie caching, parallel merklization, and default synchronous SR resolution)
    • Prewarming states mechanism
    • Support processing flashblock access list
    • Asynchronous resolution of transaction root, receipt root and log bloom on block assembling
  3. Sequence validator supports both fresh builds (on new pending heights) and incremental builds for flashblock sequence deltas (building on top of the current pending state). This includes:
    • Support re-using cache reads across incremental builds
    • Merging suffix execution results with cached prefix execution results
    • Pre-validation of incoming flashblocks sequence
    • Executing transactions on top of in-memory state overlay providers, with pending bundle pre-state updated

sieniven and others added 3 commits March 18, 2026 07:54
Consolidate `processor.rs` into `validator.rs`, removing the separate
module. Add parallel and overlay-based state root computation via
`reth-trie-parallel`, `reth-trie-db`, and `reth-engine-tree`. Introduce
`OverlayProviderFactory` trait alias and `compute_state_root` dispatcher
that tries parallel SR first and falls back to serial. Replace direct
`BlockBuilder` usage with `PayloadProcessor`-based execution using a
no-op `flashblock_tx_iterator` for pre-recovered transactions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Contributor Author

@sieniven sieniven left a comment

Choose a reason for hiding this comment

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

Note on subsequent reth version upgrades (todo):

  1. Add paradigmxyz/reth#22347 fixes once reth version is upgraded
  2. Add paradigmxyz/reth#22647 optimizations to share tx index
  3. paradigmxyz/reth#22604

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sieniven sieniven merged commit 190237c into niven/cleanup-flashblocks-rpc Mar 19, 2026
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