Skip to content

feat(rpc): add web3, net namespaces and expand debug/eth for tooling compatibility#120

Draft
prestwich wants to merge 14 commits intoprestwich/eng-1899from
prestwich/eng-960-rpc-namespace-completeness
Draft

feat(rpc): add web3, net namespaces and expand debug/eth for tooling compatibility#120
prestwich wants to merge 14 commits intoprestwich/eng-1899from
prestwich/eng-960-rpc-namespace-completeness

Conversation

@prestwich
Copy link
Copy Markdown
Member

@prestwich prestwich commented Mar 25, 2026

Summary

[Claude Code]

Adds standard Ethereum JSON-RPC namespaces and methods for general tooling compatibility (Blockscout, Routescan, wallets, etc.). Driven by ENG-960.

  • web3 namespace: clientVersion, sha3
  • net namespace: version, listening
  • eth: protocolVersion
  • debug: getRawHeader, getRawTransaction, getRawBlock, getRawReceipts, traceBlock (raw RLP), traceCall

Total: 56 routes across 5 namespaces (eth 41, debug 9, signet 2, web3 2, net 2).

Methods that don't apply to Signet (mining, keystore, txpool, proofs, blobs, net_peerCount) are not registered and return method_not_found.

Key implementation details

  • debug_traceBlock decodes raw RLP, recovers senders, reuses extracted trace_block_inner shared tracing loop
  • debug_traceCall combines EVM state resolution (like eth_call) with the tracer infrastructure
  • debug_getRawReceipts reconstructs consensus ReceiptEnvelope from ColdReceipt (strips RPC log metadata)
  • debug_getRawBlock assembles full block from separately-stored header + transactions
  • New DebugError variants: RlpDecode, SenderRecovery

Test plan

  • All 35 existing tests pass (updated test_not_supportedtest_protocol_version)
  • New unit tests for web3_sha3, web3_clientVersion, DebugError variants
  • Clippy clean (--all-features --all-targets)
  • Manual testing with Blockscout/Routescan against a running node

Review Fixes

  • Replace EvmHalt with Internal for task panic/cancellation in all await_handler! sites
  • Replace EvmHalt with Internal for resolve_evm_block error mapping in debug_traceCall
  • Use unwrap_or_default() for optional tracer options per Geth spec (all 4 handlers)
  • Change pub(super) to pub(crate) on all debug handler functions
  • Replace use super::* glob import with explicit imports in web3 tests
  • Remove accidentally committed planning/spec documents

Reviewed and updated by Claude Code.

🤖 Generated with Claude Code

@prestwich prestwich requested a review from a team as a code owner March 25, 2026 16:37
@prestwich prestwich requested a review from Fraser999 March 25, 2026 23:24
@prestwich prestwich marked this pull request as draft March 26, 2026 11:07
@prestwich prestwich force-pushed the prestwich/eng-960-rpc-namespace-completeness branch from 9af104c to 4dd2e29 Compare March 26, 2026 15:29
@prestwich prestwich force-pushed the prestwich/eng-1899 branch from dfd1229 to b87e46b Compare March 26, 2026 15:37
@prestwich prestwich force-pushed the prestwich/eng-960-rpc-namespace-completeness branch from 4dd2e29 to 03bbd7c Compare March 26, 2026 15:38
@prestwich prestwich force-pushed the prestwich/eng-1899 branch from b87e46b to 112c417 Compare March 26, 2026 21:41
@prestwich prestwich force-pushed the prestwich/eng-960-rpc-namespace-completeness branch from 03bbd7c to c0379af Compare March 26, 2026 21:41
H: HotKv + Send + Sync + 'static,
<H::RoTx as HotKvRead>::Error: DBErrorMarker,
{
let opts = opts.ok_or(DebugError::InvalidTracerConfig)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

According to claude: "Per the Geth spec, the tracer options parameter is optional and should default to the struct logger when omitted."

Suggested change
let opts = opts.ok_or(DebugError::InvalidTracerConfig)?;
let opts = opts.unwrap_or_default();

It seems this is what we already have for existing endpoints, so they should probably all be changed.

H: HotKv + Send + Sync + 'static,
<H::RoTx as HotKvRead>::Error: DBErrorMarker,
{
let opts = opts.ok_or(DebugError::InvalidTracerConfig)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
let opts = opts.ok_or(DebugError::InvalidTracerConfig)?;
let opts = opts.unwrap_or_default();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Committed by mistake?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Committed by mistake?

@prestwich
Copy link
Copy Markdown
Member Author

[Claude Code]

Code review

Found 1 issue:

  1. Planning/spec documents appear to be committed by mistake — docs/superpowers/plans/2026-03-25-parity-trace-namespace.md and docs/superpowers/specs/2026-03-25-parity-trace-namespace-design.md. This was also flagged in PR feat: handle reorgs in get_filter_changes with reorg watermark #98 for similar files.

# Parity `trace_` Namespace Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add a Parity/OpenEthereum `trace_` JSON-RPC namespace (9 methods) to signet-rpc for Blockscout and general tooling compatibility.

# Parity `trace_` Namespace
Add the Parity/OpenEthereum `trace_` JSON-RPC namespace to signet-rpc for
Blockscout and general tooling compatibility. Driven by ENG-1064 and ENG-1065.

Additionally, several lower-confidence findings were identified (not posted here as they scored below threshold): pub(super) on new handlers (CLAUDE.md violation), opts.ok_or() instead of unwrap_or_default() (spec compliance), and EvmHalt misuse for task panics (regression from afe39f5 fix). These may warrant attention during triage.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

prestwich and others added 14 commits March 30, 2026 13:31
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract trace_block_inner() so it can be reused by the new
debug_traceBlock (raw RLP) handler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Decodes an RLP-encoded block, recovers transaction senders, and
traces all transactions using the shared trace_block_inner loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
eth_protocolVersion is now implemented, so the test that expected
method_not_found is updated to assert the "0x44" response.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Document partial-move pattern in get_raw_receipts
- Consolidate duplicate -32602 error code arms in DebugError
- Fix resolve_header error mapping: use Resolve(e) instead of
  BlockNotFound(id) to preserve the distinction between "block not
  found" (-32001) and "storage layer failed" (-32000). The
  resolve_error_message helper already sanitizes DB errors to the
  opaque "server error" string, so no internals are leaked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9 methods (trace_block, trace_transaction, trace_replayBlockTransactions,
trace_replayTransaction, trace_call, trace_callMany, trace_rawTransaction,
trace_get, trace_filter) for Blockscout/tooling compatibility. ENG-1064,
ENG-1065.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
12 tasks covering TraceError, param types, config, Parity tracer
functions, block replay helpers, 9 trace_ endpoints, and router wiring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace EvmHalt with Internal for task panic/cancellation errors
- Replace EvmHalt with Internal for resolve_evm_block error mapping
- Use unwrap_or_default() for optional tracer options per Geth spec
- Change pub(super) to pub(crate) on all debug handler functions
- Replace glob import with explicit imports in web3 test module
- Remove accidentally committed planning/spec documents

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prestwich prestwich force-pushed the prestwich/eng-960-rpc-namespace-completeness branch from c0379af to f3d693c Compare March 30, 2026 17:35
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.

3 participants