Fix Syncing Simulator (#2049)

## Issue Addressed

NA

## Proposed Changes

Fixes problems with slot times below 1 second which got revealed by running the syncing simulator with the default speedup time.
This commit is contained in:
blacktemplar
2020-12-16 05:37:38 +00:00
parent da1c5fe69d
commit 3fcc517993
5 changed files with 31 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ use node_test_rig::{
ClientGenesis, ValidatorFiles,
};
use rayon::prelude::*;
use std::cmp::max;
use std::net::{IpAddr, Ipv4Addr};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use tokio::time::{sleep_until, Instant};
@@ -55,6 +56,8 @@ pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
let total_validator_count = validators_per_node * node_count;
spec.milliseconds_per_slot /= speed_up_factor;
//currently lighthouse only supports slot lengths that are multiples of seconds
spec.milliseconds_per_slot = max(1000, spec.milliseconds_per_slot / 1000 * 1000);
spec.eth1_follow_distance = 16;
spec.genesis_delay = eth1_block_time.as_secs() * spec.eth1_follow_distance * 2;
spec.min_genesis_time = 0;