Skip to content

Commit

Permalink
chore: switch useful logs to debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
t00ts committed Sep 23, 2024
1 parent 08cca56 commit 57cde2d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
21 changes: 13 additions & 8 deletions crates/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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<L1ToL2MessageLog> = logs
.into_iter()
.filter_map(|log| {
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions crates/pathfinder/src/state/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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),
Expand Down
3 changes: 1 addition & 2 deletions crates/pathfinder/src/state/sync/l1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions crates/storage/src/connection/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/src/connection/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 57cde2d

Please sign in to comment.