From c78fe81a895151e675c22e5d07ef102bd288efa9 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Thu, 28 Nov 2019 15:05:25 +1100 Subject: [PATCH] Remove unnecessary logging and correct formatting --- beacon_node/beacon_chain/src/beacon_chain.rs | 4 ++-- beacon_node/eth2-libp2p/src/behaviour.rs | 10 +++++----- beacon_node/eth2-libp2p/src/rpc/handler.rs | 10 ---------- beacon_node/network/src/service.rs | 4 ++-- beacon_node/network/src/sync/message_processor.rs | 15 +++++---------- 5 files changed, 14 insertions(+), 29 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 09aa28e86b..7feb8f2f96 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -664,7 +664,7 @@ impl BeaconChain { }); } other => { - warn!( + trace!( self.log, "Beacon attestation rejected"; "reason" => format!("{:?}", other), @@ -1019,7 +1019,7 @@ impl BeaconChain { }); } other => { - warn!( + trace!( self.log, "Beacon block rejected"; "reason" => format!("{:?}", other), diff --git a/beacon_node/eth2-libp2p/src/behaviour.rs b/beacon_node/eth2-libp2p/src/behaviour.rs index a64f960084..63464bc729 100644 --- a/beacon_node/eth2-libp2p/src/behaviour.rs +++ b/beacon_node/eth2-libp2p/src/behaviour.rs @@ -173,11 +173,11 @@ impl NetworkBehaviourEventProcess format!("{}", peer_id), - "Protocol Version" => info.protocol_version, - "Agent Version" => info.agent_version, - "Listening Addresses" => format!("{:?}", info.listen_addrs), - "Observed Address" => format!("{:?}", observed_addr), - "Protocols" => format!("{:?}", info.protocols) + "protocol_version" => info.protocol_version, + "agent_version" => info.agent_version, + "listening_ addresses" => format!("{:?}", info.listen_addrs), + "observed_address" => format!("{:?}", observed_addr), + "protocols" => format!("{:?}", info.protocols) ); } IdentifyEvent::Sent { .. } => {} diff --git a/beacon_node/eth2-libp2p/src/rpc/handler.rs b/beacon_node/eth2-libp2p/src/rpc/handler.rs index d461545e61..e2f07ba7a6 100644 --- a/beacon_node/eth2-libp2p/src/rpc/handler.rs +++ b/beacon_node/eth2-libp2p/src/rpc/handler.rs @@ -273,8 +273,6 @@ where RPCEvent::Request(_, _) => self.send_request(rpc_event), RPCEvent::Response(rpc_id, response) => { // check if the stream matching the response still exists - trace!(self.log, "Checking for outbound stream"); - // variables indicating if the response is an error response or a multi-part // response let res_is_error = response.is_error(); @@ -284,7 +282,6 @@ where Some((substream_state, _)) => { match std::mem::replace(substream_state, InboundSubstreamState::Poisoned) { InboundSubstreamState::ResponseIdle(substream) => { - trace!(self.log, "Stream is idle, sending message"; "message" => format!("{}", response)); // close the stream if there is no response if let RPCErrorResponse::StreamTermination(_) = response { trace!(self.log, "Stream termination sent. Ending the stream"); @@ -302,7 +299,6 @@ where if res_is_multiple => { // the stream is in use, add the request to a pending queue - trace!(self.log, "Adding message to queue"; "message" => format!("{}", response)); (*self .queued_outbound_items .entry(rpc_id) @@ -386,7 +382,6 @@ where .poll() .map_err(|_| ProtocolsHandlerUpgrErr::Timer)? { - trace!(self.log, "Closing expired inbound stream"); self.inbound_substreams.remove(stream_id.get_ref()); } @@ -396,7 +391,6 @@ where .poll() .map_err(|_| ProtocolsHandlerUpgrErr::Timer)? { - trace!(self.log, "Closing expired outbound stream"); self.outbound_substreams.remove(stream_id.get_ref()); } @@ -420,7 +414,6 @@ where match substream.poll() { Ok(Async::Ready(raw_substream)) => { // completed the send - trace!(self.log, "RPC message sent"); // close the stream if required if closing { @@ -428,7 +421,6 @@ where InboundSubstreamState::Closing(raw_substream) } else { // check for queued chunks and update the stream - trace!(self.log, "Checking for queued items"); entry.get_mut().0 = apply_queued_responses( raw_substream, &mut self @@ -456,7 +448,6 @@ where }; } InboundSubstreamState::ResponseIdle(substream) => { - trace!(self.log, "Idle stream searching queue"); entry.get_mut().0 = apply_queued_responses( substream, &mut self.queued_outbound_items.get_mut(&request_id), @@ -502,7 +493,6 @@ where request, } => match substream.poll() { Ok(Async::Ready(Some(response))) => { - trace!(self.log, "Message received"; "message" => format!("{}", response)); if request.multiple_responses() { entry.get_mut().0 = OutboundSubstreamState::RequestPendingResponse { diff --git a/beacon_node/network/src/service.rs b/beacon_node/network/src/service.rs index 1e5335bead..1df5825c21 100644 --- a/beacon_node/network/src/service.rs +++ b/beacon_node/network/src/service.rs @@ -167,7 +167,7 @@ fn network_service( match network_recv.poll() { Ok(Async::Ready(Some(message))) => match message { NetworkMessage::RPC(peer_id, rpc_event) => { - trace!(log, "Sending RPC"; "RPC" => format!("{}", rpc_event)); + trace!(log, "Sending RPC"; "rpc" => format!("{}", rpc_event)); libp2p_service.lock().swarm.send_rpc(peer_id, rpc_event); } NetworkMessage::Propagate { @@ -236,7 +236,7 @@ fn network_service( match libp2p_service.lock().poll() { Ok(Async::Ready(Some(event))) => match event { Libp2pEvent::RPC(peer_id, rpc_event) => { - trace!(log, "Received RPC"; "RPC" => format!("{}", rpc_event)); + trace!(log, "Received RPC"; "rpc" => format!("{}", rpc_event)); // if we received or sent a Goodbye message, drop and ban the peer match rpc_event { diff --git a/beacon_node/network/src/sync/message_processor.rs b/beacon_node/network/src/sync/message_processor.rs index 4b46058d7b..c683beff37 100644 --- a/beacon_node/network/src/sync/message_processor.rs +++ b/beacon_node/network/src/sync/message_processor.rs @@ -6,7 +6,7 @@ use beacon_chain::{ use eth2_libp2p::rpc::methods::*; use eth2_libp2p::rpc::{RPCEvent, RPCRequest, RPCResponse, RequestId}; use eth2_libp2p::PeerId; -use slog::{debug, error, info, o, trace, warn}; +use slog::{debug, info, o, trace, warn}; use ssz::Encode; use std::sync::Arc; use store::Store; @@ -475,13 +475,8 @@ impl MessageProcessor { SHOULD_NOT_FORWARD_GOSSIP_BLOCK //TODO: Decide if we want to forward these } }, - Err(e) => { - error!( - self.log, - "Error processing gossip beacon block"; - "error" => format!("{:?}", e), - "block slot" => block.slot - ); + Err(_) => { + // error is logged during the processing therefore no error is logged here trace!( self.log, "Erroneous gossip beacon block ssz"; @@ -525,13 +520,13 @@ impl MessageProcessor { self.network.disconnect(peer_id, GoodbyeReason::Fault); } }, - Err(e) => { + Err(_) => { + // error is logged during the processing therefore no error is logged here trace!( self.log, "Erroneous gossip attestation ssz"; "ssz" => format!("0x{}", hex::encode(msg.as_ssz_bytes())), ); - error!(self.log, "Invalid gossip attestation"; "error" => format!("{:?}", e)); } } }