From 56fcf289ec7bca2d9a77d776675108fad41a2900 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Thu, 12 Jun 2025 15:45:36 +0200 Subject: [PATCH] lint --- .../lighthouse_network/src/types/globals.rs | 4 ++++ .../block_components_by_range.rs | 22 +++++-------------- beacon_node/network/src/sync/tests/range.rs | 2 +- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/beacon_node/lighthouse_network/src/types/globals.rs b/beacon_node/lighthouse_network/src/types/globals.rs index 0c02344208..1c11e7aa1f 100644 --- a/beacon_node/lighthouse_network/src/types/globals.rs +++ b/beacon_node/lighthouse_network/src/types/globals.rs @@ -248,6 +248,10 @@ impl NetworkGlobals { } } + pub fn sampling_columns_count(&self) -> usize { + self.sampling_columns.read().len() + } + pub fn sampling_columns(&self) -> HashSet { self.sampling_columns.read().clone() } diff --git a/beacon_node/network/src/sync/network_context/block_components_by_range.rs b/beacon_node/network/src/sync/network_context/block_components_by_range.rs index 913b798d8e..f896589f85 100644 --- a/beacon_node/network/src/sync/network_context/block_components_by_range.rs +++ b/beacon_node/network/src/sync/network_context/block_components_by_range.rs @@ -188,10 +188,7 @@ impl BlockComponentsByRangeRequest { } => { if let Some((blocks, block_peer)) = blocks_by_range_request.to_finished() { let peer_group = BatchPeers::new_from_block_peer(*block_peer); - let rpc_blocks = couple_blocks_base( - blocks.to_vec(), - cx.network_globals().sampling_columns.len(), - ); + let rpc_blocks = couple_blocks_base(blocks.to_vec()); Ok(Some((rpc_blocks, peer_group))) } else { // Wait for blocks_by_range requests to complete @@ -230,8 +227,7 @@ impl BlockComponentsByRangeRequest { if blocks_with_data.is_empty() { let custody_column_indices = cx .network_globals() - .sampling_columns - .clone() + .sampling_columns() .iter() .copied() .collect(); @@ -248,8 +244,7 @@ impl BlockComponentsByRangeRequest { } else { let mut column_indices = cx .network_globals() - .sampling_columns - .clone() + .sampling_columns() .iter() .copied() .collect::>(); @@ -295,8 +290,7 @@ impl BlockComponentsByRangeRequest { if let Some((columns, column_peers)) = custody_by_range_request.to_finished() { let custody_column_indices = cx .network_globals() - .sampling_columns - .clone() + .sampling_columns() .iter() .copied() .collect(); @@ -425,13 +419,10 @@ impl BlockComponentsByRangeRequest { } } -fn couple_blocks_base( - blocks: Vec>>, - custody_columns_count: usize, -) -> Vec> { +fn couple_blocks_base(blocks: Vec>>) -> Vec> { blocks .into_iter() - .map(|block| RpcBlock::new_without_blobs(None, block, custody_columns_count)) + .map(|block| RpcBlock::new_without_blobs(None, block)) .collect() } @@ -509,7 +500,6 @@ fn couple_blocks_fulu( Some(block_root), block, data_columns_with_block_root, - custody_column_indices.clone(), spec, ) .map_err(Error::InternalError) diff --git a/beacon_node/network/src/sync/tests/range.rs b/beacon_node/network/src/sync/tests/range.rs index 6de5902bb1..599c808bef 100644 --- a/beacon_node/network/src/sync/tests/range.rs +++ b/beacon_node/network/src/sync/tests/range.rs @@ -209,7 +209,7 @@ fn complete() -> CompleteConfig { impl TestRig { fn our_custody_indices(&self) -> Vec { self.network_globals - .sampling_columns + .sampling_columns() .iter() .copied() .collect()