fix default network handling (#2029)
## Issue Addressed #1992 and #1987, and also to be considered a continuation of #1751 ## Proposed Changes many changed files but most are renaming to align the code with the semantics of `--network` - remove the `--network` default value (in clap) and instead set it after checking the `network` and `testnet-dir` flags - move `eth2_testnet_config` crate to `eth2_network_config` - move `Eth2TestnetConfig` to `Eth2NetworkConfig` - move `DEFAULT_HARDCODED_TESTNET` to `DEFAULT_HARDCODED_NETWORK` - `beacon_node`s `get_eth2_testnet_config` loads the `DEFAULT_HARDCODED_NETWORK` if there is no network nor testnet provided - `boot_node`s config loads the config same as the `beacon_node`, it was using the configuration only for preconfigured networks (That code is ~1year old so I asume it was not intended) - removed a one year old comment stating we should try to emulate `https://github.com/eth2-clients/eth2-testnets/tree/master/nimbus/testnet1` it looks outdated (?) - remove `lighthouse`s `load_testnet_config` in favor of `get_eth2_network_config` to centralize that logic (It had differences) - some spelling ## Additional Info Both the command of #1992 and the scripts of #1987 seem to work fine, same as `bn` and `vc`
This commit is contained in:
parent
f3200784b4
commit
57489e620f
44
Cargo.lock
generated
44
Cargo.lock
generated
@ -14,9 +14,9 @@ dependencies = [
|
|||||||
"environment",
|
"environment",
|
||||||
"eth2",
|
"eth2",
|
||||||
"eth2_keystore",
|
"eth2_keystore",
|
||||||
|
"eth2_network_config",
|
||||||
"eth2_ssz",
|
"eth2_ssz",
|
||||||
"eth2_ssz_derive",
|
"eth2_ssz_derive",
|
||||||
"eth2_testnet_config",
|
|
||||||
"eth2_wallet",
|
"eth2_wallet",
|
||||||
"eth2_wallet_manager",
|
"eth2_wallet_manager",
|
||||||
"futures 0.3.8",
|
"futures 0.3.8",
|
||||||
@ -592,8 +592,8 @@ dependencies = [
|
|||||||
"environment",
|
"environment",
|
||||||
"eth2_config",
|
"eth2_config",
|
||||||
"eth2_libp2p",
|
"eth2_libp2p",
|
||||||
|
"eth2_network_config",
|
||||||
"eth2_ssz",
|
"eth2_ssz",
|
||||||
"eth2_testnet_config",
|
|
||||||
"exit-future",
|
"exit-future",
|
||||||
"futures 0.3.8",
|
"futures 0.3.8",
|
||||||
"genesis",
|
"genesis",
|
||||||
@ -816,8 +816,8 @@ dependencies = [
|
|||||||
"beacon_node",
|
"beacon_node",
|
||||||
"clap",
|
"clap",
|
||||||
"eth2_libp2p",
|
"eth2_libp2p",
|
||||||
|
"eth2_network_config",
|
||||||
"eth2_ssz",
|
"eth2_ssz",
|
||||||
"eth2_testnet_config",
|
|
||||||
"futures 0.3.8",
|
"futures 0.3.8",
|
||||||
"hex",
|
"hex",
|
||||||
"log 0.4.11",
|
"log 0.4.11",
|
||||||
@ -1048,8 +1048,8 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"dirs 3.0.1",
|
"dirs 3.0.1",
|
||||||
|
"eth2_network_config",
|
||||||
"eth2_ssz",
|
"eth2_ssz",
|
||||||
"eth2_testnet_config",
|
|
||||||
"hex",
|
"hex",
|
||||||
"types",
|
"types",
|
||||||
]
|
]
|
||||||
@ -1604,7 +1604,7 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"clap_utils",
|
"clap_utils",
|
||||||
"dirs 3.0.1",
|
"dirs 3.0.1",
|
||||||
"eth2_testnet_config",
|
"eth2_network_config",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1851,7 +1851,7 @@ version = "0.1.2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ctrlc",
|
"ctrlc",
|
||||||
"eth2_config",
|
"eth2_config",
|
||||||
"eth2_testnet_config",
|
"eth2_network_config",
|
||||||
"exit-future",
|
"exit-future",
|
||||||
"futures 0.3.8",
|
"futures 0.3.8",
|
||||||
"logging",
|
"logging",
|
||||||
@ -2062,6 +2062,20 @@ dependencies = [
|
|||||||
"void",
|
"void",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "eth2_network_config"
|
||||||
|
version = "0.2.0"
|
||||||
|
dependencies = [
|
||||||
|
"enr",
|
||||||
|
"eth2_config",
|
||||||
|
"eth2_ssz",
|
||||||
|
"serde",
|
||||||
|
"serde_yaml",
|
||||||
|
"tempdir",
|
||||||
|
"types",
|
||||||
|
"zip",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eth2_ssz"
|
name = "eth2_ssz"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
@ -2094,20 +2108,6 @@ dependencies = [
|
|||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "eth2_testnet_config"
|
|
||||||
version = "0.2.0"
|
|
||||||
dependencies = [
|
|
||||||
"enr",
|
|
||||||
"eth2_config",
|
|
||||||
"eth2_ssz",
|
|
||||||
"serde",
|
|
||||||
"serde_yaml",
|
|
||||||
"tempdir",
|
|
||||||
"types",
|
|
||||||
"zip",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eth2_wallet"
|
name = "eth2_wallet"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -3483,8 +3483,8 @@ dependencies = [
|
|||||||
"environment",
|
"environment",
|
||||||
"eth2_keystore",
|
"eth2_keystore",
|
||||||
"eth2_libp2p",
|
"eth2_libp2p",
|
||||||
|
"eth2_network_config",
|
||||||
"eth2_ssz",
|
"eth2_ssz",
|
||||||
"eth2_testnet_config",
|
|
||||||
"futures 0.3.8",
|
"futures 0.3.8",
|
||||||
"genesis",
|
"genesis",
|
||||||
"hex",
|
"hex",
|
||||||
@ -3877,7 +3877,7 @@ dependencies = [
|
|||||||
"directory",
|
"directory",
|
||||||
"env_logger 0.8.2",
|
"env_logger 0.8.2",
|
||||||
"environment",
|
"environment",
|
||||||
"eth2_testnet_config",
|
"eth2_network_config",
|
||||||
"futures 0.3.8",
|
"futures 0.3.8",
|
||||||
"lighthouse_version",
|
"lighthouse_version",
|
||||||
"logging",
|
"logging",
|
||||||
|
@ -24,7 +24,7 @@ members = [
|
|||||||
"common/eth2",
|
"common/eth2",
|
||||||
"common/eth2_config",
|
"common/eth2_config",
|
||||||
"common/eth2_interop_keypairs",
|
"common/eth2_interop_keypairs",
|
||||||
"common/eth2_testnet_config",
|
"common/eth2_network_config",
|
||||||
"common/eth2_wallet_manager",
|
"common/eth2_wallet_manager",
|
||||||
"common/hashset_delay",
|
"common/hashset_delay",
|
||||||
"common/lighthouse_metrics",
|
"common/lighthouse_metrics",
|
||||||
|
@ -19,7 +19,7 @@ eth2_ssz = "0.1.2"
|
|||||||
eth2_ssz_derive = "0.1.0"
|
eth2_ssz_derive = "0.1.0"
|
||||||
hex = "0.4.2"
|
hex = "0.4.2"
|
||||||
rayon = "1.4.1"
|
rayon = "1.4.1"
|
||||||
eth2_testnet_config = { path = "../common/eth2_testnet_config" }
|
eth2_network_config = { path = "../common/eth2_network_config" }
|
||||||
futures = { version = "0.3.7", features = ["compat"] }
|
futures = { version = "0.3.7", features = ["compat"] }
|
||||||
clap_utils = { path = "../common/clap_utils" }
|
clap_utils = { path = "../common/clap_utils" }
|
||||||
directory = { path = "../common/directory" }
|
directory = { path = "../common/directory" }
|
||||||
|
@ -7,7 +7,7 @@ use eth2::{
|
|||||||
BeaconNodeHttpClient, Url,
|
BeaconNodeHttpClient, Url,
|
||||||
};
|
};
|
||||||
use eth2_keystore::Keystore;
|
use eth2_keystore::Keystore;
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_network_config::Eth2NetworkConfig;
|
||||||
use safe_arith::SafeArith;
|
use safe_arith::SafeArith;
|
||||||
use slot_clock::{SlotClock, SystemTimeSlotClock};
|
use slot_clock::{SlotClock, SystemTimeSlotClock};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -99,7 +99,7 @@ async fn publish_voluntary_exit<E: EthSpec>(
|
|||||||
client: &BeaconNodeHttpClient,
|
client: &BeaconNodeHttpClient,
|
||||||
spec: &ChainSpec,
|
spec: &ChainSpec,
|
||||||
stdin_inputs: bool,
|
stdin_inputs: bool,
|
||||||
testnet_config: &Eth2TestnetConfig,
|
testnet_config: &Eth2NetworkConfig,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
let genesis_data = get_geneisis_data(client).await?;
|
let genesis_data = get_geneisis_data(client).await?;
|
||||||
let testnet_genesis_root = testnet_config
|
let testnet_genesis_root = testnet_config
|
||||||
|
@ -36,7 +36,7 @@ futures = "0.3.7"
|
|||||||
environment = { path = "../lighthouse/environment" }
|
environment = { path = "../lighthouse/environment" }
|
||||||
task_executor = { path = "../common/task_executor" }
|
task_executor = { path = "../common/task_executor" }
|
||||||
genesis = { path = "genesis" }
|
genesis = { path = "genesis" }
|
||||||
eth2_testnet_config = { path = "../common/eth2_testnet_config" }
|
eth2_network_config = { path = "../common/eth2_network_config" }
|
||||||
eth2_libp2p = { path = "./eth2_libp2p" }
|
eth2_libp2p = { path = "./eth2_libp2p" }
|
||||||
eth2_ssz = "0.1.2"
|
eth2_ssz = "0.1.2"
|
||||||
serde = "1.0.116"
|
serde = "1.0.116"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::types::{GossipKind, MessageData};
|
use crate::types::{GossipKind, MessageData};
|
||||||
use crate::{Enr, PeerIdSerialized};
|
use crate::{Enr, PeerIdSerialized};
|
||||||
use directory::{
|
use directory::{
|
||||||
DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_TESTNET, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR,
|
DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_NETWORK, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR,
|
||||||
};
|
};
|
||||||
use discv5::{Discv5Config, Discv5ConfigBuilder};
|
use discv5::{Discv5Config, Discv5ConfigBuilder};
|
||||||
use libp2p::gossipsub::{
|
use libp2p::gossipsub::{
|
||||||
@ -104,7 +104,7 @@ impl Default for Config {
|
|||||||
let network_dir = dirs::home_dir()
|
let network_dir = dirs::home_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join(DEFAULT_ROOT_DIR)
|
.join(DEFAULT_ROOT_DIR)
|
||||||
.join(DEFAULT_HARDCODED_TESTNET)
|
.join(DEFAULT_HARDCODED_NETWORK)
|
||||||
.join(DEFAULT_BEACON_NODE_DIR)
|
.join(DEFAULT_BEACON_NODE_DIR)
|
||||||
.join(DEFAULT_NETWORK_DIR);
|
.join(DEFAULT_NETWORK_DIR);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ use clap_utils::BAD_TESTNET_DIR_MESSAGE;
|
|||||||
use client::{ClientConfig, ClientGenesis};
|
use client::{ClientConfig, ClientGenesis};
|
||||||
use directory::{DEFAULT_BEACON_NODE_DIR, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR};
|
use directory::{DEFAULT_BEACON_NODE_DIR, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR};
|
||||||
use eth2_libp2p::{multiaddr::Protocol, Enr, Multiaddr, NetworkConfig, PeerIdSerialized};
|
use eth2_libp2p::{multiaddr::Protocol, Enr, Multiaddr, NetworkConfig, PeerIdSerialized};
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_network_config::{Eth2NetworkConfig, DEFAULT_HARDCODED_NETWORK};
|
||||||
use slog::{info, warn, Logger};
|
use slog::{info, warn, Logger};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
@ -237,13 +237,13 @@ pub fn get_config<E: EthSpec>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load the eth2 testnet dir to obtain some additional config values.
|
* Load the eth2 network dir to obtain some additional config values.
|
||||||
*/
|
*/
|
||||||
let eth2_testnet_config = get_eth2_testnet_config(&cli_args)?;
|
let eth2_network_config = get_eth2_network_config(&cli_args)?;
|
||||||
|
|
||||||
client_config.eth1.deposit_contract_address = format!("{:?}", spec.deposit_contract_address);
|
client_config.eth1.deposit_contract_address = format!("{:?}", spec.deposit_contract_address);
|
||||||
client_config.eth1.deposit_contract_deploy_block =
|
client_config.eth1.deposit_contract_deploy_block =
|
||||||
eth2_testnet_config.deposit_contract_deploy_block;
|
eth2_network_config.deposit_contract_deploy_block;
|
||||||
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;
|
||||||
@ -260,11 +260,11 @@ pub fn get_config<E: EthSpec>(
|
|||||||
"address" => &client_config.eth1.deposit_contract_address
|
"address" => &client_config.eth1.deposit_contract_address
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(mut boot_nodes) = eth2_testnet_config.boot_enr {
|
if let Some(mut boot_nodes) = eth2_network_config.boot_enr {
|
||||||
client_config.network.boot_nodes_enr.append(&mut boot_nodes)
|
client_config.network.boot_nodes_enr.append(&mut boot_nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(genesis_state_bytes) = eth2_testnet_config.genesis_state_bytes {
|
if let Some(genesis_state_bytes) = eth2_network_config.genesis_state_bytes {
|
||||||
// Note: re-serializing the genesis state is not so efficient, however it avoids adding
|
// Note: re-serializing the genesis state is not so efficient, however it avoids adding
|
||||||
// trait bounds to the `ClientGenesis` enum. This would have significant flow-on
|
// trait bounds to the `ClientGenesis` enum. This would have significant flow-on
|
||||||
// effects.
|
// effects.
|
||||||
@ -578,26 +578,25 @@ pub fn get_data_dir(cli_args: &ArgMatches) -> PathBuf {
|
|||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
dirs::home_dir().map(|home| {
|
dirs::home_dir().map(|home| {
|
||||||
home.join(DEFAULT_ROOT_DIR)
|
home.join(DEFAULT_ROOT_DIR)
|
||||||
.join(directory::get_testnet_name(cli_args))
|
.join(directory::get_network_dir(cli_args))
|
||||||
.join(DEFAULT_BEACON_NODE_DIR)
|
.join(DEFAULT_BEACON_NODE_DIR)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to parse the eth2 testnet config from the `network`, `testnet-dir` flags in that order.
|
/// Try to parse the eth2 network config from the `network`, `testnet-dir` flags in that order.
|
||||||
/// Returns the default hardcoded testnet if neither flags are set.
|
/// Returns the default hardcoded testnet if neither flags are set.
|
||||||
pub fn get_eth2_testnet_config(cli_args: &ArgMatches) -> Result<Eth2TestnetConfig, String> {
|
pub fn get_eth2_network_config(cli_args: &ArgMatches) -> Result<Eth2NetworkConfig, String> {
|
||||||
let optional_testnet_config = if cli_args.is_present("network") {
|
let optional_network_config = if cli_args.is_present("network") {
|
||||||
clap_utils::parse_hardcoded_network(cli_args, "network")?
|
clap_utils::parse_hardcoded_network(cli_args, "network")?
|
||||||
} else if cli_args.is_present("testnet-dir") {
|
} else if cli_args.is_present("testnet-dir") {
|
||||||
clap_utils::parse_testnet_dir(cli_args, "testnet-dir")?
|
clap_utils::parse_testnet_dir(cli_args, "testnet-dir")?
|
||||||
} else {
|
} else {
|
||||||
return Err(
|
// if neither is present, assume the default network
|
||||||
"No --network or --testnet-dir flags provided, cannot load config.".to_string(),
|
Eth2NetworkConfig::constant(DEFAULT_HARDCODED_NETWORK)?
|
||||||
);
|
|
||||||
};
|
};
|
||||||
optional_testnet_config.ok_or_else(|| BAD_TESTNET_DIR_MESSAGE.to_string())
|
optional_network_config.ok_or_else(|| BAD_TESTNET_DIR_MESSAGE.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A bit of hack to find an unused port.
|
/// A bit of hack to find an unused port.
|
||||||
|
@ -12,7 +12,7 @@ use beacon_chain::{
|
|||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
pub use cli::cli_app;
|
pub use cli::cli_app;
|
||||||
pub use client::{Client, ClientBuilder, ClientConfig, ClientGenesis};
|
pub use client::{Client, ClientBuilder, ClientConfig, ClientGenesis};
|
||||||
pub use config::{get_config, get_data_dir, get_eth2_testnet_config, set_network_config};
|
pub use config::{get_config, get_data_dir, get_eth2_network_config, set_network_config};
|
||||||
use environment::RuntimeContext;
|
use environment::RuntimeContext;
|
||||||
pub use eth2_config::Eth2Config;
|
pub use eth2_config::Eth2Config;
|
||||||
use slasher::Slasher;
|
use slasher::Slasher;
|
||||||
|
@ -7,9 +7,9 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
beacon_node = { path = "../beacon_node" }
|
beacon_node = { path = "../beacon_node" }
|
||||||
clap = "2.33.3"
|
clap = "2.33.3"
|
||||||
eth2_libp2p = { path = "../beacon_node/eth2_libp2p" }
|
eth2_libp2p = { path = "../beacon_node/eth2_libp2p" }
|
||||||
types = { path = "../consensus/types" }
|
types = { path = "../consensus/types" }
|
||||||
eth2_testnet_config = { path = "../common/eth2_testnet_config" }
|
eth2_network_config = { path = "../common/eth2_network_config" }
|
||||||
eth2_ssz = "0.1.2"
|
eth2_ssz = "0.1.2"
|
||||||
slog = "2.5.2"
|
slog = "2.5.2"
|
||||||
sloggers = "1.0.1"
|
sloggers = "1.0.1"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use beacon_node::{get_data_dir, get_eth2_testnet_config, set_network_config};
|
use beacon_node::{get_data_dir, get_eth2_network_config, set_network_config};
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use eth2_libp2p::discv5::{enr::CombinedKey, Enr};
|
use eth2_libp2p::discv5::{enr::CombinedKey, Enr};
|
||||||
use eth2_libp2p::{
|
use eth2_libp2p::{
|
||||||
@ -28,24 +28,16 @@ impl<T: EthSpec> TryFrom<&ArgMatches<'_>> for BootNodeConfig<T> {
|
|||||||
fn try_from(matches: &ArgMatches<'_>) -> Result<Self, Self::Error> {
|
fn try_from(matches: &ArgMatches<'_>) -> Result<Self, Self::Error> {
|
||||||
let data_dir = get_data_dir(matches);
|
let data_dir = get_data_dir(matches);
|
||||||
|
|
||||||
// Try and grab testnet config from input CLI params
|
// Try and grab network config from input CLI params
|
||||||
let eth2_testnet_config = {
|
let eth2_network_config = get_eth2_network_config(&matches)?;
|
||||||
if matches.is_present("network") {
|
|
||||||
Some(get_eth2_testnet_config(&matches)?)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Try and obtain bootnodes
|
// Try and obtain bootnodes
|
||||||
|
|
||||||
let boot_nodes = {
|
let boot_nodes = {
|
||||||
let mut boot_nodes = Vec::new();
|
let mut boot_nodes = Vec::new();
|
||||||
|
|
||||||
if let Some(testnet_config) = eth2_testnet_config.as_ref() {
|
if let Some(enr) = ð2_network_config.boot_enr {
|
||||||
if let Some(enr) = &testnet_config.boot_enr {
|
boot_nodes.extend_from_slice(enr);
|
||||||
boot_nodes.extend_from_slice(enr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(nodes) = matches.value_of("boot-nodes") {
|
if let Some(nodes) = matches.value_of("boot-nodes") {
|
||||||
@ -80,16 +72,16 @@ impl<T: EthSpec> TryFrom<&ArgMatches<'_>> for BootNodeConfig<T> {
|
|||||||
let local_key = CombinedKey::from_libp2p(&private_key)?;
|
let local_key = CombinedKey::from_libp2p(&private_key)?;
|
||||||
|
|
||||||
// build the enr_fork_id and add it to the local_enr if it exists
|
// build the enr_fork_id and add it to the local_enr if it exists
|
||||||
let enr_fork = if let Some(config) = eth2_testnet_config.as_ref() {
|
let enr_fork = {
|
||||||
let spec = config
|
let spec = eth2_network_config
|
||||||
.yaml_config
|
.yaml_config
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or("The testnet directory must contain a spec config")?
|
.ok_or("The network directory must contain a spec config")?
|
||||||
.apply_to_chain_spec::<T>(&T::default_spec())
|
.apply_to_chain_spec::<T>(&T::default_spec())
|
||||||
.ok_or("The loaded config is not compatible with the current spec")?;
|
.ok_or("The loaded config is not compatible with the current spec")?;
|
||||||
|
|
||||||
if config.beacon_state_is_known() {
|
if eth2_network_config.beacon_state_is_known() {
|
||||||
let genesis_state = config.beacon_state::<T>()?;
|
let genesis_state = eth2_network_config.beacon_state::<T>()?;
|
||||||
|
|
||||||
slog::info!(logger, "Genesis state found"; "root" => genesis_state.canonical_root().to_string());
|
slog::info!(logger, "Genesis state found"; "root" => genesis_state.canonical_root().to_string());
|
||||||
let enr_fork = spec.enr_fork_id(
|
let enr_fork = spec.enr_fork_id(
|
||||||
@ -105,12 +97,6 @@ impl<T: EthSpec> TryFrom<&ArgMatches<'_>> for BootNodeConfig<T> {
|
|||||||
);
|
);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
slog::warn!(
|
|
||||||
logger,
|
|
||||||
"No testnet config provided. Not setting an eth2 field"
|
|
||||||
);
|
|
||||||
None
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build the local ENR
|
// Build the local ENR
|
||||||
|
@ -11,5 +11,5 @@ clap = "2.33.3"
|
|||||||
hex = "0.4.2"
|
hex = "0.4.2"
|
||||||
dirs = "3.0.1"
|
dirs = "3.0.1"
|
||||||
types = { path = "../../consensus/types" }
|
types = { path = "../../consensus/types" }
|
||||||
eth2_testnet_config = { path = "../eth2_testnet_config" }
|
eth2_network_config = { path = "../eth2_network_config" }
|
||||||
eth2_ssz = "0.1.2"
|
eth2_ssz = "0.1.2"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! A helper library for parsing values from `clap::ArgMatches`.
|
//! A helper library for parsing values from `clap::ArgMatches`.
|
||||||
|
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_network_config::Eth2NetworkConfig;
|
||||||
use ssz::Decode;
|
use ssz::Decode;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
@ -16,9 +16,9 @@ pub const BAD_TESTNET_DIR_MESSAGE: &str = "The hard-coded testnet directory was
|
|||||||
pub fn parse_testnet_dir(
|
pub fn parse_testnet_dir(
|
||||||
matches: &ArgMatches,
|
matches: &ArgMatches,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
) -> Result<Option<Eth2TestnetConfig>, String> {
|
) -> Result<Option<Eth2NetworkConfig>, String> {
|
||||||
let path = parse_required::<PathBuf>(matches, name)?;
|
let path = parse_required::<PathBuf>(matches, name)?;
|
||||||
Eth2TestnetConfig::load(path.clone())
|
Eth2NetworkConfig::load(path.clone())
|
||||||
.map_err(|e| format!("Unable to open testnet dir at {:?}: {}", path, e))
|
.map_err(|e| format!("Unable to open testnet dir at {:?}: {}", path, e))
|
||||||
.map(Some)
|
.map(Some)
|
||||||
}
|
}
|
||||||
@ -28,9 +28,9 @@ pub fn parse_testnet_dir(
|
|||||||
pub fn parse_hardcoded_network(
|
pub fn parse_hardcoded_network(
|
||||||
matches: &ArgMatches,
|
matches: &ArgMatches,
|
||||||
name: &str,
|
name: &str,
|
||||||
) -> Result<Option<Eth2TestnetConfig>, String> {
|
) -> Result<Option<Eth2NetworkConfig>, String> {
|
||||||
let network_name = parse_required::<String>(matches, name)?;
|
let network_name = parse_required::<String>(matches, name)?;
|
||||||
Eth2TestnetConfig::constant(network_name.as_str())
|
Eth2NetworkConfig::constant(network_name.as_str())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If `name` is in `matches`, parses the value as a path. Otherwise, attempts to find the user's
|
/// If `name` is in `matches`, parses the value as a path. Otherwise, attempts to find the user's
|
||||||
|
@ -10,4 +10,4 @@ edition = "2018"
|
|||||||
clap = "2.33.3"
|
clap = "2.33.3"
|
||||||
clap_utils = {path = "../clap_utils"}
|
clap_utils = {path = "../clap_utils"}
|
||||||
dirs = "3.0.1"
|
dirs = "3.0.1"
|
||||||
eth2_testnet_config = { path = "../eth2_testnet_config" }
|
eth2_network_config = { path = "../eth2_network_config" }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
pub use eth2_testnet_config::DEFAULT_HARDCODED_TESTNET;
|
pub use eth2_network_config::DEFAULT_HARDCODED_NETWORK;
|
||||||
use std::fs::{self, create_dir_all};
|
use std::fs::{self, create_dir_all};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
@ -19,13 +19,13 @@ pub const CUSTOM_TESTNET_DIR: &str = "custom";
|
|||||||
/// Tries to get the name first from the "network" flag,
|
/// Tries to get the name first from the "network" flag,
|
||||||
/// if not present, then checks the "testnet-dir" flag and returns a custom name
|
/// if not present, then checks the "testnet-dir" flag and returns a custom name
|
||||||
/// If neither flags are present, returns the default hardcoded network name.
|
/// If neither flags are present, returns the default hardcoded network name.
|
||||||
pub fn get_testnet_name(matches: &ArgMatches) -> String {
|
pub fn get_network_dir(matches: &ArgMatches) -> String {
|
||||||
if let Some(testnet_name) = matches.value_of("network") {
|
if let Some(network_name) = matches.value_of("network") {
|
||||||
testnet_name.to_string()
|
network_name.to_string()
|
||||||
} else if matches.value_of("testnet-dir").is_some() {
|
} else if matches.value_of("testnet-dir").is_some() {
|
||||||
CUSTOM_TESTNET_DIR.to_string()
|
CUSTOM_TESTNET_DIR.to_string()
|
||||||
} else {
|
} else {
|
||||||
eth2_testnet_config::DEFAULT_HARDCODED_TESTNET.to_string()
|
eth2_network_config::DEFAULT_HARDCODED_NETWORK.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ pub fn parse_path_or_default_with_flag(
|
|||||||
arg,
|
arg,
|
||||||
PathBuf::new()
|
PathBuf::new()
|
||||||
.join(DEFAULT_ROOT_DIR)
|
.join(DEFAULT_ROOT_DIR)
|
||||||
.join(get_testnet_name(matches))
|
.join(get_network_dir(matches))
|
||||||
.join(flag),
|
.join(flag),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,13 @@ use types::{ChainSpec, EthSpecId};
|
|||||||
|
|
||||||
// A macro is used to define this constant so it can be used with `include_bytes!`.
|
// A macro is used to define this constant so it can be used with `include_bytes!`.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! testnets_dir {
|
macro_rules! predefined_networks_dir {
|
||||||
() => {
|
() => {
|
||||||
"built_in_testnet_configs"
|
"built_in_network_configs"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const TESTNETS_DIR: &str = testnets_dir!();
|
pub const PREDEFINED_NETWORKS_DIR: &str = predefined_networks_dir!();
|
||||||
pub const GENESIS_FILE_NAME: &str = "genesis.ssz";
|
pub const GENESIS_FILE_NAME: &str = "genesis.ssz";
|
||||||
pub const GENESIS_ZIP_FILE_NAME: &str = "genesis.ssz.zip";
|
pub const GENESIS_ZIP_FILE_NAME: &str = "genesis.ssz.zip";
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ impl Eth2Config {
|
|||||||
|
|
||||||
/// A directory that can be built by downloading files via HTTP.
|
/// A directory that can be built by downloading files via HTTP.
|
||||||
///
|
///
|
||||||
/// Used by the `eth2_testnet_config` crate to initialize testnet directories during build and
|
/// Used by the `eth2_network_config` crate to initialize the network directories during build and
|
||||||
/// access them at runtime.
|
/// access them at runtime.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
pub struct Eth2NetArchiveAndDirectory<'a> {
|
pub struct Eth2NetArchiveAndDirectory<'a> {
|
||||||
@ -73,7 +73,7 @@ impl<'a> Eth2NetArchiveAndDirectory<'a> {
|
|||||||
.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(PREDEFINED_NETWORKS_DIR)
|
||||||
.join(self.unique_id)
|
.join(self.unique_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ macro_rules! define_net {
|
|||||||
genesis_is_known: $genesis_is_known,
|
genesis_is_known: $genesis_is_known,
|
||||||
};
|
};
|
||||||
|
|
||||||
// A wrapper around `std::include_bytes` which includes a file from a specific testnet
|
// A wrapper around `std::include_bytes` which includes a file from a specific network
|
||||||
// directory. Used by upstream crates to import files at compile time.
|
// directory. Used by upstream crates to import files at compile time.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! $macro_title {
|
macro_rules! $macro_title {
|
||||||
@ -102,7 +102,7 @@ macro_rules! define_net {
|
|||||||
include_bytes!(concat!(
|
include_bytes!(concat!(
|
||||||
$base_dir,
|
$base_dir,
|
||||||
"/",
|
"/",
|
||||||
testnets_dir!(),
|
predefined_networks_dir!(),
|
||||||
"/",
|
"/",
|
||||||
$name,
|
$name,
|
||||||
"/",
|
"/",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "eth2_testnet_config"
|
name = "eth2_network_config"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = ["Paul Hauner <paul@paulhauner.com>"]
|
authors = ["Paul Hauner <paul@paulhauner.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
@ -1,4 +1,4 @@
|
|||||||
//! Downloads a testnet configuration from Github.
|
//! Downloads a network configuration from Github.
|
||||||
|
|
||||||
use eth2_config::{
|
use eth2_config::{
|
||||||
altona, mainnet, medalla, pyrmont, spadina, toledo, Eth2NetArchiveAndDirectory,
|
altona, mainnet, medalla, pyrmont, spadina, toledo, Eth2NetArchiveAndDirectory,
|
||||||
@ -18,21 +18,21 @@ const ETH2_NET_DIRS: &[Eth2NetArchiveAndDirectory<'static>] = &[
|
|||||||
];
|
];
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for testnet in ETH2_NET_DIRS {
|
for network in ETH2_NET_DIRS {
|
||||||
match uncompress_state(testnet) {
|
match uncompress_state(network) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(e) => panic!(
|
Err(e) => panic!(
|
||||||
"Failed to uncompress {} genesis state zip file: {}",
|
"Failed to uncompress {} genesis state zip file: {}",
|
||||||
testnet.name, e
|
network.name, e
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Uncompress the testnet configs archive into a testnet configs folder.
|
/// Uncompress the network configs archive into a network configs folder.
|
||||||
fn uncompress_state(testnet: &Eth2NetArchiveAndDirectory<'static>) -> Result<(), String> {
|
fn uncompress_state(network: &Eth2NetArchiveAndDirectory<'static>) -> Result<(), String> {
|
||||||
if testnet.genesis_is_known {
|
if network.genesis_is_known {
|
||||||
let archive_path = testnet.genesis_state_archive();
|
let archive_path = network.genesis_state_archive();
|
||||||
let archive_file = File::open(&archive_path)
|
let archive_file = File::open(&archive_path)
|
||||||
.map_err(|e| format!("Failed to open archive file {:?}: {:?}", archive_path, e))?;
|
.map_err(|e| format!("Failed to open archive file {:?}: {:?}", archive_path, e))?;
|
||||||
|
|
||||||
@ -45,14 +45,14 @@ fn uncompress_state(testnet: &Eth2NetArchiveAndDirectory<'static>) -> Result<(),
|
|||||||
GENESIS_FILE_NAME, e
|
GENESIS_FILE_NAME, e
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let path = testnet.dir().join(GENESIS_FILE_NAME);
|
let path = network.dir().join(GENESIS_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 {
|
} else {
|
||||||
// Create empty genesis.ssz if genesis is unknown
|
// Create empty genesis.ssz if genesis is unknown
|
||||||
let genesis_file = testnet.dir().join(GENESIS_FILE_NAME);
|
let genesis_file = network.dir().join(GENESIS_FILE_NAME);
|
||||||
if !genesis_file.exists() {
|
if !genesis_file.exists() {
|
||||||
File::create(genesis_file)
|
File::create(genesis_file)
|
||||||
.map_err(|e| format!("Failed to create {}: {}", GENESIS_FILE_NAME, e))?;
|
.map_err(|e| format!("Failed to create {}: {}", GENESIS_FILE_NAME, e))?;
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,13 +1,4 @@
|
|||||||
//! This crate should eventually represent the structure at this repo:
|
use eth2_config::{predefined_networks_dir, *};
|
||||||
//!
|
|
||||||
//! https://github.com/eth2-clients/eth2-testnets/tree/master/nimbus/testnet1
|
|
||||||
//!
|
|
||||||
//! It is not accurate at the moment, we include extra files and we also don't support a few
|
|
||||||
//! others. We are unable to conform to the repo until we have the following PR merged:
|
|
||||||
//!
|
|
||||||
//! https://github.com/sigp/lighthouse/pull/605
|
|
||||||
//!
|
|
||||||
use eth2_config::{testnets_dir, *};
|
|
||||||
|
|
||||||
use enr::{CombinedKey, Enr};
|
use enr::{CombinedKey, Enr};
|
||||||
use ssz::Decode;
|
use ssz::Decode;
|
||||||
@ -55,13 +46,13 @@ const MAINNET: HardcodedNet = define_net!(mainnet, include_mainnet_file);
|
|||||||
const TOLEDO: HardcodedNet = define_net!(toledo, include_toledo_file);
|
const TOLEDO: HardcodedNet = define_net!(toledo, include_toledo_file);
|
||||||
|
|
||||||
const HARDCODED_NETS: &[HardcodedNet] = &[ALTONA, MEDALLA, SPADINA, PYRMONT, MAINNET, TOLEDO];
|
const HARDCODED_NETS: &[HardcodedNet] = &[ALTONA, MEDALLA, SPADINA, PYRMONT, MAINNET, TOLEDO];
|
||||||
pub const DEFAULT_HARDCODED_TESTNET: &str = "mainnet";
|
pub const DEFAULT_HARDCODED_NETWORK: &str = "mainnet";
|
||||||
|
|
||||||
/// Specifies an Eth2 testnet.
|
/// Specifies an Eth2 network.
|
||||||
///
|
///
|
||||||
/// See the crate-level documentation for more details.
|
/// See the crate-level documentation for more details.
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub struct Eth2TestnetConfig {
|
pub struct Eth2NetworkConfig {
|
||||||
/// Note: instead of the block where the contract is deployed, it is acceptable to set this
|
/// Note: instead of the block where the contract is deployed, it is acceptable to set this
|
||||||
/// value to be the block number where the first deposit occurs.
|
/// value to be the block number where the first deposit occurs.
|
||||||
pub deposit_contract_deploy_block: u64,
|
pub deposit_contract_deploy_block: u64,
|
||||||
@ -70,7 +61,7 @@ pub struct Eth2TestnetConfig {
|
|||||||
pub yaml_config: Option<YamlConfig>,
|
pub yaml_config: Option<YamlConfig>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eth2TestnetConfig {
|
impl Eth2NetworkConfig {
|
||||||
/// When Lighthouse is built it includes zero or more "hardcoded" network specifications. This
|
/// When Lighthouse is built it includes zero or more "hardcoded" network specifications. This
|
||||||
/// function allows for instantiating one of these nets by name.
|
/// function allows for instantiating one of these nets by name.
|
||||||
pub fn constant(name: &str) -> Result<Option<Self>, String> {
|
pub fn constant(name: &str) -> Result<Option<Self>, String> {
|
||||||
@ -100,7 +91,7 @@ impl Eth2TestnetConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an identifier that should be used for selecting an `EthSpec` instance for this
|
/// Returns an identifier that should be used for selecting an `EthSpec` instance for this
|
||||||
/// testnet.
|
/// network configuration.
|
||||||
pub fn eth_spec_id(&self) -> Result<EthSpecId, String> {
|
pub fn eth_spec_id(&self) -> Result<EthSpecId, String> {
|
||||||
self.yaml_config
|
self.yaml_config
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -133,7 +124,7 @@ impl Eth2TestnetConfig {
|
|||||||
/// Overwrites files if specified to do so.
|
/// Overwrites files if specified to do so.
|
||||||
pub fn write_to_file(&self, base_dir: PathBuf, overwrite: bool) -> Result<(), String> {
|
pub fn write_to_file(&self, base_dir: PathBuf, overwrite: bool) -> Result<(), String> {
|
||||||
if base_dir.exists() && !overwrite {
|
if base_dir.exists() && !overwrite {
|
||||||
return Err("Testnet directory already exists".to_string());
|
return Err("Network directory already exists".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
self.force_write_to_file(base_dir)
|
self.force_write_to_file(base_dir)
|
||||||
@ -257,7 +248,7 @@ mod tests {
|
|||||||
fn hard_coded_nets_work() {
|
fn hard_coded_nets_work() {
|
||||||
for net in HARDCODED_NETS {
|
for net in HARDCODED_NETS {
|
||||||
let config =
|
let config =
|
||||||
Eth2TestnetConfig::from_hardcoded_net(net).expect(&format!("{:?}", net.name));
|
Eth2NetworkConfig::from_hardcoded_net(net).expect(&format!("{:?}", net.name));
|
||||||
|
|
||||||
if net.name == "mainnet" || net.name == "toledo" || net.name == "pyrmont" {
|
if net.name == "mainnet" || net.name == "toledo" || net.name == "pyrmont" {
|
||||||
// Ensure we can parse the YAML config to a chain spec.
|
// Ensure we can parse the YAML config to a chain spec.
|
||||||
@ -314,7 +305,7 @@ mod tests {
|
|||||||
let base_dir = temp_dir.path().join("my_testnet");
|
let base_dir = temp_dir.path().join("my_testnet");
|
||||||
let deposit_contract_deploy_block = 42;
|
let deposit_contract_deploy_block = 42;
|
||||||
|
|
||||||
let testnet: Eth2TestnetConfig = Eth2TestnetConfig {
|
let testnet: Eth2NetworkConfig = Eth2NetworkConfig {
|
||||||
deposit_contract_deploy_block,
|
deposit_contract_deploy_block,
|
||||||
boot_enr,
|
boot_enr,
|
||||||
genesis_state_bytes: genesis_state.as_ref().map(Encode::as_ssz_bytes),
|
genesis_state_bytes: genesis_state.as_ref().map(Encode::as_ssz_bytes),
|
||||||
@ -325,7 +316,7 @@ mod tests {
|
|||||||
.write_to_file(base_dir.clone(), false)
|
.write_to_file(base_dir.clone(), false)
|
||||||
.expect("should write to file");
|
.expect("should write to file");
|
||||||
|
|
||||||
let decoded = Eth2TestnetConfig::load(base_dir).expect("should load struct");
|
let decoded = Eth2NetworkConfig::load(base_dir).expect("should load struct");
|
||||||
|
|
||||||
assert_eq!(testnet, decoded, "should decode as encoded");
|
assert_eq!(testnet, decoded, "should decode as encoded");
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ regex = "1.3.9"
|
|||||||
futures = { version = "0.3.7", features = ["compat"] }
|
futures = { version = "0.3.7", features = ["compat"] }
|
||||||
environment = { path = "../lighthouse/environment" }
|
environment = { path = "../lighthouse/environment" }
|
||||||
web3 = "0.11.0"
|
web3 = "0.11.0"
|
||||||
eth2_testnet_config = { path = "../common/eth2_testnet_config" }
|
eth2_network_config = { path = "../common/eth2_network_config" }
|
||||||
dirs = "3.0.1"
|
dirs = "3.0.1"
|
||||||
genesis = { path = "../beacon_node/genesis" }
|
genesis = { path = "../beacon_node/genesis" }
|
||||||
deposit_contract = { path = "../common/deposit_contract" }
|
deposit_contract = { path = "../common/deposit_contract" }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use environment::Environment;
|
use environment::Environment;
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_network_config::Eth2NetworkConfig;
|
||||||
use genesis::{Eth1Config, Eth1GenesisService};
|
use genesis::{Eth1Config, Eth1GenesisService};
|
||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
@ -32,9 +32,9 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches<'_>) -> Res
|
|||||||
.expect("should locate home directory")
|
.expect("should locate home directory")
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut eth2_testnet_config = Eth2TestnetConfig::load(testnet_dir.clone())?;
|
let mut eth2_network_config = Eth2NetworkConfig::load(testnet_dir.clone())?;
|
||||||
|
|
||||||
let spec = eth2_testnet_config
|
let spec = eth2_network_config
|
||||||
.yaml_config
|
.yaml_config
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or("The testnet directory must contain a spec config")?
|
.ok_or("The testnet directory must contain a spec config")?
|
||||||
@ -51,8 +51,8 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches<'_>) -> Res
|
|||||||
config.endpoints = v;
|
config.endpoints = v;
|
||||||
}
|
}
|
||||||
config.deposit_contract_address = format!("{:?}", spec.deposit_contract_address);
|
config.deposit_contract_address = format!("{:?}", spec.deposit_contract_address);
|
||||||
config.deposit_contract_deploy_block = eth2_testnet_config.deposit_contract_deploy_block;
|
config.deposit_contract_deploy_block = eth2_network_config.deposit_contract_deploy_block;
|
||||||
config.lowest_cached_block_number = eth2_testnet_config.deposit_contract_deploy_block;
|
config.lowest_cached_block_number = eth2_network_config.deposit_contract_deploy_block;
|
||||||
config.follow_distance = spec.eth1_follow_distance / 2;
|
config.follow_distance = spec.eth1_follow_distance / 2;
|
||||||
config.node_far_behind_seconds = max(5, config.follow_distance) * spec.seconds_per_eth1_block;
|
config.node_far_behind_seconds = max(5, config.follow_distance) * spec.seconds_per_eth1_block;
|
||||||
|
|
||||||
@ -65,8 +65,8 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches<'_>) -> Res
|
|||||||
.wait_for_genesis_state::<T>(ETH1_GENESIS_UPDATE_INTERVAL, spec)
|
.wait_for_genesis_state::<T>(ETH1_GENESIS_UPDATE_INTERVAL, spec)
|
||||||
.await
|
.await
|
||||||
.map(move |genesis_state| {
|
.map(move |genesis_state| {
|
||||||
eth2_testnet_config.genesis_state_bytes = Some(genesis_state.as_ssz_bytes());
|
eth2_network_config.genesis_state_bytes = Some(genesis_state.as_ssz_bytes());
|
||||||
eth2_testnet_config.force_write_to_file(testnet_dir)
|
eth2_network_config.force_write_to_file(testnet_dir)
|
||||||
})
|
})
|
||||||
.map_err(|e| format!("Failed to find genesis: {}", e))?;
|
.map_err(|e| format!("Failed to find genesis: {}", e))?;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use clap_utils::parse_ssz_optional;
|
use clap_utils::parse_ssz_optional;
|
||||||
use environment::Environment;
|
use environment::Environment;
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_network_config::Eth2NetworkConfig;
|
||||||
use genesis::interop_genesis_state;
|
use genesis::interop_genesis_state;
|
||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -36,9 +36,9 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
|||||||
.expect("should locate home directory")
|
.expect("should locate home directory")
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut eth2_testnet_config = Eth2TestnetConfig::load(testnet_dir.clone())?;
|
let mut eth2_network_config = Eth2NetworkConfig::load(testnet_dir.clone())?;
|
||||||
|
|
||||||
let mut spec = eth2_testnet_config
|
let mut spec = eth2_network_config
|
||||||
.yaml_config
|
.yaml_config
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or("The testnet directory must contain a spec config")?
|
.ok_or("The testnet directory must contain a spec config")?
|
||||||
@ -57,8 +57,8 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
|||||||
let keypairs = generate_deterministic_keypairs(validator_count);
|
let keypairs = generate_deterministic_keypairs(validator_count);
|
||||||
let genesis_state = interop_genesis_state::<T>(&keypairs, genesis_time, &spec)?;
|
let genesis_state = interop_genesis_state::<T>(&keypairs, genesis_time, &spec)?;
|
||||||
|
|
||||||
eth2_testnet_config.genesis_state_bytes = Some(genesis_state.as_ssz_bytes());
|
eth2_network_config.genesis_state_bytes = Some(genesis_state.as_ssz_bytes());
|
||||||
eth2_testnet_config.force_write_to_file(testnet_dir)?;
|
eth2_network_config.force_write_to_file(testnet_dir)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use clap::ArgMatches;
|
|||||||
use clap_utils::{
|
use clap_utils::{
|
||||||
parse_optional, parse_path_with_default_in_home_dir, parse_required, parse_ssz_optional,
|
parse_optional, parse_path_with_default_in_home_dir, parse_required, parse_ssz_optional,
|
||||||
};
|
};
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_network_config::Eth2NetworkConfig;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use types::{Address, EthSpec, YamlConfig};
|
use types::{Address, EthSpec, YamlConfig};
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ pub fn run<T: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
|
|||||||
spec.genesis_fork_version = v;
|
spec.genesis_fork_version = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
let testnet = Eth2TestnetConfig {
|
let testnet = Eth2NetworkConfig {
|
||||||
deposit_contract_deploy_block,
|
deposit_contract_deploy_block,
|
||||||
boot_enr: Some(vec![]),
|
boot_enr: Some(vec![]),
|
||||||
genesis_state_bytes: None,
|
genesis_state_bytes: None,
|
||||||
|
@ -32,7 +32,7 @@ futures = "0.3.7"
|
|||||||
validator_client = { "path" = "../validator_client" }
|
validator_client = { "path" = "../validator_client" }
|
||||||
account_manager = { "path" = "../account_manager" }
|
account_manager = { "path" = "../account_manager" }
|
||||||
clap_utils = { path = "../common/clap_utils" }
|
clap_utils = { path = "../common/clap_utils" }
|
||||||
eth2_testnet_config = { path = "../common/eth2_testnet_config" }
|
eth2_network_config = { path = "../common/eth2_network_config" }
|
||||||
directory = { path = "../common/directory" }
|
directory = { path = "../common/directory" }
|
||||||
lighthouse_version = { path = "../common/lighthouse_version" }
|
lighthouse_version = { path = "../common/lighthouse_version" }
|
||||||
account_utils = { path = "../common/account_utils" }
|
account_utils = { path = "../common/account_utils" }
|
||||||
|
@ -11,7 +11,7 @@ sloggers = "1.0.1"
|
|||||||
types = { "path" = "../../consensus/types" }
|
types = { "path" = "../../consensus/types" }
|
||||||
eth2_config = { "path" = "../../common/eth2_config" }
|
eth2_config = { "path" = "../../common/eth2_config" }
|
||||||
task_executor = { "path" = "../../common/task_executor" }
|
task_executor = { "path" = "../../common/task_executor" }
|
||||||
eth2_testnet_config = { path = "../../common/eth2_testnet_config" }
|
eth2_network_config = { path = "../../common/eth2_network_config" }
|
||||||
logging = { path = "../../common/logging" }
|
logging = { path = "../../common/logging" }
|
||||||
slog-term = "2.6.0"
|
slog-term = "2.6.0"
|
||||||
slog-async = "2.5.0"
|
slog-async = "2.5.0"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//! logging.
|
//! logging.
|
||||||
|
|
||||||
use eth2_config::Eth2Config;
|
use eth2_config::Eth2Config;
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_network_config::Eth2NetworkConfig;
|
||||||
use futures::channel::{
|
use futures::channel::{
|
||||||
mpsc::{channel, Receiver, Sender},
|
mpsc::{channel, Receiver, Sender},
|
||||||
oneshot,
|
oneshot,
|
||||||
@ -38,7 +38,7 @@ pub struct EnvironmentBuilder<E: EthSpec> {
|
|||||||
log: Option<Logger>,
|
log: Option<Logger>,
|
||||||
eth_spec_instance: E,
|
eth_spec_instance: E,
|
||||||
eth2_config: Eth2Config,
|
eth2_config: Eth2Config,
|
||||||
testnet: Option<Eth2TestnetConfig>,
|
testnet: Option<Eth2NetworkConfig>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EnvironmentBuilder<MinimalEthSpec> {
|
impl EnvironmentBuilder<MinimalEthSpec> {
|
||||||
@ -221,12 +221,12 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a testnet configuration to the environment.
|
/// Adds a testnet configuration to the environment.
|
||||||
pub fn eth2_testnet_config(
|
pub fn eth2_network_config(
|
||||||
mut self,
|
mut self,
|
||||||
eth2_testnet_config: Eth2TestnetConfig,
|
eth2_network_config: Eth2NetworkConfig,
|
||||||
) -> Result<Self, String> {
|
) -> Result<Self, String> {
|
||||||
// Create a new chain spec from the default configuration.
|
// Create a new chain spec from the default configuration.
|
||||||
self.eth2_config.spec = eth2_testnet_config
|
self.eth2_config.spec = eth2_network_config
|
||||||
.yaml_config
|
.yaml_config
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or("The testnet directory must contain a spec config")?
|
.ok_or("The testnet directory must contain a spec config")?
|
||||||
@ -238,18 +238,18 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
|
|||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
self.testnet = Some(eth2_testnet_config);
|
self.testnet = Some(eth2_network_config);
|
||||||
|
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Optionally adds a testnet configuration to the environment.
|
/// Optionally adds a testnet configuration to the environment.
|
||||||
pub fn optional_eth2_testnet_config(
|
pub fn optional_eth2_network_config(
|
||||||
self,
|
self,
|
||||||
optional_config: Option<Eth2TestnetConfig>,
|
optional_config: Option<Eth2NetworkConfig>,
|
||||||
) -> Result<Self, String> {
|
) -> Result<Self, String> {
|
||||||
if let Some(config) = optional_config {
|
if let Some(config) = optional_config {
|
||||||
self.eth2_testnet_config(config)
|
self.eth2_network_config(config)
|
||||||
} else {
|
} else {
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ pub struct Environment<E: EthSpec> {
|
|||||||
log: Logger,
|
log: Logger,
|
||||||
eth_spec_instance: E,
|
eth_spec_instance: E,
|
||||||
pub eth2_config: Eth2Config,
|
pub eth2_config: Eth2Config,
|
||||||
pub testnet: Option<Eth2TestnetConfig>,
|
pub testnet: Option<Eth2NetworkConfig>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: EthSpec> Environment<E> {
|
impl<E: EthSpec> Environment<E> {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#![cfg(test)]
|
#![cfg(test)]
|
||||||
|
|
||||||
use environment::EnvironmentBuilder;
|
use environment::EnvironmentBuilder;
|
||||||
use eth2_testnet_config::{Eth2TestnetConfig, DEFAULT_HARDCODED_TESTNET};
|
use eth2_network_config::{Eth2NetworkConfig, DEFAULT_HARDCODED_NETWORK};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use types::{V012LegacyEthSpec, YamlConfig};
|
use types::{V012LegacyEthSpec, YamlConfig};
|
||||||
|
|
||||||
@ -13,8 +13,8 @@ fn builder() -> EnvironmentBuilder<V012LegacyEthSpec> {
|
|||||||
.expect("should set logger")
|
.expect("should set logger")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eth2_testnet_config() -> Option<Eth2TestnetConfig> {
|
fn eth2_network_config() -> Option<Eth2NetworkConfig> {
|
||||||
Eth2TestnetConfig::constant(DEFAULT_HARDCODED_TESTNET).expect("should decode mainnet params")
|
Eth2NetworkConfig::constant(DEFAULT_HARDCODED_NETWORK).expect("should decode mainnet params")
|
||||||
}
|
}
|
||||||
|
|
||||||
mod setup_eth2_config {
|
mod setup_eth2_config {
|
||||||
@ -22,15 +22,15 @@ mod setup_eth2_config {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn update_spec_with_yaml_config() {
|
fn update_spec_with_yaml_config() {
|
||||||
if let Some(mut eth2_testnet_config) = eth2_testnet_config() {
|
if let Some(mut eth2_network_config) = eth2_network_config() {
|
||||||
let config_yaml = PathBuf::from("./tests/testnet_dir/config.yaml");
|
let config_yaml = PathBuf::from("./tests/testnet_dir/config.yaml");
|
||||||
|
|
||||||
eth2_testnet_config.yaml_config = Some(
|
eth2_network_config.yaml_config = Some(
|
||||||
YamlConfig::from_file(config_yaml.as_path()).expect("should load yaml config"),
|
YamlConfig::from_file(config_yaml.as_path()).expect("should load yaml config"),
|
||||||
);
|
);
|
||||||
|
|
||||||
let environment = builder()
|
let environment = builder()
|
||||||
.eth2_testnet_config(eth2_testnet_config)
|
.eth2_network_config(eth2_network_config)
|
||||||
.expect("should setup eth2_config")
|
.expect("should setup eth2_config")
|
||||||
.build()
|
.build()
|
||||||
.expect("should build environment");
|
.expect("should build environment");
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use beacon_node::ProductionBeaconNode;
|
use beacon_node::{get_eth2_network_config, ProductionBeaconNode};
|
||||||
use clap::{App, Arg, ArgMatches};
|
use clap::{App, Arg, ArgMatches};
|
||||||
use env_logger::{Builder, Env};
|
use env_logger::{Builder, Env};
|
||||||
use environment::EnvironmentBuilder;
|
use environment::EnvironmentBuilder;
|
||||||
use eth2_testnet_config::{Eth2TestnetConfig, DEFAULT_HARDCODED_TESTNET};
|
use eth2_network_config::{Eth2NetworkConfig, DEFAULT_HARDCODED_NETWORK};
|
||||||
use lighthouse_version::VERSION;
|
use lighthouse_version::VERSION;
|
||||||
use slog::{crit, info, warn};
|
use slog::{crit, info, warn};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -118,7 +118,6 @@ fn main() {
|
|||||||
.help("Name of the Eth2 chain Lighthouse will sync and follow.")
|
.help("Name of the Eth2 chain Lighthouse will sync and follow.")
|
||||||
.possible_values(&["medalla", "altona", "spadina", "pyrmont", "mainnet", "toledo"])
|
.possible_values(&["medalla", "altona", "spadina", "pyrmont", "mainnet", "toledo"])
|
||||||
.conflicts_with("testnet-dir")
|
.conflicts_with("testnet-dir")
|
||||||
.default_value(DEFAULT_HARDCODED_TESTNET)
|
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.global(true)
|
.global(true)
|
||||||
|
|
||||||
@ -135,7 +134,7 @@ fn main() {
|
|||||||
Builder::from_env(Env::default()).init();
|
Builder::from_env(Env::default()).init();
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = load_testnet_config(&matches).and_then(|testnet_config| {
|
let result = get_eth2_network_config(&matches).and_then(|testnet_config| {
|
||||||
let eth_spec_id = testnet_config.eth_spec_id()?;
|
let eth_spec_id = testnet_config.eth_spec_id()?;
|
||||||
|
|
||||||
// boot node subcommand circumvents the environment
|
// boot node subcommand circumvents the environment
|
||||||
@ -174,22 +173,10 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_testnet_config(matches: &ArgMatches) -> Result<Eth2TestnetConfig, String> {
|
|
||||||
if matches.is_present("testnet-dir") {
|
|
||||||
clap_utils::parse_testnet_dir(matches, "testnet-dir")?
|
|
||||||
.ok_or_else(|| "Unable to load testnet dir".to_string())
|
|
||||||
} else if matches.is_present("network") {
|
|
||||||
clap_utils::parse_hardcoded_network(matches, "network")?
|
|
||||||
.ok_or_else(|| "Unable to load hard coded network config".to_string())
|
|
||||||
} else {
|
|
||||||
Err("No --network or --testnet-dir flags provided, cannot start.".to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run<E: EthSpec>(
|
fn run<E: EthSpec>(
|
||||||
environment_builder: EnvironmentBuilder<E>,
|
environment_builder: EnvironmentBuilder<E>,
|
||||||
matches: &ArgMatches,
|
matches: &ArgMatches,
|
||||||
testnet_config: Eth2TestnetConfig,
|
testnet_config: Eth2NetworkConfig,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
if std::mem::size_of::<usize>() != 8 {
|
if std::mem::size_of::<usize>() != 8 {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
@ -215,7 +202,7 @@ fn run<E: EthSpec>(
|
|||||||
|
|
||||||
let mut environment = builder
|
let mut environment = builder
|
||||||
.multi_threaded_tokio_runtime()?
|
.multi_threaded_tokio_runtime()?
|
||||||
.optional_eth2_testnet_config(Some(testnet_config))?
|
.optional_eth2_network_config(Some(testnet_config))?
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let log = environment.core_context().log().clone();
|
let log = environment.core_context().log().clone();
|
||||||
@ -248,15 +235,15 @@ fn run<E: EthSpec>(
|
|||||||
let optional_testnet = clap_utils::parse_optional::<String>(matches, "network")?;
|
let optional_testnet = clap_utils::parse_optional::<String>(matches, "network")?;
|
||||||
let optional_testnet_dir = clap_utils::parse_optional::<PathBuf>(matches, "testnet-dir")?;
|
let optional_testnet_dir = clap_utils::parse_optional::<PathBuf>(matches, "testnet-dir")?;
|
||||||
|
|
||||||
let testnet_name = match (optional_testnet, optional_testnet_dir) {
|
let network_name = match (optional_testnet, optional_testnet_dir) {
|
||||||
(Some(testnet), None) => testnet,
|
(Some(testnet), None) => testnet,
|
||||||
(None, Some(testnet_dir)) => format!("custom ({})", testnet_dir.display()),
|
(None, Some(testnet_dir)) => format!("custom ({})", testnet_dir.display()),
|
||||||
(None, None) => DEFAULT_HARDCODED_TESTNET.to_string(),
|
(None, None) => DEFAULT_HARDCODED_NETWORK.to_string(),
|
||||||
(Some(_), Some(_)) => panic!("CLI prevents both --network and --testnet-dir"),
|
(Some(_), Some(_)) => panic!("CLI prevents both --network and --testnet-dir"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(sub_matches) = matches.subcommand_matches("account_manager") {
|
if let Some(sub_matches) = matches.subcommand_matches("account_manager") {
|
||||||
eprintln!("Running account manager for {} network", testnet_name);
|
eprintln!("Running account manager for {} network", network_name);
|
||||||
// Pass the entire `environment` to the account manager so it can run blocking operations.
|
// Pass the entire `environment` to the account manager so it can run blocking operations.
|
||||||
account_manager::run(sub_matches, environment)?;
|
account_manager::run(sub_matches, environment)?;
|
||||||
|
|
||||||
@ -268,7 +255,7 @@ fn run<E: EthSpec>(
|
|||||||
info!(
|
info!(
|
||||||
log,
|
log,
|
||||||
"Configured for network";
|
"Configured for network";
|
||||||
"name" => &testnet_name
|
"name" => &network_name
|
||||||
);
|
);
|
||||||
|
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
|
@ -2,7 +2,7 @@ use crate::{http_api, http_metrics};
|
|||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use clap_utils::{parse_optional, parse_required};
|
use clap_utils::{parse_optional, parse_required};
|
||||||
use directory::{
|
use directory::{
|
||||||
get_testnet_name, DEFAULT_HARDCODED_TESTNET, DEFAULT_ROOT_DIR, DEFAULT_SECRET_DIR,
|
get_network_dir, DEFAULT_HARDCODED_NETWORK, DEFAULT_ROOT_DIR, DEFAULT_SECRET_DIR,
|
||||||
DEFAULT_VALIDATOR_DIR,
|
DEFAULT_VALIDATOR_DIR,
|
||||||
};
|
};
|
||||||
use eth2::types::Graffiti;
|
use eth2::types::Graffiti;
|
||||||
@ -44,12 +44,12 @@ pub struct Config {
|
|||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
/// Build a new configuration from defaults.
|
/// Build a new configuration from defaults.
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
// WARNING: these directory defaults should be always overrided with parameters
|
// WARNING: these directory defaults should be always overwritten with parameters from cli
|
||||||
// from cli for specific networks.
|
// for specific networks.
|
||||||
let base_dir = dirs::home_dir()
|
let base_dir = dirs::home_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join(DEFAULT_ROOT_DIR)
|
.join(DEFAULT_ROOT_DIR)
|
||||||
.join(DEFAULT_HARDCODED_TESTNET);
|
.join(DEFAULT_HARDCODED_NETWORK);
|
||||||
let validator_dir = base_dir.join(DEFAULT_VALIDATOR_DIR);
|
let validator_dir = base_dir.join(DEFAULT_VALIDATOR_DIR);
|
||||||
let secrets_dir = base_dir.join(DEFAULT_SECRET_DIR);
|
let secrets_dir = base_dir.join(DEFAULT_SECRET_DIR);
|
||||||
Self {
|
Self {
|
||||||
@ -91,13 +91,13 @@ impl Config {
|
|||||||
|
|
||||||
config.validator_dir = validator_dir.unwrap_or_else(|| {
|
config.validator_dir = validator_dir.unwrap_or_else(|| {
|
||||||
default_root_dir
|
default_root_dir
|
||||||
.join(get_testnet_name(cli_args))
|
.join(get_network_dir(cli_args))
|
||||||
.join(DEFAULT_VALIDATOR_DIR)
|
.join(DEFAULT_VALIDATOR_DIR)
|
||||||
});
|
});
|
||||||
|
|
||||||
config.secrets_dir = secrets_dir.unwrap_or_else(|| {
|
config.secrets_dir = secrets_dir.unwrap_or_else(|| {
|
||||||
default_root_dir
|
default_root_dir
|
||||||
.join(get_testnet_name(cli_args))
|
.join(get_network_dir(cli_args))
|
||||||
.join(DEFAULT_SECRET_DIR)
|
.join(DEFAULT_SECRET_DIR)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user