diff --git a/crates/katana/executor/src/implementation/blockifier/mod.rs b/crates/katana/executor/src/implementation/blockifier/mod.rs index f58a7d7686..a1948db15f 100644 --- a/crates/katana/executor/src/implementation/blockifier/mod.rs +++ b/crates/katana/executor/src/implementation/blockifier/mod.rs @@ -181,6 +181,7 @@ impl<'a> BlockExecutor<'a> for StarknetVMProcessor<'a> { }; let tx = TxWithHash::from(&exec_tx); + let hash = tx.hash; let res = utils::transact(&mut state.inner, block_context, flags, exec_tx); match &res { @@ -190,7 +191,7 @@ impl<'a> BlockExecutor<'a> for StarknetVMProcessor<'a> { receipt.resources_used().vm_resources.n_steps as u128; if let Some(reason) = receipt.revert_reason() { - info!(target: LOG_TARGET, %reason, "Transaction reverted."); + info!(target: LOG_TARGET, hash = format!("{hash:#x}"), %reason, "Transaction reverted."); } if let Some((class_hash, compiled, sierra)) = class_decl_artifacts { @@ -201,7 +202,7 @@ impl<'a> BlockExecutor<'a> for StarknetVMProcessor<'a> { } ExecutionResult::Failed { error } => { - info!(target: LOG_TARGET, %error, "Executing transaction."); + info!(target: LOG_TARGET, hash = format!("{hash:#x}"), %error, "Executing transaction."); } }; diff --git a/crates/katana/pool/src/pool.rs b/crates/katana/pool/src/pool.rs index f047e94467..266057e633 100644 --- a/crates/katana/pool/src/pool.rs +++ b/crates/katana/pool/src/pool.rs @@ -137,7 +137,7 @@ where let hash = tx.hash(); let id = TxId::new(tx.sender(), tx.nonce()); - info!(hash = format!("{hash:#x}"), "Transaction received."); + info!(target: "pool", hash = format!("{hash:#x}"), "Transaction received."); match self.inner.validator.validate(tx) { Ok(outcome) => { @@ -157,14 +157,14 @@ where // TODO: create a small cache for rejected transactions to respect the rpc spec // `getTransactionStatus` ValidationOutcome::Invalid { error, .. } => { - warn!(hash = format!("{hash:#x}"), "Invalid transaction."); + warn!(target: "pool", hash = format!("{hash:#x}"), %error, "Invalid transaction."); Err(PoolError::InvalidTransaction(Box::new(error))) } // return as error for now but ideally we should kept the tx in a separate // queue and revalidate it when the parent tx is added to the pool ValidationOutcome::Dependent { tx, tx_nonce, current_nonce } => { - info!(hash = format!("{hash:#x}"), "Dependent transaction."); + info!(target: "pool", hash = format!("{hash:#x}"), %tx_nonce, %current_nonce, "Dependent transaction."); let err = InvalidTransactionError::InvalidNonce { address: tx.sender(), current_nonce, @@ -175,9 +175,9 @@ where } } - Err(e @ crate::validation::Error { hash, .. }) => { - error!(hash = format!("{hash:#x}"), %e, "Failed to validate transaction."); - Err(PoolError::Internal(e.error)) + Err(error @ crate::validation::Error { hash, .. }) => { + error!(target: "pool", hash = format!("{hash:#x}"), %error, "Failed to validate transaction."); + Err(PoolError::Internal(error.error)) } } }