fixup! Disable use of system time in tests
This commit is contained in:
parent
9e4abc79fb
commit
13efd47238
@ -1926,8 +1926,9 @@ where
|
|||||||
chain_dump
|
chain_dump
|
||||||
.iter()
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.map(|checkpoint| checkpoint.beacon_state.finalized_checkpoint().root.into())
|
.map(|checkpoint| checkpoint.beacon_state.finalized_checkpoint().root)
|
||||||
.filter(|block_hash| *block_hash != Hash256::zero().into())
|
.filter(|block_hash| *block_hash != Hash256::zero())
|
||||||
|
.map(|hash| hash.into())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ use beacon_chain::test_utils::{
|
|||||||
};
|
};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use sloggers::{null::NullLoggerBuilder, Build};
|
use sloggers::{null::NullLoggerBuilder, Build};
|
||||||
use slot_clock::TestingSlotClock;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use store::{LevelDB, StoreConfig};
|
use store::{LevelDB, StoreConfig};
|
||||||
use tempfile::{tempdir, TempDir};
|
use tempfile::{tempdir, TempDir};
|
||||||
@ -23,7 +22,7 @@ lazy_static! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type E = MinimalEthSpec;
|
type E = MinimalEthSpec;
|
||||||
type TestHarness = BeaconChainHarness<DiskHarnessType<E, TestingSlotClock>>;
|
type TestHarness = BeaconChainHarness<DiskHarnessType<E>>;
|
||||||
type HotColdDB = store::HotColdDB<E, LevelDB<E>, LevelDB<E>>;
|
type HotColdDB = store::HotColdDB<E, LevelDB<E>, LevelDB<E>>;
|
||||||
|
|
||||||
fn get_store(db_path: &TempDir) -> Arc<HotColdDB> {
|
fn get_store(db_path: &TempDir) -> Arc<HotColdDB> {
|
||||||
|
@ -18,7 +18,6 @@ use lazy_static::lazy_static;
|
|||||||
use logging::test_logger;
|
use logging::test_logger;
|
||||||
use maplit::hashset;
|
use maplit::hashset;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use slot_clock::TestingSlotClock;
|
|
||||||
use state_processing::BlockReplayer;
|
use state_processing::BlockReplayer;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
@ -45,7 +44,7 @@ lazy_static! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type E = MinimalEthSpec;
|
type E = MinimalEthSpec;
|
||||||
type TestHarness = BeaconChainHarness<DiskHarnessType<E, TestingSlotClock>>;
|
type TestHarness = BeaconChainHarness<DiskHarnessType<E>>;
|
||||||
|
|
||||||
fn get_store(db_path: &TempDir) -> Arc<HotColdDB<E, LevelDB<E>, LevelDB<E>>> {
|
fn get_store(db_path: &TempDir) -> Arc<HotColdDB<E, LevelDB<E>, LevelDB<E>>> {
|
||||||
get_store_with_spec(db_path, test_spec::<E>())
|
get_store_with_spec(db_path, test_spec::<E>())
|
||||||
@ -2118,7 +2117,7 @@ async fn weak_subjectivity_sync() {
|
|||||||
|
|
||||||
// Initialise a new beacon chain from the finalized checkpoint
|
// Initialise a new beacon chain from the finalized checkpoint
|
||||||
let beacon_chain = Arc::new(
|
let beacon_chain = Arc::new(
|
||||||
BeaconChainBuilder::<DiskHarnessType<E, TestingSlotClock>>::new(MinimalEthSpec)
|
BeaconChainBuilder::<DiskHarnessType<E>>::new(MinimalEthSpec)
|
||||||
.store(store.clone())
|
.store(store.clone())
|
||||||
.custom_spec(test_spec::<E>())
|
.custom_spec(test_spec::<E>())
|
||||||
.task_executor(harness.chain.task_executor.clone())
|
.task_executor(harness.chain.task_executor.clone())
|
||||||
@ -2315,13 +2314,12 @@ async fn finalizes_after_resuming_from_db() {
|
|||||||
|
|
||||||
let original_chain = harness.chain;
|
let original_chain = harness.chain;
|
||||||
|
|
||||||
let resumed_harness =
|
let resumed_harness = BeaconChainHarness::<DiskHarnessType<E>>::builder(MinimalEthSpec)
|
||||||
BeaconChainHarness::<DiskHarnessType<E, TestingSlotClock>>::builder(MinimalEthSpec)
|
.default_spec()
|
||||||
.default_spec()
|
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
.resumed_disk_store(store)
|
||||||
.resumed_disk_store(store)
|
.mock_execution_layer()
|
||||||
.mock_execution_layer()
|
.build();
|
||||||
.build();
|
|
||||||
|
|
||||||
assert_chains_pretty_much_the_same(&original_chain, &resumed_harness.chain);
|
assert_chains_pretty_much_the_same(&original_chain, &resumed_harness.chain);
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ use logging::test_logger;
|
|||||||
use network::{NetworkReceivers, NetworkSenders};
|
use network::{NetworkReceivers, NetworkSenders};
|
||||||
use sensitive_url::SensitiveUrl;
|
use sensitive_url::SensitiveUrl;
|
||||||
use slog::Logger;
|
use slog::Logger;
|
||||||
use slot_clock::TestingSlotClock;
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -56,9 +55,9 @@ pub struct ApiServer<E: EthSpec, SFut: Future<Output = ()>> {
|
|||||||
pub external_peer_id: PeerId,
|
pub external_peer_id: PeerId,
|
||||||
}
|
}
|
||||||
|
|
||||||
type HarnessBuilder<E> = Builder<EphemeralHarnessType<E>, TestingSlotClock>;
|
type HarnessBuilder<E> = Builder<EphemeralHarnessType<E>>;
|
||||||
type Initializer<E> = Box<dyn FnOnce(HarnessBuilder<E>) -> HarnessBuilder<E>>;
|
type Initializer<E> = Box<dyn FnOnce(HarnessBuilder<E>) -> HarnessBuilder<E>>;
|
||||||
type Mutator<E> = BoxedMutator<E, MemoryStore<E>, MemoryStore<E>, TestingSlotClock>;
|
type Mutator<E> = BoxedMutator<E, MemoryStore<E>, MemoryStore<E>>;
|
||||||
|
|
||||||
impl<E: EthSpec> InteractiveTester<E> {
|
impl<E: EthSpec> InteractiveTester<E> {
|
||||||
pub async fn new(spec: Option<ChainSpec>, validator_count: usize) -> Self {
|
pub async fn new(spec: Option<ChainSpec>, validator_count: usize) -> Self {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
mod tests {
|
mod tests {
|
||||||
use crate::persisted_dht::load_dht;
|
use crate::persisted_dht::load_dht;
|
||||||
use crate::{NetworkConfig, NetworkService};
|
use crate::{NetworkConfig, NetworkService};
|
||||||
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType};
|
use beacon_chain::test_utils::EphemeralHarnessType;
|
||||||
use lighthouse_network::Enr;
|
use lighthouse_network::Enr;
|
||||||
use slog::{o, Drain, Level, Logger};
|
use slog::{o, Drain, Level, Logger};
|
||||||
use sloggers::{null::NullLoggerBuilder, Build};
|
use sloggers::{null::NullLoggerBuilder, Build};
|
||||||
@ -12,6 +12,8 @@ mod tests {
|
|||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
use types::MinimalEthSpec as E;
|
use types::MinimalEthSpec as E;
|
||||||
|
|
||||||
|
type BeaconChainHarness = beacon_chain::test_utils::BeaconChainHarness<EphemeralHarnessType<E>>;
|
||||||
|
|
||||||
fn get_logger(actual_log: bool) -> Logger {
|
fn get_logger(actual_log: bool) -> Logger {
|
||||||
if actual_log {
|
if actual_log {
|
||||||
let drain = {
|
let drain = {
|
||||||
@ -34,7 +36,7 @@ mod tests {
|
|||||||
fn test_dht_persistence() {
|
fn test_dht_persistence() {
|
||||||
let log = get_logger(false);
|
let log = get_logger(false);
|
||||||
|
|
||||||
let beacon_chain = BeaconChainHarness::EphemeralHarnessType::<E>::builder(E)
|
let beacon_chain = BeaconChainHarness::builder(E)
|
||||||
.default_spec()
|
.default_spec()
|
||||||
.deterministic_keypairs(8)
|
.deterministic_keypairs(8)
|
||||||
.fresh_ephemeral_store()
|
.fresh_ephemeral_store()
|
||||||
|
@ -7,8 +7,8 @@ mod system_time_slot_clock;
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
pub use crate::manual_slot_clock::ManualSlotClock;
|
|
||||||
pub use crate::manual_slot_clock::ManualSlotClock as TestingSlotClock;
|
pub use crate::manual_slot_clock::ManualSlotClock as TestingSlotClock;
|
||||||
|
pub use crate::manual_slot_clock::ManualSlotClock;
|
||||||
pub use crate::system_time_slot_clock::SystemTimeSlotClock;
|
pub use crate::system_time_slot_clock::SystemTimeSlotClock;
|
||||||
pub use metrics::scrape_for_metrics;
|
pub use metrics::scrape_for_metrics;
|
||||||
use types::consts::merge::INTERVALS_PER_SLOT;
|
use types::consts::merge::INTERVALS_PER_SLOT;
|
||||||
|
Loading…
Reference in New Issue
Block a user