Fix range sync tests

This commit is contained in:
Emilia Hane
2023-01-26 17:40:21 +01:00
parent e9e198a2b6
commit 6beca6defc
4 changed files with 37 additions and 52 deletions

View File

@@ -34,7 +34,9 @@ use rand::Rng;
use rand::SeedableRng;
use rayon::prelude::*;
use sensitive_url::SensitiveUrl;
use slog::Logger;
use slog::{o, Drain, Logger};
use slog_async::Async;
use slog_term::{FullFormat, TermDecorator};
use slot_clock::{SlotClock, SystemTimeSlotClock, TestingSlotClock};
use state_processing::per_block_processing::compute_timestamp_at_slot;
use state_processing::{
@@ -72,7 +74,6 @@ pub type DiskHarnessType<E, TSlotClock> = BaseHarnessType<E, LevelDB<E>, LevelDB
pub type EphemeralHarnessType<E, TSlotClock> =
BaseHarnessType<E, MemoryStore<E>, MemoryStore<E>, TSlotClock>;
pub type EphemeralTestingSlotClockHarnessType<E> =
BaseHarnessType<E, MemoryStore<E>, MemoryStore<E>, TestingSlotClock>;
pub type EphemeralSystemTimeSlotClockHarnessType<E> =
@@ -2129,3 +2130,15 @@ impl<T: BeaconChainTypes> fmt::Debug for BeaconChainHarness<T> {
write!(f, "BeaconChainHarness")
}
}
pub fn build_log(level: slog::Level, enabled: bool) -> Logger {
let decorator = TermDecorator::new().build();
let drain = FullFormat::new(decorator).build().fuse();
let drain = Async::new(drain).build().fuse();
if enabled {
Logger::root(drain.filter_level(level).fuse(), o!())
} else {
Logger::root(drain.filter(|_| false).fuse(), o!())
}
}