Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
exeokan committed Dec 19, 2024
1 parent 529ec3e commit b7fca83
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/citrea/tests/evm/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ async fn tracing_tests() -> Result<(), Box<dyn std::error::Error>> {
_ => anyhow::bail!("Unexpected trace result"),
})
.collect::<Result<Vec<_>, _>>()?;

assert_eq!(traces.len(), 8);
assert_eq!(traces[5], CallTracer(reth_json));
assert_eq!(traces[6], CallTracer(expected_call_get_trace));
Expand Down
6 changes: 2 additions & 4 deletions crates/ethereum-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,9 @@ fn register_rpc_methods<C: sov_modules_api::Context, Da: DaService>(
opts,
)?;
match &traces[0] {
TraceResult::Success { result, .. } => {
Ok(result.clone())
}
TraceResult::Success { result, .. } => Ok(result.clone()),
// this should never happen since we propagate any tracing error
TraceResult::Error { error, tx_hash: _} => {
TraceResult::Error { error, tx_hash: _ } => {
Err(EthApiError::EvmCustom(error.clone()).into())
}
}
Expand Down
29 changes: 22 additions & 7 deletions crates/ethereum-rpc/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,17 @@ fn get_traces_with_requested_tracer_and_config(
}
_ => {
traces.into_iter().for_each(|trace| {
if let TraceResult::Success { result: GethTrace::CallTracer(call_frame), tx_hash } = trace {
if let TraceResult::Success {
result: GethTrace::CallTracer(call_frame),
tx_hash,
} = trace
{
let new_call_frame =
apply_call_config(call_frame.clone(), call_config);
new_traces.push(TraceResult::new_success(GethTrace::CallTracer(new_call_frame), tx_hash));
new_traces.push(TraceResult::new_success(
GethTrace::CallTracer(new_call_frame),
tx_hash,
));
}
});
}
Expand All @@ -249,17 +256,25 @@ fn get_traces_with_requested_tracer_and_config(
}
GethDebugBuiltInTracerType::FourByteTracer => {
traces.into_iter().for_each(|trace| {
if let TraceResult::Success { result: GethTrace::CallTracer(call_frame), tx_hash } = trace {
if let TraceResult::Success {
result: GethTrace::CallTracer(call_frame),
tx_hash,
} = trace
{
let four_byte_frame =
convert_call_trace_into_4byte_frame(vec![call_frame]);
new_traces.push(TraceResult::new_success(GethTrace::FourByteTracer(four_byte_frame), tx_hash));
new_traces.push(TraceResult::new_success(
GethTrace::FourByteTracer(four_byte_frame),
tx_hash,
));
}
});
Ok(new_traces)
}
GethDebugBuiltInTracerType::NoopTracer => {
Ok(vec![TraceResult::new_success(GethTrace::NoopTracer(NoopFrame::default()), None)])
}
GethDebugBuiltInTracerType::NoopTracer => Ok(vec![TraceResult::new_success(
GethTrace::NoopTracer(NoopFrame::default()),
None,
)]),
_ => Err(EthApiError::Unsupported("This tracer is not supported")),
}
}
Expand Down

0 comments on commit b7fca83

Please sign in to comment.