Remove testnet dir from repo (#857)
* Pull testnet dir with build script * Add comment * Don't hardcode the genesis fork * Re-enable hard-coded test
This commit is contained in:
parent
6368be148d
commit
58fb144276
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1212,6 +1212,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"eth2-libp2p 0.1.0",
|
"eth2-libp2p 0.1.0",
|
||||||
"eth2_ssz 0.1.2",
|
"eth2_ssz 0.1.2",
|
||||||
|
"reqwest 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -376,9 +376,6 @@ fn init_new_client<E: EthSpec>(
|
|||||||
|
|
||||||
let spec = &mut eth2_config.spec;
|
let spec = &mut eth2_config.spec;
|
||||||
|
|
||||||
// For now, assume that all networks will use the lighthouse genesis fork.
|
|
||||||
spec.genesis_fork_version = [1, 3, 3, 7];
|
|
||||||
|
|
||||||
client_config.eth1.deposit_contract_address =
|
client_config.eth1.deposit_contract_address =
|
||||||
format!("{:?}", eth2_testnet_config.deposit_contract_address()?);
|
format!("{:?}", eth2_testnet_config.deposit_contract_address()?);
|
||||||
client_config.eth1.deposit_contract_deploy_block =
|
client_config.eth1.deposit_contract_deploy_block =
|
||||||
|
1
eth2/utils/eth2_testnet_config/.gitignore
vendored
Normal file
1
eth2/utils/eth2_testnet_config/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
testnet*
|
@ -4,10 +4,14 @@ version = "0.1.0"
|
|||||||
authors = ["Paul Hauner <paul@paulhauner.com>"]
|
authors = ["Paul Hauner <paul@paulhauner.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
build = "build.rs"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
reqwest = "0.9.20"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempdir = "0.3"
|
tempdir = "0.3"
|
||||||
|
reqwest = "0.9.20"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
61
eth2/utils/eth2_testnet_config/build.rs
Normal file
61
eth2/utils/eth2_testnet_config/build.rs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/// Pulls down the latest Lighthouse testnet from https://github.com/eth2-clients/eth2-testnets
|
||||||
|
use reqwest;
|
||||||
|
use std::env;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
const TESTNET_ID: &str = "testnet5";
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
match get_all_files() {
|
||||||
|
Ok(()) => (),
|
||||||
|
Err(e) => panic!(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_all_files() -> Result<(), String> {
|
||||||
|
if !base_dir().exists() {
|
||||||
|
std::fs::create_dir_all(base_dir())
|
||||||
|
.map_err(|e| format!("Unable to create {:?}: {}", base_dir(), e))?;
|
||||||
|
|
||||||
|
get_file("boot_enr.yaml")?;
|
||||||
|
get_file("config.yaml")?;
|
||||||
|
get_file("deploy_block.txt")?;
|
||||||
|
get_file("deposit_contract.txt")?;
|
||||||
|
get_file("genesis.ssz")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_file(filename: &str) -> Result<(), String> {
|
||||||
|
let url = format!(
|
||||||
|
"https://raw.githubusercontent.com/eth2-clients/eth2-testnets/master/lighthouse/{}/{}",
|
||||||
|
TESTNET_ID, 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 contents: Vec<u8> = vec![];
|
||||||
|
response
|
||||||
|
.copy_to(&mut contents)
|
||||||
|
.map_err(|e| format!("Failed to read {} response bytes: {}", filename, e))?;
|
||||||
|
|
||||||
|
file.write(&contents)
|
||||||
|
.map_err(|e| format!("Failed to write to {}: {:?}", filename, e))?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn base_dir() -> PathBuf {
|
||||||
|
env::var("CARGO_MANIFEST_DIR")
|
||||||
|
.expect("should know manifest dir")
|
||||||
|
.parse::<PathBuf>()
|
||||||
|
.expect("should parse manifest dir as path")
|
||||||
|
.join(TESTNET_ID)
|
||||||
|
}
|
@ -20,11 +20,11 @@ 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!("../testnet/config.yaml");
|
pub const HARDCODED_YAML_CONFIG: &[u8] = include_bytes!("../testnet5/config.yaml");
|
||||||
pub const HARDCODED_DEPLOY_BLOCK: &[u8] = include_bytes!("../testnet/deploy_block.txt");
|
pub const HARDCODED_DEPLOY_BLOCK: &[u8] = include_bytes!("../testnet5/deploy_block.txt");
|
||||||
pub const HARDCODED_DEPOSIT_CONTRACT: &[u8] = include_bytes!("../testnet/deposit_contract.txt");
|
pub const HARDCODED_DEPOSIT_CONTRACT: &[u8] = include_bytes!("../testnet5/deposit_contract.txt");
|
||||||
pub const HARDCODED_GENESIS_STATE: &[u8] = include_bytes!("../testnet/genesis.ssz");
|
pub const HARDCODED_GENESIS_STATE: &[u8] = include_bytes!("../testnet5/genesis.ssz");
|
||||||
pub const HARDCODED_BOOT_ENR: &[u8] = include_bytes!("../testnet/boot_enr.yaml");
|
pub const HARDCODED_BOOT_ENR: &[u8] = include_bytes!("../testnet5/boot_enr.yaml");
|
||||||
|
|
||||||
/// Specifies an Eth2 testnet.
|
/// Specifies an Eth2 testnet.
|
||||||
///
|
///
|
||||||
@ -202,7 +202,6 @@ mod tests {
|
|||||||
|
|
||||||
type E = MainnetEthSpec;
|
type E = MainnetEthSpec;
|
||||||
|
|
||||||
/* FIXME: add new testnet config and re-enable this test
|
|
||||||
#[test]
|
#[test]
|
||||||
fn hard_coded_works() {
|
fn hard_coded_works() {
|
||||||
let dir: Eth2TestnetConfig<E> =
|
let dir: Eth2TestnetConfig<E> =
|
||||||
@ -212,7 +211,6 @@ mod tests {
|
|||||||
assert!(dir.genesis_state.is_some());
|
assert!(dir.genesis_state.is_some());
|
||||||
assert!(dir.yaml_config.is_some());
|
assert!(dir.yaml_config.is_some());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn round_trip() {
|
fn round_trip() {
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
- -Iu4QMK9kcJ246666k9FlE_8IXy8NGP_zO-M8hN4di66eZNjBhoipKSoZaJnHZERnb-0aZ4U4UMPT-We7yx1sfMdbeEDgmlkgnY0gmlwhDbOLfeJc2VjcDI1NmsxoQLVqNEoCVTC74VmUx25USyFe7lL0TgpXHaCX9CDy9H6boN0Y3CCIyiDdWRwgiMo
|
|
||||||
- -Iu4QB2V3Y21rbjnId2ZqpssdcQlKB49prr-ggq2smRJLg0xc5_7ar6GfuQkbnlj1LBHKY3l__Lkk8aIM29VgpLCDBgBgmlkgnY0gmlwhCOhiGqJc2VjcDI1NmsxoQMrmBYg_yR_ZKZKoLiChvlpNqdwXwodXmgw_TRow7RVwYN0Y3CCIyiDdWRwgiMo
|
|
||||||
- -Iu4QCCuoEoHoOyYO728lOOiMqVZsNs_jd-uhj6_kiuBUySwYtHQLVkycNu8o-4oCzr-ql1u_n8g6tCw3ZXAEf0U008BgmlkgnY0gmlwhA01ZgSJc2VjcDI1NmsxoQPk2OMW7stSjbdcMgrKEdFOLsRkIuxgBFryA3tIJM0YxYN0Y3CCIyiDdWRwgiMo
|
|
||||||
- -Iu4QF5vgIx1BDlqFKAiAeejWPphhc_OeHDzM5feKhibcyWHLlDlov8E8L7MDJ8dQvCyaCynJGf0eWUfo5pzLhM_e8QBgmlkgnY0gmlwhDRCMUyJc2VjcDI1NmsxoQJZ8jY1HYauxirnJkVI32FoN7_7KrE05asCkZb7nj_b-YN0Y3CCIyiDdWRwgiMo
|
|
@ -1,51 +0,0 @@
|
|||||||
FAR_FUTURE_EPOCH: 18446744073709551615
|
|
||||||
BASE_REWARDS_PER_EPOCH: 4
|
|
||||||
DEPOSIT_CONTRACT_TREE_DEPTH: 32
|
|
||||||
SECONDS_PER_DAY: 2400
|
|
||||||
MAX_COMMITTEES_PER_SLOT: 64
|
|
||||||
TARGET_COMMITTEE_SIZE: 128
|
|
||||||
MIN_PER_EPOCH_CHURN_LIMIT: 4
|
|
||||||
CHURN_LIMIT_QUOTIENT: 65536
|
|
||||||
SHUFFLE_ROUND_COUNT: 90
|
|
||||||
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384
|
|
||||||
MIN_GENESIS_TIME: 0
|
|
||||||
MIN_DEPOSIT_AMOUNT: 100
|
|
||||||
MAX_EFFECTIVE_BALANCE: 3200000000
|
|
||||||
EJECTION_BALANCE: 1600000000
|
|
||||||
EFFECTIVE_BALANCE_INCREMENT: 100000000
|
|
||||||
GENESIS_SLOT: 0
|
|
||||||
BLS_WITHDRAWAL_PREFIX: 0x00
|
|
||||||
SECONDS_PER_SLOT: 12
|
|
||||||
MIN_ATTESTATION_INCLUSION_DELAY: 1
|
|
||||||
MIN_SEED_LOOKAHEAD: 1
|
|
||||||
MAX_SEED_LOOKAHEAD: 4
|
|
||||||
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
|
|
||||||
PERSISTENT_COMMITTEE_PERIOD: 2048
|
|
||||||
MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4
|
|
||||||
BASE_REWARD_FACTOR: 64
|
|
||||||
WHISTLEBLOWER_REWARD_QUOTIENT: 512
|
|
||||||
PROPOSER_REWARD_QUOTIENT: 8
|
|
||||||
INACTIVITY_PENALTY_QUOTIENT: 33554432
|
|
||||||
MIN_SLASHING_PENALTY_QUOTIENT: 32
|
|
||||||
SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 8
|
|
||||||
DOMAIN_BEACON_PROPOSER: 0x00000000
|
|
||||||
DOMAIN_BEACON_ATTESTER: 0x01000000
|
|
||||||
DOMAIN_RANDAO: 0x02000000
|
|
||||||
DOMAIN_DEPOSIT: 0x03000000
|
|
||||||
DOMAIN_VOLUNTARY_EXIT: 0x04000000
|
|
||||||
JUSTIFICATION_BITS_LENGTH: 0x04000000
|
|
||||||
MAX_VALIDATORS_PER_COMMITTEE: 2048
|
|
||||||
GENESIS_EPOCH: 0
|
|
||||||
SLOTS_PER_EPOCH: 32
|
|
||||||
SLOTS_PER_ETH1_VOTING_PERIOD: 1024
|
|
||||||
SLOTS_PER_HISTORICAL_ROOT: 8192
|
|
||||||
EPOCHS_PER_HISTORICAL_VECTOR: 65536
|
|
||||||
EPOCHS_PER_SLASHINGS_VECTOR: 8192
|
|
||||||
HISTORICAL_ROOTS_LIMIT: 16777216
|
|
||||||
VALIDATOR_REGISTRY_LIMIT: 1099511627776
|
|
||||||
MAX_PROPOSER_SLASHINGS: 16
|
|
||||||
MAX_ATTESTER_SLASHINGS: 1
|
|
||||||
MAX_ATTESTATIONS: 128
|
|
||||||
MAX_DEPOSITS: 16
|
|
||||||
MAX_VOLUNTARY_EXITS: 16
|
|
||||||
ETH1_FOLLOW_DISTANCE: 16
|
|
@ -1 +0,0 @@
|
|||||||
1857277
|
|
@ -1 +0,0 @@
|
|||||||
0x74a03685a1cbc279efe4ea88b5a86d6cb0c6cedb
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user