Use schlesi as default testnet (#1108)
* Use schlesi as default testnet * Add schlesi dir to gitignore
This commit is contained in:
parent
4afcf721b9
commit
1552f9997e
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2304,6 +2304,7 @@ dependencies = [
|
|||||||
"clap_utils 0.1.0",
|
"clap_utils 0.1.0",
|
||||||
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"environment 0.2.0",
|
"environment 0.2.0",
|
||||||
|
"eth2_testnet_config 0.2.0",
|
||||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"logging 0.2.0",
|
"logging 0.2.0",
|
||||||
"slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
1
eth2/utils/eth2_testnet_config/.gitignore
vendored
1
eth2/utils/eth2_testnet_config/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
testnet*
|
testnet*
|
||||||
|
schlesi-*
|
||||||
|
@ -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 reqwest;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
const TESTNET_ID: &str = "testnet5";
|
const TESTNET_ID: &str = "schlesi-v0-11";
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if !base_dir().exists() {
|
if !base_dir().exists() {
|
||||||
@ -37,16 +38,18 @@ pub fn get_all_files() -> Result<(), String> {
|
|||||||
|
|
||||||
pub fn get_file(filename: &str) -> Result<(), String> {
|
pub fn get_file(filename: &str) -> Result<(), String> {
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"https://raw.githubusercontent.com/eth2-clients/eth2-testnets/master/lighthouse/{}/{}",
|
"https://raw.githubusercontent.com/goerli/schlesi/839866fe29a1b4df3a87bfe2ff1257c8a58671c9/light/{}",
|
||||||
TESTNET_ID, filename
|
filename
|
||||||
);
|
);
|
||||||
|
|
||||||
let path = base_dir().join(filename);
|
let path = base_dir().join(filename);
|
||||||
let mut file =
|
let mut file =
|
||||||
File::create(path).map_err(|e| format!("Failed to create {}: {:?}", filename, e))?;
|
File::create(path).map_err(|e| format!("Failed to create {}: {:?}", filename, e))?;
|
||||||
|
|
||||||
let mut response =
|
let mut response = reqwest::get(&url)
|
||||||
reqwest::get(&url).map_err(|e| format!("Failed to download {}: {}", filename, e))?;
|
.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![];
|
let mut contents: Vec<u8> = vec![];
|
||||||
response
|
response
|
||||||
.copy_to(&mut contents)
|
.copy_to(&mut contents)
|
||||||
|
@ -20,11 +20,14 @@ pub const BOOT_ENR_FILE: &str = "boot_enr.yaml";
|
|||||||
pub const GENESIS_STATE_FILE: &str = "genesis.ssz";
|
pub const GENESIS_STATE_FILE: &str = "genesis.ssz";
|
||||||
pub const YAML_CONFIG_FILE: &str = "config.yaml";
|
pub const YAML_CONFIG_FILE: &str = "config.yaml";
|
||||||
|
|
||||||
pub const HARDCODED_YAML_CONFIG: &[u8] = include_bytes!("../testnet5/config.yaml");
|
pub const HARDCODED_TESTNET: &str = "schlesi-v0-11";
|
||||||
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_YAML_CONFIG: &[u8] = include_bytes!("../schlesi-v0-11/config.yaml");
|
||||||
pub const HARDCODED_GENESIS_STATE: &[u8] = include_bytes!("../testnet5/genesis.ssz");
|
pub const HARDCODED_DEPLOY_BLOCK: &[u8] = include_bytes!("../schlesi-v0-11/deploy_block.txt");
|
||||||
pub const HARDCODED_BOOT_ENR: &[u8] = include_bytes!("../testnet5/boot_enr.yaml");
|
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.
|
/// Specifies an Eth2 testnet.
|
||||||
///
|
///
|
||||||
|
@ -23,3 +23,4 @@ futures = "0.1.25"
|
|||||||
validator_client = { "path" = "../validator_client" }
|
validator_client = { "path" = "../validator_client" }
|
||||||
account_manager = { "path" = "../account_manager" }
|
account_manager = { "path" = "../account_manager" }
|
||||||
clap_utils = { path = "../eth2/utils/clap_utils" }
|
clap_utils = { path = "../eth2/utils/clap_utils" }
|
||||||
|
eth2_testnet_config = { path = "../eth2/utils/eth2_testnet_config" }
|
||||||
|
@ -6,6 +6,7 @@ use clap::{App, Arg, ArgMatches};
|
|||||||
use clap_utils;
|
use clap_utils;
|
||||||
use env_logger::{Builder, Env};
|
use env_logger::{Builder, Env};
|
||||||
use environment::EnvironmentBuilder;
|
use environment::EnvironmentBuilder;
|
||||||
|
use eth2_testnet_config::HARDCODED_TESTNET;
|
||||||
use slog::{crit, info, warn};
|
use slog::{crit, info, warn};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
@ -156,6 +157,14 @@ fn run<E: EthSpec>(
|
|||||||
"Ethereum 2.0 is pre-release. This software is experimental."
|
"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
|
// Note: the current code technically allows for starting a beacon node _and_ a validator
|
||||||
// client at the same time.
|
// client at the same time.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user