From 69e15af0b2c4521e9a3204babb8f12df6b99416c Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Fri, 26 Jun 2020 10:54:57 +1000 Subject: [PATCH] Bake in Altona (without genesis state) (#1295) * Bake in Altona testnet (without genesis state) * Update config.yml * Fix eth2_testnet_config test * Update min genesis time --- common/eth2_testnet_config/.gitignore | 1 + common/eth2_testnet_config/build.rs | 8 ++++--- common/eth2_testnet_config/src/lib.rs | 24 ++++++++++++------- .../environment/tests/testnet_dir/config.yaml | 4 ++-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/common/eth2_testnet_config/.gitignore b/common/eth2_testnet_config/.gitignore index 9268a7229..e7c8e1add 100644 --- a/common/eth2_testnet_config/.gitignore +++ b/common/eth2_testnet_config/.gitignore @@ -1,3 +1,4 @@ testnet* schlesi-* witti-* +altona diff --git a/common/eth2_testnet_config/build.rs b/common/eth2_testnet_config/build.rs index 7400d05a3..d2970cb1b 100644 --- a/common/eth2_testnet_config/build.rs +++ b/common/eth2_testnet_config/build.rs @@ -6,7 +6,7 @@ use std::fs::File; use std::io::Write; use std::path::PathBuf; -const TESTNET_ID: &str = "witti-v0-11-3"; +const TESTNET_ID: &str = "altona"; fn main() { if !base_dir().exists() { @@ -31,14 +31,16 @@ pub fn get_all_files() -> Result<(), String> { get_file("config.yaml")?; get_file("deploy_block.txt")?; get_file("deposit_contract.txt")?; - get_file("genesis.ssz")?; + // TODO: add once we know the genesis state for Altona. + // + // get_file("genesis.ssz")?; Ok(()) } pub fn get_file(filename: &str) -> Result<(), String> { let url = format!( - "https://raw.githubusercontent.com/sigp/witti/6d079b0f10f6bed75cd003e5f0ea5ecbe2044455/lighthouse/{}", + "https://raw.githubusercontent.com/sigp/witti/ff9ff43ba4f15fe50838d832daabd284ab1124df/altona/lighthouse/{}", filename ); diff --git a/common/eth2_testnet_config/src/lib.rs b/common/eth2_testnet_config/src/lib.rs index ca29245bf..bbbb227eb 100644 --- a/common/eth2_testnet_config/src/lib.rs +++ b/common/eth2_testnet_config/src/lib.rs @@ -23,14 +23,15 @@ pub const YAML_CONFIG_FILE: &str = "config.yaml"; /// The name of the testnet to hardcode. /// /// Should be set to `None` when no existing testnet is compatible with the codebase. -pub const HARDCODED_TESTNET: Option<&str> = None; +pub const HARDCODED_TESTNET: Option<&str> = Some("altona"); -pub const HARDCODED_YAML_CONFIG: &[u8] = include_bytes!("../witti-v0-11-3/config.yaml"); -pub const HARDCODED_DEPLOY_BLOCK: &[u8] = include_bytes!("../witti-v0-11-3/deploy_block.txt"); -pub const HARDCODED_DEPOSIT_CONTRACT: &[u8] = - include_bytes!("../witti-v0-11-3/deposit_contract.txt"); -pub const HARDCODED_GENESIS_STATE: &[u8] = include_bytes!("../witti-v0-11-3/genesis.ssz"); -pub const HARDCODED_BOOT_ENR: &[u8] = include_bytes!("../witti-v0-11-3/boot_enr.yaml"); +pub const HARDCODED_YAML_CONFIG: &[u8] = include_bytes!("../altona/config.yaml"); +pub const HARDCODED_DEPLOY_BLOCK: &[u8] = include_bytes!("../altona/deploy_block.txt"); +pub const HARDCODED_DEPOSIT_CONTRACT: &[u8] = include_bytes!("../altona/deposit_contract.txt"); +// TODO: add once we know the genesis state for Altona. +// +// pub const HARDCODED_GENESIS_STATE: &[u8] = include_bytes!("../altona/genesis.ssz"); +pub const HARDCODED_BOOT_ENR: &[u8] = include_bytes!("../altona/boot_enr.yaml"); /// Specifies an Eth2 testnet. /// @@ -61,10 +62,15 @@ impl Eth2TestnetConfig { serde_yaml::from_reader(HARDCODED_BOOT_ENR) .map_err(|e| format!("Unable to parse boot enr: {:?}", e))?, ), + genesis_state: None, + /* + * TODO: add once we know the genesis state for Altona. + * genesis_state: Some( BeaconState::from_ssz_bytes(HARDCODED_GENESIS_STATE) .map_err(|e| format!("Unable to parse genesis state: {:?}", e))?, ), + */ yaml_config: Some( serde_yaml::from_reader(HARDCODED_YAML_CONFIG) .map_err(|e| format!("Unable to parse genesis state: {:?}", e))?, @@ -221,7 +227,9 @@ mod tests { Eth2TestnetConfig::::hard_coded().expect("should decode hard_coded params") { assert!(dir.boot_enr.is_some()); - assert!(dir.genesis_state.is_some()); + // TODO: add once we know the genesis state for Altona. + // + // assert!(dir.genesis_state.is_some()); assert!(dir.yaml_config.is_some()); } } diff --git a/lighthouse/environment/tests/testnet_dir/config.yaml b/lighthouse/environment/tests/testnet_dir/config.yaml index f0b3d35af..7404c99ff 100644 --- a/lighthouse/environment/tests/testnet_dir/config.yaml +++ b/lighthouse/environment/tests/testnet_dir/config.yaml @@ -45,7 +45,7 @@ EPOCHS_PER_SLASHINGS_VECTOR: 8192 HISTORICAL_ROOTS_LIMIT: 16777216 VALIDATOR_REGISTRY_LIMIT: 1099511627776 MAX_PROPOSER_SLASHINGS: 16 -MAX_ATTESTER_SLASHINGS: 1 +MAX_ATTESTER_SLASHINGS: 2 MAX_ATTESTATIONS: 128 MAX_DEPOSITS: 16 MAX_VOLUNTARY_EXITS: 16 @@ -53,4 +53,4 @@ ETH1_FOLLOW_DISTANCE: 16 TARGET_AGGREGATORS_PER_COMMITTEE: 0 RANDOM_SUBNETS_PER_VALIDATOR: 0 EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 0 -SECONDS_PER_ETH1_BLOCK: 14 \ No newline at end of file +SECONDS_PER_ETH1_BLOCK: 14