Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use schlesi as default testnet #1108

Merged
merged 2 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions eth2/utils/eth2_testnet_config/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
testnet*
schlesi-*
15 changes: 9 additions & 6 deletions eth2/utils/eth2_testnet_config/build.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/// Pulls down the latest Lighthouse testnet from https://github.com/eth2-clients/eth2-testnets
//! Downloads a testnet configuration from Github.

use reqwest;
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

const TESTNET_ID: &str = "testnet5";
const TESTNET_ID: &str = "schlesi-v0-11";

fn main() {
if !base_dir().exists() {
Expand Down Expand Up @@ -37,16 +38,18 @@ pub fn get_all_files() -> Result<(), String> {

pub fn get_file(filename: &str) -> Result<(), String> {
let url = format!(
"https://raw.githubusercontent.com/eth2-clients/eth2-testnets/master/lighthouse/{}/{}",
TESTNET_ID, filename
"https://raw.githubusercontent.com/goerli/schlesi/839866fe29a1b4df3a87bfe2ff1257c8a58671c9/light/{}",
filename
);

let path = base_dir().join(filename);
let mut file =
File::create(path).map_err(|e| format!("Failed to create {}: {:?}", filename, e))?;

let mut response =
reqwest::get(&url).map_err(|e| format!("Failed to download {}: {}", filename, e))?;
let mut response = reqwest::get(&url)
.map_err(|e| format!("Failed to download {}: {}", filename, e))?
.error_for_status()
.map_err(|e| format!("Error downloading {}: {}", filename, e))?;
let mut contents: Vec<u8> = vec![];
response
.copy_to(&mut contents)
Expand Down
13 changes: 8 additions & 5 deletions eth2/utils/eth2_testnet_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ pub const BOOT_ENR_FILE: &str = "boot_enr.yaml";
pub const GENESIS_STATE_FILE: &str = "genesis.ssz";
pub const YAML_CONFIG_FILE: &str = "config.yaml";

pub const HARDCODED_YAML_CONFIG: &[u8] = include_bytes!("../testnet5/config.yaml");
pub const HARDCODED_DEPLOY_BLOCK: &[u8] = include_bytes!("../testnet5/deploy_block.txt");
pub const HARDCODED_DEPOSIT_CONTRACT: &[u8] = include_bytes!("../testnet5/deposit_contract.txt");
pub const HARDCODED_GENESIS_STATE: &[u8] = include_bytes!("../testnet5/genesis.ssz");
pub const HARDCODED_BOOT_ENR: &[u8] = include_bytes!("../testnet5/boot_enr.yaml");
pub const HARDCODED_TESTNET: &str = "schlesi-v0-11";

pub const HARDCODED_YAML_CONFIG: &[u8] = include_bytes!("../schlesi-v0-11/config.yaml");
pub const HARDCODED_DEPLOY_BLOCK: &[u8] = include_bytes!("../schlesi-v0-11/deploy_block.txt");
pub const HARDCODED_DEPOSIT_CONTRACT: &[u8] =
include_bytes!("../schlesi-v0-11/deposit_contract.txt");
pub const HARDCODED_GENESIS_STATE: &[u8] = include_bytes!("../schlesi-v0-11/genesis.ssz");
pub const HARDCODED_BOOT_ENR: &[u8] = include_bytes!("../schlesi-v0-11/boot_enr.yaml");

/// Specifies an Eth2 testnet.
///
Expand Down
1 change: 1 addition & 0 deletions lighthouse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ futures = "0.1.25"
validator_client = { "path" = "../validator_client" }
account_manager = { "path" = "../account_manager" }
clap_utils = { path = "../eth2/utils/clap_utils" }
eth2_testnet_config = { path = "../eth2/utils/eth2_testnet_config" }
9 changes: 9 additions & 0 deletions lighthouse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use clap::{App, Arg, ArgMatches};
use clap_utils;
use env_logger::{Builder, Env};
use environment::EnvironmentBuilder;
use eth2_testnet_config::HARDCODED_TESTNET;
use slog::{crit, info, warn};
use std::path::PathBuf;
use std::process::exit;
Expand Down Expand Up @@ -156,6 +157,14 @@ fn run<E: EthSpec>(
"Ethereum 2.0 is pre-release. This software is experimental."
);

if !matches.is_present("testnet-dir") {
info!(
log,
"Using default testnet";
"default" => HARDCODED_TESTNET
)
}

// Note: the current code technically allows for starting a beacon node _and_ a validator
// client at the same time.
//
Expand Down