Skip to content

Commit 46bd906

Browse files
prestwichclaude
andcommitted
fix(rpc): review fixes — correct error codes, remove dead code, deduplicate
- 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>
1 parent 5f5a115 commit 46bd906

7 files changed

Lines changed: 78 additions & 1192 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
.DS_Store
33
Cargo.lock
44
.idea/
5-
docs/superpowers/
5+
docs/

crates/rpc/src/debug/error.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//! Error types for the debug namespace.
22
3-
use alloy::{
4-
eips::BlockId,
5-
primitives::{B256, Bytes},
6-
};
3+
use alloy::{eips::BlockId, primitives::B256};
74
use std::borrow::Cow;
85

96
/// Errors that can occur in the `debug` namespace.
@@ -24,12 +21,6 @@ pub enum DebugError {
2421
/// Unsupported tracer type.
2522
#[error("unsupported: {0}")]
2623
Unsupported(&'static str),
27-
/// EVM execution reverted with output data.
28-
#[error("execution reverted")]
29-
EvmRevert {
30-
/// ABI-encoded revert reason bytes.
31-
output: Bytes,
32-
},
3324
/// EVM execution halted.
3425
#[error("execution halted: {reason}")]
3526
EvmHalt {
@@ -45,15 +36,14 @@ pub enum DebugError {
4536
}
4637

4738
impl ajj::IntoErrorPayload for DebugError {
48-
type ErrData = Bytes;
39+
type ErrData = ();
4940

5041
fn error_code(&self) -> i64 {
5142
match self {
5243
Self::Cold(_) | Self::Hot(_) | Self::EvmHalt { .. } => -32000,
5344
Self::Resolve(r) => crate::eth::error::resolve_error_code(r),
5445
Self::InvalidTracerConfig => -32602,
5546
Self::Unsupported(_) => -32601,
56-
Self::EvmRevert { .. } => 3,
5747
Self::BlockNotFound(_) | Self::TransactionNotFound(_) => -32001,
5848
}
5949
}
@@ -64,17 +54,13 @@ impl ajj::IntoErrorPayload for DebugError {
6454
Self::Resolve(r) => crate::eth::error::resolve_error_message(r),
6555
Self::InvalidTracerConfig => "invalid tracer config".into(),
6656
Self::Unsupported(msg) => format!("unsupported: {msg}").into(),
67-
Self::EvmRevert { .. } => "execution reverted".into(),
6857
Self::EvmHalt { reason } => format!("execution halted: {reason}").into(),
6958
Self::BlockNotFound(id) => format!("block not found: {id}").into(),
7059
Self::TransactionNotFound(h) => format!("transaction not found: {h}").into(),
7160
}
7261
}
7362

7463
fn error_data(self) -> Option<Self::ErrData> {
75-
match self {
76-
Self::EvmRevert { output } => Some(output),
77-
_ => None,
78-
}
64+
None
7965
}
8066
}

0 commit comments

Comments
 (0)