mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Represent slots in secs instead of millisecs (#2163)
## Issue Addressed NA ## Proposed Changes Copied from #2083, changes the config milliseconds_per_slot to seconds_per_slot to avoid errors when slot duration is not a multiple of a second. To avoid deserializing old serialized data (with milliseconds instead of seconds) the Serialize and Deserialize derive got removed from the Spec struct (isn't currently used anyway). This PR replaces #2083 for the purpose of fixing a merge conflict without requiring the input of @blacktemplar. ## Additional Info NA Co-authored-by: blacktemplar <blacktemplar@a1.net>
This commit is contained in:
@@ -58,16 +58,15 @@ pub fn run_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.seconds_per_slot /= speed_up_factor;
|
||||
spec.seconds_per_slot = max(1, spec.seconds_per_slot);
|
||||
spec.eth1_follow_distance = 16;
|
||||
spec.genesis_delay = eth1_block_time.as_secs() * spec.eth1_follow_distance * 2;
|
||||
spec.min_genesis_time = 0;
|
||||
spec.min_genesis_active_validator_count = total_validator_count as u64;
|
||||
spec.seconds_per_eth1_block = 1;
|
||||
|
||||
let slot_duration = Duration::from_millis(spec.milliseconds_per_slot);
|
||||
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
|
||||
let initial_validator_count = spec.min_genesis_active_validator_count as usize;
|
||||
let deposit_amount = env.eth2_config.spec.max_effective_balance;
|
||||
|
||||
|
||||
@@ -55,9 +55,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.seconds_per_slot /= speed_up_factor;
|
||||
spec.seconds_per_slot = max(1, spec.seconds_per_slot);
|
||||
spec.eth1_follow_distance = 16;
|
||||
spec.genesis_delay = eth1_block_time.as_secs() * spec.eth1_follow_distance * 2;
|
||||
spec.min_genesis_time = 0;
|
||||
@@ -71,7 +70,7 @@ pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
|
||||
+ genesis_delay;
|
||||
let genesis_instant = Instant::now() + genesis_delay;
|
||||
|
||||
let slot_duration = Duration::from_millis(spec.milliseconds_per_slot);
|
||||
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
|
||||
|
||||
let context = env.core_context();
|
||||
|
||||
|
||||
@@ -53,9 +53,8 @@ fn syncing_sim(
|
||||
let end_after_checks = true;
|
||||
let eth1_block_time = Duration::from_millis(15_000 / speed_up_factor);
|
||||
|
||||
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.seconds_per_slot /= speed_up_factor;
|
||||
spec.seconds_per_slot = max(1, spec.seconds_per_slot);
|
||||
spec.eth1_follow_distance = 16;
|
||||
spec.genesis_delay = eth1_block_time.as_secs() * spec.eth1_follow_distance * 2;
|
||||
spec.min_genesis_time = 0;
|
||||
@@ -63,7 +62,7 @@ fn syncing_sim(
|
||||
spec.seconds_per_eth1_block = 1;
|
||||
|
||||
let num_validators = 8;
|
||||
let slot_duration = Duration::from_millis(spec.milliseconds_per_slot);
|
||||
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
|
||||
let context = env.core_context();
|
||||
let mut beacon_config = testing_client_config();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user