Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add error field to parity transaction traces #3611

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/revm/revm-inspectors/src/tracing/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use reth_rpc_types::trace::{
geth::{CallFrame, CallLogFrame, GethDefaultTracingOptions, StructLog},
parity::{
Action, ActionType, CallAction, CallOutput, CallType, ChangedType, CreateAction,
CreateOutput, Delta, SelfdestructAction, StateDiff, TraceOutput, TraceResult,
TransactionTrace,
CreateOutput, Delta, SelfdestructAction, StateDiff, TraceOutput, TransactionTrace,
},
};
use revm::interpreter::{
Expand Down Expand Up @@ -321,9 +320,10 @@ impl CallTraceNode {
/// Converts this node into a parity `TransactionTrace`
pub(crate) fn parity_transaction_trace(&self, trace_address: Vec<usize>) -> TransactionTrace {
let action = self.parity_action();
let output = TraceResult::parity_success(self.parity_trace_output());
let output = self.parity_trace_output();
TransactionTrace {
action,
error: None,
result: Some(output),
trace_address,
subtraces: self.children.len(),
Expand Down
21 changes: 3 additions & 18 deletions crates/rpc/rpc-types/src/eth/trace/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@ use std::{
ops::{Deref, DerefMut},
};

/// Result type for parity style transaction trace
pub type TraceResult = crate::trace::common::TraceResult<TraceOutput, String>;

// === impl TraceResult ===

impl TraceResult {
/// Wraps the result type in a [TraceResult::Success] variant
pub fn parity_success(result: TraceOutput) -> Self {
TraceResult::Success { result }
}

/// Wraps the result type in a [TraceResult::Error] variant
pub fn parity_error(error: String) -> Self {
TraceResult::Error { error }
}
}

/// Different Trace diagnostic targets.
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -241,7 +224,9 @@ pub struct TransactionTrace {
#[serde(flatten)]
pub action: Action,
#[serde(flatten)]
pub result: Option<TraceResult>,
pub error: Option<String>,
#[serde(flatten)]
pub result: Option<TraceOutput>,
pub subtraces: usize,
pub trace_address: Vec<usize>,
}
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/rpc/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ fn reward_trace(header: &SealedHeader, reward: RewardAction) -> LocalizedTransac
trace_address: vec![],
subtraces: 0,
action: Action::Reward(reward),
error: None,
result: None,
},
}
Expand Down