## Issue Addressed Closes #1504 Closes #1505 Replaces #1703 Closes #1707 ## Proposed Changes * Update BLST and Milagro to versions compatible with BLSv4 spec * Update Lighthouse to spec v1.0.0-rc.0, and update EF test vectors * Use the v1.0.0 constants for `MainnetEthSpec`. * Rename `InteropEthSpec` -> `V012LegacyEthSpec` * Change all constants to suit the mainnet `v0.12.3` specification (i.e., Medalla). * Deprecate the `--spec` flag for the `lighthouse` binary * This value is now obtained from the `config_name` field of the `YamlConfig`. * Built in testnet YAML files have been updated. * Ignore the `--spec` value, if supplied, log a warning that it will be deprecated * `lcli` still has the spec flag, that's fine because it's dev tooling. * Remove the `E: EthSpec` from `YamlConfig` * This means we need to deser the genesis `BeaconState` on-demand, but this is fine. * Swap the old "minimal", "mainnet" strings over to the new `EthSpecId` enum. * Always require a `CONFIG_NAME` field in `YamlConfig` (it used to have a default). ## Additional Info Lots of breaking changes, do not merge! ~~We will likely need a Lighthouse v0.4.0 branch, and possibly a long-term v0.3.0 branch to keep Medalla alive~~. Co-authored-by: Kirk Baird <baird.k@outlook.com> Co-authored-by: Paul Hauner <paul@paulhauner.com>
64 lines
2.3 KiB
Rust
64 lines
2.3 KiB
Rust
use clap::ArgMatches;
|
|
use clap_utils::{
|
|
parse_optional, parse_path_with_default_in_home_dir, parse_required, parse_ssz_optional,
|
|
};
|
|
use eth2_testnet_config::Eth2TestnetConfig;
|
|
use std::path::PathBuf;
|
|
use types::{Address, EthSpec, YamlConfig};
|
|
|
|
pub fn run<T: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
|
|
let testnet_dir_path = parse_path_with_default_in_home_dir(
|
|
matches,
|
|
"testnet-dir",
|
|
PathBuf::from(directory::DEFAULT_ROOT_DIR).join("testnet"),
|
|
)?;
|
|
let deposit_contract_address: Address = parse_required(matches, "deposit-contract-address")?;
|
|
let deposit_contract_deploy_block = parse_required(matches, "deposit-contract-deploy-block")?;
|
|
|
|
let overwrite_files = matches.is_present("force");
|
|
|
|
if testnet_dir_path.exists() && !overwrite_files {
|
|
return Err(format!(
|
|
"{:?} already exists, will not overwrite. Use --force to overwrite",
|
|
testnet_dir_path
|
|
));
|
|
}
|
|
|
|
let mut spec = T::default_spec();
|
|
|
|
// Update the spec value if the flag was defined. Otherwise, leave it as the default.
|
|
macro_rules! maybe_update {
|
|
($flag: tt, $var: ident) => {
|
|
if let Some(val) = parse_optional(matches, $flag)? {
|
|
spec.$var = val
|
|
}
|
|
};
|
|
}
|
|
|
|
maybe_update!("min-genesis-time", min_genesis_time);
|
|
maybe_update!("min-deposit-amount", min_deposit_amount);
|
|
maybe_update!(
|
|
"min-genesis-active-validator-count",
|
|
min_genesis_active_validator_count
|
|
);
|
|
maybe_update!("max-effective-balance", max_effective_balance);
|
|
maybe_update!("effective-balance-increment", effective_balance_increment);
|
|
maybe_update!("ejection-balance", ejection_balance);
|
|
maybe_update!("eth1-follow-distance", eth1_follow_distance);
|
|
maybe_update!("genesis-delay", genesis_delay);
|
|
|
|
if let Some(v) = parse_ssz_optional(matches, "genesis-fork-version")? {
|
|
spec.genesis_fork_version = v;
|
|
}
|
|
|
|
let testnet = Eth2TestnetConfig {
|
|
deposit_contract_address: format!("{:?}", deposit_contract_address),
|
|
deposit_contract_deploy_block,
|
|
boot_enr: Some(vec![]),
|
|
genesis_state_bytes: None,
|
|
yaml_config: Some(YamlConfig::from_spec::<T>(&spec)),
|
|
};
|
|
|
|
testnet.write_to_file(testnet_dir_path, overwrite_files)
|
|
}
|