Skip to content

Commit

Permalink
Lookup log improvements (sigp#5491)
Browse files Browse the repository at this point in the history
* log improvements
  • Loading branch information
realbigsean authored Mar 27, 2024
1 parent 334aa2e commit 9d24844
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 49 deletions.
35 changes: 20 additions & 15 deletions beacon_node/network/src/sync/block_lookups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
if let Some(components) = child_components {
lookup.add_child_components(components);
}
debug!(self.log, "Already searching for block"; "block_root" => ?block_root);
return;
}

Expand All @@ -163,7 +162,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {

// If the block was already downloaded, or is being downloaded in this moment, do not
// request it.
debug!(self.log, "Already searching for block in a parent lookup request"; "block_root" => ?block_root);
trace!(self.log, "Already searching for block in a parent lookup request"; "block_root" => ?block_root);
return;
}

Expand All @@ -173,7 +172,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
.any(|(hashes, _last_parent_request)| hashes.contains(&block_root))
{
// we are already processing this block, ignore it.
debug!(self.log, "Already processing block in a parent request"; "block_root" => ?block_root);
trace!(self.log, "Already processing block in a parent request"; "block_root" => ?block_root);
return;
}

Expand Down Expand Up @@ -309,12 +308,15 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
};

let expected_block_root = lookup.block_root();
debug!(self.log,
"Peer returned block for single lookup";
"peer_id" => %peer_id ,
"id" => ?id,
"block_root" => ?expected_block_root,
);
if response.is_some() {
debug!(self.log,
"Peer returned response for single lookup";
"peer_id" => %peer_id ,
"id" => ?id,
"block_root" => ?expected_block_root,
"response_type" => ?response_type,
);
}

match self.single_lookup_response_inner::<R>(peer_id, response, seen_timestamp, cx, lookup)
{
Expand Down Expand Up @@ -495,12 +497,15 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
return;
};

debug!(self.log,
"Peer returned block for parent lookup";
"peer_id" => %peer_id ,
"id" => ?id,
"block_root" => ?parent_lookup.current_parent_request.block_request_state.requested_block_root,
);
if response.is_some() {
debug!(self.log,
"Peer returned response for parent lookup";
"peer_id" => %peer_id ,
"id" => ?id,
"block_root" => ?parent_lookup.current_parent_request.block_request_state.requested_block_root,
"response_type" => ?R::response_type(),
);
}

match self.parent_lookup_response_inner::<R>(
peer_id,
Expand Down
52 changes: 18 additions & 34 deletions beacon_node/network/src/sync/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,44 +915,28 @@ impl<T: BeaconChainTypes> SyncManager<T> {
RequestId::SingleBlock { .. } => {
crit!(self.log, "Single blob received during block request"; "peer_id" => %peer_id );
}
RequestId::SingleBlob { id } => {
if let Some(blob) = blob.as_ref() {
debug!(self.log,
"Peer returned blob for single lookup";
"peer_id" => %peer_id ,
"blob_id" =>?blob.id()
);
}
self.block_lookups
.single_lookup_response::<BlobRequestState<Current, T::EthSpec>>(
id,
peer_id,
blob,
seen_timestamp,
&self.network,
)
}
RequestId::SingleBlob { id } => self
.block_lookups
.single_lookup_response::<BlobRequestState<Current, T::EthSpec>>(
id,
peer_id,
blob,
seen_timestamp,
&self.network,
),

RequestId::ParentLookup { id: _ } => {
crit!(self.log, "Single blob received during parent block request"; "peer_id" => %peer_id );
}
RequestId::ParentLookupBlob { id } => {
if let Some(blob) = blob.as_ref() {
debug!(self.log,
"Peer returned blob for parent lookup";
"peer_id" => %peer_id ,
"blob_id" =>?blob.id()
);
}
self.block_lookups
.parent_lookup_response::<BlobRequestState<Parent, T::EthSpec>>(
id,
peer_id,
blob,
seen_timestamp,
&self.network,
)
}
RequestId::ParentLookupBlob { id } => self
.block_lookups
.parent_lookup_response::<BlobRequestState<Parent, T::EthSpec>>(
id,
peer_id,
blob,
seen_timestamp,
&self.network,
),
RequestId::BackFillBlocks { id: _ } => {
crit!(self.log, "Blob received during backfill block request"; "peer_id" => %peer_id );
}
Expand Down

0 comments on commit 9d24844

Please sign in to comment.