Skip to content

Commit

Permalink
extract deep call
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jul 1, 2023
1 parent c812dc8 commit 509238c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/revm/revm-inspectors/src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ impl TracingInspector {
GethTraceBuilder::new(self.traces.arena, self.config)
}

/// Returns true if we're no longer in the context of the root call.
fn is_deep(&self) -> bool {
// the root call will always be the first entry in the trace stack
!self.trace_stack.is_empty()
}

/// Returns true if this a call to a precompile contract.
///
/// Returns true if the `to` address is a precompile contract and the value is zero.
Expand All @@ -97,7 +103,7 @@ impl TracingInspector {
) -> bool {
if data.precompiles.contains(to) {
// only if this is _not_ the root call
return !self.trace_stack.is_empty() && value == U256::ZERO
return self.is_deep() && value == U256::ZERO
}
false
}
Expand Down

0 comments on commit 509238c

Please sign in to comment.