mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 05:14:35 +00:00
Add gossipsub as a Lighthouse behaviour (#5066)
* Move gossipsub as a lighthouse behaviour * Update dependencies, pin to corrected libp2p version * Merge latest unstable * Fix test * Remove unused dep * Fix cargo.lock * Re-order behaviour, pin upstream libp2p * Pin discv5 to latest version
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::peer_manager::PeerManager;
|
||||
use crate::rpc::{ReqId, RPC};
|
||||
use crate::types::SnappyTransform;
|
||||
|
||||
use libp2p::gossipsub;
|
||||
use crate::gossipsub;
|
||||
use libp2p::identify;
|
||||
use libp2p::swarm::NetworkBehaviour;
|
||||
use types::EthSpec;
|
||||
@@ -22,8 +22,8 @@ where
|
||||
{
|
||||
/// Keep track of active and pending connections to enforce hard limits.
|
||||
pub connection_limits: libp2p::connection_limits::Behaviour,
|
||||
/// The routing pub-sub mechanism for eth2.
|
||||
pub gossipsub: Gossipsub,
|
||||
/// The peer manager that keeps track of peer's reputation and status.
|
||||
pub peer_manager: PeerManager<TSpec>,
|
||||
/// The Eth2 RPC specified in the wire-0 protocol.
|
||||
pub eth2_rpc: RPC<RequestId<AppReqId>, TSpec>,
|
||||
/// Discv5 Discovery protocol.
|
||||
@@ -32,6 +32,6 @@ where
|
||||
// NOTE: The id protocol is used for initial interop. This will be removed by mainnet.
|
||||
/// Provides IP addresses and peer information.
|
||||
pub identify: identify::Behaviour,
|
||||
/// The peer manager that keeps track of peer's reputation and status.
|
||||
pub peer_manager: PeerManager<TSpec>,
|
||||
/// The routing pub-sub mechanism for eth2.
|
||||
pub gossipsub: Gossipsub,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::types::{GossipEncoding, GossipKind, GossipTopic};
|
||||
use crate::{error, TopicHash};
|
||||
use libp2p::gossipsub::{
|
||||
use crate::gossipsub::{
|
||||
Config as GossipsubConfig, IdentTopic as Topic, PeerScoreParams, PeerScoreThresholds,
|
||||
TopicScoreParams,
|
||||
};
|
||||
use crate::types::{GossipEncoding, GossipKind, GossipTopic};
|
||||
use crate::{error, TopicHash};
|
||||
use std::cmp::max;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
@@ -4,6 +4,10 @@ use crate::config::{gossipsub_config, GossipsubConfigParams, NetworkLoad};
|
||||
use crate::discovery::{
|
||||
subnet_predicate, DiscoveredPeers, Discovery, FIND_NODE_QUERY_CLOSEST_PEERS,
|
||||
};
|
||||
use crate::gossipsub::{
|
||||
self, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError,
|
||||
TopicScoreParams,
|
||||
};
|
||||
use crate::peer_manager::{
|
||||
config::Config as PeerManagerCfg, peerdb::score::PeerAction, peerdb::score::ReportSource,
|
||||
ConnectionDirection, PeerManager, PeerManagerEvent,
|
||||
@@ -24,10 +28,6 @@ use crate::{error, metrics, Enr, NetworkGlobals, PubsubMessage, TopicHash};
|
||||
use api_types::{PeerRequestId, Request, RequestId, Response};
|
||||
use futures::stream::StreamExt;
|
||||
use gossipsub_scoring_parameters::{lighthouse_gossip_thresholds, PeerScoreSettings};
|
||||
use libp2p::gossipsub::{
|
||||
self, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError,
|
||||
TopicScoreParams,
|
||||
};
|
||||
use libp2p::multiaddr::{Multiaddr, Protocol as MProtocol};
|
||||
use libp2p::swarm::{Swarm, SwarmEvent};
|
||||
use libp2p::PeerId;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::gossipsub;
|
||||
use crate::multiaddr::Protocol;
|
||||
use crate::rpc::{MetaData, MetaDataV1, MetaDataV2};
|
||||
use crate::types::{
|
||||
@@ -6,7 +7,6 @@ use crate::types::{
|
||||
use crate::{GossipTopic, NetworkConfig};
|
||||
use futures::future::Either;
|
||||
use libp2p::core::{multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed};
|
||||
use libp2p::gossipsub;
|
||||
use libp2p::identity::{secp256k1, Keypair};
|
||||
use libp2p::quic;
|
||||
use libp2p::{core, noise, yamux, PeerId, Transport};
|
||||
|
||||
Reference in New Issue
Block a user