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:
Paul Hauner
2021-01-19 09:39:51 +00:00
parent 46cb6e204c
commit d9f940613f
24 changed files with 58 additions and 132 deletions

View File

@@ -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();