Skip to content

Commit

Permalink
fix(rpc/v0.4): align trace updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko-von-Leipzig committed Feb 2, 2024
1 parent b28f94f commit ed04033
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/rpc/src/v04/method/trace_block_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub async fn trace_block_transactions(
let hash = header.hash;
let state = ExecutionState::trace(&db, context.chain_id, header, None);
let traces =
pathfinder_executor::trace(state, &context.cache, hash, transactions, true, true)?;
pathfinder_executor::trace(state, context.cache, hash, transactions, true, true)?;

let result = traces
.into_iter()
Expand Down
12 changes: 8 additions & 4 deletions crates/rpc/src/v04/method/trace_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub async fn trace_transaction(
.get(&db)
.context("Querying pending data")?;

let (header, transactions) = if let Some(pending_tx) = pending
let (header, transactions, cache) = if let Some(pending_tx) = pending
.block
.transactions
.iter()
Expand All @@ -123,7 +123,11 @@ pub async fn trace_transaction(
return Ok(LocalExecution::Unsupported(pending_tx.clone()));
}

(header, pending.block.transactions.clone())
(
header,
pending.block.transactions.clone(),
Default::default(),
)
} else {
let block_hash = db
.transaction_block_hash(input.transaction_hash)?
Expand Down Expand Up @@ -155,7 +159,7 @@ pub async fn trace_transaction(
.context("Fetching block transactions")?
.context("Block transactions missing")?;

(header, transactions.clone())
(header, transactions.clone(), context.cache.clone())
};

let hash = header.hash;
Expand All @@ -166,7 +170,7 @@ pub async fn trace_transaction(
.map(|transaction| compose_executor_transaction(transaction, &db))
.collect::<Result<Vec<_>, _>>()?;

pathfinder_executor::trace(state, &context.cache, hash, transactions, true, true)
pathfinder_executor::trace(state, cache, hash, transactions, true, true)
.map_err(TraceTransactionError::from)
.and_then(|txs| {
txs.into_iter()
Expand Down

0 comments on commit ed04033

Please sign in to comment.