feat(evm): add witness oracle metrics - #983
Draft
0xOsiris wants to merge 1 commit into
Draft
Conversation
0xOsiris
requested review from
0xForerunner,
Dzejkop,
Kemperino,
alessandromazza98,
cichaczem,
karankurbur,
kilianglas,
murph and
piohei
as code owners
August 4, 2026 22:56
0xOsiris
marked this pull request as draft
August 4, 2026 23:12
Contributor
Benchmark ResultsBase and PR measured on the same runner in the same workflow run.
Raw
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the missing observability for the live pre-image witness oracle (
--witness.collect). Phase 5 (host integration) is deliberately not built — see the verdict below.What this adds
New
world_chain.witnessmetric scope (crates/evm/src/metrics.rs):captured/droppedWorldChainBlockExecutor::finishusestry_send; on a full channel it drops the witness and continues. A single drop makes every range spanning that block permanently unservable, and today that is invisible.assembly_failedinserted/evicted/cache_len/cache_oldest_block/cache_newest_blockwitness_bytes(histogram) /cache_bytes--witness.depthis a number instead of a guess.range_hit/range_miss/range_missing_blocksdebug_collectRangeWitness, and how far off a miss was.WitnessCachenow tracks retained bytes exactly across replace and eviction (new unit test covers it). All counters are inert when--witness.collectis off.Verdict on Phase 5: do not build it yet
op-rethalready ships--proofs-history, and it subsumes the witness cache for the Kona host path:rust/op-reth/crates/node/src/proof_history.rs:94-101installs RPC overrides foreth_getProofanddebug_executePayload—debug_executePayloadis the exact high-level hint the witness cache targets (kona/bin/host/src/single/handler.rs:394-421), andeth_getProofis what the current incident is about (handler.rs:296-341,:225-241).op-proofsbackfill/prune/snapshot subcommands — versus 1024 blocks (~34 min) of RAM, lost on every restart, with no backfill.build_range_inputkeeps talking standard RPC.The witness cache has one genuine advantage — zero re-execution on the serving side (op-reth still re-executes in
DebugApiExt::execute_payload,crates/rpc/src/debug.rs:194-255, it just makes the state reads fast). That advantage is real but does not justify a second, weaker mechanism before the first one is even switched on.World Chain parses
--proofs-historytoday and silently ignores it.WorldChainArgs.rollupis op-rethRollupArgs(crates/cli/src/cli.rs:8,167), which carriesproofs_history(op-reth/crates/node/src/args.rs:196), so the flags show up inspecs/cli/reference.md:79-106. World Chain only ever readssequencer,disable_txpool_gossip,discovery_v4andcompute_pending_blockfrom it — the exex and the RPC overrides are never installed. An operator who sets--proofs-historygets a node that looks configured and is not. Fixing that is the higher-priority change and it subsumes most of Phase 5.Fix concerns 2 (single-drop poisoning, no repair path) and 3 (metrics — this PR) before revisiting the witness cache at all.
🤖 Generated with Claude Code
Note
Low Risk
Observability-only changes with no altered witness serving logic; cache byte accounting is additive and covered by a new test.
Overview
Adds
world_chain.witnessPrometheus metrics for the live pre-image witness path (--witness.collect), so drops, cache bounds, memory use, and range lookup success are visible in production.WitnessMetrics(lazy singleton) records capture (captured/dropped), collector assembly failures (assembly_failed), cache lifecycle (inserted,evicted,witness_bytes,cache_bytes,cache_len, oldest/newest block gauges), andWitnessCache::rangeoutcomes (range_hit,range_miss,range_missing_blocks).WorldChainBlockExecutor::finishand the witness collector increment the failure counters; the cache updates gauges on insert and range.WitnessCachenow keeps an exact running byte total per entry (retained_bytesover state/codes/keys/headers), including on replace and eviction, with a unit test for that accounting.metrics/metrics-deriveare added toworld-chain-evm.Reviewed by Cursor Bugbot for commit 55005fe. Configure here.