Skip to content

Commit 725dfcf

Browse files
authored
refactor(executor): remove tx resource logs (#415)
1 parent fa5edec commit 725dfcf

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

crates/executor/src/implementation/blockifier/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,21 @@ impl<'a> BlockExecutor<'a> for StarknetVMProcessor<'a> {
257257
match result {
258258
Ok(exec_result) => {
259259
match &exec_result {
260-
ExecutionResult::Success { receipt, trace } => {
260+
ExecutionResult::Success { receipt, .. } => {
261261
self.stats.l1_gas_used +=
262262
receipt.resources_used().total_gas_consumed.l1_gas as u128;
263263
self.stats.cairo_steps_used +=
264264
receipt.resources_used().vm_resources.n_steps as u128;
265265

266-
if let Some(reason) = receipt.revert_reason() {
267-
info!(target: LOG_TARGET, hash = format!("{hash:#x}"), %reason, "Transaction reverted.");
268-
}
269-
270266
if let Some((class_hash, class)) = class_decl_artifacts {
271267
state.declared_classes.insert(class_hash, class.as_ref().clone());
272268
}
273269

274-
crate::utils::log_resources(&trace.receipt.resources);
270+
if let Some(reason) = receipt.revert_reason() {
271+
info!(target: LOG_TARGET, hash = format!("{hash:#x}"), type = ?receipt.r#type(), revert_reason = %reason, "Transaction executed (reverted).");
272+
} else {
273+
info!(target: LOG_TARGET, hash = format!("{hash:#x}"), type = ?receipt.r#type(), "Transaction executed.");
274+
}
275275
}
276276

277277
ExecutionResult::Failed { error } => {

crates/executor/src/utils.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
11
use blockifier::fee::receipt::TransactionReceipt;
2-
use katana_primitives::execution::{CallInfo, TransactionExecutionInfo, TransactionResources};
2+
use katana_primitives::execution::{CallInfo, TransactionExecutionInfo};
33
use katana_primitives::fee::FeeInfo;
44
use katana_primitives::receipt::{
55
self, DataAvailabilityResources, DeclareTxReceipt, DeployAccountTxReceipt, Event, GasUsed,
66
InvokeTxReceipt, L1HandlerTxReceipt, MessageToL1, Receipt,
77
};
88
use katana_primitives::transaction::ExecutableTx;
9-
use tracing::trace;
10-
11-
pub(crate) const LOG_TARGET: &str = "executor";
12-
13-
pub fn log_resources(resources: &TransactionResources) {
14-
let mut mapped_strings = Vec::new();
15-
16-
for (builtin, count) in &resources.computation.tx_vm_resources.builtin_instance_counter {
17-
mapped_strings.push(format!("{builtin}: {count}"));
18-
}
19-
20-
// Sort the strings alphabetically
21-
mapped_strings.sort();
22-
mapped_strings.insert(0, format!("steps: {}", resources.computation.tx_vm_resources.n_steps));
23-
mapped_strings.insert(
24-
1,
25-
format!("memory holes: {}", resources.computation.tx_vm_resources.n_memory_holes),
26-
);
27-
28-
trace!(target: LOG_TARGET, usage = mapped_strings.join(" | "), "Transaction resource usage.");
29-
}
309

3110
pub(crate) fn build_receipt(
3211
tx: &ExecutableTx,

0 commit comments

Comments
 (0)