Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate litep2p into Polkadot SDK #2944

Merged
merged 59 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
70670ae
Introduce `sc-network-types` and `PeerId` for the crate
altonen Sep 25, 2023
265a674
Make Polkadot SDK generic over the networking implementation
altonen Sep 25, 2023
39a6428
Implement `litep2p` network backend for Polkadot SDK
altonen Sep 25, 2023
7472a60
Fix CI complaints
altonen Jan 18, 2024
38f0003
Apply review comments
altonen Jan 18, 2024
1ad2bdc
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Jan 22, 2024
e6fc19e
Fix clippy
altonen Jan 22, 2024
62aedb3
more clippy fixes
altonen Jan 22, 2024
39dc59c
bind to both ipv4 and ipv6
altonen Jan 22, 2024
1319e66
Apply suggestions from code review
altonen Jan 26, 2024
7d0aaee
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Jan 26, 2024
99a6705
Apply review comments
altonen Jan 26, 2024
b4cab2b
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Jan 29, 2024
0396c06
Add support for fallback request-responses
altonen Jan 29, 2024
f60faad
Apply review comments
altonen Feb 2, 2024
5f7c2a8
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Feb 2, 2024
e5bb679
fix
altonen Feb 5, 2024
2fec872
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Feb 5, 2024
b08c3d3
prdoc + workspace fix
altonen Feb 5, 2024
98379bd
fixes
altonen Feb 5, 2024
439e65e
Reimplement fallback request support
altonen Feb 8, 2024
cf2b6d5
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Feb 12, 2024
9ca02df
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Feb 14, 2024
669c428
updates
altonen Feb 27, 2024
9a68856
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Feb 27, 2024
b0e9567
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Mar 6, 2024
a0542ac
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Mar 7, 2024
7c3df5b
fixes
altonen Mar 9, 2024
83988d4
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Mar 9, 2024
cef84e6
fix metrics
altonen Mar 10, 2024
246ba63
fix prdoc
altonen Mar 10, 2024
bfbfaa0
fix url
altonen Mar 10, 2024
beae17e
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
altonen Mar 11, 2024
58722ba
fix Cargo.lock
altonen Mar 11, 2024
f212d54
Apply suggestions from code review
altonen Mar 12, 2024
33e030e
Apply suggestions from code review
dmitry-markin Mar 18, 2024
1812dc8
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
dmitry-markin Mar 18, 2024
4561871
rustfmt
dmitry-markin Mar 18, 2024
43cb163
Apply suggestion: `reserved_peer` -> `is_reserved_peer`
dmitry-markin Mar 21, 2024
d4d89c0
monor: rustfmt
dmitry-markin Mar 21, 2024
e4470e1
Upgrade litep2p identify implementation (#3785)
dmitry-markin Mar 22, 2024
62cc8b1
Merge branch 'master' into altonen-integrate-litep2p
dmitry-markin Mar 22, 2024
d88ba6d
Update `Cargo.lock`
dmitry-markin Mar 22, 2024
ddc98a2
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
lexnv Mar 27, 2024
188cf3f
node: Fix clippy
lexnv Mar 27, 2024
3496f29
bench: Remove unused imports
lexnv Mar 27, 2024
d475762
bench: Remove PeerId to fix clippy
lexnv Mar 27, 2024
73d5770
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
lexnv Apr 8, 2024
df191f4
cumulus: Merge conflict with network generic type
lexnv Apr 8, 2024
08b038c
Apply cargo fmt
lexnv Apr 8, 2024
0690577
Update prdoc/pr_2944.prdoc
lexnv Apr 8, 2024
0735488
beefy/tests: Impl missing method
lexnv Apr 8, 2024
a00b965
beefy/tests: Add #[async_trait::async_trait]
lexnv Apr 8, 2024
612cd7b
Fix clippy
lexnv Apr 8, 2024
25be974
tests: Apply rustfmt
lexnv Apr 8, 2024
02e072a
Remove unused import
lexnv Apr 8, 2024
5b9a70f
prdoc: Fix PR doc
lexnv Apr 8, 2024
f5d028a
Merge remote-tracking branch 'origin/master' into altonen-integrate-l…
lexnv Apr 8, 2024
656ac74
Remove unused bitswap (merge conflict)
lexnv Apr 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cumulus/client/relay-chain-minimal-node/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(crate) fn build_collator_network(
.network_config
.boot_nodes
.iter()
.map(|bootnode| bootnode.peer_id)
.map(|bootnode| bootnode.peer_id.into())
.collect(),
);
let peer_store_handle = peer_store.handle();
Expand Down
1 change: 1 addition & 0 deletions polkadot/node/jaeger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ parking_lot = "0.12.1"
polkadot-primitives = { path = "../../primitives" }
polkadot-node-primitives = { path = "../primitives" }
sc-network = { path = "../../../substrate/client/network" }
sc-network-types = { path = "../../../substrate/client/network/types" }
sp-core = { path = "../../../substrate/primitives/core" }
thiserror = "1.0.48"
tokio = "1.24.2"
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/jaeger/src/spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
use parity_scale_codec::Encode;
use polkadot_node_primitives::PoV;
use polkadot_primitives::{BlakeTwo256, CandidateHash, Hash, HashT, Id as ParaId, ValidatorIndex};
use sc_network::PeerId;
use sc_network_types::PeerId;

use std::{fmt, sync::Arc};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ fn to_incoming_req(

IncomingRequest::new(
// We don't really care:
network::PeerId::random(),
network::PeerId::random().into(),
payload,
tx,
)
Expand Down
1 change: 1 addition & 0 deletions polkadot/node/network/gossip-support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sp-keystore = { path = "../../../../substrate/primitives/keystore" }
sp-core = { path = "../../../../substrate/primitives/core" }
sc-network = { path = "../../../../substrate/client/network" }
sc-network-common = { path = "../../../../substrate/client/network/common" }
sc-network-types = { path = "../../../../substrate/client/network/types" }
altonen marked this conversation as resolved.
Show resolved Hide resolved

polkadot-node-network-protocol = { path = "../protocol" }
polkadot-node-subsystem = { path = "../../subsystem" }
Expand Down
1 change: 1 addition & 0 deletions polkadot/node/network/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-jaeger = { path = "../../jaeger" }
parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] }
sc-network = { path = "../../../../substrate/client/network" }
sc-network-types = { path = "../../../../substrate/client/network/types" }
sc-authority-discovery = { path = "../../../../substrate/client/authority-discovery" }
strum = { version = "0.24", features = ["derive"] }
futures = "0.3.21"
Expand Down
3 changes: 2 additions & 1 deletion polkadot/node/network/protocol/src/authority_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ use async_trait::async_trait;
use sc_authority_discovery::Service as AuthorityDiscoveryService;

use polkadot_primitives::AuthorityDiscoveryId;
use sc_network::{Multiaddr, PeerId};
use sc_network::Multiaddr;
use sc_network_types::PeerId;

/// An abstraction over the authority discovery service.
///
Expand Down
7 changes: 4 additions & 3 deletions polkadot/node/network/protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ use std::{collections::HashMap, fmt};

#[doc(hidden)]
pub use polkadot_node_jaeger as jaeger;
pub use sc_network::{IfDisconnected, PeerId};
pub use sc_network::IfDisconnected;
pub use sc_network_types::PeerId;
#[doc(hidden)]
pub use std::sync::Arc;

Expand Down Expand Up @@ -610,7 +611,7 @@ pub mod v1 {
///
/// The payload is the local peer id of the node, which serves to prove that it
/// controls the collator key it is declaring an intention to collate under.
pub fn declare_signature_payload(peer_id: &sc_network::PeerId) -> Vec<u8> {
pub fn declare_signature_payload(peer_id: &sc_network_types::PeerId) -> Vec<u8> {
let mut payload = peer_id.to_bytes();
payload.extend_from_slice(b"COLL");
payload
Expand Down Expand Up @@ -863,7 +864,7 @@ pub mod v2 {
///
/// The payload is the local peer id of the node, which serves to prove that it
/// controls the collator key it is declaring an intention to collate under.
pub fn declare_signature_payload(peer_id: &sc_network::PeerId) -> Vec<u8> {
pub fn declare_signature_payload(peer_id: &sc_network_types::PeerId) -> Vec<u8> {
let mut payload = peer_id.to_bytes();
payload.extend_from_slice(b"COLL");
payload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! Error handling related code and Error/Result definitions.

use sc_network::PeerId;
use sc_network_types::PeerId;

use parity_scale_codec::Error as DecodingError;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use futures::{channel::oneshot, StreamExt};

use parity_scale_codec::{Decode, Encode};

use sc_network::{config as netconfig, config::RequestResponseConfig, PeerId};
use sc_network::{config as netconfig, config::RequestResponseConfig};
use sc_network_types::PeerId;

use super::{IsRequest, ReqProtocolNames};
use crate::UnifiedReputationChange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use network::ProtocolName;
use parity_scale_codec::{Decode, Encode, Error as DecodingError};

use sc_network as network;
use sc_network::PeerId;
use sc_network_types::PeerId;

use polkadot_primitives::AuthorityDiscoveryId;

Expand Down
1 change: 1 addition & 0 deletions polkadot/node/subsystem-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ polkadot-statement-table = { path = "../../statement-table" }
polkadot-node-jaeger = { path = "../jaeger" }
orchestra = { version = "0.3.3", default-features = false, features = ["futures_channel"] }
sc-network = { path = "../../../substrate/client/network" }
sc-network-types = { path = "../../../substrate/client/network/types" }
sp-api = { path = "../../../substrate/primitives/api" }
sp-blockchain = { path = "../../../substrate/primitives/blockchain" }
sp-consensus-babe = { path = "../../../substrate/primitives/consensus/babe" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

use std::{collections::HashSet, convert::TryFrom};

pub use sc_network::{PeerId, ReputationChange};
pub use sc_network::ReputationChange;
pub use sc_network_types::PeerId;

use polkadot_node_network_protocol::{
grid_topology::SessionGridTopology, peer_set::ProtocolVersion, ObservedRole, OurView, View,
Expand Down
1 change: 1 addition & 0 deletions substrate/client/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ thiserror = "1.0"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" }
sc-client-api = { path = "../api" }
sc-network = { path = "../network" }
sc-network-types = { path = "../network/types" }
sp-api = { path = "../../primitives/api" }
sp-authority-discovery = { path = "../../primitives/authority-discovery" }
sp-blockchain = { path = "../../primitives/blockchain" }
Expand Down
4 changes: 2 additions & 2 deletions substrate/client/authority-discovery/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub enum Error {
VerifyingDhtPayload,

#[error("Failed to hash the authority id to be used as a dht key.")]
HashingAuthorityId(#[from] libp2p::core::multiaddr::multihash::Error),
HashingAuthorityId(#[from] sc_network::multiaddr::multihash::Error),

#[error("Failed calling into the Substrate runtime: {0}")]
CallingRuntime(#[from] sp_blockchain::Error),
Expand All @@ -53,7 +53,7 @@ pub enum Error {
EncodingDecodingScale(#[from] codec::Error),

#[error("Failed to parse a libp2p multi address.")]
ParsingMultiaddress(#[from] libp2p::core::multiaddr::Error),
ParsingMultiaddress(#[from] sc_network::multiaddr::Error),

#[error("Failed to parse a libp2p key.")]
ParsingLibp2pIdentity(#[from] libp2p::identity::DecodingError),
Expand Down
4 changes: 2 additions & 2 deletions substrate/client/authority-discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ use futures::{
Stream,
};

use libp2p::{Multiaddr, PeerId};
use sc_network::event::DhtEvent;
use sc_network::{event::DhtEvent, Multiaddr};
use sc_network_types::PeerId;
use sp_authority_discovery::AuthorityId;
use sp_blockchain::HeaderBackend;
use sp_runtime::traits::Block as BlockT;
Expand Down
3 changes: 2 additions & 1 deletion substrate/client/authority-discovery/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ use futures::{
SinkExt,
};

use libp2p::{Multiaddr, PeerId};
use sc_network::Multiaddr;
use sc_network_types::PeerId;
use sp_authority_discovery::AuthorityId;

/// Service to interact with the [`crate::Worker`].
Expand Down
Loading