Skip to content

Commit

Permalink
A0-3562: Slightly better logging in sync and gossip network (#1510)
Browse files Browse the repository at this point in the history
# Description

Logs!

## Type of change

Logs!

# Checklist:

- logs
- logs
- l0g5
- Iogs
- lololgs
- lo~~gs
  • Loading branch information
timorleph authored Nov 27, 2023
1 parent 9055e42 commit f208095
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 13 deletions.
36 changes: 26 additions & 10 deletions finality-aleph/src/network/gossip/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,23 +301,29 @@ impl<N: RawNetwork, AD: Data, BSD: Data> Service<N, AD, BSD> {
}

fn send_authentication_data(&mut self, data: AD, peer_id: N::PeerId) {
trace!(
target: LOG_TARGET,
"Sending authentication data to peer {:?}.",
peer_id,
);
if let Err(e) = self.send_to_authentication_peer(data, peer_id.clone()) {
trace!(
debug!(
target: LOG_TARGET,
"Failed to send to peer{:?}, {:?}",
peer_id,
e
"Failed to send to peer{:?}, {:?}", peer_id, e
);
}
}

fn send_block_sync_data(&mut self, data: BSD, peer_id: N::PeerId) {
trace!(
target: LOG_TARGET,
"Sending block sync data to peer {:?}.",
peer_id,
);
if let Err(e) = self.send_to_block_sync_peer(data, peer_id.clone()) {
trace!(
debug!(
target: LOG_TARGET,
"Failed to send to peer{:?}, {:?}",
peer_id,
e
"Failed to send to peer{:?}, {:?}", peer_id, e
);
}
}
Expand Down Expand Up @@ -345,10 +351,15 @@ impl<N: RawNetwork, AD: Data, BSD: Data> Service<N, AD, BSD> {
}

fn send_to_random_authentication(&mut self, data: AD, peer_ids: HashSet<N::PeerId>) {
trace!(
target: LOG_TARGET,
"Sending authentication data to random peer among {:?}.",
peer_ids,
);
let peer_id = match self.random_peer(&peer_ids, Protocol::Authentication) {
Some(peer_id) => peer_id.clone(),
None => {
trace!(
debug!(
target: LOG_TARGET,
"Failed to send authentication message to random peer, no peers are available."
);
Expand All @@ -359,10 +370,15 @@ impl<N: RawNetwork, AD: Data, BSD: Data> Service<N, AD, BSD> {
}

fn send_to_random_block_sync(&mut self, data: BSD, peer_ids: HashSet<N::PeerId>) {
trace!(
target: LOG_TARGET,
"Sending block sync data to random peer among {:?}.",
peer_ids,
);
let peer_id = match self.random_peer(&peer_ids, Protocol::BlockSync) {
Some(peer_id) => peer_id.clone(),
None => {
trace!(
debug!(
target: LOG_TARGET,
"Failed to send block sync message to random peer, no peers are available."
);
Expand Down
18 changes: 15 additions & 3 deletions finality-aleph/src/sync/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,11 @@ where
target: LOG_TARGET,
"Failed to handle sync state response from {:?}: {}.", peer, e
),
_ => {}
None => trace!(
target: LOG_TARGET,
"Handled state response from {:?}.",
peer
),
}
if new_info {
self.try_request_chain_extension();
Expand Down Expand Up @@ -479,7 +483,11 @@ where
target: LOG_TARGET,
"Failed to handle sync request response from {:?}: {}.", peer, e
),
_ => {}
None => trace!(
target: LOG_TARGET,
"Handled sync request response from {:?}.",
peer,
),
}
self.process_equivocation_proofs(equivocation_proofs);
if new_info {
Expand Down Expand Up @@ -522,7 +530,11 @@ where
}
}
Action::RequestBlock(header) => self.request_block(header.id()),
_ => {}
Action::Noop => trace!(
target: LOG_TARGET,
"Doing nothing in response to a request from {:?}.",
peer,
),
}
}
Err(e) => {
Expand Down

0 comments on commit f208095

Please sign in to comment.