mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-21 14:58:31 +00:00
Replace INTERVALS_PER_SLOT with explicit slot component times (#7944)
https://github.com/ethereum/consensus-specs/pull/4476 Co-Authored-By: Barnabas Busa <barnabas.busa@ethereum.org> Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -15,12 +15,12 @@ use rayon::prelude::*;
|
||||
use std::cmp::max;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::time::sleep;
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
|
||||
use types::{Epoch, EthSpec, MinimalEthSpec};
|
||||
|
||||
const END_EPOCH: u64 = 16;
|
||||
const GENESIS_DELAY: u64 = 38;
|
||||
const ALTAIR_FORK_EPOCH: u64 = 0;
|
||||
@@ -179,8 +179,11 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
||||
|
||||
let genesis_delay = GENESIS_DELAY;
|
||||
|
||||
spec.seconds_per_slot /= speed_up_factor;
|
||||
spec.seconds_per_slot = max(1, spec.seconds_per_slot);
|
||||
let mut slot_duration_ms = spec.get_slot_duration().as_millis() as u64;
|
||||
slot_duration_ms /= speed_up_factor;
|
||||
slot_duration_ms = max(1_000, slot_duration_ms);
|
||||
spec = spec.set_slot_duration_ms::<MinimalEthSpec>(slot_duration_ms);
|
||||
|
||||
spec.genesis_delay = genesis_delay;
|
||||
spec.min_genesis_time = 0;
|
||||
spec.min_genesis_active_validator_count = total_validator_count as u64;
|
||||
@@ -193,7 +196,7 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
||||
let spec = Arc::new(spec);
|
||||
env.eth2_config.spec = spec.clone();
|
||||
|
||||
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
|
||||
let slot_duration = spec.get_slot_duration();
|
||||
let slots_per_epoch = MinimalEthSpec::slots_per_epoch();
|
||||
|
||||
let disconnection_epoch = 1;
|
||||
|
||||
Reference in New Issue
Block a user