Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 5f955c5

Browse files
authored
Upgrade to libp2p-0.28. (#7077)
* Upgrade to libp2p-0.28 * Clean up test imports. * CI * CI * CI? * CI once more. * One more. * CI * CI * CI
1 parent ea07951 commit 5f955c5

File tree

24 files changed

+181
-268
lines changed

24 files changed

+181
-268
lines changed

Cargo.lock

Lines changed: 84 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ members = [
203203
#
204204
# This list is ordered alphabetically.
205205
[profile.dev.package]
206-
aes-ctr = { opt-level = 3 }
207206
aes-soft = { opt-level = 3 }
208207
aesni = { opt-level = 3 }
209208
blake2 = { opt-level = 3 }
@@ -217,7 +216,6 @@ crc32fast = { opt-level = 3 }
217216
crossbeam-deque = { opt-level = 3 }
218217
crossbeam-queue = { opt-level = 3 }
219218
crypto-mac = { opt-level = 3 }
220-
ctr = { opt-level = 3 }
221219
curve25519-dalek = { opt-level = 3 }
222220
ed25519-dalek = { opt-level = 3 }
223221
evm-core = { opt-level = 3 }

bin/node/browser-testing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "Apache-2.0"
88

99
[dependencies]
1010
futures-timer = "3.0.2"
11-
libp2p = { version = "0.24.0", default-features = false }
11+
libp2p = { version = "0.28.1", default-features = false }
1212
jsonrpc-core = "14.2.0"
1313
serde = "1.0.106"
1414
serde_json = "1.0.48"

client/authority-discovery/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ derive_more = "0.99.2"
2222
either = "1.5.3"
2323
futures = "0.3.4"
2424
futures-timer = "3.0.1"
25-
libp2p = { version = "0.24.0", default-features = false, features = ["kad"] }
25+
libp2p = { version = "0.28.1", default-features = false, features = ["kad"] }
2626
log = "0.4.8"
2727
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc6"}
2828
prost = "0.6.1"

client/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ lazy_static = "1.4.0"
2323
tokio = { version = "0.2.21", features = [ "signal", "rt-core", "rt-threaded", "blocking" ] }
2424
futures = "0.3.4"
2525
fdlimit = "0.2.0"
26-
libp2p = "0.24.0"
26+
libp2p = "0.28.1"
2727
parity-scale-codec = "1.3.0"
2828
hex = "0.4.2"
2929
rand = "0.7.3"

client/network-gossip/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
1616
[dependencies]
1717
futures = "0.3.4"
1818
futures-timer = "3.0.1"
19-
libp2p = { version = "0.24.0", default-features = false }
19+
libp2p = { version = "0.28.1", default-features = false }
2020
log = "0.4.8"
2121
lru = "0.4.3"
2222
sc-network = { version = "0.8.0-rc6", path = "../network" }

client/network/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ wasm-timer = "0.2"
6363
zeroize = "1.0.0"
6464

6565
[dependencies.libp2p]
66-
version = "0.24.0"
66+
version = "0.28.1"
6767
default-features = false
6868
features = ["identify", "kad", "mdns-async-std", "mplex", "noise", "ping", "request-response", "tcp-async-std", "websocket", "yamux"]
6969

7070
[dev-dependencies]
7171
assert_matches = "1.3"
7272
env_logger = "0.7.0"
73-
libp2p = { version = "0.24.0", default-features = false, features = ["secio"] }
73+
libp2p = { version = "0.28.1", default-features = false }
7474
quickcheck = "0.9.0"
7575
rand = "0.7.2"
7676
sp-keyring = { version = "2.0.0-rc6", path = "../../primitives/keyring" }

client/network/src/block_requests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ where
478478
let mut cfg = OneShotHandlerConfig::default();
479479
cfg.keep_alive_timeout = self.config.inactivity_timeout;
480480
cfg.outbound_substream_timeout = self.config.request_timeout;
481-
OneShotHandler::new(SubstreamProtocol::new(p), cfg)
481+
OneShotHandler::new(SubstreamProtocol::new(p, ()), cfg)
482482
}
483483

484484
fn addresses_of_peer(&mut self, _: &PeerId) -> Vec<Multiaddr> {

client/network/src/discovery.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,9 @@ mod tests {
765765
use libp2p::{Multiaddr, PeerId};
766766
use libp2p::core::upgrade;
767767
use libp2p::core::transport::{Transport, MemoryTransport};
768-
use libp2p::core::upgrade::{InboundUpgradeExt, OutboundUpgradeExt};
768+
use libp2p::noise;
769769
use libp2p::swarm::Swarm;
770+
use libp2p::yamux;
770771
use std::{collections::HashSet, task::Poll};
771772
use super::{DiscoveryConfig, DiscoveryOut, protocol_name_from_protocol_id};
772773

@@ -779,25 +780,15 @@ mod tests {
779780
// the first swarm via `with_user_defined`.
780781
let mut swarms = (0..25).map(|i| {
781782
let keypair = Keypair::generate_ed25519();
782-
let keypair2 = keypair.clone();
783+
784+
let noise_keys = noise::Keypair::<noise::X25519Spec>::new()
785+
.into_authentic(&keypair)
786+
.unwrap();
783787

784788
let transport = MemoryTransport
785-
.and_then(move |out, endpoint| {
786-
let secio = libp2p::secio::SecioConfig::new(keypair2);
787-
libp2p::core::upgrade::apply(
788-
out,
789-
secio,
790-
endpoint,
791-
upgrade::Version::V1
792-
)
793-
})
794-
.and_then(move |(peer_id, stream), endpoint| {
795-
let peer_id2 = peer_id.clone();
796-
let upgrade = libp2p::yamux::Config::default()
797-
.map_inbound(move |muxer| (peer_id, muxer))
798-
.map_outbound(move |muxer| (peer_id2, muxer));
799-
upgrade::apply(stream, upgrade, endpoint, upgrade::Version::V1)
800-
});
789+
.upgrade(upgrade::Version::V1)
790+
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
791+
.multiplex(yamux::Config::default());
801792

802793
let behaviour = {
803794
let mut config = DiscoveryConfig::new(keypair.public());

client/network/src/finality_requests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ where
235235
};
236236
let mut cfg = OneShotHandlerConfig::default();
237237
cfg.keep_alive_timeout = self.config.inactivity_timeout;
238-
OneShotHandler::new(SubstreamProtocol::new(p), cfg)
238+
OneShotHandler::new(SubstreamProtocol::new(p, ()), cfg)
239239
}
240240

241241
fn addresses_of_peer(&mut self, _: &PeerId) -> Vec<Multiaddr> {

0 commit comments

Comments
 (0)