mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
switch to upstream gossipsub (#7057)
We forked `gossipsub` into the lighthouse repo sometime ago so that we could iterate quicker on implementing back pressure and IDONTWANT. Meanwhile we have pushed all our changes upstream and we are now the main maintainers of `rust-libp2p` this allows us to use upstream `gossipsub` again. Nonetheless we still use our forked repo to give us freedom to experiment with features before submitting them upstream
This commit is contained in:
@@ -817,17 +817,8 @@ impl<E: EthSpec> Network<E> {
|
||||
// unsubscribe from the topic
|
||||
let libp2p_topic: Topic = topic.clone().into();
|
||||
|
||||
match self.gossipsub_mut().unsubscribe(&libp2p_topic) {
|
||||
Err(_) => {
|
||||
warn!(self.log, "Failed to unsubscribe from topic"; "topic" => %libp2p_topic);
|
||||
false
|
||||
}
|
||||
Ok(v) => {
|
||||
// Inform the network
|
||||
debug!(self.log, "Unsubscribed to topic"; "topic" => %topic);
|
||||
v
|
||||
}
|
||||
}
|
||||
debug!(self.log, "Unsubscribed to topic"; "topic" => %topic);
|
||||
self.gossipsub_mut().unsubscribe(&libp2p_topic)
|
||||
}
|
||||
|
||||
/// Publishes a list of messages on the pubsub (gossipsub) behaviour, choosing the encoding.
|
||||
@@ -912,13 +903,11 @@ impl<E: EthSpec> Network<E> {
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(e) = self.gossipsub_mut().report_message_validation_result(
|
||||
self.gossipsub_mut().report_message_validation_result(
|
||||
&message_id,
|
||||
propagation_source,
|
||||
validation_result,
|
||||
) {
|
||||
warn!(self.log, "Failed to report message validation"; "message_id" => %message_id, "peer_id" => %propagation_source, "error" => ?e);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates the current gossipsub scoring parameters based on the validator count and current
|
||||
@@ -1256,13 +1245,11 @@ impl<E: EthSpec> Network<E> {
|
||||
Err(e) => {
|
||||
debug!(self.log, "Could not decode gossipsub message"; "topic" => ?gs_msg.topic,"error" => e);
|
||||
//reject the message
|
||||
if let Err(e) = self.gossipsub_mut().report_message_validation_result(
|
||||
self.gossipsub_mut().report_message_validation_result(
|
||||
&id,
|
||||
&propagation_source,
|
||||
MessageAcceptance::Reject,
|
||||
) {
|
||||
warn!(self.log, "Failed to report message validation"; "message_id" => %id, "peer_id" => %propagation_source, "error" => ?e);
|
||||
}
|
||||
);
|
||||
}
|
||||
Ok(msg) => {
|
||||
// Notify the network
|
||||
@@ -1357,7 +1344,7 @@ impl<E: EthSpec> Network<E> {
|
||||
} => {
|
||||
debug!(self.log, "Slow gossipsub peer"; "peer_id" => %peer_id, "publish" => failed_messages.publish, "forward" => failed_messages.forward, "priority" => failed_messages.priority, "non_priority" => failed_messages.non_priority);
|
||||
// Punish the peer if it cannot handle priority messages
|
||||
if failed_messages.total_timeout() > 10 {
|
||||
if failed_messages.timeout > 10 {
|
||||
debug!(self.log, "Slow gossipsub peer penalized for priority failure"; "peer_id" => %peer_id);
|
||||
self.peer_manager_mut().report_peer(
|
||||
&peer_id,
|
||||
|
||||
Reference in New Issue
Block a user