Gossipsub update (#1400)

## Issue Addressed

N/A

## Proposed Changes

This provides a number of corrections and improvements to gossipsub. Specifically
- Enables options for greater privacy around the message author
- Provides greater flexibility on message validation
- Prevents unvalidated messages from being gossiped
- Shifts the duplicate cache to a time-based cache inside gossipsub
- Updates the message-id to handle bytes
- Bug fixes related to mesh maintenance and topic subscription. This should improve our attestation inclusion rate.
This commit is contained in:
Age Manning
2020-07-29 03:40:22 +00:00
parent 09b40b7a5e
commit ba0f3daf9d
6 changed files with 139 additions and 139 deletions

View File

@@ -297,10 +297,10 @@ impl<T: BeaconChainTypes> Router<T> {
}
}
/// Informs the network service that the message should be forwarded to other peers.
/// Informs the network service that the message should be forwarded to other peers (is valid).
fn propagate_message(&mut self, message_id: MessageId, propagation_source: PeerId) {
self.network_send
.send(NetworkMessage::Propagate {
.send(NetworkMessage::Validate {
propagation_source,
message_id,
})

View File

@@ -54,9 +54,11 @@ pub enum NetworkMessage<T: EthSpec> {
},
/// Publish a list of messages to the gossipsub protocol.
Publish { messages: Vec<PubsubMessage<T>> },
/// Propagate a received gossipsub message.
Propagate {
/// Validates a received gossipsub message. This will propagate the message on the network.
Validate {
/// The peer that sent us the message. We don't send back to this peer.
propagation_source: PeerId,
/// The id of the message we are validating and propagating.
message_id: MessageId,
},
/// Reports a peer to the peer manager for performing an action.
@@ -213,7 +215,7 @@ fn spawn_service<T: BeaconChainTypes>(
NetworkMessage::SendError{ peer_id, error, id, reason } => {
service.libp2p.respond_with_error(peer_id, id, error, reason);
}
NetworkMessage::Propagate {
NetworkMessage::Validate {
propagation_source,
message_id,
} => {
@@ -224,7 +226,7 @@ fn spawn_service<T: BeaconChainTypes>(
service
.libp2p
.swarm
.propagate_message(&propagation_source, message_id);
.validate_message(&propagation_source, message_id);
}
NetworkMessage::Publish { messages } => {
let mut topic_kinds = Vec::new();