mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Switch libp2p sigp gossipsub fork (#4999)
* switch libp2p source to sigp fork * Shift the connection closing inside RPC behaviour * Tag specific commits * Add slow peer scoring * Fix test * Use default yamux config * Pin discv5 to our libp2p fork and cargo update * Upgrade libp2p to enable yamux gains * Add a comment specifying the branch being used * cleanup build output from within container (prevents CI warnings related to fs permissions) * Remove revision tags add branches for testing, will revert back once we're happy * Update to latest rust-libp2p version * Pin forks * Update cargo.lock * Re-pin to panic-free rust --------- Co-authored-by: Age Manning <Age@AgeManning.com> Co-authored-by: Pawan Dhananjay <pawandhananjay@gmail.com> Co-authored-by: antondlr <anton@delaruelle.net> Co-authored-by: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -96,6 +96,9 @@ impl<TSpec: EthSpec> PeerScoreSettings<TSpec> {
|
||||
ip_colocation_factor_threshold: 8.0, // Allow up to 8 nodes per IP
|
||||
behaviour_penalty_threshold: 6.0,
|
||||
behaviour_penalty_decay: self.score_parameter_decay(self.epoch * 10),
|
||||
slow_peer_decay: 0.1,
|
||||
slow_peer_weight: -10.0,
|
||||
slow_peer_threshold: 0.0,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -1264,6 +1264,32 @@ impl<AppReqId: ReqId, TSpec: EthSpec> Network<AppReqId, TSpec> {
|
||||
"does_not_support_gossipsub",
|
||||
);
|
||||
}
|
||||
gossipsub::Event::SlowPeer {
|
||||
peer_id,
|
||||
failed_messages,
|
||||
} => {
|
||||
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 {
|
||||
debug!(self.log, "Slow gossipsub peer penalized for priority failure"; "peer_id" => %peer_id);
|
||||
self.peer_manager_mut().report_peer(
|
||||
&peer_id,
|
||||
PeerAction::HighToleranceError,
|
||||
ReportSource::Gossipsub,
|
||||
None,
|
||||
"publish_timeout_penalty",
|
||||
);
|
||||
} else if failed_messages.total_queue_full() > 10 {
|
||||
debug!(self.log, "Slow gossipsub peer penalized for send queue full"; "peer_id" => %peer_id);
|
||||
self.peer_manager_mut().report_peer(
|
||||
&peer_id,
|
||||
PeerAction::HighToleranceError,
|
||||
ReportSource::Gossipsub,
|
||||
None,
|
||||
"queue_full_penalty",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -1468,8 +1494,7 @@ impl<AppReqId: ReqId, TSpec: EthSpec> Network<AppReqId, TSpec> {
|
||||
self.build_response(id, peer_id, response)
|
||||
}
|
||||
HandlerEvent::Close(_) => {
|
||||
let _ = self.swarm.disconnect_peer_id(peer_id);
|
||||
// NOTE: we wait for the swarm to report the connection as actually closed
|
||||
// NOTE: This is handled in the RPC behaviour.
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,7 @@ pub fn build_transport(
|
||||
mplex_config.set_max_buffer_behaviour(libp2p_mplex::MaxBufferBehaviour::Block);
|
||||
|
||||
// yamux config
|
||||
let mut yamux_config = yamux::Config::default();
|
||||
yamux_config.set_window_update_mode(yamux::WindowUpdateMode::on_read());
|
||||
let yamux_config = yamux::Config::default();
|
||||
// Creates the TCP transport layer
|
||||
let tcp = libp2p::tcp::tokio::Transport::new(libp2p::tcp::Config::default().nodelay(true))
|
||||
.upgrade(core::upgrade::Version::V1)
|
||||
|
||||
Reference in New Issue
Block a user