From 2672cf40bb390a13deedec1f59f46f181b88a4ac Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Wed, 15 Feb 2023 11:47:56 +0100 Subject: [PATCH] Better fix for debug tests --- .../network/src/sync/block_lookups/parent_lookup.rs | 4 ++-- beacon_node/network/src/sync/block_lookups/tests.rs | 8 ++++---- beacon_node/network/src/sync/range_sync/range.rs | 7 +++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/beacon_node/network/src/sync/block_lookups/parent_lookup.rs b/beacon_node/network/src/sync/block_lookups/parent_lookup.rs index e136369438..b6de52d705 100644 --- a/beacon_node/network/src/sync/block_lookups/parent_lookup.rs +++ b/beacon_node/network/src/sync/block_lookups/parent_lookup.rs @@ -185,10 +185,10 @@ impl ParentLookup { None } - /*#[cfg(test)] + #[cfg(test)] pub fn failed_attempts(&self) -> u8 { self.current_parent_request.failed_attempts() - }*/ + } pub fn add_peer(&mut self, block_root: &Hash256, peer_id: &PeerId) -> bool { self.current_parent_request.add_peer(block_root, peer_id) diff --git a/beacon_node/network/src/sync/block_lookups/tests.rs b/beacon_node/network/src/sync/block_lookups/tests.rs index 28fa2ce20a..9bbd4790d9 100644 --- a/beacon_node/network/src/sync/block_lookups/tests.rs +++ b/beacon_node/network/src/sync/block_lookups/tests.rs @@ -1,4 +1,4 @@ -/*use std::sync::Arc; +use std::sync::Arc; use crate::service::RequestId; use crate::sync::manager::RequestId as SyncId; @@ -13,7 +13,7 @@ use beacon_chain::{ }; pub use genesis::{interop_genesis_state, DEFAULT_ETH1_BLOCK_HASH}; use lighthouse_network::{NetworkGlobals, Request}; -use slot_clock::SystemTimeSlotClock; +use slot_clock::TestingSlotClock; use std::time::Duration; use store::MemoryStore; use tokio::sync::mpsc; @@ -22,7 +22,7 @@ use types::{ MinimalEthSpec as E, SignedBeaconBlock, }; -type T = Witness, E, MemoryStore, MemoryStore>; +type T = Witness, E, MemoryStore, MemoryStore>; struct TestRig { beacon_processor_rx: mpsc::Receiver>, @@ -711,4 +711,4 @@ fn test_same_chain_race_condition() { }; bl.parent_chain_processed(chain_hash, process_result, &mut cx); assert_eq!(bl.parent_lookups.len(), 0); -}*/ +} diff --git a/beacon_node/network/src/sync/range_sync/range.rs b/beacon_node/network/src/sync/range_sync/range.rs index 8de67ba602..b53fa872dd 100644 --- a/beacon_node/network/src/sync/range_sync/range.rs +++ b/beacon_node/network/src/sync/range_sync/range.rs @@ -370,7 +370,6 @@ where } } -/* #[cfg(test)] mod tests { use super::*; @@ -390,7 +389,7 @@ mod tests { NetworkGlobals, Request, }; use slog::o; - use slot_clock::SystemTimeSlotClock; + use slot_clock::TestingSlotClock; use std::{collections::HashSet, sync::Arc}; use store::MemoryStore; use tokio::sync::mpsc; @@ -441,7 +440,7 @@ mod tests { } type TestBeaconChainType = - Witness, E, MemoryStore, MemoryStore>; + Witness, E, MemoryStore, MemoryStore>; #[allow(unused)] struct TestRig { @@ -725,4 +724,4 @@ mod tests { rig.expect_chain_segment(); rig.expect_chain_segment(); } -}*/ +}