From 428310c88132dcf29ff08a2fc28382eed4d80960 Mon Sep 17 00:00:00 2001 From: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Date: Thu, 3 Oct 2024 06:06:02 +0300 Subject: [PATCH] Fit sampling log statements to fmt width (#6433) * Fit sampling log statements to fmt width --- beacon_node/network/src/sync/sampling.rs | 65 +++++++++++++++++------- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/beacon_node/network/src/sync/sampling.rs b/beacon_node/network/src/sync/sampling.rs index 524fe86bee..4d0fa509cd 100644 --- a/beacon_node/network/src/sync/sampling.rs +++ b/beacon_node/network/src/sync/sampling.rs @@ -244,22 +244,31 @@ impl ActiveSamplingRequest { .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; }; @@ -270,7 +279,11 @@ impl ActiveSamplingRequest { 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; }; @@ -283,15 +296,16 @@ impl ActiveSamplingRequest { .iter() .map(|d| d.index) .collect::>(); - 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 { @@ -302,10 +316,18 @@ impl ActiveSamplingRequest { // 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, @@ -316,22 +338,31 @@ impl ActiveSamplingRequest { }, ) { // 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; };