feat(builder): incremental trie cache optimization for flashblocks state root#163
feat(builder): incremental trie cache optimization for flashblocks state root#163louisliu2048 merged 4 commits intomainfrom
Conversation
…ks state root Port flashbots/op-rbuilder#385 - caches TrieUpdates after each flashblock state root calculation so subsequent flashblocks reuse cached trie nodes instead of recomputing from the database each time, achieving ~2.4-2.5x speedup in state root calculation. Changes: - Add `prev_trie_updates: Option<Arc<TrieUpdates>>` field to FlashblocksState - Use `state_root_from_nodes_with_updates` with cached trie on subsequent flashblocks - Cache trie updates after each calculation and propagate to next flashblock - Add criterion benchmark: bench_flashblocks_state_root - Add reth-trie-db and criterion workspace dependencies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* main: fix: update testcontainers to v0.27.0 to remediate CVE-2025-62518 (#164)
|
Maybe TPS is not improve on testnet dataset. cc @cliff0412 WITHOUT cache ======================================================== [TPS log] StartBlock Num: 18696394, NewBlockNum: 18696409, totalTxCount:72641 [Summary] Average BTPS: 4470.82, Max TPS: 4505.51, Min TPS: 1512.50, Time Last: 16s ======================================================== ======================================================== [TPS log] StartBlock Num: 18696394, NewBlockNum: 18696414, totalTxCount:93937 [Summary] Average BTPS: 4409.64, Max TPS: 4505.51, Min TPS: 1512.50, Time Last: 21s ======================================================== WITH cache ======================================================== [TPS log] StartBlock Num: 18696450, NewBlockNum: 18696495, totalTxCount:195854 [Summary] Average BTPS: 4218.62, Max TPS: 4519.30, Min TPS: 1705.02, Time Last: 46s ======================================================== ======================================================== [TPS log] StartBlock Num: 18696450, NewBlockNum: 18696500, totalTxCount:216390 [Summary] Average BTPS: 4204.20, Max TPS: 4519.30, Min TPS: 1705.02, Time Last: 51s ======================================================== ======================================================== [TPS log] StartBlock Num: 18696450, NewBlockNum: 18696505, totalTxCount:236926 [Summary] Average BTPS: 4192.30, Max TPS: 4519.30, Min TPS: 1705.02, Time Last: 56s ======================================================== ======================================================== [TPS log] StartBlock Num: 18696450, NewBlockNum: 18696510, totalTxCount:257462 [Summary] Average BTPS: 4182.11, Max TPS: 4519.30, Min TPS: 1705.02, Time Last: 61s ======================================================== ======================================================== [TPS log] StartBlock Num: 18696450, NewBlockNum: 18696515, totalTxCount:280281 [Summary] Average BTPS: 4207.66, Max TPS: 4519.30, Min TPS: 1705.02, Time Last: 66s ======================================================== ======================================================== [TPS log] StartBlock Num: 18696450, NewBlockNum: 18696520, totalTxCount:300816 [Summary] Average BTPS: 4198.11, Max TPS: 4519.30, Min TPS: 1705.02, Time Last: 71s ======================================================== |
|
can port this also. they rebase with other small improvements |
|
I will add on the improvements next week. |
* main: Feat(chainspec): adding xlayer-devnet chainspec (#167) chore(builder): flatten flashblocks builder, remove unnecessary trait interfaces (#172) rpc: remove unnecessary trait bounds and dependencies from XlayerRpcExtApiServer impl (#171) fix fmt in bin/tools/gen_genesis.rs (#170) fix(builder): Resolve bugs on upstream flashblocks timing scheduler (#169) Feat(tools): Add a tool to generate a custom genesis file based on a template and existing chain data (#159) feat(flashblocks): Add flashblocks sequence persistence logic on RPC and sequence replay flashblock builder (#162) chore(builder): remove unused custom-engine-api feature flag in tests (#168) fix: p2p test hang due to hang on port (#165)
Align with upstream flashbots/op-rbuilder#427: - Wrap trie_output in Arc once upfront instead of cloning then wrapping - Reuse same Arc allocation for both executed block and fb_state cache - Remove trie cache benchmark and related dev dependencies (criterion, reth-trie-db)
* main: (25 commits) fix: bump quinn-proto to 0.11.14 to patch CVE-2026-31812 DoS vuln (#183) pre-job authorization (#193) fix: trigger review skill failed to ack (#192) feat: trigger skill review separately (#191) feat: add Claude skills and CLAUDE.md for AI-assisted development (#190) rename ext (#185) supply workflow for claude (#184) feat(builder): incremental trie cache optimization for flashblocks state root (#163) chore(flashblocks-rpc): migrate op-reth flashblocks into xlayer-reth (#175) Feat(chainspec): adding xlayer-devnet chainspec (#167) chore(builder): flatten flashblocks builder, remove unnecessary trait interfaces (#172) rpc: remove unnecessary trait bounds and dependencies from XlayerRpcExtApiServer impl (#171) fix fmt in bin/tools/gen_genesis.rs (#170) fix(builder): Resolve bugs on upstream flashblocks timing scheduler (#169) Feat(tools): Add a tool to generate a custom genesis file based on a template and existing chain data (#159) feat(flashblocks): Add flashblocks sequence persistence logic on RPC and sequence replay flashblock builder (#162) chore(builder): remove unused custom-engine-api feature flag in tests (#168) fix: p2p test hang due to hang on port (#165) fix: update testcontainers to v0.27.0 to remediate CVE-2025-62518 (#164) chore(builder): further clean up builder crate (#161) ...
Summary
Port of flashbots/op-rbuilder#385 — incremental trie cache optimization for flashblocks state root calculation.
prev_trie_updates: Option<Arc<TrieUpdates>>field toFlashblocksStateto hold cached trie nodes across flashblocksstate_root_with_updatesTrieUpdatesviastate_root_from_nodes_with_updates, skipping the full DB trie traversalFlashblocksState::next()and updated after each state root calculationBenchmark (from the upstream report) shows ~2.4–2.5x speedup in state root calculation across sequential flashblocks.
Running the benchmark
🤖 Generated with Claude Code