Skip to content

Commit

Permalink
fix: improve CallTracer type detection for transaction tracing (#2010)
Browse files Browse the repository at this point in the history
Enhance the default trace generation for CallTracer by dynamically determining the transaction type (CALL or CREATE) based on the presence of a 'to' address
  • Loading branch information
gabriel-aranha-cw authored Feb 12, 2025
1 parent b0504ab commit e2e1043
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/eth/executor/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,13 +608,21 @@ pub fn default_trace(tracer_type: GethDebugTracerType, tx: TransactionStage) ->
match tracer_type {
GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::FourByteTracer) => FourByteFrame::default().into(),
// HACK: Spoof empty call frame to prevent Blockscout from retrying unnecessary trace calls
GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::CallTracer) => CallFrame {
from: tx.from().into(),
to: tx.to().map_into(),
typ: "CALL".to_string(),
..Default::default()
GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::CallTracer) => {
let typ = match tx.to() {
Some(_) => "CALL",
None => "CREATE",
}
.to_string();

CallFrame {
from: tx.from().into(),
to: tx.to().map_into(),
typ,
..Default::default()
}
.into()
}
.into(),
GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::MuxTracer) => MuxFrame::default().into(),
GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::FlatCallTracer) => FlatCallFrame::default().into(),
_ => NoopFrame::default().into(),
Expand Down

0 comments on commit e2e1043

Please sign in to comment.