From 92c16bb9112de696fdf3f832a8be342bcb43d63b Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sun, 8 Sep 2019 14:20:48 -0400 Subject: [PATCH] Add extra logs to gossip object processing --- beacon_node/network/Cargo.toml | 1 + beacon_node/network/src/sync/simple_sync.rs | 23 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/beacon_node/network/Cargo.toml b/beacon_node/network/Cargo.toml index 06fc06ddea..ffeba96ec5 100644 --- a/beacon_node/network/Cargo.toml +++ b/beacon_node/network/Cargo.toml @@ -13,6 +13,7 @@ store = { path = "../store" } eth2-libp2p = { path = "../eth2-libp2p" } types = { path = "../../eth2/types" } slog = { version = "^2.2.3" , features = ["max_level_trace"] } +hex = "0.3" eth2_ssz = "0.1" tree_hash = "0.1" futures = "0.1.25" diff --git a/beacon_node/network/src/sync/simple_sync.rs b/beacon_node/network/src/sync/simple_sync.rs index c54c481c73..af5b3dd9a8 100644 --- a/beacon_node/network/src/sync/simple_sync.rs +++ b/beacon_node/network/src/sync/simple_sync.rs @@ -408,7 +408,19 @@ impl MessageProcessor { SHOULD_FORWARD_GOSSIP_BLOCK } BlockProcessingOutcome::BlockIsAlreadyKnown => SHOULD_FORWARD_GOSSIP_BLOCK, - _ => SHOULD_NOT_FORWARD_GOSSIP_BLOCK, //TODO: Decide if we want to forward these + _ => { + warn!( + self.log, + "Invalid gossip beacon block"; + "block slot" => block.slot + ); + trace!( + self.log, + "Invalid gossip beacon block ssz"; + "ssz" => format!("0x{}", hex::encode(block.as_ssz_bytes())), + ); + SHOULD_NOT_FORWARD_GOSSIP_BLOCK //TODO: Decide if we want to forward these + } } } else { SHOULD_NOT_FORWARD_GOSSIP_BLOCK @@ -419,7 +431,7 @@ impl MessageProcessor { /// /// Not currently implemented. pub fn on_attestation_gossip(&mut self, _peer_id: PeerId, msg: Attestation) { - match self.chain.process_attestation(msg) { + match self.chain.process_attestation(msg.clone()) { Ok(outcome) => info!( self.log, "Processed attestation"; @@ -427,7 +439,12 @@ impl MessageProcessor { "outcome" => format!("{:?}", outcome) ), Err(e) => { - warn!(self.log, "InvalidAttestation"; "source" => "gossip", "error" => format!("{:?}", e)) + warn!(self.log, "Invalid gossip attestation"; "error" => format!("{:?}", e)); + trace!( + self.log, + "Invalid gossip attestation ssz"; + "ssz" => format!("0x{}", hex::encode(msg.as_ssz_bytes())), + ); } } }