Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Merge #472
Browse files Browse the repository at this point in the history
472: chore: upgrade to libp2p 0.39 r=koivunej a=CHr15F0x

This PR is a follow up of #463.

It includes the following:
- upgrading libp2p to [v.0.39.1](https://github.com/libp2p/rust-libp2p/releases/tag/v0.39.1)
- upgrading some other deps (e.g.: prost, prost-base, quick-protobuf, base64), **excluding cid and multihash**
- fixes to tests that started failing following upgrade to libp2p v.0.38 in #463

Incoming shortly:
- [x] respective changelog update
- [x] ~~I haven't run the changes against current workflow, so some additional fixes could be necessary;~~ edit: though I did check against all tests locally numerous times during dev, albeit only in a linux/x64 environment; btw looks like the workflows are fine with the changes


Co-authored-by: Joonas Koivunen <[email protected]>
Co-authored-by: Krzysztof Lis <[email protected]>
  • Loading branch information
3 people committed Aug 18, 2021
2 parents 08f840b + c7a7998 commit ede42eb
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 111 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* fix: connect using DialPeer instead of DialAddress [#454]
* fix: compilation error when used as a dependency [#470]
* perf: use hash_hasher where the key is Cid [#467]
* chore: upgrade to libp2p 0.39.1, update most of the other deps with the notable exception of cid and multihash [#472]

[#429]: https://github.com/rs-ipfs/rust-ipfs/pull/429
[#428]: https://github.com/rs-ipfs/rust-ipfs/pull/428
Expand All @@ -23,6 +24,7 @@
[#454]: https://github.com/rs-ipfs/rust-ipfs/pull/454
[#470]: https://github.com/rs-ipfs/rust-ipfs/pull/470
[#467]: https://github.com/rs-ipfs/rust-ipfs/pull/467
[#472]: https://github.com/rs-ipfs/rust-ipfs/pull/472

# 0.2.1

Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test_js_interop = []
anyhow = "1.0"
async-stream = { default-features = false, version = "0.3" }
async-trait = { default-features = false, version = "0.1" }
base64 = { default-features = false, features = ["alloc"], version = "0.12" }
base64 = { default-features = false, features = ["alloc"], version = "0.13" }
ipfs-bitswap = { version = "0.1", path = "bitswap" }
byteorder = { default-features = false, version = "1.3" }
bytes = { default-features = false, version = "1" }
Expand All @@ -31,10 +31,10 @@ either = { default-features = false, version = "1.5" }
futures = { default-features = false, version = "0.3.9", features = ["alloc", "std"] }
hash_hasher = "2.0.3"
ipfs-unixfs = { version = "0.2", path = "unixfs" }
libp2p = { default-features = false, features = ["floodsub", "identify", "kad", "tcp-tokio", "mplex", "noise", "ping", "yamux", "dns"], version = "0.34" }
multibase = { default-features = false, version = "0.8" }
libp2p = { default-features = false, features = ["floodsub", "identify", "kad", "tcp-tokio", "mplex", "noise", "ping", "yamux", "dns-tokio"], version = "0.39" }
multibase = { default-features = false, version = "0.9" }
multihash = { default-features = false, version = "0.11" }
prost = { default-features = false, version = "0.7" }
prost = { default-features = false, version = "0.8" }
serde = { default-features = false, features = ["derive"], version = "1.0" }
serde_json = { default-features = false, features = ["std"], version = "1.0" }
thiserror = { default-features = false, version = "1.0" }
Expand All @@ -49,7 +49,7 @@ sled = "0.34"
once_cell = "1.5.2"

[build-dependencies]
prost-build = { default-features = false, version = "0.7" }
prost-build = { default-features = false, version = "0.8" }

[dev-dependencies]
criterion = { default-features = false, version = "0.3" }
Expand Down
8 changes: 4 additions & 4 deletions bitswap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/rs-ipfs/rust-ipfs"

[build-dependencies]
prost-build = { default-features = false, version = "0.7" }
prost-build = { default-features = false, version = "0.8" }

[dependencies]
cid = { default-features = false, version = "0.5" }
fnv = { default-features = false, version = "1.0" }
futures = { default-features = false, version = "0.3" }
hash_hasher = "2.0.3"
libp2p-core = { default-features = false, version = "0.27" }
libp2p-swarm = { default-features = false, version = "0.27" }
libp2p-core = { default-features = false, version = "0.29" }
libp2p-swarm = { default-features = false, version = "0.30" }
multihash = { default-features = false, version = "0.11" }
prost = { default-features = false, version = "0.7" }
prost = { default-features = false, version = "0.8" }
thiserror = { default-features = false, version = "1.0" }
tokio = { default-features = false, version = "1", features = ["rt"] }
tracing = { default-features = false, version = "0.1" }
Expand Down
2 changes: 1 addition & 1 deletion bitswap/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use thiserror::Error;
#[derive(Debug, Error)]
pub enum BitswapError {
#[error("Error while reading from socket: {0}")]
ReadError(#[from] libp2p_core::upgrade::ReadOneError),
ReadError(#[from] std::io::Error),
#[error("Error while decoding bitswap message: {0}")]
ProtobufError(#[from] prost::DecodeError),
#[error("Error while parsing cid: {0}")]
Expand Down
10 changes: 7 additions & 3 deletions bitswap/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use crate::ledger::Message;
use core::future::Future;
use core::iter;
use core::pin::Pin;
use futures::io::{AsyncRead, AsyncWrite};
use futures::{
io::{AsyncRead, AsyncWrite},
AsyncWriteExt,
};
use libp2p_core::{upgrade, InboundUpgrade, OutboundUpgrade, UpgradeInfo};
use std::io;

Expand Down Expand Up @@ -42,7 +45,7 @@ where
#[inline]
fn upgrade_inbound(self, mut socket: TSocket, _info: Self::Info) -> Self::Future {
Box::pin(async move {
let packet = upgrade::read_one(&mut socket, MAX_BUF_SIZE).await?;
let packet = upgrade::read_length_prefixed(&mut socket, MAX_BUF_SIZE).await?;
let message = Message::from_bytes(&packet)?;
Ok(message)
})
Expand Down Expand Up @@ -71,7 +74,8 @@ where
fn upgrade_outbound(self, mut socket: TSocket, _info: Self::Info) -> Self::Future {
Box::pin(async move {
let bytes = self.to_bytes();
upgrade::write_one(&mut socket, bytes).await
upgrade::write_length_prefixed(&mut socket, bytes).await?;
socket.close().await
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "ipfs-http"
version = "0.1.0"

[build-dependencies]
prost-build = { default-features = false, version = "0.7" }
prost-build = { default-features = false, version = "0.8" }
vergen = { default-features = false, version = "3.1" }

[dependencies]
Expand All @@ -19,12 +19,12 @@ humantime = { default-features = false, version = "2.0" }
ipfs = { path = "../" }
mime = { default-features = false, version = "0.3" }
mpart-async = { default-features = false, version = "0.5" }
multibase = { default-features = false, version = "0.8" }
multibase = { default-features = false, features = ["std"], version = "0.9" }
multihash = { default-features = false, version = "0.11" }
# openssl is required for rsa keygen but not used by the rust-ipfs or its dependencies
openssl = { default-features = false, version = "0.10" }
percent-encoding = { default-features = false, version = "2.1" }
prost = { default-features = false, version = "0.7" }
prost = { default-features = false, version = "0.8" }
serde = { default-features = false, features = ["derive"], version = "1.0" }
serde_json = { default-features = false, version = "1.0" }
structopt = { default-features = false, version = "0.3" }
Expand Down
Loading

0 comments on commit ede42eb

Please sign in to comment.