Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fit sampling log statements to fmt width #6433

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 48 additions & 17 deletions beacon_node/network/src/sync/sampling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,31 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
.column_indexes_by_sampling_request
.get(&sampling_request_id)
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);
};

match resp {
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]);

// Filter the data received in the response using the requested column indexes.
let mut data_columns = vec![];
for column_index in column_indexes {
let Some(request) = self.column_requests.get_mut(column_index) else {
warn!(
self.log,
"Active column sample request not found"; "block_root" => %self.block_root, "column_index" => column_index
warn!(self.log,
"Active column sample request not found";
"block_root" => %self.block_root,
"column_index" => column_index
);
continue;
};
Expand All @@ -270,7 +279,11 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
else {
// Peer does not have the requested data.
// 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()?;
continue;
};
Expand All @@ -283,15 +296,16 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
.iter()
.map(|d| d.index)
.collect::<Vec<_>>();
debug!(
self.log,
"Received data that was not requested"; "block_root" => %self.block_root, "column_indexes" => ?resp_column_indexes
debug!(self.log,
"Received data that was not requested";
"block_root" => %self.block_root,
"column_indexes" => ?resp_column_indexes
);
}

// Handle the downloaded data columns.
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
.remove(&sampling_request_id);
} else {
Expand All @@ -302,10 +316,18 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
// Peer has data column, send to verify
let Some(beacon_processor) = cx.beacon_processor_if_enabled() else {
// 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);
};
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(
self.block_root,
data_columns,
Expand All @@ -316,22 +338,31 @@ impl<T: BeaconChainTypes> ActiveSamplingRequest<T> {
},
) {
// 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"));
}
}
}
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]);

// Error downloading, maybe penalize peer and retry again.
// TODO(das) with different peer or different peer?
for column_index in column_indexes {
let Some(request) = self.column_requests.get_mut(column_index) else {
warn!(
self.log,
"Active column sample request not found"; "block_root" => %self.block_root, "column_index" => column_index
warn!(self.log,
"Active column sample request not found";
"block_root" => %self.block_root,
"column_index" => column_index
);
continue;
};
Expand Down
Loading