fix(l1,l2): make eth_getLogs topics optional and honour blockHash #7098
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 393 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.358
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7098"
general
weight: 0.35
ElFantasma
Two spec deviations in
eth_getLogs, both incrates/networking/rpc/eth/logs.rs.topicswas mandatoryEvery field of the filter object is optional in
execution-apis/src/schemas/filter.yaml, and an absenttopicsmeans match any topic.LogsFilter::parseread it with.ok_or_else(|| RpcErr::MissingParam("topics")), so a request omitting it got-32000 Expected parameter: topics is missing, whilefromBlock,toBlockandaddressimmediately above all tolerate absence via.map(...).transpose()?. Everything downstream already handled the empty case (topics: topics_filters.unwrap_or_else(Vec::new), and theif filter.topics.is_empty()short-circuit infetch_logs_with_filter), so this is the parse step being written in a different shape than its neighbours."topics": nullbehaves as before.geth agrees:
GetLogsonly rejectslen(crit.Topics) > maxTopicsand never requires the field.blockHashwas silently ignoredEIP-234 lets a filter name one block by hash instead of a range, and the schema models the two as mutually exclusive shapes.
LogsFilterhad no field for it, and since the parser reads keys by name and ignores the rest,{"blockHash": "0x…"}was not rejected but dropped, leavingfrom_block/to_blockat theirlatestdefaults. The request appeared to succeed and returned the head block's logs instead of the requested block's.That failure mode matters precisely where the hash form is used. Naming a block by hash rather than by height exists so a reorg produces an error instead of substituting a different block at the same height; returning the head's logs defeats the guarantee and hands back wrong data with no signal. A chain-following consumer at the tip is the main caller of this shape.
So
block_hash: Option<H256>is now a real field: parsed,WrongParamwhen malformed, and honoured infetch_logs_with_filter, which resolves the hash to a block number and scans exactly that block, erroring withBadParamson an unknown hash. Combining it withfromBlockortoBlockisBadParams, matching geth'serrBlockHashWithRange("can't specify fromBlock/toBlock with blockHash").eth_newFiltershares this parser but tracks a moving range of blocks, and the spec definesblockHashforeth_getLogsonly, soNewFilterRequest::parserejects the field rather than accepting something meaningless.Tests
Added to the
logsmodule: an absenttopicskey, a fully empty filter object,blockHashalone,blockHashcombined with either range field rejected, and a malformedblockHashrejected. The existing tests all passedtopicsexplicitly and never passed ablockHash, which is why neither gap was caught.cargo test -p ethrex-rpc --libis green (103 tests),cargo fmt --checkandcargo clippy -p ethrex-rpc --libclean.Draft because the
blockHashpath is only covered by parse-level tests here: it would be worth an integration test against a store with a known block, and a hive/spec-test run, before merging.