Add test for ActiveSamplingRequest (#6307)

* Add test for ActiveSamplingRequest

* Fix the column_indexes field from the requested ones to the responded ones

* Fix clippy errors

* Move tests to tests.rs

* Fix unused import

* Fix clippy error

* Merge branch 'unstable' into fork/add-test-for-active-sampling-request

# Conflicts:
#	beacon_node/network/Cargo.toml
#	beacon_node/network/src/sync/sampling.rs

* Merge branch 'unstable' into fork/add-test-for-active-sampling-request
This commit is contained in:
Akihito Nakano
2024-10-04 12:00:32 +09:00
committed by GitHub
parent f3a5e256da
commit 8cf686f5c1
5 changed files with 145 additions and 1 deletions

View File

@@ -71,6 +71,9 @@ use std::time::Duration;
use tokio::sync::mpsc;
use types::{BlobSidecar, DataColumnSidecar, EthSpec, Hash256, SignedBeaconBlock, Slot};
#[cfg(test)]
use types::ColumnIndex;
/// The number of slots ahead of us that is allowed before requesting a long-range (batch) Sync
/// from a peer. If a peer is within this tolerance (forwards or backwards), it is treated as a
/// fully sync'd peer.
@@ -334,6 +337,17 @@ impl<T: BeaconChainTypes> SyncManager<T> {
self.sampling.active_sampling_requests()
}
#[cfg(test)]
pub(crate) fn assert_sampling_request_status(
&self,
block_root: Hash256,
ongoing: &Vec<ColumnIndex>,
no_peers: &Vec<ColumnIndex>,
) {
self.sampling
.assert_sampling_request_status(block_root, ongoing, no_peers);
}
fn network_globals(&self) -> &NetworkGlobals<T::EthSpec> {
self.network.network_globals()
}