2019-03-30 07:14:04 +00:00
|
|
|
mod attestation_producer;
|
2019-03-29 06:28:07 +00:00
|
|
|
mod block_producer;
|
2019-02-14 01:09:18 +00:00
|
|
|
mod config;
|
|
|
|
mod duties;
|
2019-03-25 05:50:15 +00:00
|
|
|
pub mod error;
|
2019-03-22 06:27:07 +00:00
|
|
|
mod service;
|
2019-03-29 05:33:27 +00:00
|
|
|
mod signer;
|
2019-03-22 06:27:07 +00:00
|
|
|
|
2019-03-25 06:03:17 +00:00
|
|
|
use crate::config::Config as ValidatorClientConfig;
|
2019-03-22 06:27:07 +00:00
|
|
|
use clap::{App, Arg};
|
2019-03-29 12:45:53 +00:00
|
|
|
use protos::services_grpc::ValidatorServiceClient;
|
2019-04-08 05:02:11 +00:00
|
|
|
use crate::service::Service as ValidatorService;
|
2019-03-25 05:50:15 +00:00
|
|
|
use slog::{error, info, o, Drain};
|
2019-03-30 03:27:37 +00:00
|
|
|
use types::Keypair;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Logging
|
|
|
|
let decorator = slog_term::TermDecorator::new().build();
|
|
|
|
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
|
|
|
|
let drain = slog_async::Async::new(drain).build().fuse();
|
|
|
|
let log = slog::Logger::root(drain, o!());
|
|
|
|
|
|
|
|
// CLI
|
|
|
|
let matches = App::new("Lighthouse Validator Client")
|
|
|
|
.version("0.0.1")
|
|
|
|
.author("Sigma Prime <contact@sigmaprime.io>")
|
|
|
|
.about("Eth 2.0 Validator Client")
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("datadir")
|
|
|
|
.long("datadir")
|
|
|
|
.value_name("DIR")
|
|
|
|
.help("Data directory for keys and databases.")
|
|
|
|
.takes_value(true),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("server")
|
|
|
|
.long("server")
|
|
|
|
.value_name("server")
|
|
|
|
.help("Address to connect to BeaconNode.")
|
|
|
|
.takes_value(true),
|
|
|
|
)
|
2019-03-01 17:19:08 +00:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("spec")
|
|
|
|
.long("spec")
|
|
|
|
.value_name("spec")
|
|
|
|
.short("s")
|
|
|
|
.help("Configuration of Beacon Chain")
|
|
|
|
.takes_value(true)
|
2019-03-28 03:32:02 +00:00
|
|
|
.possible_values(&["foundation", "few_validators", "lighthouse_testnet"])
|
|
|
|
.default_value("lighthouse_testnet"),
|
2019-03-01 17:19:08 +00:00
|
|
|
)
|
2019-02-14 01:09:18 +00:00
|
|
|
.get_matches();
|
|
|
|
|
2019-03-25 06:03:17 +00:00
|
|
|
let config = ValidatorClientConfig::parse_args(&matches, &log)
|
2019-03-20 05:23:33 +00:00
|
|
|
.expect("Unable to build a configuration for the validator client.");
|
2019-02-14 01:09:18 +00:00
|
|
|
|
2019-03-22 06:27:07 +00:00
|
|
|
// start the validator service.
|
2019-03-30 03:27:37 +00:00
|
|
|
// this specifies the GRPC and signer type to use as the duty manager beacon node.
|
|
|
|
match ValidatorService::<ValidatorServiceClient, Keypair>::start(config, log.clone()) {
|
2019-03-25 05:50:15 +00:00
|
|
|
Ok(_) => info!(log, "Validator client shutdown successfully."),
|
2019-03-25 06:47:23 +00:00
|
|
|
Err(e) => error!(log, "Validator exited due to: {}", e.to_string()),
|
2019-03-25 05:50:15 +00:00
|
|
|
}
|
2019-02-14 01:09:18 +00:00
|
|
|
}
|