diff --git a/code/gossip/src/lib.rs b/code/gossip/src/lib.rs index 5f1a9d599..1f8fd7605 100644 --- a/code/gossip/src/lib.rs +++ b/code/gossip/src/lib.rs @@ -6,7 +6,7 @@ use futures::StreamExt; use libp2p::swarm::{self, NetworkBehaviour, SwarmEvent}; use libp2p::{gossipsub, identify, mdns, noise, tcp, yamux, SwarmBuilder}; use tokio::sync::mpsc; -use tracing::{debug, error, error_span, info, Instrument}; +use tracing::{debug, error, error_span, Instrument}; pub use libp2p::identity::Keypair; pub use libp2p::{Multiaddr, PeerId}; @@ -215,7 +215,7 @@ async fn handle_swarm_event( ) -> ControlFlow<()> { match event { SwarmEvent::NewListenAddr { address, .. } => { - info!("Node is listening on {address}"); + debug!("Node is listening on {address}"); if let Err(e) = tx_event.send(HandleEvent::Listening(address)).await { error!("Error sending listening event to handle: {e}"); diff --git a/code/node/src/node.rs b/code/node/src/node.rs index f1d99ebb1..cca8666fe 100644 --- a/code/node/src/node.rs +++ b/code/node/src/node.rs @@ -280,12 +280,13 @@ where msg: NetworkMsg, tx_input: &TxInput, ) { - info!("Received message from peer {peer_id}: {msg:?}"); - match msg { NetworkMsg::Vote(signed_vote) => { - let signed_vote = SignedVote::::from_proto(signed_vote).unwrap(); + let signed_vote = SignedVote::::from_proto(signed_vote).unwrap(); // FIXME let validator_address = signed_vote.validator_address(); + + info!(%peer_id, %validator_address, "Received vote: {:?}", signed_vote.vote); + let Some(validator) = self.params.validator_set.get_by_address(validator_address) else { warn!(%peer_id, %validator_address, "Received vote from unknown validator"); @@ -305,6 +306,9 @@ where NetworkMsg::Proposal(proposal) => { let signed_proposal = SignedProposal::::from_proto(proposal).unwrap(); let validator_address = signed_proposal.proposal.validator_address(); + + info!(%peer_id, %validator_address, "Received proposal: {:?}", signed_proposal.proposal); + let Some(validator) = self.params.validator_set.get_by_address(validator_address) else { warn!(%peer_id, %validator_address, "Received proposal from unknown validator"); diff --git a/code/test/src/address.rs b/code/test/src/address.rs index 56f589ec2..4103003c6 100644 --- a/code/test/src/address.rs +++ b/code/test/src/address.rs @@ -4,7 +4,7 @@ use malachite_proto as proto; use crate::signing::PublicKey; -#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct Address([u8; Self::LENGTH]); impl Address { @@ -34,6 +34,13 @@ impl fmt::Display for Address { } } +impl fmt::Debug for Address { + #[cfg_attr(coverage_nightly, coverage(off))] + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Address({})", self) + } +} + impl malachite_common::Address for Address {} impl malachite_proto::Protobuf for Address { diff --git a/code/test/src/height.rs b/code/test/src/height.rs index 74639eb6e..438fcfb7b 100644 --- a/code/test/src/height.rs +++ b/code/test/src/height.rs @@ -3,7 +3,7 @@ use core::fmt; use malachite_proto as proto; /// A blockchain height -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord)] pub struct Height(u64); impl Height { @@ -22,6 +22,12 @@ impl fmt::Display for Height { } } +impl fmt::Debug for Height { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Height({})", self.0) + } +} + impl malachite_common::Height for Height { fn increment(&self) -> Self { Self(self.0 + 1)