Skip to content

feat: live sync witness cache oracle#759

Open
0xOsiris wants to merge 16 commits into
mainfrom
osiris/live-preimage-witness-oracle
Open

feat: live sync witness cache oracle#759
0xOsiris wants to merge 16 commits into
mainfrom
osiris/live-preimage-witness-oracle

Conversation

@0xOsiris

@0xOsiris 0xOsiris commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

PROTO-4718

Creates an optional live witness cache that accumulates pre-image witnesses into a fixed size in memory circular ring buffer. The witnesses can then be fetched over a range externally with enormous compute savings.

As historical witnesses require unwinding the database to the beginning of the range. Witnesses are deterministic based on execution (and the last proven state), and can be easily cached during live sync in the Block Executor minimizing both compute, and complexity of the pre-image witness collection in the proof system.


Note

Medium Risk
Touches block-import execution via an executor wrapper on the engine validation path; default-off limits blast radius, but enabled mode adds async witness assembly and a new debug RPC surface on proof nodes.

Overview
Introduces an optional live pre-image witness oracle for proof workflows: when --witness.collect is set, the node captures witnesses during normal newPayload import instead of relying on repeated debug_executePayload re-execution.

New world-chain-witness crate defines BlockWitness / RangeWitness and a bounded WitnessCache (depth from --witness.depth, default 1024).

EVM layer: WorldChainEvmConfig is no longer a type alias—it wraps OpEvmConfig with WorldChainBlockExecutorFactory / WorldChainBlockExecutor, which snapshot ExecutionWitnessRecord from the live revm State on executor finish and send BlockExecutionWitness over a channel. A background collector assembles full BlockWitness values (parent state trie, headers, RLP header/txs) into the cache. With collection off, behavior stays a passthrough (no sender). Requires #![feature(min_specialization)] for the State DB witness hook.

Wiring: CLI WitnessArgs, node context creates channel + cache when enabled, WorldChainExecutorBuilder arms the sender, and add-ons spawn the collector and register debug_collectRangeWitness on the debug module when collection is on.

Adds design doc docs/proof/live-preimage-witness-oracle.md. Kona host pre-seeding (design Phase 5) is not included in this diff.

Reviewed by Cursor Bugbot for commit 13239c3. Configure here.

@0xOsiris 0xOsiris changed the title feat: witness cache feat: live witness cache oracle Jun 18, 2026
@0xOsiris 0xOsiris changed the title feat: live witness cache oracle feat: live sync witness cache oracle Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results

Compared on the same runner in the same workflow run.

group                                                                                              base                                   pr
-----                                                                                              ----                                   --
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_125tx                  1.00     28.8±0.16ms        ? ?/sec    1.00     28.8±0.16ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_250tx                  1.03     57.3±0.25ms        ? ?/sec    1.00     55.9±0.29ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_50tx                   1.00     11.9±0.11ms        ? ?/sec    1.00     11.9±0.05ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_125tx         1.00     35.8±0.34ms        ? ?/sec    1.00     35.8±0.16ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_250tx         1.02     68.2±0.61ms        ? ?/sec    1.00     67.1±0.30ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_50tx          1.02     17.4±0.34ms        ? ?/sec    1.00     17.1±0.29ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_125tx                            1.02     27.1±0.05ms        ? ?/sec    1.00     26.6±0.12ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_250tx                            1.02     53.1±0.07ms        ? ?/sec    1.00     52.2±0.09ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_50tx                             1.00     11.2±0.19ms        ? ?/sec    1.00     11.2±0.02ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_125tx                   1.00     34.4±0.19ms        ? ?/sec    1.02     35.0±0.51ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_250tx                   1.00     62.9±0.32ms        ? ?/sec    1.01     63.4±0.40ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_50tx                    1.00     15.9±0.09ms        ? ?/sec    1.01     16.1±0.16ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_10tx             1.00    135.1±0.24ms        ? ?/sec    1.00    135.6±0.48ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_12tx             1.00    162.0±0.33ms        ? ?/sec    1.00    162.7±0.20ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_5tx              1.00     68.2±0.20ms        ? ?/sec    1.00     68.4±0.18ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_10tx    1.00     22.7±1.11ms        ? ?/sec    1.03     23.3±1.24ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_12tx    1.00     23.3±0.70ms        ? ?/sec    1.00     23.4±1.01ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_5tx     1.00     19.2±0.35ms        ? ?/sec    1.01     19.4±0.46ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers/txs/1000                                    1.00     48.7±0.15ms        ? ?/sec    1.00     48.6±0.11ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers/txs/50                                      1.00      2.6±0.02ms        ? ?/sec    1.01      2.7±0.02ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers/txs/500                                     1.00     24.4±0.03ms        ? ?/sec    1.00     24.4±0.03ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/1000                           1.00     58.3±0.17ms        ? ?/sec    1.01     58.9±0.19ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/50                             1.00      3.8±0.06ms        ? ?/sec    1.01      3.9±0.05ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/500                            1.00     29.4±0.09ms        ? ?/sec    1.01     29.5±0.41ms        ? ?/sec
flashblock_validation_process_flashblock_fib/txs/1000                                              1.00     47.8±0.29ms        ? ?/sec    1.00     47.7±0.09ms        ? ?/sec
flashblock_validation_process_flashblock_fib/txs/50                                                1.00      2.5±0.01ms        ? ?/sec    1.01      2.6±0.03ms        ? ?/sec
flashblock_validation_process_flashblock_fib/txs/500                                               1.00     24.0±0.02ms        ? ?/sec    1.00     24.0±0.07ms        ? ?/sec
flashblock_validation_process_flashblock_fib_with_bal/txs/1000                                     1.00     55.4±0.14ms        ? ?/sec    1.00     55.6±0.50ms        ? ?/sec
flashblock_validation_process_flashblock_fib_with_bal/txs/50                                       1.01      3.8±0.04ms        ? ?/sec    1.00      3.7±0.05ms        ? ?/sec
flashblock_validation_process_flashblock_fib_with_bal/txs/500                                      1.00     28.2±0.10ms        ? ?/sec    1.00     28.2±0.13ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254/txs/10                                1.00     33.7±0.15ms        ? ?/sec    1.00     33.8±0.06ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254/txs/25                                1.00     84.0±0.16ms        ? ?/sec    1.00     84.0±0.06ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254/txs/50                                1.00    167.5±0.33ms        ? ?/sec    1.00    167.8±0.14ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/10                       1.01      5.7±0.38ms        ? ?/sec    1.00      5.6±0.49ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/25                       1.00      8.4±0.10ms        ? ?/sec    1.01      8.5±0.09ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/50                       1.19     13.7±1.80ms        ? ?/sec    1.00     11.5±0.10ms        ? ?/sec

Threshold: 10% regression triggers failure

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 13239c3. Configure here.

Comment thread crates/evm/src/execution/executor.rs
Comment thread crates/node/src/context.rs
Comment thread crates/evm/src/collector.rs
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