Skip to content

Commit

Permalink
improve network debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tumas committed Oct 22, 2024
1 parent 0d98f90 commit 45f440b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions p2p/src/block_sync_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl<P: Preset> BlockSyncService<P> {

if slot < blob_serve_slot {
debug!(
"Ignoring needed blob sidecar request: slot: {slot} < blob_serve_slot: {blob_serve_slot}"
"ignoring needed blob sidecar request: slot: {slot} < blob_serve_slot: {blob_serve_slot}"
);
return Ok(());
}
Expand Down Expand Up @@ -555,7 +555,7 @@ impl<P: Preset> BlockSyncService<P> {

fn request_peer_status_update(&mut self, status: StatusMessage) -> Result<()> {
for peer_id in self.sync_manager.outdated_peers(status) {
debug!("Update outdated peer: {peer_id}");
debug!("update outdated peer: {peer_id}");
self.request_peer_status(peer_id)?;
}

Expand Down
21 changes: 14 additions & 7 deletions p2p/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,9 @@ impl<P: Preset> Network<P> {

debug!(
"sending BeaconBlocksByRange response chunk \
(peer_request_id: {peer_request_id:?}, peer_id: {peer_id}, block: {block:?})",
(peer_request_id: {peer_request_id:?}, peer_id: {peer_id}, block: {}, slot: {})",
block_with_root.root,
block.message().slot(),
);

ServiceInboundMessage::SendResponse(
Expand Down Expand Up @@ -976,10 +978,12 @@ impl<P: Preset> Network<P> {
let blob_sidecars = controller.blob_sidecars_by_range(start_slot..end_slot)?;

for blob_sidecar in blob_sidecars {
let blob_identifier: BlobIdentifier = blob_sidecar.as_ref().into();

debug!(
"sending BlobSidecarsByRange response chunk \
(peer_request_id: {peer_request_id:?}, peer_id: {peer_id}, \
blob_sidecar: {blob_sidecar:?})",
blob_sidecar: {blob_identifier:?})",
);

ServiceInboundMessage::SendResponse(
Expand Down Expand Up @@ -1033,10 +1037,12 @@ impl<P: Preset> Network<P> {
let blob_sidecars = controller.blob_sidecars_by_ids(blob_ids)?;

for blob_sidecar in blob_sidecars {
let blob_identifier: BlobIdentifier = blob_sidecar.as_ref().into();

debug!(
"sending BlobSidecarsByRoot response chunk \
(peer_request_id: {peer_request_id:?}, peer_id: {peer_id}, \
blob_sidecar: {blob_sidecar:?})",
blob_sidecar: {blob_identifier:?})",
);

ServiceInboundMessage::SendResponse(
Expand Down Expand Up @@ -1213,14 +1219,15 @@ impl<P: Preset> Network<P> {
.send(&self.channels.p2p_to_sync_tx);
}
Response::BlocksByRoot(Some(block)) => {
let block_root = block.message().hash_tree_root();
let block_slot = block.message().slot();

debug!(
"received BeaconBlocksByRoot response chunk \
(request_id: {request_id}, peer_id: {peer_id}, block: {block:?})",
(request_id: {request_id}, peer_id: {peer_id}, block: {block_root:?}, \
block_slot: {block_slot})",
);

let block_root = block.message().hash_tree_root();
let block_slot = block.message().slot();

info!("received beacon block from RPC slot: {block_slot}, root: {block_root:?}");

P2pToSync::BlockByRootRequestFinished(block_root)
Expand Down

0 comments on commit 45f440b

Please sign in to comment.