420: Bump libp2p from 0.36.0 to 0.37.1 r=thomaseizinger a=dependabot[bot]

Bumps [libp2p](https://github.com/libp2p/rust-libp2p) from 0.36.0 to 0.37.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/libp2p/rust-libp2p/releases">libp2p's releases</a>.</em></p>
<blockquote>
<h2>v0.37.1</h2>
<p>See individual <a href="https://github.com/libp2p/rust-libp2p/blob/HEAD/CHANGELOG.md">changelogs</a> for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/libp2p/rust-libp2p/blob/master/CHANGELOG.md">libp2p's changelog</a>.</em></p>
<blockquote>
<h2>Version 0.37.1 [2021-04-14]</h2>
<ul>
<li>Update individual crates.
<ul>
<li><code>libp2p-swarm-derive</code></li>
</ul>
</li>
</ul>
<h2>Version 0.37.0 [2021-04-13]</h2>
<ul>
<li>
<p>Update individual crates.</p>
<ul>
<li><code>libp2p-core</code></li>
<li><code>libp2p-dns</code></li>
<li><code>libp2p-floodsub</code></li>
<li><code>libp2p-gossipsub</code></li>
<li><code>libp2p-kad</code></li>
<li><code>libp2p-mdns</code></li>
<li><code>libp2p-ping</code></li>
<li><code>libp2p-relay</code></li>
<li><code>libp2p-request-response</code></li>
<li><code>libp2p-swarm</code></li>
<li><code>libp2p-wasm-ext</code></li>
<li><code>libp2p-yamux</code></li>
</ul>
</li>
<li>
<p>Drop support for <code>wasm32-unknown-unknown</code> in favor of
<code>wasm32-unknown-emscripten</code> and <code>wasm32-wasi</code> <a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/pull/2038">PR
2038</a>.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="40c4287bc9"><code>40c4287</code></a> *: Prepare libp2p-swarm-derive v0.23.0 and libp2p v0.37.1</li>
<li><a href="42441dbd86"><code>42441db</code></a> *: Prepare v0.37.0 release (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2049">#2049</a>)</li>
<li><a href="807ce10656"><code>807ce10</code></a> build(deps): bump actions/cache from v2.1.4 to v2.1.5 (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2050">#2050</a>)</li>
<li><a href="05aa794552"><code>05aa794</code></a> Derive debug for RelayConfig. (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2048">#2048</a>)</li>
<li><a href="426a20c66b"><code>426a20c</code></a> Update yamux requirement from 0.8.0 to 0.9.0 (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/1960">#1960</a>)</li>
<li><a href="8ccb96a9f3"><code>8ccb96a</code></a> *: Drop generic wasm32-unknown-unknown support (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2038">#2038</a>)</li>
<li><a href="687145d784"><code>687145d</code></a> protocols: Derive debug for MemoryStoreConfig and IdentifyConfig (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2029">#2029</a>)</li>
<li><a href="b1b6f2bafe"><code>b1b6f2b</code></a> build(deps): bump styfle/cancel-workflow-action from 0.8.0 to 0.9.0 (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2045">#2045</a>)</li>
<li><a href="de261d5280"><code>de261d5</code></a> .github: Only test benchmarks, don't run them (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2042">#2042</a>)</li>
<li><a href="2d995a62e7"><code>2d995a6</code></a> *: Fix redundant_semicolons warnings (<a href="https://github-redirect.dependabot.com/libp2p/rust-libp2p/issues/2039">#2039</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/libp2p/rust-libp2p/compare/v0.36.0...v0.37.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=libp2p&package-manager=cargo&previous-version=0.36.0&new-version=0.37.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
bors[bot] 2021-04-20 02:58:48 +00:00 committed by GitHub
commit a5ee32ae23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 55 deletions

53
Cargo.lock generated
View File

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

View File

@ -27,7 +27,7 @@ directories-next = "2"
ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["libsecp_compat", "serde"] }
futures = { version = "0.3", default-features = false }
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" }
miniscript = { version = "5", features = ["serde"] }
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 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 (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 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) =
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(_) => {},
Err(_) => {
// 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 }) => {
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");
}
}
@ -228,7 +228,7 @@ where
for (transfer_proof, responder) in transfer_proofs {
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);
}
}
@ -255,13 +255,13 @@ where
next_transfer_proof = self.send_transfer_proof.next() => {
match next_transfer_proof {
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");
self.buffered_transfer_proofs.entry(peer).or_insert_with(Vec::new).push((transfer_proof, responder));
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);
},
Some(Err(e)) => {
@ -273,7 +273,7 @@ where
}
}
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) {
match libp2p::Swarm::dial(&mut self.swarm, &self.alice_peer_id) {
match self.swarm.dial(&self.alice_peer_id) {
Ok(()) => {}
Err(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);
// 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;
}
@ -176,7 +176,7 @@ impl EventLoop {
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);
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());
}
}
@ -187,15 +187,15 @@ impl EventLoop {
// 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.
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);
},
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);
},
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);
},
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
};
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);
},
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);
}
@ -218,7 +218,7 @@ impl EventLoop {
}
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 get_port::get_port;
use libp2p::core::Multiaddr;
use libp2p::{PeerId, Swarm};
use libp2p::PeerId;
use monero_harness::{image, Monero};
use std::cmp::Ordering;
use std::fmt;
@ -117,7 +117,9 @@ impl BobParams {
pub fn new_eventloop(&self, swap_id: Uuid) -> Result<(bob::EventLoop, bob::EventLoopHandle)> {
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(
swap_id,
@ -642,7 +644,7 @@ fn start_alice(
let db = Arc::new(Database::open(db_path.as_path()).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(
swarm,