feat(rpc): structured JSON-RPC error codes for all endpoints#119
Open
feat(rpc): structured JSON-RPC error codes for all endpoints#119
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <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>
…Payload Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restructure EthError, DebugError, and SignetError with IntoErrorPayload impls. Migrate all 45 RPC endpoints from Result<T, String> / ResponsePayload<T, E> to Result<T, ErrorType> with proper JSON-RPC error codes: - Code 3: EVM reverts (with revert bytes in data field) - Code -32000: Server/infrastructure errors - Code -32001: Resource not found (block, tx, receipt) - Code -32602: Invalid client parameters - Code -32601: Unsupported operations Remove CallErrorData, response_tri! macro, EthError::into_string. Simplify await_handler! to single parameterized form. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…licate - Use `?` for resolve_block_id in eth endpoints so hash-not-found returns -32001 instead of -32000 - Use `?` for cold storage errors so they route through #[from] impls with sanitized "server error" messages instead of leaking internals - Remove unused EvmRevert variants from DebugError and SignetError - Add EthError::task_panic() to replace 20+ inline copies - Fix resolve_error_code to be const fn (clippy) - Map decode_2718 errors to InvalidParams (-32602) instead of Internal - Remove tracked docs/ files from git, widen .gitignore to docs/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace git branch reference with crates.io release. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dfd1229 to
b87e46b
Compare
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.
[Claude Code]
Summary
EthError,DebugError, andSignetErrorwithIntoErrorPayloadimpls (ajj 0.7) so all 45 RPC endpoints return proper JSON-RPC error codes instead of blanket-32603Result<T, String>/ResponsePayload<T, E>toResult<T, ErrorType>— the framework handles error-to-JSON-RPC conversion automaticallyCallErrorData,response_tri!macro,EthError::into_string; simplifyawait_handler!to single parameterized form?with#[from]impls for correct error codes and sanitized messages (no internal details leaked)EvmRevertvariants fromDebugErrorandSignetErrorEthError::task_panic()constructor to deduplicate 20+ inline copiesError code mapping
3eth_call,eth_estimateGasreverts — revert bytes indatafield-32000-32001-32602-32601debug_traceTransactionwith unsupported tracerDependencies
IntoErrorPayloadtrait) — currently patched to ajj PR #42 branch. Will update to published version once merged.Closes ENG-1899
Test plan
--all-featurescargo +nightly fmt🤖 Generated with Claude Code