Bump libp2p from 0.36.0 to 0.37.1

Bumps [libp2p](https://github.com/libp2p/rust-libp2p) from 0.36.0 to 0.37.1.
- [Release notes](https://github.com/libp2p/rust-libp2p/releases)
- [Changelog](https://github.com/libp2p/rust-libp2p/blob/master/CHANGELOG.md)
- [Commits](https://github.com/libp2p/rust-libp2p/compare/v0.36.0...v0.37.1)

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2021-04-15 07:44:21 +00:00 committed by Thomas Eizinger
parent a8fb344fc8
commit 19483c5ead
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
6 changed files with 48 additions and 55 deletions

53
Cargo.lock generated
View File

@ -106,22 +106,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]] [[package]]
name = "asn1_der" name = "asn1_der"
version = "0.6.3" version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" checksum = "9d6e24d2cce90c53b948c46271bfb053e4bdc2db9b5d3f65e20f8cf28a1b7fc3"
dependencies = [
"asn1_der_derive",
]
[[package]]
name = "asn1_der_derive"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502"
dependencies = [
"quote",
"syn",
]
[[package]] [[package]]
name = "async-compression" name = "async-compression"
@ -1702,9 +1689,9 @@ checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae"
[[package]] [[package]]
name = "libp2p" name = "libp2p"
version = "0.36.0" version = "0.37.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe5759b526f75102829c15e4d8566603b4bf502ed19b5f35920d98113873470d" checksum = "08053fbef67cd777049ef7a95ebaca2ece370b4ed7712c3fa404d69a88cb741b"
dependencies = [ dependencies = [
"atomic", "atomic",
"bytes 1.0.1", "bytes 1.0.1",
@ -1730,7 +1717,7 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-async-await" name = "libp2p-async-await"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/comit-network/rust-libp2p-async-await#7a9006ceddd132ef5d40a597936cf15381a5cfe1" source = "git+https://github.com/comit-network/rust-libp2p-async-await#50e781b12bbeda7986c0cada090f171f41093144"
dependencies = [ dependencies = [
"libp2p", "libp2p",
"log 0.4.14", "log 0.4.14",
@ -1738,9 +1725,9 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-core" name = "libp2p-core"
version = "0.28.1" version = "0.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e1797734bbd4c453664fefb029628f77c356ffc5bce98f06b18a7db3ebb0f7" checksum = "71dd51b562e14846e65bad00e5808d0644376e6588668c490d3c48e1dfeb4a9a"
dependencies = [ dependencies = [
"asn1_der", "asn1_der",
"bs58", "bs58",
@ -1772,9 +1759,9 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-dns" name = "libp2p-dns"
version = "0.28.0" version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9712eb3e9f7dcc77cc5ca7d943b6a85ce4b1faaf91a67e003442412a26d6d6f8" checksum = "62e63dab8b5ff35e0c101a3e51e843ba782c07bbb1682f5fd827622e0d02b98b"
dependencies = [ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
@ -1825,9 +1812,9 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-request-response" name = "libp2p-request-response"
version = "0.10.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "725367dd2318c54c5ab1a6418592e5b01c63b0dedfbbfb8389220b2bcf691899" checksum = "1cdbe172f08e6d0f95fa8634e273d4c4268c4063de2e33e7435194b0130c62e3"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bytes 1.0.1", "bytes 1.0.1",
@ -1845,9 +1832,9 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-swarm" name = "libp2p-swarm"
version = "0.28.0" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75c26980cadd7c25d89071cb23e1f7f5df4863128cc91d83c6ddc72338cecafa" checksum = "1e04d8e1eef675029ec728ba14e8d0da7975d84b6679b699b4ae91a1de9c3a92"
dependencies = [ dependencies = [
"either", "either",
"futures", "futures",
@ -1861,9 +1848,9 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-swarm-derive" name = "libp2p-swarm-derive"
version = "0.22.0" version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c564ebaa36a64839f51eaddb0243aaaa29ce64affb56129193cc3248b72af273" checksum = "365b0a699fea5168676840567582a012ea297b1ca02eee467e58301b9c9c5eed"
dependencies = [ dependencies = [
"quote", "quote",
"syn", "syn",
@ -1906,9 +1893,9 @@ dependencies = [
[[package]] [[package]]
name = "libp2p-yamux" name = "libp2p-yamux"
version = "0.31.0" version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d6144cc94143fb0a8dd1e7c2fbcc32a2808168bcd1d69920635424d5993b7b" checksum = "f35da42cfc6d5cb0dcf3ad6881bc68d146cdf38f98655e09e33fbba4d13eabc4"
dependencies = [ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
@ -4609,15 +4596,15 @@ dependencies = [
[[package]] [[package]]
name = "yamux" name = "yamux"
version = "0.8.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cc7bd8c983209ed5d527f44b01c41b7dc146fd960c61cf9e1d25399841dc271" checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107"
dependencies = [ dependencies = [
"futures", "futures",
"log 0.4.14", "log 0.4.14",
"nohash-hasher", "nohash-hasher",
"parking_lot 0.11.1", "parking_lot 0.11.1",
"rand 0.7.3", "rand 0.8.3",
"static_assertions", "static_assertions",
] ]

View File

@ -27,7 +27,7 @@ directories-next = "2"
ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["libsecp_compat", "serde"] } ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["libsecp_compat", "serde"] }
futures = { version = "0.3", default-features = false } futures = { version = "0.3", default-features = false }
itertools = "0.10" itertools = "0.10"
libp2p = { version = "0.36", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket"] } libp2p = { version = "0.37", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket"] }
libp2p-async-await = { git = "https://github.com/comit-network/rust-libp2p-async-await" } libp2p-async-await = { git = "https://github.com/comit-network/rust-libp2p-async-await" }
miniscript = { version = "5", features = ["serde"] } miniscript = { version = "5", features = ["serde"] }
monero = { version = "0.11", features = ["serde_support"] } monero = { version = "0.11", features = ["serde_support"] }

View File

@ -77,7 +77,9 @@ async fn main() -> Result<()> {
let bitcoin_wallet = Arc::new(bitcoin_wallet); let bitcoin_wallet = Arc::new(bitcoin_wallet);
let mut swarm = swarm::bob(&seed, alice_peer_id)?; let mut swarm = swarm::bob(&seed, alice_peer_id)?;
swarm.add_address(alice_peer_id, alice_multiaddr); swarm
.behaviour_mut()
.add_address(alice_peer_id, alice_multiaddr);
let swap_id = Uuid::new_v4(); let swap_id = Uuid::new_v4();
let (event_loop, mut event_loop_handle) = let (event_loop, mut event_loop_handle) =
@ -172,7 +174,9 @@ async fn main() -> Result<()> {
let alice_peer_id = db.get_peer_id(swap_id)?; let alice_peer_id = db.get_peer_id(swap_id)?;
let mut swarm = swarm::bob(&seed, alice_peer_id)?; let mut swarm = swarm::bob(&seed, alice_peer_id)?;
swarm.add_address(alice_peer_id, alice_multiaddr); swarm
.behaviour_mut()
.add_address(alice_peer_id, alice_multiaddr);
let (event_loop, event_loop_handle) = let (event_loop, event_loop_handle) =
EventLoop::new(swap_id, swarm, alice_peer_id, bitcoin_wallet.clone())?; EventLoop::new(swap_id, swarm, alice_peer_id, bitcoin_wallet.clone())?;

View File

@ -153,7 +153,7 @@ where
} }
}; };
match self.swarm.spot_price.send_response(channel, spot_price::Response { xmr }) { match self.swarm.behaviour_mut().spot_price.send_response(channel, spot_price::Response { xmr }) {
Ok(_) => {}, Ok(_) => {},
Err(_) => { Err(_) => {
// if we can't respond, the peer probably just disconnected so it is not a huge deal, only log this on debug // if we can't respond, the peer probably just disconnected so it is not a huge deal, only log this on debug
@ -170,7 +170,7 @@ where
} }
}; };
self.swarm.execution_setup.run(peer, state0); self.swarm.behaviour_mut().execution_setup.run(peer, state0);
} }
SwarmEvent::Behaviour(OutEvent::QuoteRequested { channel, peer }) => { SwarmEvent::Behaviour(OutEvent::QuoteRequested { channel, peer }) => {
let quote = match self.make_quote(self.max_buy).await { let quote = match self.make_quote(self.max_buy).await {
@ -181,7 +181,7 @@ where
} }
}; };
if self.swarm.quote.send_response(channel, quote).is_err() { if self.swarm.behaviour_mut().quote.send_response(channel, quote).is_err() {
tracing::debug!(%peer, "Failed to respond with quote"); tracing::debug!(%peer, "Failed to respond with quote");
} }
} }
@ -228,7 +228,7 @@ where
for (transfer_proof, responder) in transfer_proofs { for (transfer_proof, responder) in transfer_proofs {
tracing::debug!(%peer, "Found buffered transfer proof for peer"); tracing::debug!(%peer, "Found buffered transfer proof for peer");
let id = self.swarm.transfer_proof.send_request(&peer, transfer_proof); let id = self.swarm.behaviour_mut().transfer_proof.send_request(&peer, transfer_proof);
self.inflight_transfer_proofs.insert(id, responder); self.inflight_transfer_proofs.insert(id, responder);
} }
} }
@ -255,13 +255,13 @@ where
next_transfer_proof = self.send_transfer_proof.next() => { next_transfer_proof = self.send_transfer_proof.next() => {
match next_transfer_proof { match next_transfer_proof {
Some(Ok((peer, transfer_proof, responder))) => { Some(Ok((peer, transfer_proof, responder))) => {
if !self.swarm.transfer_proof.is_connected(&peer) { if !self.swarm.behaviour_mut().transfer_proof.is_connected(&peer) {
tracing::warn!(%peer, "No active connection to peer, buffering transfer proof"); tracing::warn!(%peer, "No active connection to peer, buffering transfer proof");
self.buffered_transfer_proofs.entry(peer).or_insert_with(Vec::new).push((transfer_proof, responder)); self.buffered_transfer_proofs.entry(peer).or_insert_with(Vec::new).push((transfer_proof, responder));
continue; continue;
} }
let id = self.swarm.transfer_proof.send_request(&peer, transfer_proof); let id = self.swarm.behaviour_mut().transfer_proof.send_request(&peer, transfer_proof);
self.inflight_transfer_proofs.insert(id, responder); self.inflight_transfer_proofs.insert(id, responder);
}, },
Some(Err(e)) => { Some(Err(e)) => {
@ -273,7 +273,7 @@ where
} }
} }
Some(response_channel) = self.inflight_encrypted_signatures.next() => { Some(response_channel) = self.inflight_encrypted_signatures.next() => {
let _ = self.swarm.encrypted_signature.send_response(response_channel, ()); let _ = self.swarm.behaviour_mut().encrypted_signature.send_response(response_channel, ());
} }
} }
} }

View File

@ -89,7 +89,7 @@ impl EventLoop {
} }
pub async fn run(mut self) { pub async fn run(mut self) {
match libp2p::Swarm::dial(&mut self.swarm, &self.alice_peer_id) { match self.swarm.dial(&self.alice_peer_id) {
Ok(()) => {} Ok(()) => {}
Err(e) => { Err(e) => {
tracing::error!("Failed to initiate dial to Alice: {}", e); tracing::error!("Failed to initiate dial to Alice: {}", e);
@ -124,7 +124,7 @@ impl EventLoop {
tracing::warn!("Received unexpected transfer proof for swap {} while running swap {}. This transfer proof will be ignored.", msg.swap_id, self.swap_id); tracing::warn!("Received unexpected transfer proof for swap {} while running swap {}. This transfer proof will be ignored.", msg.swap_id, self.swap_id);
// When receiving a transfer proof that is unexpected we still have to acknowledge that it was received // When receiving a transfer proof that is unexpected we still have to acknowledge that it was received
let _ = self.swarm.transfer_proof.send_response(channel, ()); let _ = self.swarm.behaviour_mut().transfer_proof.send_response(channel, ());
continue; continue;
} }
@ -176,7 +176,7 @@ impl EventLoop {
SwarmEvent::UnreachableAddr { peer_id, address, attempts_remaining, error } if peer_id == self.alice_peer_id && attempts_remaining == 0 => { SwarmEvent::UnreachableAddr { peer_id, address, attempts_remaining, error } if peer_id == self.alice_peer_id && attempts_remaining == 0 => {
tracing::warn!(%address, "Failed to dial Alice: {}", error); tracing::warn!(%address, "Failed to dial Alice: {}", error);
if let Some(duration) = self.swarm.redial.until_next_redial() { if let Some(duration) = self.swarm.behaviour_mut().redial.until_next_redial() {
tracing::info!("Next redial attempt in {}s", duration.as_secs()); tracing::info!("Next redial attempt in {}s", duration.as_secs());
} }
} }
@ -187,15 +187,15 @@ impl EventLoop {
// Handle to-be-sent requests for all our network protocols. // Handle to-be-sent requests for all our network protocols.
// Use `self.is_connected_to_alice` as a guard to "buffer" requests until we are connected. // Use `self.is_connected_to_alice` as a guard to "buffer" requests until we are connected.
Some((request, responder)) = self.spot_price_requests.next().fuse(), if self.is_connected_to_alice() => { Some((request, responder)) = self.spot_price_requests.next().fuse(), if self.is_connected_to_alice() => {
let id = self.swarm.spot_price.send_request(&self.alice_peer_id, request); let id = self.swarm.behaviour_mut().spot_price.send_request(&self.alice_peer_id, request);
self.inflight_spot_price_requests.insert(id, responder); self.inflight_spot_price_requests.insert(id, responder);
}, },
Some(((), responder)) = self.quote_requests.next().fuse(), if self.is_connected_to_alice() => { Some(((), responder)) = self.quote_requests.next().fuse(), if self.is_connected_to_alice() => {
let id = self.swarm.quote.send_request(&self.alice_peer_id, ()); let id = self.swarm.behaviour_mut().quote.send_request(&self.alice_peer_id, ());
self.inflight_quote_requests.insert(id, responder); self.inflight_quote_requests.insert(id, responder);
}, },
Some((request, responder)) = self.execution_setup_requests.next().fuse(), if self.is_connected_to_alice() => { Some((request, responder)) = self.execution_setup_requests.next().fuse(), if self.is_connected_to_alice() => {
self.swarm.execution_setup.run(self.alice_peer_id, request, self.bitcoin_wallet.clone()); self.swarm.behaviour_mut().execution_setup.run(self.alice_peer_id, request, self.bitcoin_wallet.clone());
self.inflight_execution_setup = Some(responder); self.inflight_execution_setup = Some(responder);
}, },
Some((tx_redeem_encsig, responder)) = self.encrypted_signatures.next().fuse(), if self.is_connected_to_alice() => { Some((tx_redeem_encsig, responder)) = self.encrypted_signatures.next().fuse(), if self.is_connected_to_alice() => {
@ -204,12 +204,12 @@ impl EventLoop {
tx_redeem_encsig tx_redeem_encsig
}; };
let id = self.swarm.encrypted_signature.send_request(&self.alice_peer_id, request); let id = self.swarm.behaviour_mut().encrypted_signature.send_request(&self.alice_peer_id, request);
self.inflight_encrypted_signature_requests.insert(id, responder); self.inflight_encrypted_signature_requests.insert(id, responder);
}, },
Some(response_channel) = &mut self.pending_transfer_proof => { Some(response_channel) = &mut self.pending_transfer_proof => {
let _ = self.swarm.transfer_proof.send_response(response_channel, ()); let _ = self.swarm.behaviour_mut().transfer_proof.send_response(response_channel, ());
self.pending_transfer_proof = OptionFuture::from(None); self.pending_transfer_proof = OptionFuture::from(None);
} }
@ -218,7 +218,7 @@ impl EventLoop {
} }
fn is_connected_to_alice(&self) -> bool { fn is_connected_to_alice(&self) -> bool {
Swarm::is_connected(&self.swarm, &self.alice_peer_id) self.swarm.is_connected(&self.alice_peer_id)
} }
} }

View File

@ -8,7 +8,7 @@ use bitcoin_harness::{BitcoindRpcApi, Client};
use futures::Future; use futures::Future;
use get_port::get_port; use get_port::get_port;
use libp2p::core::Multiaddr; use libp2p::core::Multiaddr;
use libp2p::{PeerId, Swarm}; use libp2p::PeerId;
use monero_harness::{image, Monero}; use monero_harness::{image, Monero};
use std::cmp::Ordering; use std::cmp::Ordering;
use std::fmt; use std::fmt;
@ -117,7 +117,9 @@ impl BobParams {
pub fn new_eventloop(&self, swap_id: Uuid) -> Result<(bob::EventLoop, bob::EventLoopHandle)> { pub fn new_eventloop(&self, swap_id: Uuid) -> Result<(bob::EventLoop, bob::EventLoopHandle)> {
let mut swarm = swarm::bob(&self.seed, self.alice_peer_id)?; let mut swarm = swarm::bob(&self.seed, self.alice_peer_id)?;
swarm.add_address(self.alice_peer_id, self.alice_address.clone()); swarm
.behaviour_mut()
.add_address(self.alice_peer_id, self.alice_address.clone());
bob::EventLoop::new( bob::EventLoop::new(
swap_id, swap_id,
@ -642,7 +644,7 @@ fn start_alice(
let db = Arc::new(Database::open(db_path.as_path()).unwrap()); let db = Arc::new(Database::open(db_path.as_path()).unwrap());
let mut swarm = swarm::alice(&seed).unwrap(); let mut swarm = swarm::alice(&seed).unwrap();
Swarm::listen_on(&mut swarm, listen_address).unwrap(); swarm.listen_on(listen_address).unwrap();
let (event_loop, swap_handle) = alice::EventLoop::new( let (event_loop, swap_handle) = alice::EventLoop::new(
swarm, swarm,