Add additional logs to validator client

This commit is contained in:
Paul Hauner 2019-09-10 17:40:21 -04:00
parent b33f9c2bc9
commit 3fe61f5044
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C
6 changed files with 37 additions and 7 deletions

View File

@ -1386,10 +1386,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
new_head.beacon_state.build_all_caches(&self.spec)?; new_head.beacon_state.build_all_caches(&self.spec)?;
trace!(self.log, "Taking write lock on head");
// Update the checkpoint that stores the head of the chain at the time it received the // Update the checkpoint that stores the head of the chain at the time it received the
// block. // block.
*self.canonical_head.write() = new_head; *self.canonical_head.write() = new_head;
trace!(self.log, "Dropping write lock on head");
// Save `self` to `self.store`. // Save `self` to `self.store`.
self.persist()?; self.persist()?;

View File

@ -25,8 +25,8 @@ impl<T: BeaconChainTypes> ValidatorService for ValidatorServiceInstance<T> {
req: GetDutiesRequest, req: GetDutiesRequest,
sink: UnarySink<GetDutiesResponse>, sink: UnarySink<GetDutiesResponse>,
) { ) {
let validators = req.get_validators();
trace!(self.log, "RPC request"; "endpoint" => "GetValidatorDuties", "epoch" => req.get_epoch()); trace!(self.log, "RPC request"; "endpoint" => "GetValidatorDuties", "epoch" => req.get_epoch());
let validators = req.get_validators();
let epoch = Epoch::from(req.get_epoch()); let epoch = Epoch::from(req.get_epoch());
let slot = epoch.start_slot(T::EthSpec::slots_per_epoch()); let slot = epoch.start_slot(T::EthSpec::slots_per_epoch());

View File

@ -26,7 +26,7 @@ slot_clock = { path = "../eth2/utils/slot_clock" }
types = { path = "../eth2/types" } types = { path = "../eth2/types" }
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
slog = "^2.2.3" slog = { version = "^2.2.3" , features = ["max_level_trace", "release_max_level_trace"] }
slog-async = "^2.3.0" slog-async = "^2.3.0"
slog-json = "^2.3" slog-json = "^2.3"
slog-term = "^2.4.0" slog-term = "^2.4.0"

View File

@ -232,7 +232,11 @@ impl Config {
let keypairs = match &self.key_source { let keypairs = match &self.key_source {
KeySource::Disk => self.fetch_keys_from_disk(log)?, KeySource::Disk => self.fetch_keys_from_disk(log)?,
KeySource::TestingKeypairRange(range) => { KeySource::TestingKeypairRange(range) => {
warn!(log, "Using insecure private keys"); warn!(
log,
"Using insecure interop private keys";
"range" => format!("{:?}", range)
);
self.fetch_testing_keypairs(range.clone())? self.fetch_testing_keypairs(range.clone())?
} }
KeySource::YamlKeypairs(path) => { KeySource::YamlKeypairs(path) => {

View File

@ -82,7 +82,8 @@ fn main() {
) )
.arg( .arg(
Arg::with_name("server-grpc-port") Arg::with_name("server-grpc-port")
.long("g") .long("server-grpc-port")
.short("g")
.value_name("PORT") .value_name("PORT")
.help("Port to use for gRPC API connection to the server.") .help("Port to use for gRPC API connection to the server.")
.default_value(DEFAULT_SERVER_GRPC_PORT) .default_value(DEFAULT_SERVER_GRPC_PORT)
@ -90,7 +91,8 @@ fn main() {
) )
.arg( .arg(
Arg::with_name("server-http-port") Arg::with_name("server-http-port")
.long("h") .long("server-http-port")
.short("h")
.value_name("PORT") .value_name("PORT")
.help("Port to use for HTTP API connection to the server.") .help("Port to use for HTTP API connection to the server.")
.default_value(DEFAULT_SERVER_HTTP_PORT) .default_value(DEFAULT_SERVER_HTTP_PORT)
@ -104,7 +106,7 @@ fn main() {
.help("The title of the spec constants for chain config.") .help("The title of the spec constants for chain config.")
.takes_value(true) .takes_value(true)
.possible_values(&["info", "debug", "trace", "warn", "error", "crit"]) .possible_values(&["info", "debug", "trace", "warn", "error", "crit"])
.default_value("info"), .default_value("trace"),
) )
/* /*
* The "testnet" sub-command. * The "testnet" sub-command.
@ -152,7 +154,9 @@ fn main() {
Some("crit") => drain.filter_level(Level::Critical), Some("crit") => drain.filter_level(Level::Critical),
_ => unreachable!("guarded by clap"), _ => unreachable!("guarded by clap"),
}; };
let mut log = slog::Logger::root(drain.fuse(), o!()); let mut log = slog::Logger::root(drain.fuse(), o!());
let (client_config, eth2_config) = match get_configs(&matches, &mut log) { let (client_config, eth2_config) = match get_configs(&matches, &mut log) {
Ok(tuple) => tuple, Ok(tuple) => tuple,
Err(e) => { Err(e) => {

View File

@ -22,7 +22,7 @@ use protos::services_grpc::{
AttestationServiceClient, BeaconBlockServiceClient, BeaconNodeServiceClient, AttestationServiceClient, BeaconBlockServiceClient, BeaconNodeServiceClient,
ValidatorServiceClient, ValidatorServiceClient,
}; };
use slog::{crit, error, info, warn}; use slog::{crit, error, info, trace, warn};
use slot_clock::{SlotClock, SystemTimeSlotClock}; use slot_clock::{SlotClock, SystemTimeSlotClock};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::sync::Arc; use std::sync::Arc;
@ -289,6 +289,11 @@ impl<B: BeaconNodeDuties + 'static, S: Signer + 'static, E: EthSpec> Service<B,
/* process any required duties for validators */ /* process any required duties for validators */
self.process_duties(); self.process_duties();
trace!(
self.log,
"Per slot execution finished";
);
Ok(()) Ok(())
} }
@ -328,6 +333,13 @@ impl<B: BeaconNodeDuties + 'static, S: Signer + 'static, E: EthSpec> Service<B,
.current_slot .current_slot
.expect("The current slot must be updated before checking for duties") .expect("The current slot must be updated before checking for duties")
.epoch(self.slots_per_epoch); .epoch(self.slots_per_epoch);
trace!(
self.log,
"Checking for duties";
"epoch" => current_epoch
);
// spawn a new thread separate to the runtime // spawn a new thread separate to the runtime
// TODO: Handle thread termination/timeout // TODO: Handle thread termination/timeout
// TODO: Add duties thread back in, with channel to process duties in duty change. // TODO: Add duties thread back in, with channel to process duties in duty change.
@ -345,6 +357,12 @@ impl<B: BeaconNodeDuties + 'static, S: Signer + 'static, E: EthSpec> Service<B,
self.current_slot self.current_slot
.expect("The current slot must be updated before processing duties"), .expect("The current slot must be updated before processing duties"),
) { ) {
trace!(
self.log,
"Processing duties";
"work_items" => work.len()
);
for (signer_index, work_type) in work { for (signer_index, work_type) in work {
if work_type.produce_block { if work_type.produce_block {
// we need to produce a block // we need to produce a block