Fix conflicts rebasing eip4844
This commit is contained in:
parent
d292a3a6a8
commit
e9e198a2b6
@ -1017,6 +1017,7 @@ fn descriptive_db_error(item: &str, error: &StoreError) -> String {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::test_utils::EphemeralTestingSlotClockHarnessType;
|
||||
use crate::validator_monitor::DEFAULT_INDIVIDUAL_TRACKING_THRESHOLD;
|
||||
use eth2_hashing::hash;
|
||||
use genesis::{
|
||||
@ -1031,6 +1032,7 @@ mod test {
|
||||
use types::{EthSpec, MinimalEthSpec, Slot};
|
||||
|
||||
type TestEthSpec = MinimalEthSpec;
|
||||
type Builder = BeaconChainBuilder<EphemeralTestingSlotClockHarnessType<TestEthSpec>>;
|
||||
|
||||
fn get_logger() -> Logger {
|
||||
let builder = NullLoggerBuilder;
|
||||
@ -1063,7 +1065,7 @@ mod test {
|
||||
let (shutdown_tx, _) = futures::channel::mpsc::channel(1);
|
||||
let runtime = TestRuntime::default();
|
||||
|
||||
let chain = BeaconChainBuilder::new(MinimalEthSpec)
|
||||
let chain = Builder::new(MinimalEthSpec)
|
||||
.logger(log.clone())
|
||||
.store(Arc::new(store))
|
||||
.task_executor(runtime.task_executor.clone())
|
||||
|
@ -212,7 +212,7 @@ mod test {
|
||||
use types::*;
|
||||
|
||||
type BeaconChainHarness =
|
||||
crate::test_utils::BeaconChainHarness<EphemeralHarnessType<MinimalEthSpec>>;
|
||||
crate::test_utils::BeaconChainHarness<EphemeralTestingSlotClockHarnessType<MinimalEthSpec>>;
|
||||
|
||||
/// Returns two different committee caches for testing.
|
||||
fn committee_caches() -> (Arc<CommitteeCache>, Arc<CommitteeCache>) {
|
||||
|
@ -69,6 +69,7 @@ pub type BaseHarnessType<TEthSpec, THotStore, TColdStore, TSlotClock> =
|
||||
Witness<TSlotClock, CachingEth1Backend<TEthSpec>, TEthSpec, THotStore, TColdStore>;
|
||||
|
||||
pub type DiskHarnessType<E, TSlotClock> = BaseHarnessType<E, LevelDB<E>, LevelDB<E>, TSlotClock>;
|
||||
|
||||
pub type EphemeralHarnessType<E, TSlotClock> =
|
||||
BaseHarnessType<E, MemoryStore<E>, MemoryStore<E>, TSlotClock>;
|
||||
|
||||
@ -282,6 +283,18 @@ impl<E: EthSpec, S: SlotClock> Builder<DiskHarnessType<E, S>, S> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E, Hot, Cold> Builder<TestingSlotClockHarnessType<E, Hot, Cold>, TestingSlotClock>
|
||||
where
|
||||
E: EthSpec,
|
||||
Hot: ItemStore<E>,
|
||||
Cold: ItemStore<E>,
|
||||
{
|
||||
pub fn testing_slot_clock(mut self, slot_clock: TestingSlotClock) -> Self {
|
||||
self.testing_slot_clock = Some(slot_clock);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<E, Hot, Cold, S> Builder<BaseHarnessType<E, Hot, Cold, S>, S>
|
||||
where
|
||||
E: EthSpec,
|
||||
|
@ -3,7 +3,8 @@
|
||||
use beacon_chain::{
|
||||
attestation_verification::Error as AttnError,
|
||||
test_utils::{
|
||||
test_spec, AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralHarnessType,
|
||||
test_spec, AttestationStrategy, BeaconChainHarness, BlockStrategy,
|
||||
EphemeralTestingSlotClockHarnessType,
|
||||
},
|
||||
BeaconChain, BeaconChainError, BeaconChainTypes, WhenSlotSkipped,
|
||||
};
|
||||
@ -31,7 +32,9 @@ lazy_static! {
|
||||
}
|
||||
|
||||
/// Returns a beacon chain harness.
|
||||
fn get_harness(validator_count: usize) -> BeaconChainHarness<EphemeralHarnessType<E>> {
|
||||
fn get_harness(
|
||||
validator_count: usize,
|
||||
) -> BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>> {
|
||||
let mut spec = test_spec::<E>();
|
||||
|
||||
// A kind-of arbitrary number that ensures that _some_ validators are aggregators, but
|
||||
@ -189,7 +192,7 @@ fn get_non_aggregator<T: BeaconChainTypes>(
|
||||
}
|
||||
|
||||
struct GossipTester {
|
||||
harness: BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
harness: BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
/*
|
||||
* Valid unaggregated attestation
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![cfg(not(debug_assertions))]
|
||||
|
||||
use beacon_chain::test_utils::{
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralHarnessType,
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralTestingSlotClockHarnessType,
|
||||
};
|
||||
use beacon_chain::{BeaconSnapshot, BlockError, ChainSegmentResult, NotifyExecutionLayer};
|
||||
use fork_choice::CountUnrealized;
|
||||
@ -65,7 +65,9 @@ async fn get_chain_segment() -> Vec<BeaconSnapshot<E>> {
|
||||
segment
|
||||
}
|
||||
|
||||
fn get_harness(validator_count: usize) -> BeaconChainHarness<EphemeralHarnessType<E>> {
|
||||
fn get_harness(
|
||||
validator_count: usize,
|
||||
) -> BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>> {
|
||||
let harness = BeaconChainHarness::builder(MainnetEthSpec)
|
||||
.default_spec()
|
||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||
@ -99,7 +101,7 @@ fn junk_aggregate_signature() -> AggregateSignature {
|
||||
|
||||
fn update_proposal_signatures(
|
||||
snapshots: &mut [BeaconSnapshot<E>],
|
||||
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
) {
|
||||
for snapshot in snapshots {
|
||||
let spec = &harness.chain.spec;
|
||||
@ -329,7 +331,7 @@ async fn chain_segment_non_linear_slots() {
|
||||
|
||||
async fn assert_invalid_signature(
|
||||
chain_segment: &[BeaconSnapshot<E>],
|
||||
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
block_index: usize,
|
||||
snapshots: &[BeaconSnapshot<E>],
|
||||
item: &str,
|
||||
@ -400,7 +402,7 @@ async fn assert_invalid_signature(
|
||||
|
||||
async fn get_invalid_sigs_harness(
|
||||
chain_segment: &[BeaconSnapshot<E>],
|
||||
) -> BeaconChainHarness<EphemeralHarnessType<E>> {
|
||||
) -> BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>> {
|
||||
let harness = get_harness(VALIDATOR_COUNT);
|
||||
harness
|
||||
.chain
|
||||
|
@ -48,7 +48,7 @@ async fn merge_with_terminal_block_hash_override() {
|
||||
|
||||
spec.terminal_block_hash = genesis_pow_block_hash;
|
||||
|
||||
let harness = BeaconChainHarness::builder(E::default(), TestingSlotClock)
|
||||
let harness = BeaconChainHarness::builder(E::default())
|
||||
.spec(spec)
|
||||
.logger(logging::test_logger())
|
||||
.deterministic_keypairs(VALIDATOR_COUNT)
|
||||
@ -105,7 +105,7 @@ async fn base_altair_merge_with_terminal_block_after_fork() {
|
||||
|
||||
let mut execution_payloads = vec![];
|
||||
|
||||
let harness = BeaconChainHarness::builder(E::default(), TestingSlotClock)
|
||||
let harness = BeaconChainHarness::builder(E::default())
|
||||
.spec(spec)
|
||||
.logger(logging::test_logger())
|
||||
.deterministic_keypairs(VALIDATOR_COUNT)
|
||||
|
@ -8,6 +8,7 @@ use beacon_chain::test_utils::{
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use sloggers::{null::NullLoggerBuilder, Build};
|
||||
use slot_clock::TestingSlotClock;
|
||||
use std::sync::Arc;
|
||||
use store::{LevelDB, StoreConfig};
|
||||
use tempfile::{tempdir, TempDir};
|
||||
@ -22,7 +23,7 @@ lazy_static! {
|
||||
}
|
||||
|
||||
type E = MinimalEthSpec;
|
||||
type TestHarness = BeaconChainHarness<DiskHarnessType<E>>;
|
||||
type TestHarness = BeaconChainHarness<DiskHarnessType<E, TestingSlotClock>>;
|
||||
type HotColdDB = store::HotColdDB<E, LevelDB<E>, LevelDB<E>>;
|
||||
|
||||
fn get_store(db_path: &TempDir) -> Arc<HotColdDB> {
|
||||
|
@ -6,7 +6,7 @@ use beacon_chain::otb_verification_service::{
|
||||
};
|
||||
use beacon_chain::{
|
||||
canonical_head::{CachedHead, CanonicalHead},
|
||||
test_utils::{BeaconChainHarness, EphemeralHarnessType},
|
||||
test_utils::{BeaconChainHarness, EphemeralTestingSlotClockHarnessType},
|
||||
BeaconChainError, BlockError, ExecutionPayloadError, NotifyExecutionLayer,
|
||||
OverrideForkchoiceUpdate, StateSkipConfig, WhenSlotSkipped,
|
||||
INVALID_FINALIZED_MERGE_TRANSITION_BLOCK_SHUTDOWN_REASON,
|
||||
@ -45,7 +45,7 @@ enum Payload {
|
||||
}
|
||||
|
||||
struct InvalidPayloadRig {
|
||||
harness: BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
harness: BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
enable_attestations: bool,
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ impl InvalidPayloadRig {
|
||||
self.harness.chain.canonical_head.cached_head()
|
||||
}
|
||||
|
||||
fn canonical_head(&self) -> &CanonicalHead<EphemeralHarnessType<E>> {
|
||||
fn canonical_head(&self) -> &CanonicalHead<EphemeralTestingSlotClockHarnessType<E>> {
|
||||
&self.harness.chain.canonical_head
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ use lazy_static::lazy_static;
|
||||
use logging::test_logger;
|
||||
use maplit::hashset;
|
||||
use rand::Rng;
|
||||
use slot_clock::TestingSlotClock;
|
||||
use state_processing::BlockReplayer;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
@ -44,7 +45,7 @@ lazy_static! {
|
||||
}
|
||||
|
||||
type E = MinimalEthSpec;
|
||||
type TestHarness = BeaconChainHarness<DiskHarnessType<E>>;
|
||||
type TestHarness = BeaconChainHarness<DiskHarnessType<E, TestingSlotClock>>;
|
||||
|
||||
fn get_store(db_path: &TempDir) -> Arc<HotColdDB<E, LevelDB<E>, LevelDB<E>>> {
|
||||
get_store_with_spec(db_path, test_spec::<E>())
|
||||
@ -67,7 +68,7 @@ fn get_harness(
|
||||
store: Arc<HotColdDB<E, LevelDB<E>, LevelDB<E>>>,
|
||||
validator_count: usize,
|
||||
) -> TestHarness {
|
||||
let harness = BeaconChainHarness::builder(MinimalEthSpec)
|
||||
let harness = TestHarness::builder(MinimalEthSpec)
|
||||
.default_spec()
|
||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||
.fresh_disk_store(store)
|
||||
@ -567,7 +568,7 @@ async fn delete_blocks_and_states() {
|
||||
let store = get_store(&db_path);
|
||||
let validators_keypairs =
|
||||
types::test_utils::generate_deterministic_keypairs(LOW_VALIDATOR_COUNT);
|
||||
let harness = BeaconChainHarness::builder(MinimalEthSpec)
|
||||
let harness = TestHarness::builder(MinimalEthSpec)
|
||||
.default_spec()
|
||||
.keypairs(validators_keypairs)
|
||||
.fresh_disk_store(store.clone())
|
||||
@ -697,7 +698,7 @@ async fn multi_epoch_fork_valid_blocks_test(
|
||||
let store = get_store(&db_path);
|
||||
let validators_keypairs =
|
||||
types::test_utils::generate_deterministic_keypairs(LOW_VALIDATOR_COUNT);
|
||||
let harness = BeaconChainHarness::builder(MinimalEthSpec)
|
||||
let harness = TestHarness::builder(MinimalEthSpec)
|
||||
.default_spec()
|
||||
.keypairs(validators_keypairs)
|
||||
.fresh_disk_store(store)
|
||||
@ -2109,7 +2110,7 @@ async fn weak_subjectivity_sync() {
|
||||
|
||||
// Initialise a new beacon chain from the finalized checkpoint
|
||||
let beacon_chain = Arc::new(
|
||||
BeaconChainBuilder::new(MinimalEthSpec)
|
||||
BeaconChainBuilder::<DiskHarnessType<E, TestingSlotClock>>::new(MinimalEthSpec)
|
||||
.store(store.clone())
|
||||
.custom_spec(test_spec::<E>())
|
||||
.task_executor(harness.chain.task_executor.clone())
|
||||
@ -2306,12 +2307,13 @@ async fn finalizes_after_resuming_from_db() {
|
||||
|
||||
let original_chain = harness.chain;
|
||||
|
||||
let resumed_harness = BeaconChainHarness::builder(MinimalEthSpec)
|
||||
.default_spec()
|
||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||
.resumed_disk_store(store)
|
||||
.mock_execution_layer()
|
||||
.build();
|
||||
let resumed_harness =
|
||||
BeaconChainHarness::<DiskHarnessType<E, TestingSlotClock>>::builder(MinimalEthSpec)
|
||||
.default_spec()
|
||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||
.resumed_disk_store(store)
|
||||
.mock_execution_layer()
|
||||
.build();
|
||||
|
||||
assert_chains_pretty_much_the_same(&original_chain, &resumed_harness.chain);
|
||||
|
||||
@ -2482,7 +2484,7 @@ async fn revert_minority_fork_on_resume() {
|
||||
drop(harness1);
|
||||
let resume_store = get_store_with_spec(&db_path1, spec2.clone());
|
||||
|
||||
let resumed_harness = BeaconChainHarness::builder(MinimalEthSpec)
|
||||
let resumed_harness = TestHarness::builder(MinimalEthSpec)
|
||||
.spec(spec2)
|
||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||
.resumed_disk_store(resume_store)
|
||||
|
@ -1,7 +1,9 @@
|
||||
#![cfg(not(debug_assertions))]
|
||||
|
||||
use beacon_chain::sync_committee_verification::Error as SyncCommitteeError;
|
||||
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType, RelativeSyncCommittee};
|
||||
use beacon_chain::test_utils::{
|
||||
BeaconChainHarness, EphemeralTestingSlotClockHarnessType, RelativeSyncCommittee,
|
||||
};
|
||||
use int_to_bytes::int_to_bytes32;
|
||||
use lazy_static::lazy_static;
|
||||
use safe_arith::SafeArith;
|
||||
@ -23,7 +25,9 @@ lazy_static! {
|
||||
}
|
||||
|
||||
/// Returns a beacon chain harness.
|
||||
fn get_harness(validator_count: usize) -> BeaconChainHarness<EphemeralHarnessType<E>> {
|
||||
fn get_harness(
|
||||
validator_count: usize,
|
||||
) -> BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>> {
|
||||
let mut spec = E::default_spec();
|
||||
spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
let harness = BeaconChainHarness::builder(MainnetEthSpec)
|
||||
@ -42,7 +46,7 @@ fn get_harness(validator_count: usize) -> BeaconChainHarness<EphemeralHarnessTyp
|
||||
///
|
||||
/// Also returns some info about who created it.
|
||||
fn get_valid_sync_committee_message(
|
||||
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
slot: Slot,
|
||||
relative_sync_committee: RelativeSyncCommittee,
|
||||
message_index: usize,
|
||||
@ -68,7 +72,7 @@ fn get_valid_sync_committee_message(
|
||||
}
|
||||
|
||||
fn get_valid_sync_contribution(
|
||||
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
relative_sync_committee: RelativeSyncCommittee,
|
||||
) -> (SignedContributionAndProof<E>, usize, SecretKey) {
|
||||
let head_state = harness.chain.head_beacon_state_cloned();
|
||||
@ -100,7 +104,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<EphemeralHarnessType<E>>,
|
||||
harness: &BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
slot: Slot,
|
||||
) -> (usize, SecretKey) {
|
||||
let state = &harness.chain.head_snapshot().beacon_state;
|
||||
|
@ -3,8 +3,8 @@
|
||||
use beacon_chain::{
|
||||
attestation_verification::Error as AttnError,
|
||||
test_utils::{
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralHarnessType,
|
||||
OP_POOL_DB_KEY,
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy,
|
||||
EphemeralTestingSlotClockHarnessType, OP_POOL_DB_KEY,
|
||||
},
|
||||
BeaconChain, NotifyExecutionLayer, StateSkipConfig, WhenSlotSkipped,
|
||||
};
|
||||
@ -26,7 +26,9 @@ lazy_static! {
|
||||
static ref KEYPAIRS: Vec<Keypair> = types::test_utils::generate_deterministic_keypairs(VALIDATOR_COUNT);
|
||||
}
|
||||
|
||||
fn get_harness(validator_count: usize) -> BeaconChainHarness<EphemeralHarnessType<MinimalEthSpec>> {
|
||||
fn get_harness(
|
||||
validator_count: usize,
|
||||
) -> BeaconChainHarness<EphemeralTestingSlotClockHarnessType<MinimalEthSpec>> {
|
||||
let harness = BeaconChainHarness::builder(MinimalEthSpec)
|
||||
.default_spec()
|
||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||
@ -143,7 +145,7 @@ async fn iterators() {
|
||||
}
|
||||
|
||||
fn find_reorg_slot(
|
||||
chain: &BeaconChain<EphemeralHarnessType<MinimalEthSpec>>,
|
||||
chain: &BeaconChain<EphemeralTestingSlotClockHarnessType<MinimalEthSpec>>,
|
||||
new_state: &BeaconState<MinimalEthSpec>,
|
||||
new_block_root: Hash256,
|
||||
) -> Slot {
|
||||
|
@ -1,7 +1,5 @@
|
||||
use beacon_chain::{
|
||||
test_utils::{
|
||||
BeaconChainHarness, BoxedMutator, Builder as HarnessBuilder, EphemeralHarnessType,
|
||||
},
|
||||
test_utils::{BeaconChainHarness, BoxedMutator, EphemeralTestingSlotClockHarnessType},
|
||||
BeaconChain, BeaconChainTypes,
|
||||
};
|
||||
use directory::DEFAULT_ROOT_DIR;
|
||||
@ -39,7 +37,7 @@ pub const EXTERNAL_ADDR: &str = "/ip4/0.0.0.0/tcp/9000";
|
||||
|
||||
/// HTTP API tester that allows interaction with the underlying beacon chain harness.
|
||||
pub struct InteractiveTester<E: EthSpec> {
|
||||
pub harness: BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
pub harness: BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
pub client: BeaconNodeHttpClient,
|
||||
pub network_rx: NetworkReceivers<E>,
|
||||
_server_shutdown: oneshot::Sender<()>,
|
||||
|
@ -1,7 +1,10 @@
|
||||
use crate::common::{create_api_server, create_api_server_on_port, ApiServer};
|
||||
use beacon_chain::test_utils::RelativeSyncCommittee;
|
||||
use beacon_chain::{
|
||||
test_utils::{AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralHarnessType},
|
||||
test_utils::{
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy,
|
||||
EphemeralTestingSlotClockHarnessType,
|
||||
},
|
||||
BeaconChain, StateSkipConfig, WhenSlotSkipped, MAXIMUM_GOSSIP_CLOCK_DISPARITY,
|
||||
};
|
||||
use environment::null_logger;
|
||||
@ -57,8 +60,8 @@ const SKIPPED_SLOTS: &[u64] = &[
|
||||
];
|
||||
|
||||
struct ApiTester {
|
||||
harness: Arc<BeaconChainHarness<EphemeralHarnessType<E>>>,
|
||||
chain: Arc<BeaconChain<EphemeralHarnessType<E>>>,
|
||||
harness: Arc<BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>>,
|
||||
chain: Arc<BeaconChain<EphemeralTestingSlotClockHarnessType<E>>>,
|
||||
client: BeaconNodeHttpClient,
|
||||
next_block: SignedBeaconBlock<E>,
|
||||
reorg_block: SignedBeaconBlock<E>,
|
||||
|
@ -7,7 +7,7 @@ use crate::beacon_processor::work_reprocessing_queue::{
|
||||
use crate::beacon_processor::*;
|
||||
use crate::{service::NetworkMessage, sync::SyncMessage};
|
||||
use beacon_chain::test_utils::{
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralHarnessType,
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralTestingSlotClockHarnessType,
|
||||
};
|
||||
use beacon_chain::{BeaconChain, MAXIMUM_GOSSIP_CLOCK_DISPARITY};
|
||||
use lighthouse_network::{
|
||||
@ -28,7 +28,7 @@ use types::{
|
||||
};
|
||||
|
||||
type E = MainnetEthSpec;
|
||||
type T = EphemeralHarnessType<E>;
|
||||
type T = EphemeralTestingSlotClockHarnessType<E>;
|
||||
|
||||
const SLOTS_PER_EPOCH: u64 = 32;
|
||||
const VALIDATOR_COUNT: usize = SLOTS_PER_EPOCH as usize;
|
||||
|
@ -768,7 +768,7 @@ mod release_tests {
|
||||
use super::attestation::earliest_attestation_validators;
|
||||
use super::*;
|
||||
use beacon_chain::test_utils::{
|
||||
test_spec, BeaconChainHarness, EphemeralHarnessType, RelativeSyncCommittee,
|
||||
test_spec, BeaconChainHarness, EphemeralTestingSlotClockHarnessType, RelativeSyncCommittee,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use maplit::hashset;
|
||||
@ -787,8 +787,8 @@ mod release_tests {
|
||||
fn get_harness<E: EthSpec>(
|
||||
validator_count: usize,
|
||||
spec: Option<ChainSpec>,
|
||||
) -> BeaconChainHarness<EphemeralHarnessType<E>> {
|
||||
let harness = BeaconChainHarness::builder(E::default(), TestingSlotClock)
|
||||
) -> BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>> {
|
||||
let harness = BeaconChainHarness::builder(E::default())
|
||||
.spec_or_default(spec)
|
||||
.keypairs(KEYPAIRS[0..validator_count].to_vec())
|
||||
.fresh_ephemeral_store()
|
||||
@ -803,7 +803,10 @@ mod release_tests {
|
||||
/// Test state for attestation-related tests.
|
||||
fn attestation_test_state<E: EthSpec>(
|
||||
num_committees: usize,
|
||||
) -> (BeaconChainHarness<EphemeralHarnessType<E>>, ChainSpec) {
|
||||
) -> (
|
||||
BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
ChainSpec,
|
||||
) {
|
||||
let spec = test_spec::<E>();
|
||||
|
||||
let num_validators =
|
||||
@ -816,7 +819,10 @@ mod release_tests {
|
||||
/// Test state for sync contribution-related tests.
|
||||
async fn sync_contribution_test_state<E: EthSpec>(
|
||||
num_committees: usize,
|
||||
) -> (BeaconChainHarness<EphemeralHarnessType<E>>, ChainSpec) {
|
||||
) -> (
|
||||
BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
ChainSpec,
|
||||
) {
|
||||
let mut spec = E::default_spec();
|
||||
spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
|
||||
@ -1786,8 +1792,10 @@ mod release_tests {
|
||||
);
|
||||
}
|
||||
|
||||
fn cross_fork_harness<E: EthSpec>() -> (BeaconChainHarness<EphemeralHarnessType<E>>, ChainSpec)
|
||||
{
|
||||
fn cross_fork_harness<E: EthSpec>() -> (
|
||||
BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
ChainSpec,
|
||||
) {
|
||||
let mut spec = E::default_spec();
|
||||
|
||||
// Give some room to sign surround slashings.
|
||||
|
@ -67,12 +67,6 @@ impl SlotClock for SystemTimeSlotClock {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ManualSlotClock> for SystemTimeSlotClock {
|
||||
fn from(clock: ManualSlotClock) -> Self {
|
||||
SystemTimeSlotClock { clock }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
@ -35,7 +35,7 @@ pub enum MutationDelay {
|
||||
|
||||
/// A helper struct to make testing fork choice more ergonomic and less repetitive.
|
||||
struct ForkChoiceTest {
|
||||
harness: BeaconChainHarness<EphemeralHarnessType<E>>,
|
||||
harness: BeaconChainHarness<EphemeralTestingSlotClockHarnessType<E>>,
|
||||
}
|
||||
|
||||
/// Allows us to use `unwrap` in some cases.
|
||||
@ -397,7 +397,7 @@ impl ForkChoiceTest {
|
||||
mut comparison_func: G,
|
||||
) -> Self
|
||||
where
|
||||
F: FnMut(&mut IndexedAttestation<E>, &BeaconChain<EphemeralHarnessType<E>>),
|
||||
F: FnMut(&mut IndexedAttestation<E>, &BeaconChain<EphemeralTestingSlotClockHarnessType<E>>),
|
||||
G: FnMut(Result<(), BeaconChainError>),
|
||||
{
|
||||
let head = self.harness.chain.head_snapshot();
|
||||
|
Loading…
Reference in New Issue
Block a user