Skip to content

Commit

Permalink
chore(l1): replace info! with debug! tracing log (#1174)
Browse files Browse the repository at this point in the history
**Motivation**

Replace `info!` tracing logs with `debug!` to avoid flooding the
console.

Closes #1134

---------

Co-authored-by: ElFantasma <[email protected]>
  • Loading branch information
h3lio5 and ElFantasma authored Nov 27, 2024
1 parent 745823b commit 203ef4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/networking/p2p/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ async fn handle_peer_as_initiator(
table: Arc<Mutex<KademliaTable>>,
connection_broadcast: broadcast::Sender<(tokio::task::Id, Arc<RLPxMessage>)>,
) {
info!("Trying RLPx connection with {node:?}");
debug!("Trying RLPx connection with {node:?}");
let stream = TcpSocket::new_v4()
.unwrap()
.connect(SocketAddr::new(node.ip, node.tcp_port))
Expand Down
26 changes: 13 additions & 13 deletions crates/networking/p2p/rlpx/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use tokio::{
task,
time::{sleep, Instant},
};
use tracing::{error, info};
use tracing::{debug, error};
const CAP_P2P: (Capability, u8) = (Capability::P2p, 5);
const CAP_ETH: (Capability, u8) = (Capability::Eth, 68);
const CAP_SNAP: (Capability, u8) = (Capability::Snap, 1);
Expand Down Expand Up @@ -167,13 +167,13 @@ impl<S: AsyncWrite + AsyncRead + std::marker::Unpin> RLPxConnection<S> {
reason: self.match_disconnect_reason(&error),
}))
.await
.unwrap_or_else(|e| info!("Could not send Disconnect message: ({e})"));
.unwrap_or_else(|e| debug!("Could not send Disconnect message: ({e})"));
if let Ok(node_id) = self.get_remote_node_id() {
// Discard peer from kademlia table
info!("{error_text}: ({error}), discarding peer {node_id}");
debug!("{error_text}: ({error}), discarding peer {node_id}");
table.lock().await.replace_peer(node_id);
} else {
info!("{error_text}: ({error}), unknown peer")
debug!("{error_text}: ({error}), unknown peer")
}
}

Expand Down Expand Up @@ -201,7 +201,7 @@ impl<S: AsyncWrite + AsyncRead + std::marker::Unpin> RLPxConnection<S> {
))
}
};
info!("Completed handshake!");
debug!("Completed handshake!");

self.exchange_hello_messages().await?;
Ok(())
Expand Down Expand Up @@ -240,7 +240,7 @@ impl<S: AsyncWrite + AsyncRead + std::marker::Unpin> RLPxConnection<S> {
async fn handle_peer_conn(&mut self) -> Result<(), RLPxError> {
if let RLPxConnectionState::Established(_) = &self.state {
self.init_peer_conn().await?;
info!("Started peer main loop");
debug!("Started peer main loop");
// Wait for eth status message or timeout.
let mut broadcaster_receive = {
if self.capabilities.contains(&CAP_ETH) {
Expand Down Expand Up @@ -301,7 +301,7 @@ impl<S: AsyncWrite + AsyncRead + std::marker::Unpin> RLPxConnection<S> {
async fn check_periodic_tasks(&mut self) -> Result<(), RLPxError> {
if Instant::now() >= self.next_periodic_task_check {
self.send(Message::Ping(PingMessage {})).await?;
info!("Ping sent");
debug!("Ping sent");
self.next_periodic_task_check = Instant::now() + PERIODIC_TASKS_CHECK_INTERVAL;
};
Ok(())
Expand All @@ -311,20 +311,20 @@ impl<S: AsyncWrite + AsyncRead + std::marker::Unpin> RLPxConnection<S> {
let peer_supports_eth = self.capabilities.contains(&CAP_ETH);
match message {
Message::Disconnect(msg_data) => {
info!("Received Disconnect: {:?}", msg_data.reason);
debug!("Received Disconnect: {:?}", msg_data.reason);
// Returning a Disonnect error to be handled later at the call stack
return Err(RLPxError::Disconnect());
}
Message::Ping(_) => {
info!("Received Ping");
debug!("Received Ping");
self.send(Message::Pong(PongMessage {})).await?;
info!("Pong sent");
debug!("Pong sent");
}
Message::Pong(_) => {
// We ignore received Pong messages
}
Message::Status(msg_data) if !peer_supports_eth => {
info!("Received Status");
debug!("Received Status");
backend::validate_status(msg_data, &self.storage)?
}
Message::GetAccountRange(req) => {
Expand Down Expand Up @@ -397,15 +397,15 @@ impl<S: AsyncWrite + AsyncRead + std::marker::Unpin> RLPxConnection<S> {
// Sending eth Status if peer supports it
if self.capabilities.contains(&CAP_ETH) {
let status = backend::get_status(&self.storage)?;
info!("Sending status");
debug!("Sending status");
self.send(Message::Status(status)).await?;
// The next immediate message in the ETH protocol is the
// status, reference here:
// https://github.com/ethereum/devp2p/blob/master/caps/eth.md#status-0x00
match self.receive().await? {
Message::Status(msg_data) => {
// TODO: Check message status is correct.
info!("Received Status");
debug!("Received Status");
backend::validate_status(msg_data, &self.storage)?
}
_msg => {
Expand Down

0 comments on commit 203ef4a

Please sign in to comment.