Update testnet configs, change on-disk format (#1799)

## Issue Addressed

- Related to #1691

## Proposed Changes

- Add `DEPOSIT_CHAIN_ID` and `DEPOSIT_NETWORK_ID` to `config.yaml`.
    - Pass the `DEPOSIT_NETWORK_ID` to the `eth1::Service`.
- Remove the unused `MAX_EPOCHS_PER_CROSSLINK` from the `altona` and `medalla` configs (see [spec commit](2befe90032 (diff-efb845ac2ebd4aafbc23df40f47ce25699255064e99d36d0406d0a14ca7953ec))).
- Change from compressing the whole testnet directory, to only compressing the genesis state file. This is the only file we need to compress and *not* compressing the others makes them work nicely with git.
    - We can modify the boot nodes, configs, etc. without incurring an eternal binary-blob cost on our git history.
    - This change is backwards compatible (i.e., non-breaking).

## Additional Info

NA
This commit is contained in:
Paul Hauner 2020-10-25 22:15:46 +00:00
parent 7453f39d68
commit eba51f0973
29 changed files with 353 additions and 52 deletions

View File

@ -270,6 +270,7 @@ pub fn get_config<E: EthSpec>(
client_config.eth1.lowest_cached_block_number = client_config.eth1.lowest_cached_block_number =
client_config.eth1.deposit_contract_deploy_block; client_config.eth1.deposit_contract_deploy_block;
client_config.eth1.follow_distance = spec.eth1_follow_distance; client_config.eth1.follow_distance = spec.eth1_follow_distance;
client_config.eth1.network_id = spec.deposit_network_id.into();
if let Some(mut boot_nodes) = eth2_testnet_config.boot_enr { if let Some(mut boot_nodes) = eth2_testnet_config.boot_enr {
client_config.network.boot_nodes_enr.append(&mut boot_nodes) client_config.network.boot_nodes_enr.append(&mut boot_nodes)

View File

@ -3,6 +3,18 @@ use std::env;
use std::path::PathBuf; use std::path::PathBuf;
use types::ChainSpec; use types::ChainSpec;
// A macro is used to define this constant so it can be used with `include_bytes!`.
#[macro_export]
macro_rules! testnets_dir {
() => {
"built_in_testnet_configs"
};
}
pub const TESTNETS_DIR: &str = testnets_dir!();
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. /// The core configuration of a Lighthouse beacon node.
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)] #[serde(default)]
@ -51,33 +63,23 @@ impl Eth2Config {
pub struct Eth2NetArchiveAndDirectory<'a> { pub struct Eth2NetArchiveAndDirectory<'a> {
pub name: &'a str, pub name: &'a str,
pub unique_id: &'a str, pub unique_id: &'a str,
pub archive_name: &'a str,
pub genesis_is_known: bool, pub genesis_is_known: bool,
} }
impl<'a> Eth2NetArchiveAndDirectory<'a> { impl<'a> Eth2NetArchiveAndDirectory<'a> {
/// The directory that should be used to store files downloaded for this net. /// The directory that should be used to store files downloaded for this net.
fn pwd(&self) -> PathBuf { pub fn dir(&self) -> PathBuf {
env::var("CARGO_MANIFEST_DIR") env::var("CARGO_MANIFEST_DIR")
.expect("should know manifest dir") .expect("should know manifest dir")
.parse::<PathBuf>() .parse::<PathBuf>()
.expect("should parse manifest dir as path") .expect("should parse manifest dir as path")
.join(TESTNETS_DIR)
.join(self.unique_id)
} }
pub fn dir(&self) -> PathBuf { pub fn genesis_state_archive(&self) -> PathBuf {
self.pwd().join(self.unique_id) self.dir().join(GENESIS_ZIP_FILE_NAME)
} }
pub fn archive_fullpath(&self) -> PathBuf {
self.pwd().join(self.archive_name)
}
}
#[macro_export]
macro_rules! unique_id {
($name: tt) => {
concat!("testnet_", $name);
};
} }
macro_rules! define_net { macro_rules! define_net {
@ -88,8 +90,7 @@ macro_rules! define_net {
pub const ETH2_NET_DIR: Eth2NetArchiveAndDirectory = Eth2NetArchiveAndDirectory { pub const ETH2_NET_DIR: Eth2NetArchiveAndDirectory = Eth2NetArchiveAndDirectory {
name: $name, name: $name,
unique_id: unique_id!($name), unique_id: $name,
archive_name: concat!(unique_id!($name), ".zip"),
genesis_is_known: $genesis_is_known, genesis_is_known: $genesis_is_known,
}; };
@ -98,7 +99,15 @@ macro_rules! define_net {
#[macro_export] #[macro_export]
macro_rules! $macro_title { macro_rules! $macro_title {
($base_dir: tt, $filename: tt) => { ($base_dir: tt, $filename: tt) => {
include_bytes!(concat!($base_dir, unique_id!($name), "/", $filename)) include_bytes!(concat!(
$base_dir,
"/",
testnets_dir!(),
"/",
$name,
"/",
$filename
))
}; };
} }
} }

View File

@ -1,4 +1,5 @@
testnet*/* testnet*/*
schlesi-* schlesi-*
witti-* witti-*
altona* /altona*
built_in_testnet_configs/*/genesis.ssz

View File

@ -1,7 +1,8 @@
//! Downloads a testnet configuration from Github. //! Downloads a testnet configuration from Github.
use eth2_config::{altona, medalla, spadina, zinken, Eth2NetArchiveAndDirectory}; use eth2_config::{
use std::fs; altona, medalla, spadina, zinken, Eth2NetArchiveAndDirectory, GENESIS_FILE_NAME,
};
use std::fs::File; use std::fs::File;
use std::io; use std::io;
use zip::ZipArchive; use zip::ZipArchive;
@ -15,42 +16,41 @@ const ETH2_NET_DIRS: &[Eth2NetArchiveAndDirectory<'static>] = &[
fn main() { fn main() {
for testnet in ETH2_NET_DIRS { for testnet in ETH2_NET_DIRS {
match uncompress(testnet) { match uncompress_state(testnet) {
Ok(()) => (), Ok(()) => (),
Err(e) => panic!("Failed to uncompress testnet zip file: {}", e), Err(e) => panic!(
"Failed to uncompress {} genesis state zip file: {}",
testnet.name, e
),
} }
} }
} }
/// Uncompress the testnet configs archive into a testnet configs folder. /// Uncompress the testnet configs archive into a testnet configs folder.
fn uncompress(testnet: &Eth2NetArchiveAndDirectory<'static>) -> Result<(), String> { fn uncompress_state(testnet: &Eth2NetArchiveAndDirectory<'static>) -> Result<(), String> {
let archive_file = File::open(&testnet.archive_fullpath()) let archive_path = testnet.genesis_state_archive();
.map_err(|e| format!("Failed to open archive file: {:?}", e))?; let archive_file = File::open(&archive_path)
.map_err(|e| format!("Failed to open archive file {:?}: {:?}", archive_path, e))?;
let mut archive = let mut archive =
ZipArchive::new(archive_file).map_err(|e| format!("Error with zip file: {}", e))?; ZipArchive::new(archive_file).map_err(|e| format!("Error with zip file: {}", e))?;
// Create testnet dir if testnet.genesis_is_known {
fs::create_dir_all(testnet.dir()) let mut file = archive.by_name(GENESIS_FILE_NAME).map_err(|e| {
.map_err(|e| format!("Failed to create testnet directory: {:?}", e))?; format!(
"Error retrieving file {} inside zip: {}",
// Create empty genesis.ssz if genesis is unknown GENESIS_FILE_NAME, e
if !testnet.genesis_is_known { )
File::create(testnet.dir().join("genesis.ssz")) })?;
.map_err(|e| format!("Failed to create genesis.ssz: {}", e))?; let path = testnet.dir().join(GENESIS_FILE_NAME);
}
for i in 0..archive.len() {
let mut file = archive
.by_index(i)
.map_err(|e| format!("Error retrieving file {} inside zip: {}", i, e))?;
let path = testnet.dir().join(file.name());
let mut outfile = File::create(&path) let mut outfile = File::create(&path)
.map_err(|e| format!("Error while creating file {:?}: {}", path, e))?; .map_err(|e| format!("Error while creating file {:?}: {}", path, e))?;
io::copy(&mut file, &mut outfile) io::copy(&mut file, &mut outfile)
.map_err(|e| format!("Error writing file {:?}: {}", path, e))?; .map_err(|e| format!("Error writing file {:?}: {}", path, e))?;
} else {
// Create empty genesis.ssz if genesis is unknown
File::create(testnet.dir().join(GENESIS_FILE_NAME))
.map_err(|e| format!("Failed to create {}: {}", GENESIS_FILE_NAME, e))?;
} }
Ok(()) Ok(())

View File

@ -0,0 +1,10 @@
- enr:-LK4QFtV7Pz4reD5a7cpfi1z6yPrZ2I9eMMU5mGQpFXLnLoKZW8TXvVubShzLLpsEj6aayvVO1vFx-MApijD3HLPhlECh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD6etXjAAABIf__________gmlkgnY0gmlwhDMPYfCJc2VjcDI1NmsxoQIerw_qBc9apYfZqo2awiwS930_vvmGnW2psuHsTzrJ8YN0Y3CCIyiDdWRwgiMo
- enr:-LK4QPVkFd_MKzdW0219doTZryq40tTe8rwWYO75KDmeZM78fBskGsfCuAww9t8y3u0Q0FlhXOhjE1CWpx3SGbUaU80Ch2F0dG5ldHOIAAAAAAAAAACEZXRoMpD6etXjAAABIf__________gmlkgnY0gmlwhDMPRgeJc2VjcDI1Nms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UNT: 90
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 640
MIN_GENESIS_TIME: 1593433800
HYSTERESIS_QUOTIENT: 4
HYSTERESIS_DOWNWARD_MULTIPLIER: 1
HYSTERESIS_UPWARD_MULTIPLIER: 5
SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 8
ETH1_FOLLOW_DISTANCE: 1024
TARGET_AGGREGATORS_PER_COMMITTEE: 16
RANDOM_SUBNETS_PER_VALIDATOR: 1
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 256
SECONDS_PER_ETH1_BLOCK: 14
DEPOSIT_CONTRACT_ADDRESS: 0x16e82D77882A663454Ef92806b7DeCa1D394810f
MIN_DEPOSIT_AMOUNT: 1000000000
MAX_EFFECTIVE_BALANCE: 32000000000
EJECTION_BALANCE: 16000000000
EFFECTIVE_BALANCE_INCREMENT: 1000000000
GENESIS_FORK_VERSION: 0x00000121
BLS_WITHDRAWAL_PREFIX: 0x00
GENESIS_DELAY: 172800
SECONDS_PER_SLOT: 12
MIN_ATTESTATION_INCLUSION_DELAY: 1
SLOTS_PER_EPOCH: 32
MIN_SEED_LOOKAHEAD: 1
MAX_SEED_LOOKAHEAD: 4
EPOCHS_PER_ETH1_VOTING_PERIOD: 32
SLOTS_PER_HISTORICAL_ROOT: 8192
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
SHARD_COMMITTEE_PERIOD: 256
MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4
EPOCHS_PER_HISTORICAL_VECTOR: 65536
EPOCHS_PER_SLASHINGS_VECTOR: 8192
HISTORICAL_ROOTS_LIMIT: 16777216
VALIDATOR_REGISTRY_LIMIT: 1099511627776
BASE_REWARD_FACTOR: 64
WHISTLEBLOWER_REWARD_QUOTIENT: 512
PROPOSER_REWARD_QUOTIENT: 8
INACTIVITY_PENALTY_QUOTIENT: 16777216
MIN_SLASHING_PENALTY_QUOTIENT: 32
MAX_PROPOSER_SLASHINGS: 16
MAX_ATTESTER_SLASHINGS: 2
MAX_ATTESTATIONS: 128
MAX_DEPOSITS: 16
MAX_VOLUNTARY_EXITS: 16
DOMAIN_BEACON_PROPOSER: 0x00000000
DOMAIN_BEACON_ATTESTER: 0x01000000
DOMAIN_RANDAO: 0x02000000
DOMAIN_DEPOSIT: 0x03000000
DOMAIN_VOLUNTARY_EXIT: 0x04000000
DOMAIN_SELECTION_PROOF: 0x05000000
DOMAIN_AGGREGATE_AND_PROOF: 0x06000000
DEPOSIT_CHAIN_ID: 5
DEPOSIT_NETWORK_ID: 5

View File

@ -0,0 +1 @@
0x16e82D77882A663454Ef92806b7DeCa1D394810f

View File

@ -0,0 +1,10 @@
- enr:-LK4QKWk9yZo258PQouLshTOEEGWVHH7GhKwpYmB5tmKE4eHeSfman0PZvM2Rpp54RWgoOagAsOfKoXgZSbiCYzERWABh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAAAAAAAAAAAAAAAAAAAAAAgmlkgnY0gmlwhDQlA5CJc2VjcDI1NmsxoQOYiWqrQtQksTEtS3qY6idxJE5wkm0t9wKqpzv2gCR21oN0Y3CCIyiDdWRwgiMo
- enr:-LK4QEnIS-PIxxLCadJdnp83VXuJqgKvC9ZTIWaJpWqdKlUFCiup2sHxWihF9EYGlMrQLs0mq_2IyarhNq38eoaOHUoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAAAAAAAAAAAAAAAAAAAAAAgmlkgnY0gmlwhA37LMaJc2VjcDI1NmsxoQJ7k0mKtTd_kdEq251flOjD1HKpqgMmIETDoD-Msy_O-4N0Y3CCIyiDdWRwgiMo
- enr:-KG4QIOJRu0BBlcXJcn3lI34Ub1aBLYipbnDaxBnr2uf2q6nE1TWnKY5OAajg3eG6mHheQSfRhXLuy-a8V5rqXKSoUEChGV0aDKQGK5MywAAAAH__________4JpZIJ2NIJpcIQKAAFhiXNlY3AyNTZrMaEDESplmV9c2k73v0DjxVXJ6__2bWyP-tK28_80lf7dUhqDdGNwgiMog3VkcIIjKA
- enr:-Ku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MPRgeJc2VjcDI1NmsxoQPjXTGx3HkaCG2neFxJmaTn5eCgbra3LY1twCeXPHChL4N0Y3CCIyiDdWRwgiMo
- enr:-Ku4QFVactU18ogiqPPasKs3jhUm5ISszUrUMK2c6SUPbGtANXVJ2wFapsKwVEVnVKxZ7Gsr9yEc4PYF-a14ahPa1q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhGQbAHyJc2VjcDI1NmsxoQILF-Ya2i5yowVkQtlnZLjG0kqC4qtwmSk8ha7tKLuME4N1ZHCCIyg

View File

@ -0,0 +1,58 @@
MAX_COMMITTEES_PER_SLOT: 64
TARGET_COMMITTEE_SIZE: 128
MAX_VALIDATORS_PER_COMMITTEE: 2048
MIN_PER_EPOCH_CHURN_LIMIT: 4
CHURN_LIMIT_QUOTIENT: 65536
SHUFFLE_ROUND_COUNT: 90
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384
MIN_GENESIS_TIME: 1596546000
HYSTERESIS_QUOTIENT: 4
HYSTERESIS_DOWNWARD_MULTIPLIER: 1
HYSTERESIS_UPWARD_MULTIPLIER: 5
SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 8
ETH1_FOLLOW_DISTANCE: 1024
TARGET_AGGREGATORS_PER_COMMITTEE: 16
RANDOM_SUBNETS_PER_VALIDATOR: 1
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 256
SECONDS_PER_ETH1_BLOCK: 14
DEPOSIT_CONTRACT_ADDRESS: 0x07b39F4fDE4A38bACe212b546dAc87C58DfE3fDC
MIN_DEPOSIT_AMOUNT: 1000000000
MAX_EFFECTIVE_BALANCE: 32000000000
EJECTION_BALANCE: 16000000000
EFFECTIVE_BALANCE_INCREMENT: 1000000000
GENESIS_FORK_VERSION: 0x00000001
BLS_WITHDRAWAL_PREFIX: 0x00
GENESIS_DELAY: 172800
SECONDS_PER_SLOT: 12
MIN_ATTESTATION_INCLUSION_DELAY: 1
SLOTS_PER_EPOCH: 32
MIN_SEED_LOOKAHEAD: 1
MAX_SEED_LOOKAHEAD: 4
EPOCHS_PER_ETH1_VOTING_PERIOD: 32
SLOTS_PER_HISTORICAL_ROOT: 8192
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
SHARD_COMMITTEE_PERIOD: 256
MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4
EPOCHS_PER_HISTORICAL_VECTOR: 65536
EPOCHS_PER_SLASHINGS_VECTOR: 8192
HISTORICAL_ROOTS_LIMIT: 16777216
VALIDATOR_REGISTRY_LIMIT: 1099511627776
BASE_REWARD_FACTOR: 64
WHISTLEBLOWER_REWARD_QUOTIENT: 512
PROPOSER_REWARD_QUOTIENT: 8
INACTIVITY_PENALTY_QUOTIENT: 16777216
MIN_SLASHING_PENALTY_QUOTIENT: 32
MAX_PROPOSER_SLASHINGS: 16
MAX_ATTESTER_SLASHINGS: 2
MAX_ATTESTATIONS: 128
MAX_DEPOSITS: 16
MAX_VOLUNTARY_EXITS: 16
DOMAIN_BEACON_PROPOSER: 0x00000000
DOMAIN_BEACON_ATTESTER: 0x01000000
DOMAIN_RANDAO: 0x02000000
DOMAIN_DEPOSIT: 0x03000000
DOMAIN_VOLUNTARY_EXIT: 0x04000000
DOMAIN_SELECTION_PROOF: 0x05000000
DOMAIN_AGGREGATE_AND_PROOF: 0x06000000
DEPOSIT_CHAIN_ID: 5
DEPOSIT_NETWORK_ID: 5

View File

@ -0,0 +1 @@
0x07b39F4fDE4A38bACe212b546dAc87C58DfE3fDC

View File

@ -0,0 +1,8 @@
# Lighthouse
- enr:-KG4QEPVpcw8HLNsDuqNPIx4sXLCUsuDOHVtPcNmgSewWcDgSkd6s-vGCXlac86BTYIU8sYqhvD-ZeTW1uG5OtEBm-QDhGV0aDKQCfsKEgAAAAL__________4JpZIJ2NIJpcIQ0ECjWiXNlY3AyNTZrMaEDCavdC37lb2fgBgKrvrLRZ-ZvL6JFNeUHHc5TXZ_BYqmDdGNwgiMog3VkcIIjKA
# teku
- enr:-KG4QA-EcFfXQsL2dcneG8vp8HTWLrpwHQ5HhfyIytfpeKOISzROy2kYSsf_v-BZKnIx5XHDjqJ-ttz0hoz6qJA7tasEhGV0aDKQxKgkDQAAAAL__________4JpZIJ2NIJpcIQDFt-UiXNlY3AyNTZrMaECkR4C5DVO_9rB48eHTY4kdyOHsguTEDlvb7Ce0_mvghSDdGNwgiMog3VkcIIjKA
# prysm
- enr:-Ku4QGQJf2bcDAwVGvbvtq3AB4KKwAvStTenY-i_QnW2ABNRRBncIU_5qR_e_um-9t3s9g-Y5ZfFATj1nhtzq6lvgc4Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDEqCQNAAAAAv__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQNoed9JnQh7ltcAacHEGOjwocL1BhMQbYTgaPX0kFuXtIN1ZHCCE4g
# proto
- enr:-Ku4QFW1SLbtzJ_ghQQC8-8xezvZ1Mx95J-zer9IPmDE2BKeD_SM7j4vH6xmroUFVuyK-54n2Ey2ueB-Lf-fkbcLwAQBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDEqCQNAAAAAv__________gmlkgnY0gmlwhGQZkSyJc2VjcDI1NmsxoQJMcbZhTCEKYSH5-qPQPgYfSHHUMLGBAKU-f-96yYKFMIN1ZHCCIyg

View File

@ -0,0 +1,59 @@
MAX_COMMITTEES_PER_SLOT: 64
TARGET_COMMITTEE_SIZE: 128
MAX_VALIDATORS_PER_COMMITTEE: 2048
MIN_PER_EPOCH_CHURN_LIMIT: 4
CHURN_LIMIT_QUOTIENT: 65536
SHUFFLE_ROUND_COUNT: 90
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 1024
MIN_GENESIS_TIME: 1601380800
HYSTERESIS_QUOTIENT: 4
HYSTERESIS_DOWNWARD_MULTIPLIER: 1
HYSTERESIS_UPWARD_MULTIPLIER: 5
PROPORTIONAL_SLASHING_MULTIPLIER: 3
SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 8
ETH1_FOLLOW_DISTANCE: 1024
TARGET_AGGREGATORS_PER_COMMITTEE: 16
RANDOM_SUBNETS_PER_VALIDATOR: 1
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 256
SECONDS_PER_ETH1_BLOCK: 14
DEPOSIT_CHAIN_ID: 5
DEPOSIT_NETWORK_ID: 5
DEPOSIT_CONTRACT_ADDRESS: 0x48B597F4b53C21B48AD95c7256B49D1779Bd5890
MIN_DEPOSIT_AMOUNT: 1000000000
MAX_EFFECTIVE_BALANCE: 32000000000
EJECTION_BALANCE: 16000000000
EFFECTIVE_BALANCE_INCREMENT: 1000000000
GENESIS_FORK_VERSION: 0x00000002
BLS_WITHDRAWAL_PREFIX: 0x00
GENESIS_DELAY: 172800
SECONDS_PER_SLOT: 12
MIN_ATTESTATION_INCLUSION_DELAY: 1
SLOTS_PER_EPOCH: 32
MIN_SEED_LOOKAHEAD: 1
MAX_SEED_LOOKAHEAD: 4
EPOCHS_PER_ETH1_VOTING_PERIOD: 32
SLOTS_PER_HISTORICAL_ROOT: 8192
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
SHARD_COMMITTEE_PERIOD: 256
MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4
EPOCHS_PER_HISTORICAL_VECTOR: 65536
EPOCHS_PER_SLASHINGS_VECTOR: 8192
HISTORICAL_ROOTS_LIMIT: 16777216
VALIDATOR_REGISTRY_LIMIT: 1099511627776
BASE_REWARD_FACTOR: 64
WHISTLEBLOWER_REWARD_QUOTIENT: 512
PROPOSER_REWARD_QUOTIENT: 8
INACTIVITY_PENALTY_QUOTIENT: 16777216
MIN_SLASHING_PENALTY_QUOTIENT: 32
MAX_PROPOSER_SLASHINGS: 16
MAX_ATTESTER_SLASHINGS: 2
MAX_ATTESTATIONS: 128
MAX_DEPOSITS: 16
MAX_VOLUNTARY_EXITS: 16
DOMAIN_BEACON_PROPOSER: 0x00000000
DOMAIN_BEACON_ATTESTER: 0x01000000
DOMAIN_RANDAO: 0x02000000
DOMAIN_DEPOSIT: 0x03000000
DOMAIN_VOLUNTARY_EXIT: 0x04000000
DOMAIN_SELECTION_PROOF: 0x05000000
DOMAIN_AGGREGATE_AND_PROOF: 0x06000000

View File

@ -0,0 +1 @@
0x48B597F4b53C21B48AD95c7256B49D1779Bd5890

View File

@ -0,0 +1,4 @@
- enr:-KG4QHPtVnKHEOkEJT1f5C6Hs-C_c4SlipTfkPrDIikLTzhqA_3m6bTq-CirsljlVP4IJybXelHE7J3l9DojR14_ZHUGhGV0aDKQ2jUIggAAAAP__________4JpZIJ2NIJpcIQSv2qciXNlY3AyNTZrMaECi_CNPDkKPilhimY7aEY-mBtSzI8AKMDvvv_I2Un74_qDdGNwgiMog3VkcIIjKA
- enr:-Ku4QH63huZ12miIY0kLI9dunG5fwKpnn-zR3XyA_kH6rQpRD1VoyLyzIcFysCJ09JDprdX-EzXp-Nc8swYqBznkXggBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDaNQiCAAAAA___________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQILqxBY-_SF8o_5FjFD3yM92s50zT_ciFi8hStde5AEjIN1ZHCCH0A
- enr:-Ku4QMGGAuQO8NPhYCz29wsahrFR-betfxKx6ltyzLUM70yJWoaRjJZ-n1Oiof2PiKnzjVG1n6RoyO4ZNJkQtqEkqNkBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDaNQiCAAAAA___________gmlkgnY0gmlwhDZUyU6Jc2VjcDI1NmsxoQNMOowBnXeUYjK71_Zz78j3y7EYKSXH9ZGhYB4wB6V8lIN1ZHCCIyg
- enr:-KG4QDCt7b_zpzEoKEATUYgvdfBy28DCtGs54E4U_IIKd5e1Pj71nUAJKqdNjjqH5L8wNVsGNI67dzX5_ATfVMHQ7ygChGV0aDKQufleewAAAAP__________4JpZIJ2NIJpcIQ0ECjWiXNlY3AyNTZrMaEC64bJmIc-R6ynv5PqUqMBjblHILK46WWi4bbXO9DAGbeDdGNwgiMog3VkcIIjKA

View File

@ -0,0 +1,60 @@
CONFIG_NAME: "zinken"
MAX_COMMITTEES_PER_SLOT: 64
TARGET_COMMITTEE_SIZE: 128
MAX_VALIDATORS_PER_COMMITTEE: 2048
MIN_PER_EPOCH_CHURN_LIMIT: 4
CHURN_LIMIT_QUOTIENT: 65536
SHUFFLE_ROUND_COUNT: 90
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 1024
MIN_GENESIS_TIME: 1602504000
HYSTERESIS_QUOTIENT: 4
HYSTERESIS_DOWNWARD_MULTIPLIER: 1
HYSTERESIS_UPWARD_MULTIPLIER: 5
PROPORTIONAL_SLASHING_MULTIPLIER: 3
SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 8
ETH1_FOLLOW_DISTANCE: 1024
TARGET_AGGREGATORS_PER_COMMITTEE: 16
RANDOM_SUBNETS_PER_VALIDATOR: 1
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 256
SECONDS_PER_ETH1_BLOCK: 14
DEPOSIT_CHAIN_ID: 5
DEPOSIT_NETWORK_ID: 5
DEPOSIT_CONTRACT_ADDRESS: 0x99F0Ec06548b086E46Cb0019C78D0b9b9F36cD53
MIN_DEPOSIT_AMOUNT: 1000000000
MAX_EFFECTIVE_BALANCE: 32000000000
EJECTION_BALANCE: 16000000000
EFFECTIVE_BALANCE_INCREMENT: 1000000000
GENESIS_FORK_VERSION: 0x00000003
BLS_WITHDRAWAL_PREFIX: 0x00
GENESIS_DELAY: 345600
SECONDS_PER_SLOT: 12
MIN_ATTESTATION_INCLUSION_DELAY: 1
SLOTS_PER_EPOCH: 32
MIN_SEED_LOOKAHEAD: 1
MAX_SEED_LOOKAHEAD: 4
EPOCHS_PER_ETH1_VOTING_PERIOD: 32
SLOTS_PER_HISTORICAL_ROOT: 8192
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
SHARD_COMMITTEE_PERIOD: 256
MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4
EPOCHS_PER_HISTORICAL_VECTOR: 65536
EPOCHS_PER_SLASHINGS_VECTOR: 8192
HISTORICAL_ROOTS_LIMIT: 16777216
VALIDATOR_REGISTRY_LIMIT: 1099511627776
BASE_REWARD_FACTOR: 64
WHISTLEBLOWER_REWARD_QUOTIENT: 512
PROPOSER_REWARD_QUOTIENT: 8
INACTIVITY_PENALTY_QUOTIENT: 16777216
MIN_SLASHING_PENALTY_QUOTIENT: 32
MAX_PROPOSER_SLASHINGS: 16
MAX_ATTESTER_SLASHINGS: 2
MAX_ATTESTATIONS: 128
MAX_DEPOSITS: 16
MAX_VOLUNTARY_EXITS: 16
DOMAIN_BEACON_PROPOSER: 0x00000000
DOMAIN_BEACON_ATTESTER: 0x01000000
DOMAIN_RANDAO: 0x02000000
DOMAIN_DEPOSIT: 0x03000000
DOMAIN_VOLUNTARY_EXIT: 0x04000000
DOMAIN_SELECTION_PROOF: 0x05000000
DOMAIN_AGGREGATE_AND_PROOF: 0x06000000

View File

@ -0,0 +1 @@
0x99F0Ec06548b086E46Cb0019C78D0b9b9F36cD53

View File

@ -8,7 +8,8 @@
//! https://github.com/sigp/lighthouse/pull/605 //! https://github.com/sigp/lighthouse/pull/605
//! //!
use eth2_config::{ use eth2_config::{
include_altona_file, include_medalla_file, include_spadina_file, include_zinken_file, unique_id, include_altona_file, include_medalla_file, include_spadina_file, include_zinken_file,
testnets_dir,
}; };
use enr::{CombinedKey, Enr}; use enr::{CombinedKey, Enr};
@ -26,7 +27,6 @@ pub const YAML_CONFIG_FILE: &str = "config.yaml";
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
pub struct HardcodedNet { pub struct HardcodedNet {
pub unique_id: &'static str,
pub name: &'static str, pub name: &'static str,
pub genesis_is_known: bool, pub genesis_is_known: bool,
pub yaml_config: &'static [u8], pub yaml_config: &'static [u8],
@ -41,7 +41,6 @@ macro_rules! define_net {
use eth2_config::$mod::ETH2_NET_DIR; use eth2_config::$mod::ETH2_NET_DIR;
HardcodedNet { HardcodedNet {
unique_id: ETH2_NET_DIR.unique_id,
name: ETH2_NET_DIR.name, name: ETH2_NET_DIR.name,
genesis_is_known: ETH2_NET_DIR.genesis_is_known, genesis_is_known: ETH2_NET_DIR.genesis_is_known,
yaml_config: $include_file!("../", "config.yaml"), yaml_config: $include_file!("../", "config.yaml"),
@ -259,8 +258,14 @@ mod tests {
#[test] #[test]
fn hard_coded_nets_work() { fn hard_coded_nets_work() {
for net in HARDCODED_NETS { for net in HARDCODED_NETS {
let config = Eth2TestnetConfig::<E>::from_hardcoded_net(net).unwrap(); let config =
assert_eq!(config.genesis_state.is_some(), net.genesis_is_known); Eth2TestnetConfig::<E>::from_hardcoded_net(net).expect(&format!("{:?}", net.name));
assert_eq!(
config.genesis_state.is_some(),
net.genesis_is_known,
"{:?}",
net.name
);
} }
} }

View File

@ -108,6 +108,8 @@ pub struct ChainSpec {
*/ */
pub eth1_follow_distance: u64, pub eth1_follow_distance: u64,
pub seconds_per_eth1_block: u64, pub seconds_per_eth1_block: u64,
pub deposit_chain_id: u64,
pub deposit_network_id: u64,
pub deposit_contract_address: Address, pub deposit_contract_address: Address,
/* /*
@ -320,6 +322,8 @@ impl ChainSpec {
*/ */
eth1_follow_distance: 1_024, eth1_follow_distance: 1_024,
seconds_per_eth1_block: 14, seconds_per_eth1_block: 14,
deposit_chain_id: 1,
deposit_network_id: 1,
deposit_contract_address: "1234567890123456789012345678901234567890" deposit_contract_address: "1234567890123456789012345678901234567890"
.parse() .parse()
.expect("chain spec deposit contract address"), .expect("chain spec deposit contract address"),
@ -357,6 +361,8 @@ impl ChainSpec {
milliseconds_per_slot: 6_000, milliseconds_per_slot: 6_000,
safe_slots_to_update_justified: 2, safe_slots_to_update_justified: 2,
network_id: 2, // lighthouse testnet network id network_id: 2, // lighthouse testnet network id
deposit_chain_id: 5,
deposit_network_id: 5,
boot_nodes, boot_nodes,
..ChainSpec::mainnet() ..ChainSpec::mainnet()
} }
@ -440,7 +446,7 @@ mod tests {
/// ///
/// Spec v0.12.3 /// Spec v0.12.3
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(rename_all = "UPPERCASE")] #[serde(rename_all = "UPPERCASE", deny_unknown_fields)]
pub struct YamlConfig { pub struct YamlConfig {
#[serde(default)] #[serde(default)]
config_name: String, config_name: String,
@ -562,11 +568,11 @@ pub struct YamlConfig {
epochs_per_random_subnet_subscription: u64, epochs_per_random_subnet_subscription: u64,
#[serde(with = "serde_utils::quoted_u64")] #[serde(with = "serde_utils::quoted_u64")]
seconds_per_eth1_block: u64, seconds_per_eth1_block: u64,
deposit_contract_address: Address, #[serde(with = "serde_utils::quoted_u64")]
/* TODO: incorporate these into ChainSpec and turn on `serde(deny_unknown_fields)`
deposit_chain_id: u64, deposit_chain_id: u64,
#[serde(with = "serde_utils::quoted_u64")]
deposit_network_id: u64, deposit_network_id: u64,
*/ deposit_contract_address: Address,
} }
// Compatibility shim for proportional slashing multpilier on Altona and Medalla. // Compatibility shim for proportional slashing multpilier on Altona and Medalla.
@ -648,6 +654,8 @@ impl YamlConfig {
random_subnets_per_validator: spec.random_subnets_per_validator, random_subnets_per_validator: spec.random_subnets_per_validator,
epochs_per_random_subnet_subscription: spec.epochs_per_random_subnet_subscription, epochs_per_random_subnet_subscription: spec.epochs_per_random_subnet_subscription,
seconds_per_eth1_block: spec.seconds_per_eth1_block, seconds_per_eth1_block: spec.seconds_per_eth1_block,
deposit_chain_id: spec.deposit_chain_id,
deposit_network_id: spec.deposit_network_id,
deposit_contract_address: spec.deposit_contract_address, deposit_contract_address: spec.deposit_contract_address,
} }
} }
@ -768,6 +776,8 @@ impl YamlConfig {
genesis_slot: chain_spec.genesis_slot, genesis_slot: chain_spec.genesis_slot,
far_future_epoch: chain_spec.far_future_epoch, far_future_epoch: chain_spec.far_future_epoch,
base_rewards_per_epoch: chain_spec.base_rewards_per_epoch, base_rewards_per_epoch: chain_spec.base_rewards_per_epoch,
deposit_chain_id: chain_spec.deposit_chain_id,
deposit_network_id: chain_spec.deposit_network_id,
deposit_contract_tree_depth: chain_spec.deposit_contract_tree_depth, deposit_contract_tree_depth: chain_spec.deposit_contract_tree_depth,
}) })
} }