From 97729f865468086a0d73daeefae6479d7447a86d Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 12 Nov 2019 19:15:56 +1100 Subject: [PATCH] Run cargo-fmt (#599) --- beacon_node/network/src/message_handler.rs | 12 ++++++++--- .../src/attestation_producer/mod.rs | 20 ++++++++++++++----- validator_client/src/block_producer/mod.rs | 16 +++++++++++---- validator_client/src/duties/mod.rs | 8 ++++++-- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/beacon_node/network/src/message_handler.rs b/beacon_node/network/src/message_handler.rs index 0e56b4c331..898304272e 100644 --- a/beacon_node/network/src/message_handler.rs +++ b/beacon_node/network/src/message_handler.rs @@ -146,9 +146,15 @@ impl MessageHandler { ) { // an error could have occurred. match error_response { - RPCErrorResponse::InvalidRequest(error) => warn!(self.log, "Peer indicated invalid request";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string()), - RPCErrorResponse::ServerError(error) => warn!(self.log, "Peer internal server error";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string()), - RPCErrorResponse::Unknown(error) => warn!(self.log, "Unknown peer error";"peer" => format!("{:?}", peer_id), "error" => error.as_string()), + RPCErrorResponse::InvalidRequest(error) => { + warn!(self.log, "Peer indicated invalid request";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string()) + } + RPCErrorResponse::ServerError(error) => { + warn!(self.log, "Peer internal server error";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string()) + } + RPCErrorResponse::Unknown(error) => { + warn!(self.log, "Unknown peer error";"peer" => format!("{:?}", peer_id), "error" => error.as_string()) + } RPCErrorResponse::Success(response) => { match response { RPCResponse::Hello(hello_message) => { diff --git a/validator_client/src/attestation_producer/mod.rs b/validator_client/src/attestation_producer/mod.rs index d73bf5e237..6f4a5f304e 100644 --- a/validator_client/src/attestation_producer/mod.rs +++ b/validator_client/src/attestation_producer/mod.rs @@ -57,11 +57,21 @@ impl<'a, B: BeaconNodeAttestation, S: Signer, E: EthSpec> AttestationProducer<'a "slot" => slot, ), Err(e) => error!(log, "Attestation production error"; "Error" => format!("{:?}", e)), - Ok(ValidatorEvent::SignerRejection(_slot)) => error!(log, "Attestation production error"; "Error" => "Signer could not sign the attestation".to_string()), - Ok(ValidatorEvent::IndexedAttestationNotProduced(_slot)) => error!(log, "Attestation production error"; "Error" => "Rejected the attestation as it could have been slashed".to_string()), - Ok(ValidatorEvent::PublishAttestationFailed) => error!(log, "Attestation production error"; "Error" => "Beacon node was unable to publish an attestation".to_string()), - Ok(ValidatorEvent::InvalidAttestation) => error!(log, "Attestation production error"; "Error" => "The signed attestation was invalid".to_string()), - Ok(v) => warn!(log, "Unknown result for attestation production"; "Error" => format!("{:?}",v)), + Ok(ValidatorEvent::SignerRejection(_slot)) => { + error!(log, "Attestation production error"; "Error" => "Signer could not sign the attestation".to_string()) + } + Ok(ValidatorEvent::IndexedAttestationNotProduced(_slot)) => { + error!(log, "Attestation production error"; "Error" => "Rejected the attestation as it could have been slashed".to_string()) + } + Ok(ValidatorEvent::PublishAttestationFailed) => { + error!(log, "Attestation production error"; "Error" => "Beacon node was unable to publish an attestation".to_string()) + } + Ok(ValidatorEvent::InvalidAttestation) => { + error!(log, "Attestation production error"; "Error" => "The signed attestation was invalid".to_string()) + } + Ok(v) => { + warn!(log, "Unknown result for attestation production"; "Error" => format!("{:?}",v)) + } } } diff --git a/validator_client/src/block_producer/mod.rs b/validator_client/src/block_producer/mod.rs index 0d8b39991a..d88ac15f63 100644 --- a/validator_client/src/block_producer/mod.rs +++ b/validator_client/src/block_producer/mod.rs @@ -68,10 +68,18 @@ impl<'a, B: BeaconNodeBlock, S: Signer, E: EthSpec> BlockProducer<'a, B, S, E> { "slot" => slot, ), Err(e) => error!(self.log, "Block production error"; "Error" => format!("{:?}", e)), - Ok(ValidatorEvent::SignerRejection(_slot)) => error!(self.log, "Block production error"; "Error" => "Signer Could not sign the block".to_string()), - Ok(ValidatorEvent::SlashableBlockNotProduced(_slot)) => error!(self.log, "Block production error"; "Error" => "Rejected the block as it could have been slashed".to_string()), - Ok(ValidatorEvent::BeaconNodeUnableToProduceBlock(_slot)) => error!(self.log, "Block production error"; "Error" => "Beacon node was unable to produce a block".to_string()), - Ok(v) => warn!(self.log, "Unknown result for block production"; "Error" => format!("{:?}",v)), + Ok(ValidatorEvent::SignerRejection(_slot)) => { + error!(self.log, "Block production error"; "Error" => "Signer Could not sign the block".to_string()) + } + Ok(ValidatorEvent::SlashableBlockNotProduced(_slot)) => { + error!(self.log, "Block production error"; "Error" => "Rejected the block as it could have been slashed".to_string()) + } + Ok(ValidatorEvent::BeaconNodeUnableToProduceBlock(_slot)) => { + error!(self.log, "Block production error"; "Error" => "Beacon node was unable to produce a block".to_string()) + } + Ok(v) => { + warn!(self.log, "Unknown result for block production"; "Error" => format!("{:?}",v)) + } } } diff --git a/validator_client/src/duties/mod.rs b/validator_client/src/duties/mod.rs index 429aea6480..f0269a41f6 100644 --- a/validator_client/src/duties/mod.rs +++ b/validator_client/src/duties/mod.rs @@ -77,8 +77,12 @@ impl DutiesManager { pub fn run_update(&self, epoch: Epoch, log: slog::Logger) -> Result, ()> { match self.update(epoch) { Err(error) => error!(log, "Epoch duties poll error"; "error" => format!("{:?}", error)), - Ok(UpdateOutcome::NoChange(epoch)) => debug!(log, "No change in duties"; "epoch" => epoch), - Ok(UpdateOutcome::DutiesChanged(epoch, duties)) => info!(log, "Duties changed (potential re-org)"; "epoch" => epoch, "duties" => format!("{:?}", duties)), + Ok(UpdateOutcome::NoChange(epoch)) => { + debug!(log, "No change in duties"; "epoch" => epoch) + } + Ok(UpdateOutcome::DutiesChanged(epoch, duties)) => { + info!(log, "Duties changed (potential re-org)"; "epoch" => epoch, "duties" => format!("{:?}", duties)) + } Ok(UpdateOutcome::NewDuties(epoch, duties)) => { info!(log, "New duties obtained"; "epoch" => epoch); print_duties(&log, duties);