Add Pyrmont testnet (#1904)

## Issue Addressed

NA

## Proposed Changes

- Replace Zinken with Pyrmont (Zinken has been sun-setted).
- Ensure Mainnet is build in the build script.

## Additional Info

NA
This commit is contained in:
Paul Hauner 2020-11-16 05:11:35 +00:00
parent eb56140582
commit fe71f25c3a
18 changed files with 190 additions and 94 deletions

View File

@ -12,7 +12,7 @@ DEPOSITS WITH LIGHTHOUSE. 🚨🚨🚨**
Lighthouse supports four testnets:
- [Medalla](https://github.com/goerli/medalla/tree/master/medalla) (default)
- [Zinken](https://github.com/goerli/medalla/tree/master/zinken)
- [Pyrmont](https://github.com/protolambda/pyrmont)
- [Spadina](https://github.com/goerli/medalla/tree/master/spadina) (deprecated)
- [Altona](https://github.com/goerli/medalla/tree/master/altona) (deprecated)
@ -20,7 +20,7 @@ When using Lighthouse, the `--testnet` flag selects a testnet. E.g.,
- `lighthouse` (no flag): Medalla.
- `lighthouse --testnet medalla`: Medalla.
- `lighthouse --testnet zinken`: Zinken.
- `lighthouse --testnet pyrmont`: Pyrmont.
Using the correct `--testnet` flag is very important; using the wrong flag can
result in penalties, slashings or lost deposits. As a rule of thumb, always
@ -48,7 +48,7 @@ setting aside one or two hours for this process.
The Ethereum Foundation provides an "Eth2 launch pad" for each active testnet:
- [Medalla launchpad](https://medalla.launchpad.ethereum.org/)
- [Zinken launchpad](https://zinken.launchpad.ethereum.org/)
- [Pyrmont launchpad](https://pyrmont.launchpad.ethereum.org/)
Please follow the steps on the appropriate launch pad site to generate
validator keys and submit deposits. Make sure you select "Lighthouse" as your
@ -120,7 +120,7 @@ lighthouse --testnet MY_TESTNET vc
```
> Note: `~/.lighthouse/{testnet}` is the default directory which contains the keys and databases.
> To specify a custom dir, see [this](#custom-directories) section
> To specify a custom dir, see [this](#custom-directories) section
#### Docker users
@ -173,7 +173,7 @@ Happy staking!
Users can override the default Lighthouse data directories (`~/.lighthouse/{testnet}`) using the `--datadir` flag. The custom data directory mirrors the structure of any testnet specific default directory (e.g. `~/.lighthouse/medalla`).
> Note: Users should specify different custom directories for different testnets.
> Note: Users should specify different custom directories for different testnets.
Below is an example flow for importing validator keys, running a beacon node and validator client using a custom data directory `/var/lib/my-custom-dir` for the medalla testnet.
@ -182,5 +182,5 @@ lighthouse --testnet medalla --datadir /var/lib/my-custom-dir account validator
lighthouse --testnet medalla --datadir /var/lib/my-custom-dir bn --staking
lighthouse --testnet medalla --datadir /var/lib/my-custom-dir vc
```
The first step creates a `validators` directory under `/var/lib/my-custom-dir` which contains the imported keys and [`validator_definitions.yml`](./validator-management.md).
After that, we simply run the beacon chain and validator client with the custom dir path.
The first step creates a `validators` directory under `/var/lib/my-custom-dir` which contains the imported keys and [`validator_definitions.yml`](./validator-management.md).
After that, we simply run the beacon chain and validator client with the custom dir path.

View File

@ -39,13 +39,13 @@ The exit phrase is the following:
Below is an example for initiating a voluntary exit on the zinken testnet.
Below is an example for initiating a voluntary exit on the Pyrmont testnet.
```
$ lighthouse --testnet zinken account validator exit --keystore /path/to/keystore --beacon-node http://localhost:5052
$ lighthouse --testnet pyrmont account validator exit --keystore /path/to/keystore --beacon-node http://localhost:5052
Running account manager for zinken testnet
validator-dir path: ~/.lighthouse/zinken/validators
Running account manager for pyrmont testnet
validator-dir path: ~/.lighthouse/pyrmont/validators
Enter the keystore password for validator in 0xabcd

View File

@ -120,7 +120,7 @@ define_net!(medalla, include_medalla_file, "medalla", true);
define_net!(spadina, include_spadina_file, "spadina", true);
define_net!(zinken, include_zinken_file, "zinken", true);
define_net!(pyrmont, include_pyrmont_file, "pyrmont", true);
define_net!(mainnet, include_mainnet_file, "mainnet", false);

View File

@ -1,7 +1,8 @@
//! Downloads a testnet configuration from Github.
use eth2_config::{
altona, medalla, spadina, toledo, zinken, Eth2NetArchiveAndDirectory, GENESIS_FILE_NAME,
altona, mainnet, medalla, pyrmont, spadina, toledo, Eth2NetArchiveAndDirectory,
GENESIS_FILE_NAME,
};
use std::fs::File;
use std::io;
@ -11,7 +12,8 @@ const ETH2_NET_DIRS: &[Eth2NetArchiveAndDirectory<'static>] = &[
altona::ETH2_NET_DIR,
medalla::ETH2_NET_DIR,
spadina::ETH2_NET_DIR,
zinken::ETH2_NET_DIR,
mainnet::ETH2_NET_DIR,
pyrmont::ETH2_NET_DIR,
toledo::ETH2_NET_DIR,
];
@ -29,14 +31,14 @@ fn main() {
/// Uncompress the testnet configs archive into a testnet configs folder.
fn uncompress_state(testnet: &Eth2NetArchiveAndDirectory<'static>) -> Result<(), String> {
let archive_path = testnet.genesis_state_archive();
let archive_file = File::open(&archive_path)
.map_err(|e| format!("Failed to open archive file {:?}: {:?}", archive_path, e))?;
let mut archive =
ZipArchive::new(archive_file).map_err(|e| format!("Error with zip file: {}", e))?;
if testnet.genesis_is_known {
let archive_path = testnet.genesis_state_archive();
let archive_file = File::open(&archive_path)
.map_err(|e| format!("Failed to open archive file {:?}: {:?}", archive_path, e))?;
let mut archive =
ZipArchive::new(archive_file).map_err(|e| format!("Error with zip file: {}", e))?;
let mut file = archive.by_name(GENESIS_FILE_NAME).map_err(|e| {
format!(
"Error retrieving file {} inside zip: {}",

View File

@ -0,0 +1,4 @@
# @protolambda bootnode 1
- enr:-Ku4QOA5OGWObY8ep_x35NlGBEj7IuQULTjkgxC_0G1AszqGEA0Wn2RNlyLFx9zGTNB1gdFBA6ZDYxCgIza1uJUUOj4Dh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDVTPWXAAAgCf__________gmlkgnY0gmlwhDQPSjiJc2VjcDI1NmsxoQM6yTQB6XGWYJbI7NZFBjp4Yb9AYKQPBhVrfUclQUobb4N1ZHCCIyg
# @protolambda bootnode 2
- enr:-Ku4QOksdA2tabOGrfOOr6NynThMoio6Ggka2oDPqUuFeWCqcRM2alNb8778O_5bK95p3EFt0cngTUXm2H7o1jkSJ_8Dh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDVTPWXAAAgCf__________gmlkgnY0gmlwhDaa13aJc2VjcDI1NmsxoQKdNQJvnohpf0VO0ZYCAJxGjT0uwJoAHbAiBMujGjK0SoN1ZHCCIyg

View File

@ -0,0 +1,154 @@
# Pyrmont preset
CONFIG_NAME: "pyrmont"
# Misc
# ---------------------------------------------------------------
# 2**6 (= 64)
MAX_COMMITTEES_PER_SLOT: 64
# 2**7 (= 128)
TARGET_COMMITTEE_SIZE: 128
# 2**11 (= 2,048)
MAX_VALIDATORS_PER_COMMITTEE: 2048
# 2**2 (= 4)
MIN_PER_EPOCH_CHURN_LIMIT: 4
# 2**16 (= 65,536)
CHURN_LIMIT_QUOTIENT: 65536
# See issue 563
SHUFFLE_ROUND_COUNT: 90
# `2**14` (= 16,384)
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384
# Nov 18, 2020, 12pm UTC
MIN_GENESIS_TIME: 1605700800
# 4
HYSTERESIS_QUOTIENT: 4
# 1 (minus 0.25)
HYSTERESIS_DOWNWARD_MULTIPLIER: 1
# 5 (plus 1.25)
HYSTERESIS_UPWARD_MULTIPLIER: 5
# Fork Choice
# ---------------------------------------------------------------
# 2**3 (= 8)
SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 8
# Validator
# ---------------------------------------------------------------
# 2**11 (= 2,048)
ETH1_FOLLOW_DISTANCE: 2048
# 2**4 (= 16)
TARGET_AGGREGATORS_PER_COMMITTEE: 16
# 2**0 (= 1)
RANDOM_SUBNETS_PER_VALIDATOR: 1
# 2**8 (= 256)
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 256
# 14 (estimate from Eth1 mainnet)
SECONDS_PER_ETH1_BLOCK: 14
# Deposit contract
# ---------------------------------------------------------------
# Ethereum Goerli testnet
DEPOSIT_CHAIN_ID: 5
DEPOSIT_NETWORK_ID: 5
# Pyrmont test deposit contract on Goerli (2nd edition, 0x00002009 fork version)
DEPOSIT_CONTRACT_ADDRESS: 0x8c5fecdC472E27Bc447696F431E425D02dd46a8c
# Gwei values
# ---------------------------------------------------------------
# 2**0 * 10**9 (= 1,000,000,000) Gwei
MIN_DEPOSIT_AMOUNT: 1000000000
# 2**5 * 10**9 (= 32,000,000,000) Gwei
MAX_EFFECTIVE_BALANCE: 32000000000
# 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE: 16000000000
# 2**0 * 10**9 (= 1,000,000,000) Gwei
EFFECTIVE_BALANCE_INCREMENT: 1000000000
# Initial values
# ---------------------------------------------------------------
# Pyrmont area code
GENESIS_FORK_VERSION: 0x00002009
BLS_WITHDRAWAL_PREFIX: 0x00
# Time parameters
# ---------------------------------------------------------------
# Customized for Pyrmont: 432000 seconds (5 days)
GENESIS_DELAY: 432000
# 12 seconds
SECONDS_PER_SLOT: 12
# 2**0 (= 1) slots 12 seconds
MIN_ATTESTATION_INCLUSION_DELAY: 1
# 2**5 (= 32) slots 6.4 minutes
SLOTS_PER_EPOCH: 32
# 2**0 (= 1) epochs 6.4 minutes
MIN_SEED_LOOKAHEAD: 1
# 2**2 (= 4) epochs 25.6 minutes
MAX_SEED_LOOKAHEAD: 4
# 2**6 (= 64) epochs ~6.8 hours
EPOCHS_PER_ETH1_VOTING_PERIOD: 64
# 2**13 (= 8,192) slots ~13 hours
SLOTS_PER_HISTORICAL_ROOT: 8192
# 2**8 (= 256) epochs ~27 hours
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
# 2**8 (= 256) epochs ~27 hours
SHARD_COMMITTEE_PERIOD: 256
# 2**2 (= 4) epochs 25.6 minutes
MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4
# State vector lengths
# ---------------------------------------------------------------
# 2**16 (= 65,536) epochs ~0.8 years
EPOCHS_PER_HISTORICAL_VECTOR: 65536
# 2**13 (= 8,192) epochs ~36 days
EPOCHS_PER_SLASHINGS_VECTOR: 8192
# 2**24 (= 16,777,216) historical roots, ~26,131 years
HISTORICAL_ROOTS_LIMIT: 16777216
# 2**40 (= 1,099,511,627,776) validator spots
VALIDATOR_REGISTRY_LIMIT: 1099511627776
# Reward and penalty quotients
# ---------------------------------------------------------------
# 2**6 (= 64)
BASE_REWARD_FACTOR: 64
# 2**9 (= 512)
WHISTLEBLOWER_REWARD_QUOTIENT: 512
# 2**3 (= 8)
PROPOSER_REWARD_QUOTIENT: 8
# 2**26 (= 67,108,864)
INACTIVITY_PENALTY_QUOTIENT: 67108864
# 2**7 (= 128) (lower safety margin at Phase 0 genesis)
MIN_SLASHING_PENALTY_QUOTIENT: 128
# 1 (lower safety margin at Phase 0 genesis)
PROPORTIONAL_SLASHING_MULTIPLIER: 1
# Max operations per block
# ---------------------------------------------------------------
# 2**4 (= 16)
MAX_PROPOSER_SLASHINGS: 16
# 2**1 (= 2)
MAX_ATTESTER_SLASHINGS: 2
# 2**7 (= 128)
MAX_ATTESTATIONS: 128
# 2**4 (= 16)
MAX_DEPOSITS: 16
# 2**4 (= 16)
MAX_VOLUNTARY_EXITS: 16
# Signature domains
# ---------------------------------------------------------------
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 @@
0x8c5fecdC472E27Bc447696F431E425D02dd46a8c

View File

@ -1,4 +0,0 @@
- 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

@ -1,60 +0,0 @@
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

@ -1 +0,0 @@
0x99F0Ec06548b086E46Cb0019C78D0b9b9F36cD53

View File

@ -52,11 +52,11 @@ macro_rules! define_net {
const ALTONA: HardcodedNet = define_net!(altona, include_altona_file);
const MEDALLA: HardcodedNet = define_net!(medalla, include_medalla_file);
const SPADINA: HardcodedNet = define_net!(spadina, include_spadina_file);
const ZINKEN: HardcodedNet = define_net!(zinken, include_zinken_file);
const PYRMONT: HardcodedNet = define_net!(pyrmont, include_pyrmont_file);
const MAINNET: HardcodedNet = define_net!(mainnet, include_mainnet_file);
const TOLEDO: HardcodedNet = define_net!(toledo, include_toledo_file);
const HARDCODED_NETS: &[HardcodedNet] = &[ALTONA, MEDALLA, SPADINA, ZINKEN, MAINNET, TOLEDO];
const HARDCODED_NETS: &[HardcodedNet] = &[ALTONA, MEDALLA, SPADINA, PYRMONT, MAINNET, TOLEDO];
pub const DEFAULT_HARDCODED_TESTNET: &str = "medalla";
/// Specifies an Eth2 testnet.
@ -281,7 +281,7 @@ mod tests {
let config =
Eth2TestnetConfig::from_hardcoded_net(net).expect(&format!("{:?}", net.name));
if net.name == "mainnet" || net.name == "toledo" {
if net.name == "mainnet" || net.name == "toledo" || net.name == "pyrmont" {
// Ensure we can parse the YAML config to a chain spec.
config
.yaml_config

View File

@ -379,7 +379,7 @@ impl ChainSpec {
/// https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/configs/mainnet/phase0.yaml
///
/// This method only needs to exist whilst we provide support for "legacy" testnets prior to v1.0.0
/// (e.g., Medalla, Zinken, Spadina, Altona, etc.).
/// (e.g., Medalla, Pyrmont, Spadina, Altona, etc.).
pub fn v012_legacy() -> Self {
let boot_nodes = vec![];
@ -603,7 +603,7 @@ impl YamlConfig {
"mainnet" => EthSpecId::Mainnet,
"minimal" => EthSpecId::Minimal,
"toledo" => EthSpecId::Mainnet,
"zinken" => EthSpecId::V012Legacy,
"pyrmont" => EthSpecId::Mainnet,
"spadina" => EthSpecId::V012Legacy,
"medalla" => EthSpecId::V012Legacy,
"altona" => EthSpecId::V012Legacy,

View File

@ -264,7 +264,7 @@ pub type MinimalBeaconState = BeaconState<MinimalEthSpec>;
/// https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/configs/mainnet/phase0.yaml
///
/// This struct only needs to exist whilst we provide support for "legacy" testnets prior to v1.0.0
/// (e.g., Medalla, Zinken, Spadina, Altona, etc.).
/// (e.g., Medalla, Pyrmont, Spadina, Altona, etc.).
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize)]
pub struct V012LegacyEthSpec;

View File

@ -115,7 +115,7 @@ fn main() {
.long("testnet")
.value_name("testnet")
.help("Name of network lighthouse will connect to")
.possible_values(&["medalla", "altona", "spadina", "zinken", "mainnet", "toledo"])
.possible_values(&["medalla", "altona", "spadina", "pyrmont", "mainnet", "toledo"])
.conflicts_with("testnet-dir")
.takes_value(true)
.global(true)