diff --git a/crates/revm/revm-inspectors/src/tracing/types.rs b/crates/revm/revm-inspectors/src/tracing/types.rs index 76ff0f510089..22bebdbb2478 100644 --- a/crates/revm/revm-inspectors/src/tracing/types.rs +++ b/crates/revm/revm-inspectors/src/tracing/types.rs @@ -159,6 +159,11 @@ impl CallTrace { self.status as u8 >= InstructionResult::Revert as u8 } + // Returns true if the status code is a revert + pub(crate) fn is_revert(&self) -> bool { + self.status == InstructionResult::Revert + } + /// Returns the error message if it is an erroneous result. pub(crate) fn as_error(&self, kind: TraceStyle) -> Option { // See also @@ -340,15 +345,16 @@ impl CallTraceNode { /// Converts this node into a parity `TransactionTrace` pub(crate) fn parity_transaction_trace(&self, trace_address: Vec) -> TransactionTrace { let action = self.parity_action(); - let output = self.parity_trace_output(); + let result = if action.is_selfdestruct() || + (self.trace.is_error() && !self.trace.is_revert()) + { + // if the trace is a selfdestruct or an error that is not a revert, the result is None + None + } else { + Some(self.parity_trace_output()) + }; let error = self.trace.as_error(TraceStyle::Parity); - TransactionTrace { - action, - error, - result: Some(output), - trace_address, - subtraces: self.children.len(), - } + TransactionTrace { action, error, result, trace_address, subtraces: self.children.len() } } /// Returns the `Output` for a parity trace