Skip to content
Merged
Changes from all commits
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
13 changes: 7 additions & 6 deletions crates/rpc/src/debug/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ where
Host: FullNodeComponents,
Signet: Pnt,
{
let opts = response_tri!(opts.ok_or(DebugError::from(EthApiError::InvalidTracerConfig)));

let _permit = response_tri!(
ctx.acquire_tracing_permit()
.await
.map_err(|_| DebugError::rpc_error("Failed to acquire tracing permit".into()))
);

let id = id.into();
let span = tracing::debug_span!("traceBlock", ?id, tracer = ?opts.as_ref().and_then(|o| o.tracer.as_ref()));
let span = tracing::debug_span!("traceBlock", ?id, tracer = ?opts.tracer.as_ref());

let fut = async move {
// Fetch the block by ID
Expand All @@ -64,8 +66,6 @@ where
let mut trevm = response_tri!(ctx.trevm(crate::LoadState::Before, block.header()));

// Apply all transactions in the block up, tracing each one
let opts = opts.unwrap_or_default();

tracing::trace!(?opts, "Tracing block transactions");

let mut txns = block.body().transactions().enumerate().peekable();
Expand Down Expand Up @@ -107,13 +107,15 @@ where
Host: FullNodeComponents,
Signet: Pnt,
{
let opts = response_tri!(opts.ok_or(DebugError::from(EthApiError::InvalidTracerConfig)));

let _permit = response_tri!(
ctx.acquire_tracing_permit()
.await
.map_err(|_| DebugError::rpc_error("Failed to acquire tracing permit".into()))
);

let span = tracing::debug_span!("traceTransaction", %tx_hash, tracer = ?opts.as_ref().and_then(|o| o.tracer.as_ref()));
let span = tracing::debug_span!("traceTransaction", %tx_hash, tracer = ?opts.tracer.as_ref());

let fut = async move {
// Load the transaction by hash
Expand Down Expand Up @@ -159,8 +161,7 @@ where
base_fee: block.header().base_fee_per_gas(),
};

let res =
response_tri!(crate::debug::tracer::trace(trevm, &opts.unwrap_or_default(), tx_info)).0;
let res = response_tri!(crate::debug::tracer::trace(trevm, &opts, tx_info)).0;

ResponsePayload::Success(res)
}
Expand Down