Add extra logs to gossip object processing

This commit is contained in:
Paul Hauner 2019-09-08 14:20:48 -04:00
parent 6311b13169
commit 92c16bb911
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C
2 changed files with 21 additions and 3 deletions

View File

@ -13,6 +13,7 @@ store = { path = "../store" }
eth2-libp2p = { path = "../eth2-libp2p" } eth2-libp2p = { path = "../eth2-libp2p" }
types = { path = "../../eth2/types" } types = { path = "../../eth2/types" }
slog = { version = "^2.2.3" , features = ["max_level_trace"] } slog = { version = "^2.2.3" , features = ["max_level_trace"] }
hex = "0.3"
eth2_ssz = "0.1" eth2_ssz = "0.1"
tree_hash = "0.1" tree_hash = "0.1"
futures = "0.1.25" futures = "0.1.25"

View File

@ -408,7 +408,19 @@ impl<T: BeaconChainTypes> MessageProcessor<T> {
SHOULD_FORWARD_GOSSIP_BLOCK SHOULD_FORWARD_GOSSIP_BLOCK
} }
BlockProcessingOutcome::BlockIsAlreadyKnown => 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 { } else {
SHOULD_NOT_FORWARD_GOSSIP_BLOCK SHOULD_NOT_FORWARD_GOSSIP_BLOCK
@ -419,7 +431,7 @@ impl<T: BeaconChainTypes> MessageProcessor<T> {
/// ///
/// Not currently implemented. /// Not currently implemented.
pub fn on_attestation_gossip(&mut self, _peer_id: PeerId, msg: Attestation<T::EthSpec>) { pub fn on_attestation_gossip(&mut self, _peer_id: PeerId, msg: Attestation<T::EthSpec>) {
match self.chain.process_attestation(msg) { match self.chain.process_attestation(msg.clone()) {
Ok(outcome) => info!( Ok(outcome) => info!(
self.log, self.log,
"Processed attestation"; "Processed attestation";
@ -427,7 +439,12 @@ impl<T: BeaconChainTypes> MessageProcessor<T> {
"outcome" => format!("{:?}", outcome) "outcome" => format!("{:?}", outcome)
), ),
Err(e) => { 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())),
);
} }
} }
} }