Improve single block/blob logging (#4579)

* remove closure from `check_availability_mayb_import`

* impove logging, add wrapper struct to requested ids

* improve logging

* only log if we're in deneb. Only delay lookup if we're in deneb

* fix bug in missing components check
This commit is contained in:
realbigsean
2023-08-08 18:45:11 -04:00
committed by GitHub
parent efbf906094
commit 02c7a2eaf5
11 changed files with 240 additions and 86 deletions

View File

@@ -654,7 +654,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
block_root,
parent_root,
block_slot,
Some(block.into()),
block.into(),
);
}
SyncMessage::UnknownParentBlob(peer_id, blob) => {
@@ -673,7 +673,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
block_root,
parent_root,
blob_slot,
Some(CachedChildComponents::new(None, Some(blobs))),
CachedChildComponents::new(None, Some(blobs)),
);
}
SyncMessage::UnknownBlockHashFromAttestation(peer_id, block_hash) => {
@@ -782,7 +782,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
block_root: Hash256,
parent_root: Hash256,
slot: Slot,
child_components: Option<CachedChildComponents<T::EthSpec>>,
child_components: CachedChildComponents<T::EthSpec>,
) {
if self.should_search_for_block(slot, &peer_id) {
self.block_lookups.search_parent(
@@ -796,7 +796,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
self.block_lookups.search_child_delayed(
block_root,
child_components,
&[PeerShouldHave::Neither(peer_id)],
PeerShouldHave::Neither(peer_id),
&mut self.network,
);
if let Err(e) = self
@@ -809,7 +809,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
self.block_lookups.search_child_block(
block_root,
child_components,
&[PeerShouldHave::Neither(peer_id)],
PeerShouldHave::Neither(peer_id),
&mut self.network,
);
}
@@ -817,6 +817,10 @@ impl<T: BeaconChainTypes> SyncManager<T> {
}
fn should_delay_lookup(&mut self, slot: Slot) -> bool {
if !self.block_lookups.da_checker.is_deneb() {
return false;
}
let maximum_gossip_clock_disparity = self.chain.spec.maximum_gossip_clock_disparity();
let earliest_slot = self
.chain
@@ -1013,28 +1017,44 @@ impl<T: BeaconChainTypes> SyncManager<T> {
RequestId::SingleBlock { .. } => {
crit!(self.log, "Single blob received during block request"; "peer_id" => %peer_id );
}
RequestId::SingleBlob { id } => self
.block_lookups
.single_lookup_response::<BlobRequestState<Current, T::EthSpec>>(
id,
peer_id,
blob,
seen_timestamp,
&self.network,
),
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::ParentLookup { id: _ } => {
crit!(self.log, "Single blob received during parent block request"; "peer_id" => %peer_id );
}
RequestId::ParentLookupBlob { id } => self
.block_lookups
.parent_lookup_response::<BlobRequestState<Parent, T::EthSpec>>(
id,
peer_id,
blob,
seen_timestamp,
&self.network,
),
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::BackFillBlocks { id: _ } => {
crit!(self.log, "Blob received during backfill block request"; "peer_id" => %peer_id );
}