perf(builder): reuse unchanged withdrawals roots - #5041
BrianBland wants to merge 1 commit into
Conversation
🟡 Heimdall Review Status
|
|
✅ All benchmarks green — 14 within ±2% (deterministic instruction counts). View run Benchmark details (14)
|
Review SummaryPR: perf(builder): reuse unchanged withdrawals roots This PR adds a fast path in AnalysisCorrectness of the optimization gate ( Flashblocks path: Fallback consistency: When the
Block production risk: No critical findings. The optimization is a pure fast-path skip of an expensive storage root computation, with a correct fallback to the existing calculation when any condition is not met. Error propagation from the fallback path is preserved. Minor observation
No blocking issues found. |
Summary
Avoid recomputing the
L2ToL1MessagePasserstorage root when building a post-Isthmus payload whose MessagePasser storage is unchanged relative to its parent. Both the standard assembler and flashblocks builder now use a shared helper that reuses the parent's withdrawals root.Reuse requires a post-Isthmus parent with a withdrawals root, no changed storage slots, and no storage destruction. Otherwise, use the existing calculation. Flashblocks retain their current published-root behavior and inspect cumulative changes relative to the parent, not just the latest flashblock. No global or flashblock-specific cache is introduced; the fast path also benefits Denim's 200ms blocks.
Includes regression tests for unchanged storage, net-zero writes, cumulative flashblocks, destruction, activation boundaries, different parents, and provider errors. Also imports
alloc::Boxexplicitly to fix an existingno_stdcompilation error exposed during validation.Validation
Rebased onto
base/base/mainat380b55db3; all checks passed after rebasing:cargo test -p base-execution-consensus --lib— 41 passed.cargo test -p base-execution-evm --lib— 25 passed.cargo test -p base-builder-core --lib flashblocks::payload::tests— 9 passed.cargo clippy -p base-execution-consensus -p base-execution-evm -p base-builder-core --lib --tests -- -D warningscargo check -p base-execution-consensus --no-default-features --libgit diff --check.No latency improvement is claimed without benchmarking.
Generated with Toshi