Disable use of system time in tests

This commit is contained in:
Emilia Hane
2023-02-14 13:33:38 +01:00
parent 148385eb70
commit 73c7ad73b8
29 changed files with 485 additions and 559 deletions

View File

@@ -1,9 +1,7 @@
#![cfg(not(debug_assertions))]
use beacon_chain::sync_committee_verification::Error as SyncCommitteeError;
use beacon_chain::test_utils::{
BeaconChainHarness, EphemeralTestingSlotClockHarnessType, RelativeSyncCommittee,
};
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType, RelativeSyncCommittee};
use int_to_bytes::int_to_bytes32;
use lazy_static::lazy_static;
use safe_arith::SafeArith;
@@ -25,9 +23,7 @@ lazy_static! {
}
/// Returns a beacon chain harness.
fn get_harness(
validator_count: usize,
) -> BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>> {
fn get_harness(validator_count: usize) -> BeaconChainHarness<EphemeralHarnessType<E>> {
let mut spec = E::default_spec();
spec.altair_fork_epoch = Some(Epoch::new(0));
let harness = BeaconChainHarness::builder(MainnetEthSpec)
@@ -46,7 +42,7 @@ fn get_harness(
///
/// Also returns some info about who created it.
fn get_valid_sync_committee_message(
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
slot: Slot,
relative_sync_committee: RelativeSyncCommittee,
message_index: usize,
@@ -72,7 +68,7 @@ fn get_valid_sync_committee_message(
}
fn get_valid_sync_contribution(
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
relative_sync_committee: RelativeSyncCommittee,
) -> (SignedContributionAndProof<E>, usize, SecretKey) {
let head_state = harness.chain.head_beacon_state_cloned();
@@ -104,7 +100,7 @@ fn get_valid_sync_contribution(
/// Returns a proof and index for a validator that is **not** an aggregator for the current sync period.
fn get_non_aggregator(
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
slot: Slot,
) -> (usize, SecretKey) {
let state = &harness.chain.head_snapshot().beacon_state;