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

fix(tracing): align trace output with geth #198

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Changes from 1 commit
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
17 changes: 14 additions & 3 deletions src/tracing/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ impl CallTrace {
InstructionResult::PrecompileError => {
if kind.is_parity() { "Built-in failed" } else { "precompiled failed" }.to_string()
}
InstructionResult::InvalidFEOpcode => {
if kind.is_parity() { "Bad instruction" } else { "invalid opcode: INVALID" }
.to_string()
}
Comment on lines +143 to +146
Copy link
Contributor

Choose a reason for hiding this comment

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

status => format!("{:?}", status),
})
}
Expand Down Expand Up @@ -402,10 +406,17 @@ impl CallTraceNode {

// we need to populate error and revert reason
if !self.trace.success {
call_frame.revert_reason = utils::maybe_revert_reason(self.trace.output.as_ref());
if self.kind() == CallKind::Create || self.trace.kind == CallKind::Create2 {
call_frame.to = None;
}

// Note: the call tracer mimics parity's trace transaction and geth maps errors to parity style error messages, <https://github.com/ethereum/go-ethereum/blob/34d507215951fb3f4a5983b65e127577989a6db8/eth/tracers/native/call_flat.go#L39-L55>
call_frame.error = self.trace.as_error_msg(TraceStyle::Parity);
if !self.status().is_revert() {
call_frame.gas_used = U256::from(self.trace.gas_limit);
call_frame.output = None;
}

call_frame.revert_reason = utils::maybe_revert_reason(self.trace.output.as_ref());
call_frame.error = self.trace.as_error_msg(TraceStyle::Geth);
}

if include_logs && !self.logs.is_empty() {
Expand Down