mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-02 04:14:33 +00:00
Fit sampling log statements to fmt width (#6433)
* Fit sampling log statements to fmt width
This commit is contained in:
@@ -244,22 +244,31 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
|
|||||||
.column_indexes_by_sampling_request
|
.column_indexes_by_sampling_request
|
||||||
.get(&sampling_request_id)
|
.get(&sampling_request_id)
|
||||||
else {
|
else {
|
||||||
error!(self.log, "Column indexes for the sampling request ID not found"; "sampling_request_id" => ?sampling_request_id);
|
error!(self.log,
|
||||||
|
"Column indexes for the sampling request ID not found";
|
||||||
|
"sampling_request_id" => ?sampling_request_id
|
||||||
|
);
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
|
||||||
match resp {
|
match resp {
|
||||||
Ok((mut resp_data_columns, seen_timestamp)) => {
|
Ok((mut resp_data_columns, seen_timestamp)) => {
|
||||||
debug!(self.log, "Sample download success"; "block_root" => %self.block_root, "column_indexes" => ?column_indexes, "count" => resp_data_columns.len());
|
debug!(self.log,
|
||||||
|
"Sample download success";
|
||||||
|
"block_root" => %self.block_root,
|
||||||
|
"column_indexes" => ?column_indexes,
|
||||||
|
"count" => resp_data_columns.len()
|
||||||
|
);
|
||||||
metrics::inc_counter_vec(&metrics::SAMPLE_DOWNLOAD_RESULT, &[metrics::SUCCESS]);
|
metrics::inc_counter_vec(&metrics::SAMPLE_DOWNLOAD_RESULT, &[metrics::SUCCESS]);
|
||||||
|
|
||||||
// Filter the data received in the response using the requested column indexes.
|
// Filter the data received in the response using the requested column indexes.
|
||||||
let mut data_columns = vec![];
|
let mut data_columns = vec![];
|
||||||
for column_index in column_indexes {
|
for column_index in column_indexes {
|
||||||
let Some(request) = self.column_requests.get_mut(column_index) else {
|
let Some(request) = self.column_requests.get_mut(column_index) else {
|
||||||
warn!(
|
warn!(self.log,
|
||||||
self.log,
|
"Active column sample request not found";
|
||||||
"Active column sample request not found"; "block_root" => %self.block_root, "column_index" => column_index
|
"block_root" => %self.block_root,
|
||||||
|
"column_index" => column_index
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
@@ -270,7 +279,11 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
|
|||||||
else {
|
else {
|
||||||
// Peer does not have the requested data.
|
// Peer does not have the requested data.
|
||||||
// TODO(das) what to do?
|
// TODO(das) what to do?
|
||||||
debug!(self.log, "Sampling peer claims to not have the data"; "block_root" => %self.block_root, "column_index" => column_index);
|
debug!(self.log,
|
||||||
|
"Sampling peer claims to not have the data";
|
||||||
|
"block_root" => %self.block_root,
|
||||||
|
"column_index" => column_index
|
||||||
|
);
|
||||||
request.on_sampling_error()?;
|
request.on_sampling_error()?;
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
@@ -283,15 +296,16 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|d| d.index)
|
.map(|d| d.index)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
debug!(
|
debug!(self.log,
|
||||||
self.log,
|
"Received data that was not requested";
|
||||||
"Received data that was not requested"; "block_root" => %self.block_root, "column_indexes" => ?resp_column_indexes
|
"block_root" => %self.block_root,
|
||||||
|
"column_indexes" => ?resp_column_indexes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the downloaded data columns.
|
// Handle the downloaded data columns.
|
||||||
if data_columns.is_empty() {
|
if data_columns.is_empty() {
|
||||||
debug!(self.log,"Received empty response"; "block_root" => %self.block_root);
|
debug!(self.log, "Received empty response"; "block_root" => %self.block_root);
|
||||||
self.column_indexes_by_sampling_request
|
self.column_indexes_by_sampling_request
|
||||||
.remove(&sampling_request_id);
|
.remove(&sampling_request_id);
|
||||||
} else {
|
} else {
|
||||||
@@ -302,10 +316,18 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
|
|||||||
// Peer has data column, send to verify
|
// Peer has data column, send to verify
|
||||||
let Some(beacon_processor) = cx.beacon_processor_if_enabled() else {
|
let Some(beacon_processor) = cx.beacon_processor_if_enabled() else {
|
||||||
// If processor is not available, error the entire sampling
|
// If processor is not available, error the entire sampling
|
||||||
debug!(self.log, "Dropping sampling"; "block" => %self.block_root, "reason" => "beacon processor unavailable");
|
debug!(self.log,
|
||||||
|
"Dropping sampling";
|
||||||
|
"block" => %self.block_root,
|
||||||
|
"reason" => "beacon processor unavailable"
|
||||||
|
);
|
||||||
return Err(SamplingError::ProcessorUnavailable);
|
return Err(SamplingError::ProcessorUnavailable);
|
||||||
};
|
};
|
||||||
debug!(self.log, "Sending data_column for verification"; "block" => ?self.block_root, "column_indexes" => ?column_indexes);
|
debug!(self.log,
|
||||||
|
"Sending data_column for verification";
|
||||||
|
"block" => ?self.block_root,
|
||||||
|
"column_indexes" => ?column_indexes
|
||||||
|
);
|
||||||
if let Err(e) = beacon_processor.send_rpc_validate_data_columns(
|
if let Err(e) = beacon_processor.send_rpc_validate_data_columns(
|
||||||
self.block_root,
|
self.block_root,
|
||||||
data_columns,
|
data_columns,
|
||||||
@@ -316,22 +338,31 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
|
|||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
// TODO(das): Beacon processor is overloaded, what should we do?
|
// TODO(das): Beacon processor is overloaded, what should we do?
|
||||||
error!(self.log, "Dropping sampling"; "block" => %self.block_root, "reason" => e.to_string());
|
error!(self.log,
|
||||||
|
"Dropping sampling";
|
||||||
|
"block" => %self.block_root,
|
||||||
|
"reason" => e.to_string()
|
||||||
|
);
|
||||||
return Err(SamplingError::SendFailed("beacon processor send failure"));
|
return Err(SamplingError::SendFailed("beacon processor send failure"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
debug!(self.log, "Sample download error"; "block_root" => %self.block_root, "column_indexes" => ?column_indexes, "error" => ?err);
|
debug!(self.log, "Sample download error";
|
||||||
|
"block_root" => %self.block_root,
|
||||||
|
"column_indexes" => ?column_indexes,
|
||||||
|
"error" => ?err
|
||||||
|
);
|
||||||
metrics::inc_counter_vec(&metrics::SAMPLE_DOWNLOAD_RESULT, &[metrics::FAILURE]);
|
metrics::inc_counter_vec(&metrics::SAMPLE_DOWNLOAD_RESULT, &[metrics::FAILURE]);
|
||||||
|
|
||||||
// Error downloading, maybe penalize peer and retry again.
|
// Error downloading, maybe penalize peer and retry again.
|
||||||
// TODO(das) with different peer or different peer?
|
// TODO(das) with different peer or different peer?
|
||||||
for column_index in column_indexes {
|
for column_index in column_indexes {
|
||||||
let Some(request) = self.column_requests.get_mut(column_index) else {
|
let Some(request) = self.column_requests.get_mut(column_index) else {
|
||||||
warn!(
|
warn!(self.log,
|
||||||
self.log,
|
"Active column sample request not found";
|
||||||
"Active column sample request not found"; "block_root" => %self.block_root, "column_index" => column_index
|
"block_root" => %self.block_root,
|
||||||
|
"column_index" => column_index
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user