From 57cde2df24145c0e57986a9cda430502c3327c3c Mon Sep 17 00:00:00 2001 From: t00ts Date: Mon, 23 Sep 2024 10:10:08 +0200 Subject: [PATCH] chore: switch useful logs to debug level --- crates/ethereum/src/lib.rs | 21 ++++++++++++-------- crates/pathfinder/src/state/sync.rs | 7 ++++--- crates/pathfinder/src/state/sync/l1.rs | 3 +-- crates/storage/src/connection/message.rs | 6 +++--- crates/storage/src/connection/transaction.rs | 4 ++-- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/crates/ethereum/src/lib.rs b/crates/ethereum/src/lib.rs index 69e92acc5..946eca9f1 100644 --- a/crates/ethereum/src/lib.rs +++ b/crates/ethereum/src/lib.rs @@ -289,12 +289,6 @@ impl EthereumApi for EthereumClient { // Create the filter let filter = core_contract.LogMessageToL2_filter().filter; - tracing::trace!( - "Fetching L1 to L2 message logs from {} to {}", - from_block, - to_block - ); - // Fetch the logs let mut logs = Vec::new(); get_logs_recursive( @@ -307,6 +301,13 @@ impl EthereumApi for EthereumClient { ) .await?; + tracing::debug!( + "Fetched {} `L1ToL2MessageLog` logs from {} to {}", + logs.len(), + from_block, + to_block + ); + let logs: Vec = logs .into_iter() .filter_map(|log| { @@ -433,9 +434,13 @@ async fn get_logs_recursive( Err(e) => { tracing::debug!("Get logs error at block {}: {}", from_block, e); if let Some(err) = e.as_error_resp() { - // Retry the request splitting the block range + // Retry the request splitting the block range in half if err.is_retry_err() { - tracing::debug!(target: "logfetch", "Retrying request (splitting) at block {}: {}", from_block, err); + tracing::debug!( + "Retrying request (splitting) at block {}: {}", + from_block, + err + ); let mid_block = from_block + block_range / 2; get_logs_recursive( provider, diff --git a/crates/pathfinder/src/state/sync.rs b/crates/pathfinder/src/state/sync.rs index a987b84a6..052b22a0c 100644 --- a/crates/pathfinder/src/state/sync.rs +++ b/crates/pathfinder/src/state/sync.rs @@ -701,8 +701,8 @@ async fn consumer( } } L1ToL2Message(msg) => { - tracing::trace!("Got an L1ToL2Message"); - tracing::trace!("{:#?}", msg); + tracing::debug!("Got an L1ToL2Message: {:?}", msg.message_hash); + tracing::debug!("{:#?}", msg); tokio::task::block_in_place(|| { // Note: There's always an L1 tx hash and block number (hence the `expect`) let l1_tx_hash = msg.l1_tx_hash.expect("missing l1 tx hash"); @@ -719,12 +719,13 @@ async fn consumer( .. }) = tx.fetch_l1_to_l2_message_log(&msg.message_hash)? { + tracing::debug!("Found L2 tx for L1 Tx {:?}", l1_tx_hash); tx.insert_l1_handler_tx(l1_block_number, l1_tx_hash, l2_tx_hash)?; tx.remove_l1_to_l2_message_log(&msg.message_hash)?; } // Otherwise, we insert the message log with an empty L2 tx hash else { - tracing::trace!("L2 tx not found for L1 Tx {:?}", l1_tx_hash); + tracing::debug!("L2 tx NOT found for L1 Tx {:?}", l1_tx_hash); let msg_log = L1ToL2MessageLog { message_hash: msg.message_hash, l1_block_number: Some(l1_block_number), diff --git a/crates/pathfinder/src/state/sync/l1.rs b/crates/pathfinder/src/state/sync/l1.rs index 1dbd1afe6..f96145429 100644 --- a/crates/pathfinder/src/state/sync/l1.rs +++ b/crates/pathfinder/src/state/sync/l1.rs @@ -4,7 +4,6 @@ use pathfinder_common::{BlockNumber, Chain}; use pathfinder_ethereum::{EthereumApi, EthereumEvent}; use primitive_types::H160; use tokio::sync::mpsc; -use tracing::trace; use crate::state::sync::SyncEvent; @@ -57,7 +56,7 @@ where ) .await?; - trace!( + tracing::debug!( "Fetched {} L1 to L2 new message logs from {} to {}", logs.len(), last_synced_l1_handler_block, diff --git a/crates/storage/src/connection/message.rs b/crates/storage/src/connection/message.rs index 84b38bd66..d47ce439a 100644 --- a/crates/storage/src/connection/message.rs +++ b/crates/storage/src/connection/message.rs @@ -23,12 +23,12 @@ impl Transaction<'_> { .context("Upserting L1 to L2 message log")?; if let Some(l2_tx_hash) = &message.l2_tx_hash { - tracing::trace!( + tracing::debug!( "Inserted L1 to L2 message log with L2 tx hash: {:?}", l2_tx_hash ); } else if let Some(l1_tx_hash) = &message.l1_tx_hash { - tracing::trace!( + tracing::debug!( "Inserted L1 to L2 message log with L1 tx hash: {:?}", l1_tx_hash ); @@ -68,7 +68,7 @@ impl Transaction<'_> { (None, Some(_)) => "[X, L2]", _ => "N/A", }; - tracing::trace!( + tracing::debug!( "Fetched (and found: {}) an L1 to L2 message log for {:?}", debug_tx_str, message_hash diff --git a/crates/storage/src/connection/transaction.rs b/crates/storage/src/connection/transaction.rs index 7fd69300a..03750d565 100644 --- a/crates/storage/src/connection/transaction.rs +++ b/crates/storage/src/connection/transaction.rs @@ -176,7 +176,7 @@ impl Transaction<'_> { // Associate L1 handler transactions with L2 transactions for (transaction, _) in transactions.iter() { if let TransactionVariant::L1Handler(l1_handler_tx) = &transaction.variant { - tracing::trace!( + tracing::debug!( "Found an l1_handler variant while inserting transaction {:?}", transaction.hash ); @@ -230,7 +230,7 @@ impl Transaction<'_> { ":l2_tx_hash": &l2_tx_hash, ])?; - tracing::trace!( + tracing::debug!( "Saved l1_handler_tx: [{}] {:?} <-> {:?}", l1_block_number, l1_tx_hash,