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

@@ -1,4 +1,3 @@
use serde_derive::{Deserialize, Serialize};
use std::env;
use std::path::PathBuf;
use types::{ChainSpec, EthSpecId};
@@ -16,8 +15,7 @@ pub const GENESIS_FILE_NAME: &str = "genesis.ssz";
pub const GENESIS_ZIP_FILE_NAME: &str = "genesis.ssz.zip";
/// The core configuration of a Lighthouse beacon node.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
#[derive(Debug, Clone)]
pub struct Eth2Config {
pub eth_spec_id: EthSpecId,
pub spec: ChainSpec,
@@ -125,15 +123,3 @@ define_net!(pyrmont, include_pyrmont_file, "pyrmont", true);
define_net!(mainnet, include_mainnet_file, "mainnet", true);
define_net!(toledo, include_toledo_file, "toledo", true);
#[cfg(test)]
mod tests {
use super::*;
use toml;
#[test]
fn serde_serialize() {
let _ =
toml::to_string(&Eth2Config::default()).expect("Should serde encode default config");
}
}