Skip to content

Commit

Permalink
Merge branch 'master' into feat/quic/deprecated-draft-29
Browse files Browse the repository at this point in the history
  • Loading branch information
tesol2y090 authored Dec 31, 2024
2 parents 2a95c84 + e1d02ca commit 5958303
Show file tree
Hide file tree
Showing 67 changed files with 1,722 additions and 1,266 deletions.
1,778 changes: 911 additions & 867 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ members = [
"misc/quickcheck-ext",
"misc/rw-stream-sink",
"misc/server",
"misc/test-utils",
"misc/webrtc-utils",
"muxers/mplex",
"muxers/test-harness",
Expand Down Expand Up @@ -113,6 +114,7 @@ libp2p-websocket = { version = "0.44.1", path = "transports/websocket" }
libp2p-websocket-websys = { version = "0.4.1", path = "transports/websocket-websys" }
libp2p-webtransport-websys = { version = "0.4.1", path = "transports/webtransport-websys" }
libp2p-yamux = { version = "0.46.0", path = "muxers/yamux" }
libp2p-test-utils = { version = "0.1.0", path = "misc/test-utils" }

# External dependencies
async-std-resolver = { version = "0.25.0-alpha.4", default-features = false }
Expand All @@ -135,10 +137,11 @@ ring = "0.17.8"
rw-stream-sink = { version = "0.4.0", path = "misc/rw-stream-sink" }
thiserror = "2"
tokio = { version = "1.38", default-features = false }
tracing = "0.1.37"
tracing-subscriber = "0.3"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
unsigned-varint = { version = "0.8.0" }
web-time = "1.1.0"
hashlink = "0.9.0"

[patch.crates-io]

Expand Down
2 changes: 1 addition & 1 deletion examples/autonatv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ libp2p = { workspace = true, features = ["macros", "tokio", "tcp", "noise", "yam
clap = { version = "4.4.18", features = ["derive"] }
tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
rand = "0.8.5"
opentelemetry_sdk = { version = "0.21.1", optional = true, features = ["rt-tokio"] }
tracing-opentelemetry = { version = "0.22.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion misc/multistream-select/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async-std = { version = "1.6.2", features = ["attributes"] }
futures_ringbuf = "0.4.0"
quickcheck = { workspace = true }
rw-stream-sink = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
libp2p-test-utils = { workspace = true }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
Expand Down
14 changes: 6 additions & 8 deletions misc/multistream-select/src/dialer_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ mod tests {
future::timeout,
net::{TcpListener, TcpStream},
};
use libp2p_test_utils::EnvFilter;
use quickcheck::{Arbitrary, Gen, GenRange};
use tracing::metadata::LevelFilter;
use tracing_subscriber::EnvFilter;

use super::*;
use crate::listener_select_proto;
Expand Down Expand Up @@ -275,13 +275,11 @@ mod tests {
ListenerProtos(listen_protos): ListenerProtos,
DialPayload(dial_payload): DialPayload,
) {
let _ = tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::builder()
.with_default_directive(LevelFilter::DEBUG.into())
.from_env_lossy(),
)
.try_init();
libp2p_test_utils::with_env_filter(
EnvFilter::builder()
.with_default_directive(LevelFilter::DEBUG.into())
.from_env_lossy(),
);

async_std::task::block_on(async move {
let listener = TcpListener::bind("0.0.0.0:0").await.unwrap();
Expand Down
4 changes: 4 additions & 0 deletions misc/test-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 0.1.0

- Introduce 'test-utils` crate.
See [PR 5725](https://github.com/libp2p/rust-libp2p/pull/5725).
17 changes: 17 additions & 0 deletions misc/test-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "libp2p-test-utils"
version = "0.1.0"
edition = "2021"
authors = ["Krishang Shah <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
publish = false

[package.metadata.release]
release = false

[dependencies]
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[lints]
workspace = true
15 changes: 15 additions & 0 deletions misc/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pub use tracing_subscriber::EnvFilter;

/// Initializes logging with the default environment filter (`RUST_LOG`).
pub fn with_default_env_filter() {
with_env_filter(EnvFilter::from_default_env());
}

/// Initializes logging with a custom environment filter.
/// Logs are written to standard error (`stderr`).
pub fn with_env_filter(filter: impl Into<EnvFilter>) {
let _ = tracing_subscriber::fmt()
.with_env_filter(filter)
.with_writer(std::io::stderr)
.try_init();
}
2 changes: 1 addition & 1 deletion muxers/mplex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ libp2p-muxer-test-harness = { path = "../test-harness" }
libp2p-plaintext = { workspace = true }
libp2p-tcp = { workspace = true, features = ["async-io"] }
quickcheck = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
libp2p-test-utils = { workspace = true }

[[bench]]
name = "split_send_size"
Expand Down
5 changes: 1 addition & 4 deletions muxers/mplex/benches/split_send_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ use libp2p_identity as identity;
use libp2p_identity::PeerId;
use libp2p_mplex as mplex;
use libp2p_plaintext as plaintext;
use tracing_subscriber::EnvFilter;

type BenchTransport = transport::Boxed<(PeerId, muxing::StreamMuxerBox)>;

Expand All @@ -55,9 +54,7 @@ const BENCH_SIZES: [usize; 8] = [
];

fn prepare(c: &mut Criterion) {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();

let payload: Vec<u8> = vec![1; 1024 * 1024];

Expand Down
10 changes: 2 additions & 8 deletions muxers/mplex/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,10 +1231,7 @@ mod tests {

#[test]
fn max_buffer_behaviour() {
use tracing_subscriber::EnvFilter;
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();

fn prop(cfg: MplexConfig, overflow: NonZeroU8) {
let mut r_buf = BytesMut::new();
Expand Down Expand Up @@ -1369,10 +1366,7 @@ mod tests {

#[test]
fn close_on_error() {
use tracing_subscriber::EnvFilter;
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();

fn prop(cfg: MplexConfig, num_streams: NonZeroU8) {
let num_streams = cmp::min(cfg.max_substreams, num_streams.get() as usize);
Expand Down
2 changes: 1 addition & 1 deletion protocols/autonat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ thiserror = { workspace = true, optional = true }
[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt", "sync"] }
libp2p-swarm-test = { path = "../../swarm-test" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
libp2p-test-utils = { workspace = true }
libp2p-identify = { workspace = true }
libp2p-swarm = { workspace = true, features = ["macros"] }

Expand Down
17 changes: 4 additions & 13 deletions protocols/autonat/tests/autonatv2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ use libp2p_swarm::{
use libp2p_swarm_test::SwarmExt;
use rand_core::OsRng;
use tokio::sync::oneshot;
use tracing_subscriber::EnvFilter;

#[tokio::test]
async fn confirm_successful() {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();
let (mut alice, mut bob) = start_and_connect().await;

let cor_server_peer = *alice.local_peer_id();
Expand Down Expand Up @@ -128,9 +125,7 @@ async fn confirm_successful() {

#[tokio::test]
async fn dial_back_to_unsupported_protocol() {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();
let (mut alice, mut bob) = bootstrap().await;

let alice_peer_id = *alice.local_peer_id();
Expand Down Expand Up @@ -226,9 +221,7 @@ async fn dial_back_to_unsupported_protocol() {

#[tokio::test]
async fn dial_back_to_non_libp2p() {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();
let (mut alice, mut bob) = bootstrap().await;
let alice_peer_id = *alice.local_peer_id();

Expand Down Expand Up @@ -314,9 +307,7 @@ async fn dial_back_to_non_libp2p() {

#[tokio::test]
async fn dial_back_to_not_supporting() {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();

let (mut alice, mut bob) = bootstrap().await;
let alice_peer_id = *alice.local_peer_id();
Expand Down
2 changes: 1 addition & 1 deletion protocols/dcutr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ libp2p-swarm = { workspace = true, features = ["macros"] }
libp2p-swarm-test = { path = "../../swarm-test" }
libp2p-tcp = { workspace = true, features = ["async-io"] }
libp2p-yamux = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
libp2p-test-utils = { workspace = true }
tokio = { workspace = true, features = ["rt", "macros"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
Expand Down
5 changes: 1 addition & 4 deletions protocols/dcutr/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ use libp2p_plaintext as plaintext;
use libp2p_relay as relay;
use libp2p_swarm::{Config, NetworkBehaviour, Swarm, SwarmEvent};
use libp2p_swarm_test::SwarmExt as _;
use tracing_subscriber::EnvFilter;

#[tokio::test]
async fn connect() {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
libp2p_test_utils::with_default_env_filter();

let mut relay = build_relay();
let mut dst = build_client();
Expand Down
5 changes: 5 additions & 0 deletions protocols/gossipsub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 0.48.0
- Add configurable `idontwant_message_size_threshold` parameter.
See [PR 5770](https://github.com/libp2p/rust-libp2p/pull/5770)

- Introduce Gossipsub v1.2 [spec](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md).
See [PR 5697](https://github.com/libp2p/rust-libp2p/pull/5697)

- Correct state inconsistencies with the mesh and fanout when unsubscribing.
See [PR 5690](https://github.com/libp2p/rust-libp2p/pull/5690)
Expand Down
3 changes: 2 additions & 1 deletion protocols/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fnv = "1.0.7"
futures = { workspace = true }
futures-timer = "3.0.2"
getrandom = { workspace = true }
hashlink = { workspace = true}
hex_fmt = "0.3.0"
web-time = { workspace = true }
libp2p-core = { workspace = true }
Expand All @@ -44,7 +45,7 @@ prometheus-client = { workspace = true }
libp2p-core = { workspace = true }
libp2p-swarm-test = { path = "../../swarm-test" }
quickcheck = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
libp2p-test-utils = { workspace = true }
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "time", "macros"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
Expand Down
Loading

0 comments on commit 5958303

Please sign in to comment.