diff --git a/beacon_node/network/src/message_handler.rs b/beacon_node/network/src/message_handler.rs index 0e56b4c331..0050bd0e66 100644 --- a/beacon_node/network/src/message_handler.rs +++ b/beacon_node/network/src/message_handler.rs @@ -204,7 +204,7 @@ impl MessageHandler { let should_forward_on = self .message_processor .on_block_gossip(peer_id.clone(), block); - // TODO: Apply more sophisticated validation and decoding logic + // TODO: Apply more sophisticated validation and decoding logic - 524 verify block if should_forward_on { self.propagate_message(id, peer_id.clone()); } @@ -215,7 +215,7 @@ impl MessageHandler { }, PubsubMessage::Attestation(message) => match self.decode_gossip_attestation(message) { Ok(attestation) => { - // TODO: Apply more sophisticated validation and decoding logic + // TODO: Apply more sophisticated validation and decoding logic - 524 verify attestation self.propagate_message(id, peer_id.clone()); self.message_processor .on_attestation_gossip(peer_id, attestation); @@ -297,7 +297,7 @@ impl MessageHandler { &self, beacon_block: Vec, ) -> Result, DecodeError> { - //TODO: Apply verification before decoding. + //TODO: Apply verification before decoding. - 524 BeaconBlock::from_ssz_bytes(&beacon_block) } @@ -305,7 +305,7 @@ impl MessageHandler { &self, beacon_block: Vec, ) -> Result, DecodeError> { - //TODO: Apply verification before decoding. + //TODO: Apply verification before decoding. - 524 Attestation::from_ssz_bytes(&beacon_block) } diff --git a/beacon_node/network/src/sync/simple_sync.rs b/beacon_node/network/src/sync/simple_sync.rs index 83aa7ebd29..34f36f8c18 100644 --- a/beacon_node/network/src/sync/simple_sync.rs +++ b/beacon_node/network/src/sync/simple_sync.rs @@ -387,7 +387,16 @@ impl MessageProcessor { /// /// Attempts to apply to block to the beacon chain. May queue the block for later processing. /// - /// Returns a `bool` which, if `true`, indicates we should forward the block to our peers. + /// Returns a `bool` which, if `true`, indicates we should forward the block to our peers. 524 + /// Old blocks or blocks on a different fork. Will need to recalc proposer shuffle. + /// May need heuristics... + /// Cases: + /// Do we know the block's parent? + /// 1.) It's a recent block on the same chain. We can use the current cache in the BeaconChain. (cheap) + /// 2.) Old block on a different fork. (may have to recalc shuffling) + /// If we don't know the block's parent, we don't who is supposed to sign it, therefore we can + /// not validate the signature. + /// 1.) We can try to look up the block's parent using the syncing thread. (it's expensive not sure how to reprop from sync thread) pub fn on_block_gossip(&mut self, peer_id: PeerId, block: BeaconBlock) -> bool { match self.chain.process_block(block.clone()) { Ok(outcome) => match outcome {