Improve parent lookup logging (#5451)

* upgrade parent lookup result processing logs to debug, use display instead of debug for BlockError in case a blob parent unknown error is hit, add block root to BlockIsAlreadyKnown

* fix compile

* fix compile

* fix compile
This commit is contained in:
realbigsean
2024-03-22 14:16:13 -04:00
committed by GitHub
parent 5ce16192c7
commit 21cdc64bfe
8 changed files with 30 additions and 22 deletions

View File

@@ -811,7 +811,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
let root = lookup.block_root();
trace!(self.log, "Single block processing failed"; "block" => %root, "error" => %e);
match e {
BlockError::BlockIsAlreadyKnown => {
BlockError::BlockIsAlreadyKnown(_) => {
// No error here
return Ok(None);
}
@@ -898,17 +898,17 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
match &result {
BlockProcessingResult::Ok(status) => match status {
AvailabilityProcessingStatus::Imported(block_root) => {
trace!(self.log, "Parent block processing succeeded"; &parent_lookup, "block_root" => ?block_root)
debug!(self.log, "Parent block processing succeeded"; &parent_lookup, "block_root" => ?block_root)
}
AvailabilityProcessingStatus::MissingComponents(_, block_root) => {
trace!(self.log, "Parent missing parts, triggering single block lookup "; &parent_lookup,"block_root" => ?block_root)
debug!(self.log, "Parent missing parts, triggering single block lookup "; &parent_lookup,"block_root" => ?block_root)
}
},
BlockProcessingResult::Err(e) => {
trace!(self.log, "Parent block processing failed"; &parent_lookup, "error" => %e)
debug!(self.log, "Parent block processing failed"; &parent_lookup, "error" => %e)
}
BlockProcessingResult::Ignored => {
trace!(
debug!(
self.log,
"Parent block processing job was ignored";
"action" => "re-requesting block",
@@ -954,7 +954,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
self.request_parent(parent_lookup, cx);
}
BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(_))
| BlockProcessingResult::Err(BlockError::BlockIsAlreadyKnown { .. }) => {
| BlockProcessingResult::Err(BlockError::BlockIsAlreadyKnown(_)) => {
// Check if the beacon processor is available
let Some(beacon_processor) = cx.beacon_processor_if_enabled() else {
return trace!(

View File

@@ -458,7 +458,11 @@ fn test_parent_lookup_happy_path() {
rig.expect_empty_network();
// Processing succeeds, now the rest of the chain should be sent for processing.
bl.parent_block_processed(chain_hash, BlockError::BlockIsAlreadyKnown.into(), &mut cx);
bl.parent_block_processed(
chain_hash,
BlockError::BlockIsAlreadyKnown(block_root).into(),
&mut cx,
);
rig.expect_parent_chain_process();
let process_result = BatchProcessResult::Success {
was_non_empty: true,
@@ -1117,7 +1121,11 @@ fn test_same_chain_race_condition() {
// the processing result
if i + 2 == depth {
// one block was removed
bl.parent_block_processed(chain_hash, BlockError::BlockIsAlreadyKnown.into(), &mut cx)
bl.parent_block_processed(
chain_hash,
BlockError::BlockIsAlreadyKnown(block.canonical_root()).into(),
&mut cx,
)
} else {
bl.parent_block_processed(
chain_hash,