This commit is contained in:
dapplion
2025-06-12 15:45:36 +02:00
parent 8c8a8124ee
commit 56fcf289ec
3 changed files with 11 additions and 17 deletions

View File

@@ -248,6 +248,10 @@ impl<E: EthSpec> NetworkGlobals<E> {
} }
} }
pub fn sampling_columns_count(&self) -> usize {
self.sampling_columns.read().len()
}
pub fn sampling_columns(&self) -> HashSet<ColumnIndex> { pub fn sampling_columns(&self) -> HashSet<ColumnIndex> {
self.sampling_columns.read().clone() self.sampling_columns.read().clone()
} }

View File

@@ -188,10 +188,7 @@ impl<T: BeaconChainTypes> BlockComponentsByRangeRequest<T> {
} => { } => {
if let Some((blocks, block_peer)) = blocks_by_range_request.to_finished() { if let Some((blocks, block_peer)) = blocks_by_range_request.to_finished() {
let peer_group = BatchPeers::new_from_block_peer(*block_peer); let peer_group = BatchPeers::new_from_block_peer(*block_peer);
let rpc_blocks = couple_blocks_base( let rpc_blocks = couple_blocks_base(blocks.to_vec());
blocks.to_vec(),
cx.network_globals().sampling_columns.len(),
);
Ok(Some((rpc_blocks, peer_group))) Ok(Some((rpc_blocks, peer_group)))
} else { } else {
// Wait for blocks_by_range requests to complete // Wait for blocks_by_range requests to complete
@@ -230,8 +227,7 @@ impl<T: BeaconChainTypes> BlockComponentsByRangeRequest<T> {
if blocks_with_data.is_empty() { if blocks_with_data.is_empty() {
let custody_column_indices = cx let custody_column_indices = cx
.network_globals() .network_globals()
.sampling_columns .sampling_columns()
.clone()
.iter() .iter()
.copied() .copied()
.collect(); .collect();
@@ -248,8 +244,7 @@ impl<T: BeaconChainTypes> BlockComponentsByRangeRequest<T> {
} else { } else {
let mut column_indices = cx let mut column_indices = cx
.network_globals() .network_globals()
.sampling_columns .sampling_columns()
.clone()
.iter() .iter()
.copied() .copied()
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@@ -295,8 +290,7 @@ impl<T: BeaconChainTypes> BlockComponentsByRangeRequest<T> {
if let Some((columns, column_peers)) = custody_by_range_request.to_finished() { if let Some((columns, column_peers)) = custody_by_range_request.to_finished() {
let custody_column_indices = cx let custody_column_indices = cx
.network_globals() .network_globals()
.sampling_columns .sampling_columns()
.clone()
.iter() .iter()
.copied() .copied()
.collect(); .collect();
@@ -425,13 +419,10 @@ impl<T: BeaconChainTypes> BlockComponentsByRangeRequest<T> {
} }
} }
fn couple_blocks_base<E: EthSpec>( fn couple_blocks_base<E: EthSpec>(blocks: Vec<Arc<SignedBeaconBlock<E>>>) -> Vec<RpcBlock<E>> {
blocks: Vec<Arc<SignedBeaconBlock<E>>>,
custody_columns_count: usize,
) -> Vec<RpcBlock<E>> {
blocks blocks
.into_iter() .into_iter()
.map(|block| RpcBlock::new_without_blobs(None, block, custody_columns_count)) .map(|block| RpcBlock::new_without_blobs(None, block))
.collect() .collect()
} }
@@ -509,7 +500,6 @@ fn couple_blocks_fulu<E: EthSpec>(
Some(block_root), Some(block_root),
block, block,
data_columns_with_block_root, data_columns_with_block_root,
custody_column_indices.clone(),
spec, spec,
) )
.map_err(Error::InternalError) .map_err(Error::InternalError)

View File

@@ -209,7 +209,7 @@ fn complete() -> CompleteConfig {
impl TestRig { impl TestRig {
fn our_custody_indices(&self) -> Vec<ColumnIndex> { fn our_custody_indices(&self) -> Vec<ColumnIndex> {
self.network_globals self.network_globals
.sampling_columns .sampling_columns()
.iter() .iter()
.copied() .copied()
.collect() .collect()