Lighthouse bootnode (#1265)

* Initial bootnode structure

* Add boot_node subcommand

* Add bootnode subcommand

* fmt corrections

* Extend help message

* Move boot_node crate

* Update discv5 dep

* Improve logging and boot-node logging

Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
Age Manning
2020-06-19 16:30:07 +10:00
committed by GitHub
parent f3380c00b8
commit f3d05c15d1
10 changed files with 509 additions and 93 deletions

View File

@@ -19,6 +19,7 @@ logging = { path = "../common/logging" }
slog-term = "2.5.0"
slog-async = "2.5.0"
environment = { path = "./environment" }
boot_node = { path = "../boot_node" }
futures = "0.3.5"
validator_client = { "path" = "../validator_client" }
account_manager = { "path" = "../account_manager" }

View File

@@ -18,13 +18,11 @@ pub const CLIENT_CONFIG_FILENAME: &str = "beacon-node.toml";
pub const ETH2_CONFIG_FILENAME: &str = "eth2-spec.toml";
fn main() {
// Debugging output for libp2p and external crates.
Builder::from_env(Env::default()).init();
// Parse the CLI parameters.
let matches = App::new("Lighthouse")
.version(crate_version!())
.author("Sigma Prime <contact@sigmaprime.io>")
.setting(clap::AppSettings::ColoredHelp)
.about(
"Ethereum 2.0 client by Sigma Prime. Provides a full-featured beacon \
node, a validator client and utilities for managing validator accounts.",
@@ -40,6 +38,13 @@ fn main() {
.global(true)
.default_value("mainnet"),
)
.arg(
Arg::with_name("env_log")
.short("l")
.help("Enables environment logging giving access to sub-protocol logs such as discv5 and libp2p",
)
.takes_value(false),
)
.arg(
Arg::with_name("logfile")
.long("logfile")
@@ -64,6 +69,7 @@ fn main() {
.help("The verbosity level for emitting logs.")
.takes_value(true)
.possible_values(&["info", "debug", "trace", "warn", "error", "crit"])
.global(true)
.default_value("info"),
)
.arg(
@@ -89,10 +95,27 @@ fn main() {
.global(true),
)
.subcommand(beacon_node::cli_app())
.subcommand(boot_node::cli_app())
.subcommand(validator_client::cli_app())
.subcommand(account_manager::cli_app())
.get_matches();
// boot node subcommand circumvents the environment
if let Some(bootnode_matches) = matches.subcommand_matches("boot_node") {
// The bootnode uses the main debug-level flag
let debug_info = matches
.value_of("debug-level")
.expect("Debug-level must be present")
.into();
boot_node::run(bootnode_matches, debug_info);
return;
}
// Debugging output for libp2p and external crates.
if matches.is_present("env_log") {
Builder::from_env(Env::default()).init();
}
macro_rules! run_with_spec {
($env_builder: expr) => {
run($env_builder, &matches)