From f54423a221104cb1967f6a88e8d04fb10b15416b Mon Sep 17 00:00:00 2001 From: Darius Clark Date: Fri, 7 Jun 2024 21:36:24 -0400 Subject: [PATCH] deps: use `web-time` instead of `instant` See https://github.com/sebcrozet/instant/issues/52 Pull-Request: #5347. --- Cargo.lock | 52 +++++++++----------- Cargo.toml | 17 ++++--- core/CHANGELOG.md | 4 ++ core/Cargo.toml | 6 +-- core/src/peer_record.rs | 2 +- interop-tests/Cargo.toml | 4 +- interop-tests/src/arch.rs | 2 +- libp2p/CHANGELOG.md | 3 ++ libp2p/Cargo.toml | 3 +- misc/metrics/CHANGELOG.md | 4 ++ misc/metrics/Cargo.toml | 4 +- misc/metrics/src/swarm.rs | 2 +- muxers/yamux/Cargo.toml | 2 +- protocols/autonat/CHANGELOG.md | 4 ++ protocols/autonat/Cargo.toml | 4 +- protocols/autonat/src/behaviour.rs | 2 +- protocols/autonat/src/behaviour/as_client.rs | 2 +- protocols/autonat/src/behaviour/as_server.rs | 2 +- protocols/dcutr/CHANGELOG.md | 4 ++ protocols/dcutr/Cargo.toml | 6 +-- protocols/dcutr/src/protocol/outbound.rs | 2 +- protocols/gossipsub/CHANGELOG.md | 4 ++ protocols/gossipsub/Cargo.toml | 8 +-- protocols/gossipsub/src/backoff.rs | 2 +- protocols/gossipsub/src/behaviour.rs | 3 +- protocols/gossipsub/src/gossip_promises.rs | 2 +- protocols/gossipsub/src/handler.rs | 2 +- protocols/gossipsub/src/peer_score.rs | 2 +- protocols/gossipsub/src/time_cache.rs | 2 +- protocols/kad/CHANGELOG.md | 2 + protocols/kad/Cargo.toml | 4 +- protocols/kad/src/behaviour.rs | 2 +- protocols/kad/src/bootstrap.rs | 2 +- protocols/kad/src/jobs.rs | 2 +- protocols/kad/src/kbucket.rs | 3 +- protocols/kad/src/protocol.rs | 2 +- protocols/kad/src/query.rs | 2 +- protocols/kad/src/query/peers/closest.rs | 2 +- protocols/kad/src/record.rs | 2 +- protocols/perf/CHANGELOG.md | 4 ++ protocols/perf/Cargo.toml | 4 +- protocols/perf/src/bin/perf.rs | 2 +- protocols/perf/src/lib.rs | 2 +- protocols/perf/src/protocol.rs | 2 +- protocols/ping/CHANGELOG.md | 3 ++ protocols/ping/Cargo.toml | 4 +- protocols/ping/src/protocol.rs | 2 +- protocols/relay/CHANGELOG.md | 4 ++ protocols/relay/Cargo.toml | 4 +- protocols/rendezvous/CHANGELOG.md | 4 ++ protocols/rendezvous/Cargo.toml | 4 +- protocols/rendezvous/src/server.rs | 2 +- protocols/request-response/CHANGELOG.md | 2 + protocols/request-response/Cargo.toml | 2 +- swarm/CHANGELOG.md | 2 + swarm/Cargo.toml | 8 +-- swarm/src/connection.rs | 2 +- swarm/src/connection/pool.rs | 2 +- 58 files changed, 139 insertions(+), 99 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 13b29b0dc0b..8ad67903c93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2402,9 +2402,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -2436,7 +2433,6 @@ dependencies = [ "either", "futures", "futures-timer", - "instant", "libp2p", "libp2p-mplex", "libp2p-noise", @@ -2458,6 +2454,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "wasm-logger", + "web-time", ] [[package]] @@ -2607,7 +2604,6 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.15", - "instant", "libp2p-allow-block-list", "libp2p-autonat", "libp2p-connection-limits", @@ -2663,14 +2659,13 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.12.0" +version = "0.12.1" dependencies = [ "async-std", "async-trait", "asynchronous-codec", "futures", "futures-timer", - "instant", "libp2p-core", "libp2p-identity", "libp2p-request-response", @@ -2681,6 +2676,7 @@ dependencies = [ "rand 0.8.5", "tracing", "tracing-subscriber", + "web-time", ] [[package]] @@ -2702,14 +2698,13 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.41.2" +version = "0.41.3" dependencies = [ "async-std", "either", "fnv", "futures", "futures-timer", - "instant", "libp2p-identity", "libp2p-mplex", "libp2p-noise", @@ -2729,11 +2724,12 @@ dependencies = [ "tracing", "unsigned-varint 0.8.0", "void", + "web-time", ] [[package]] name = "libp2p-dcutr" -version = "0.11.0" +version = "0.11.1" dependencies = [ "async-std", "asynchronous-codec", @@ -2742,7 +2738,6 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "instant", "libp2p-core", "libp2p-dns", "libp2p-identify", @@ -2763,6 +2758,7 @@ dependencies = [ "tracing", "tracing-subscriber", "void", + "web-time", ] [[package]] @@ -2805,7 +2801,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.46.1" +version = "0.46.2" dependencies = [ "async-std", "asynchronous-codec", @@ -2819,7 +2815,6 @@ dependencies = [ "getrandom 0.2.15", "hex", "hex_fmt", - "instant", "libp2p-core", "libp2p-identity", "libp2p-noise", @@ -2838,6 +2833,7 @@ dependencies = [ "tracing", "tracing-subscriber", "void", + "web-time", ] [[package]] @@ -2906,7 +2902,6 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "instant", "libp2p-core", "libp2p-identify", "libp2p-identity", @@ -2926,6 +2921,7 @@ dependencies = [ "tracing-subscriber", "uint", "void", + "web-time", ] [[package]] @@ -2974,10 +2970,9 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.14.1" +version = "0.14.2" dependencies = [ "futures", - "instant", "libp2p-core", "libp2p-dcutr", "libp2p-gossipsub", @@ -2989,6 +2984,7 @@ dependencies = [ "libp2p-swarm", "pin-project", "prometheus-client", + "web-time", ] [[package]] @@ -3055,14 +3051,13 @@ dependencies = [ [[package]] name = "libp2p-perf" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "clap", "futures", "futures-bounded", "futures-timer", - "instant", "libp2p", "libp2p-core", "libp2p-dns", @@ -3081,6 +3076,7 @@ dependencies = [ "tracing", "tracing-subscriber", "void", + "web-time", ] [[package]] @@ -3091,7 +3087,6 @@ dependencies = [ "either", "futures", "futures-timer", - "instant", "libp2p-core", "libp2p-identity", "libp2p-swarm", @@ -3101,6 +3096,7 @@ dependencies = [ "tracing", "tracing-subscriber", "void", + "web-time", ] [[package]] @@ -3173,7 +3169,7 @@ dependencies = [ [[package]] name = "libp2p-relay" -version = "0.17.2" +version = "0.17.3" dependencies = [ "asynchronous-codec", "bytes", @@ -3202,14 +3198,13 @@ dependencies = [ [[package]] name = "libp2p-rendezvous" -version = "0.14.0" +version = "0.14.1" dependencies = [ "async-trait", "asynchronous-codec", "bimap", "futures", "futures-timer", - "instant", "libp2p-core", "libp2p-identify", "libp2p-identity", @@ -3228,6 +3223,7 @@ dependencies = [ "tracing", "tracing-subscriber", "void", + "web-time", ] [[package]] @@ -3242,7 +3238,6 @@ dependencies = [ "futures-bounded", "futures-timer", "futures_ringbuf", - "instant", "libp2p-core", "libp2p-identity", "libp2p-noise", @@ -3257,6 +3252,7 @@ dependencies = [ "tracing", "tracing-subscriber", "void", + "web-time", ] [[package]] @@ -3305,7 +3301,6 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.15", - "instant", "libp2p-core", "libp2p-identify", "libp2p-identity", @@ -3327,6 +3322,7 @@ dependencies = [ "trybuild", "void", "wasm-bindgen-futures", + "web-time", ] [[package]] @@ -3566,7 +3562,7 @@ dependencies = [ "thiserror", "tracing", "yamux 0.12.1", - "yamux 0.13.1", + "yamux 0.13.3", ] [[package]] @@ -7145,18 +7141,18 @@ dependencies = [ [[package]] name = "yamux" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1d0148b89300047e72994bee99ecdabd15a9166a7b70c8b8c37c314dcc9002" +checksum = "a31b5e376a8b012bee9c423acdbb835fc34d45001cfa3106236a624e4b738028" dependencies = [ "futures", - "instant", "log", "nohash-hasher", "parking_lot", "pin-project", "rand 0.8.5", "static_assertions", + "web-time", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6c6dc114983..995951a01d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,29 +76,29 @@ futures-bounded = { version = "0.2.3" } futures-rustls = { version = "0.26.0", default-features = false } libp2p = { version = "0.54.0", path = "libp2p" } libp2p-allow-block-list = { version = "0.3.0", path = "misc/allow-block-list" } -libp2p-autonat = { version = "0.12.0", path = "protocols/autonat" } +libp2p-autonat = { version = "0.12.1", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.3.1", path = "misc/connection-limits" } -libp2p-core = { version = "0.41.2", path = "core" } -libp2p-dcutr = { version = "0.11.0", path = "protocols/dcutr" } +libp2p-core = { version = "0.41.3", path = "core" } +libp2p-dcutr = { version = "0.11.1", path = "protocols/dcutr" } libp2p-dns = { version = "0.41.1", path = "transports/dns" } libp2p-floodsub = { version = "0.44.0", path = "protocols/floodsub" } -libp2p-gossipsub = { version = "0.46.1", path = "protocols/gossipsub" } +libp2p-gossipsub = { version = "0.46.2", path = "protocols/gossipsub" } libp2p-identify = { version = "0.44.2", path = "protocols/identify" } libp2p-identity = { version = "0.2.8" } libp2p-kad = { version = "0.46.0", path = "protocols/kad" } libp2p-mdns = { version = "0.45.1", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.2.0", path = "misc/memory-connection-limits" } -libp2p-metrics = { version = "0.14.1", path = "misc/metrics" } +libp2p-metrics = { version = "0.14.2", path = "misc/metrics" } libp2p-mplex = { version = "0.41.0", path = "muxers/mplex" } libp2p-muxer-test-harness = { path = "muxers/test-harness" } libp2p-noise = { version = "0.44.0", path = "transports/noise" } -libp2p-perf = { version = "0.3.0", path = "protocols/perf" } +libp2p-perf = { version = "0.3.1", path = "protocols/perf" } libp2p-ping = { version = "0.44.1", path = "protocols/ping" } libp2p-plaintext = { version = "0.41.0", path = "transports/plaintext" } libp2p-pnet = { version = "0.24.0", path = "transports/pnet" } libp2p-quic = { version = "0.10.3", path = "transports/quic" } -libp2p-relay = { version = "0.17.2", path = "protocols/relay" } -libp2p-rendezvous = { version = "0.14.0", path = "protocols/rendezvous" } +libp2p-relay = { version = "0.17.3", path = "protocols/relay" } +libp2p-rendezvous = { version = "0.14.1", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.26.3", path = "protocols/request-response" } libp2p-server = { version = "0.12.7", path = "misc/server" } libp2p-stream = { version = "0.1.0-alpha.1", path = "protocols/stream" } @@ -128,6 +128,7 @@ tokio = { version = "1.38", default-features = false } tracing = "0.1.37" tracing-subscriber = "0.3" futures = "0.3.30" +web-time = "1.1.0" ring = "0.17.8" rcgen = "0.11.3" diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 73f377a8aa5..633b627d41d 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.41.3 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.41.2 - Implement `std::fmt::Display` on `ListenerId`. diff --git a/core/Cargo.toml b/core/Cargo.toml index 5b3fbe32d0b..6831eb54c94 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-core" edition = "2021" rust-version = { workspace = true } description = "Core traits and structs of libp2p" -version = "0.41.2" +version = "0.41.3" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,11 +11,11 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -either = "1.12" +either = "1.11" fnv = "1.0" futures = { workspace = true, features = ["executor", "thread-pool"] } futures-timer = "3" -instant = "0.1.13" +web-time = { workspace = true } libp2p-identity = { workspace = true, features = ["peerid", "ed25519"] } multiaddr = { workspace = true } multihash = { workspace = true } diff --git a/core/src/peer_record.rs b/core/src/peer_record.rs index d5fc86c391e..ac488338cc6 100644 --- a/core/src/peer_record.rs +++ b/core/src/peer_record.rs @@ -1,10 +1,10 @@ use crate::signed_envelope::SignedEnvelope; use crate::{proto, signed_envelope, DecodeError, Multiaddr}; -use instant::SystemTime; use libp2p_identity::Keypair; use libp2p_identity::PeerId; use libp2p_identity::SigningError; use quick_protobuf::{BytesReader, Writer}; +use web_time::SystemTime; const PAYLOAD_TYPE: &str = "/libp2p/routing-state-record"; const DOMAIN_SEP: &str = "libp2p-routing-state"; diff --git a/interop-tests/Cargo.toml b/interop-tests/Cargo.toml index 3a9fea3c0df..5dbdafa34b1 100644 --- a/interop-tests/Cargo.toml +++ b/interop-tests/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] anyhow = "1" -either = "1.12.0" +either = "1.11.0" futures = { workspace = true } rand = "0.8.5" serde = { version = "1", features = ["derive"] } @@ -46,7 +46,7 @@ libp2p-webrtc-websys = { workspace = true } wasm-bindgen = { version = "0.2" } wasm-bindgen-futures = { version = "0.4" } wasm-logger = { version = "0.2.0" } -instant = "0.1.13" +web-time = { workspace = true } reqwest = { version = "0.12", features = ["json"] } console_error_panic_hook = { version = "0.1.7" } futures-timer = "3.0.3" diff --git a/interop-tests/src/arch.rs b/interop-tests/src/arch.rs index 52000f90a86..06d630d68d5 100644 --- a/interop-tests/src/arch.rs +++ b/interop-tests/src/arch.rs @@ -199,7 +199,7 @@ pub(crate) mod wasm { use crate::{BlpopRequest, Muxer, SecProtocol, Transport}; - pub(crate) type Instant = instant::Instant; + pub(crate) type Instant = web_time::Instant; pub(crate) fn init_logger() { console_error_panic_hook::set_once(); diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 7acd4ab602d..8b1a332769f 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -6,6 +6,9 @@ - Raise MSRV to 1.73. See [PR 5266](https://github.com/libp2p/rust-libp2p/pull/5266). +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.53.2 - Allow `SwarmBuilder::with_bandwidth_metrics` after `SwarmBuilder::with_websocket`. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 4304f4e557a..59a075b777e 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -82,7 +82,7 @@ tcp = ["dep:libp2p-tcp"] tls = ["dep:libp2p-tls"] tokio = [ "libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio", "libp2p-upnp?/tokio"] uds = ["dep:libp2p-uds"] -wasm-bindgen = [ "futures-timer/wasm-bindgen", "instant/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen",] +wasm-bindgen = [ "futures-timer/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"] websocket-websys = ["dep:libp2p-websocket-websys"] websocket = ["dep:libp2p-websocket"] webtransport-websys = ["dep:libp2p-webtransport-websys"] @@ -95,7 +95,6 @@ either = "1.9.0" futures = { workspace = true } futures-timer = "3.0.2" # Explicit dependency to be used in `wasm-bindgen` feature getrandom = "0.2.3" # Explicit dependency to be used in `wasm-bindgen` feature -instant = "0.1.12" # Explicit dependency to be used in `wasm-bindgen` feature # TODO feature flag? rw-stream-sink = { workspace = true } diff --git a/misc/metrics/CHANGELOG.md b/misc/metrics/CHANGELOG.md index 67c304680db..c36d7f95ebc 100644 --- a/misc/metrics/CHANGELOG.md +++ b/misc/metrics/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.14.2 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.14.1 - Add `BandwidthTransport`, wrapping an existing `Transport`, exposing Prometheus bandwidth metrics. diff --git a/misc/metrics/Cargo.toml b/misc/metrics/Cargo.toml index 51da56db29f..5fb927bee84 100644 --- a/misc/metrics/Cargo.toml +++ b/misc/metrics/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-metrics" edition = "2021" rust-version = { workspace = true } description = "Metrics for libp2p" -version = "0.14.1" +version = "0.14.2" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -20,7 +20,7 @@ relay = ["libp2p-relay"] [dependencies] futures = { workspace = true } -instant = "0.1.13" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-dcutr = { workspace = true, optional = true } libp2p-gossipsub = { workspace = true, optional = true } diff --git a/misc/metrics/src/swarm.rs b/misc/metrics/src/swarm.rs index ad83401f316..51c0a0af253 100644 --- a/misc/metrics/src/swarm.rs +++ b/misc/metrics/src/swarm.rs @@ -22,13 +22,13 @@ use std::collections::HashMap; use std::sync::{Arc, Mutex}; use crate::protocol_stack; -use instant::Instant; use libp2p_swarm::{ConnectionId, DialError, SwarmEvent}; use prometheus_client::encoding::{EncodeLabelSet, EncodeLabelValue}; use prometheus_client::metrics::counter::Counter; use prometheus_client::metrics::family::Family; use prometheus_client::metrics::histogram::{exponential_buckets, Histogram}; use prometheus_client::registry::{Registry, Unit}; +use web_time::Instant; pub(crate) struct Metrics { connections_incoming: Family, diff --git a/muxers/yamux/Cargo.toml b/muxers/yamux/Cargo.toml index ddb9424895b..4d6d655e330 100644 --- a/muxers/yamux/Cargo.toml +++ b/muxers/yamux/Cargo.toml @@ -16,7 +16,7 @@ futures = { workspace = true } libp2p-core = { workspace = true } thiserror = "1.0" yamux012 = { version = "0.12.1", package = "yamux" } -yamux013 = { version = "0.13.1", package = "yamux" } +yamux013 = { version = "0.13.3", package = "yamux" } tracing = { workspace = true } [dev-dependencies] diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index 1259dd01fd4..6a25dc173dd 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.12.1 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.12.0 - Remove `Clone`, `PartialEq` and `Eq` implementations on `Event` and its sub-structs. diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index ba7a21b4da7..970dd27bc53 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" rust-version = { workspace = true } description = "NAT and firewall detection for libp2p" authors = ["David Craven ", "Elena Frank "] -version = "0.12.0" +version = "0.12.1" license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] @@ -14,7 +14,7 @@ categories = ["network-programming", "asynchronous"] async-trait = "0.1" futures = { workspace = true } futures-timer = "3.0" -instant = "0.1" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-request-response = { workspace = true } diff --git a/protocols/autonat/src/behaviour.rs b/protocols/autonat/src/behaviour.rs index a770e61e88a..a47852e5206 100644 --- a/protocols/autonat/src/behaviour.rs +++ b/protocols/autonat/src/behaviour.rs @@ -28,7 +28,6 @@ pub use as_client::{OutboundProbeError, OutboundProbeEvent}; use as_server::AsServer; pub use as_server::{InboundProbeError, InboundProbeEvent}; use futures_timer::Delay; -use instant::Instant; use libp2p_core::{multiaddr::Protocol, ConnectedPoint, Endpoint, Multiaddr}; use libp2p_identity::PeerId; use libp2p_request_response::{ @@ -45,6 +44,7 @@ use std::{ task::{Context, Poll}, time::Duration, }; +use web_time::Instant; /// Config for the [`Behaviour`]. #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/protocols/autonat/src/behaviour/as_client.rs b/protocols/autonat/src/behaviour/as_client.rs index 668f3b93719..8960163ccb3 100644 --- a/protocols/autonat/src/behaviour/as_client.rs +++ b/protocols/autonat/src/behaviour/as_client.rs @@ -26,7 +26,6 @@ use super::{ }; use futures::FutureExt; use futures_timer::Delay; -use instant::Instant; use libp2p_core::Multiaddr; use libp2p_identity::PeerId; use libp2p_request_response::{self as request_response, OutboundFailure, OutboundRequestId}; @@ -37,6 +36,7 @@ use std::{ task::{Context, Poll}, time::Duration, }; +use web_time::Instant; /// Outbound probe failed or was aborted. #[derive(Debug)] diff --git a/protocols/autonat/src/behaviour/as_server.rs b/protocols/autonat/src/behaviour/as_server.rs index 878fd713dda..af6be799e21 100644 --- a/protocols/autonat/src/behaviour/as_server.rs +++ b/protocols/autonat/src/behaviour/as_server.rs @@ -22,7 +22,6 @@ use super::{ Action, AutoNatCodec, Config, DialRequest, DialResponse, Event, HandleInnerEvent, ProbeId, ResponseError, }; -use instant::Instant; use libp2p_core::{multiaddr::Protocol, Multiaddr}; use libp2p_identity::PeerId; use libp2p_request_response::{ @@ -36,6 +35,7 @@ use std::{ collections::{HashMap, HashSet, VecDeque}, num::NonZeroU8, }; +use web_time::Instant; /// Inbound probe failed. #[derive(Debug)] diff --git a/protocols/dcutr/CHANGELOG.md b/protocols/dcutr/CHANGELOG.md index d3857373658..4865a0540bb 100644 --- a/protocols/dcutr/CHANGELOG.md +++ b/protocols/dcutr/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.11.1 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.11.0 - Add `ConnectionId` to `Event::DirectConnectionUpgradeSucceeded` and `Event::DirectConnectionUpgradeFailed`. diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index 819c7a6e56b..daf4846a2ae 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-dcutr" edition = "2021" rust-version = { workspace = true } description = "Direct connection upgrade through relay" -version = "0.11.0" +version = "0.11.1" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -12,10 +12,10 @@ categories = ["network-programming", "asynchronous"] [dependencies] asynchronous-codec = { workspace = true } -either = "1.12.0" +either = "1.11.0" futures = { workspace = true } futures-timer = "3.0" -instant = "0.1.13" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } diff --git a/protocols/dcutr/src/protocol/outbound.rs b/protocols/dcutr/src/protocol/outbound.rs index dc46442fae5..8639ff4f053 100644 --- a/protocols/dcutr/src/protocol/outbound.rs +++ b/protocols/dcutr/src/protocol/outbound.rs @@ -23,11 +23,11 @@ use crate::PROTOCOL_NAME; use asynchronous_codec::Framed; use futures::prelude::*; use futures_timer::Delay; -use instant::Instant; use libp2p_core::{multiaddr::Protocol, Multiaddr}; use libp2p_swarm::Stream; use std::io; use thiserror::Error; +use web_time::Instant; pub(crate) async fn handshake( stream: Stream, diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 5ff4cfa27d6..970db3f1ec3 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.46.2 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.46.1 - Deprecate `Rpc` in preparation for removing it from the public API because it is an internal type. diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index aa11a8a8309..35bc3eef9bd 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-gossipsub" edition = "2021" rust-version = { workspace = true } description = "Gossipsub protocol for libp2p" -version = "0.46.1" +version = "0.46.2" authors = ["Age Manning "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,20 +11,20 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [features] -wasm-bindgen = ["getrandom/js", "instant/wasm-bindgen"] +wasm-bindgen = ["getrandom/js"] [dependencies] asynchronous-codec = { workspace = true } base64 = "0.22.1" byteorder = "1.5.0" bytes = "1.6" -either = "1.12" +either = "1.11" fnv = "1.0.7" futures = { workspace = true } futures-ticker = "0.0.3" getrandom = "0.2.15" hex_fmt = "0.3.0" -instant = "0.1.13" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-identity = { workspace = true, features = ["rand"] } libp2p-swarm = { workspace = true } diff --git a/protocols/gossipsub/src/backoff.rs b/protocols/gossipsub/src/backoff.rs index b4a40b91a74..b24da318582 100644 --- a/protocols/gossipsub/src/backoff.rs +++ b/protocols/gossipsub/src/backoff.rs @@ -20,13 +20,13 @@ //! Data structure for efficiently storing known back-off's when pruning peers. use crate::topic::TopicHash; -use instant::Instant; use libp2p_identity::PeerId; use std::collections::{ hash_map::{Entry, HashMap}, HashSet, }; use std::time::Duration; +use web_time::Instant; #[derive(Copy, Clone)] struct HeartbeatIndex(usize); diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 6da2aceaa08..b508959317b 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -34,7 +34,6 @@ use futures_ticker::Ticker; use prometheus_client::registry::Registry; use rand::{seq::SliceRandom, thread_rng}; -use instant::Instant; use libp2p_core::{multiaddr::Protocol::Ip4, multiaddr::Protocol::Ip6, Endpoint, Multiaddr}; use libp2p_identity::Keypair; use libp2p_identity::PeerId; @@ -44,6 +43,7 @@ use libp2p_swarm::{ ConnectionDenied, ConnectionId, NetworkBehaviour, NotifyHandler, THandler, THandlerInEvent, THandlerOutEvent, ToSwarm, }; +use web_time::{Instant, SystemTime}; use crate::backoff::BackoffStorage; use crate::config::{Config, ValidationMode}; @@ -64,7 +64,6 @@ use crate::types::{ use crate::types::{PeerConnections, PeerKind, RpcOut}; use crate::{rpc_proto::proto, TopicScoreParams}; use crate::{PublishError, SubscriptionError, ValidationError}; -use instant::SystemTime; use quick_protobuf::{MessageWrite, Writer}; use std::{cmp::Ordering::Equal, fmt::Debug}; diff --git a/protocols/gossipsub/src/gossip_promises.rs b/protocols/gossipsub/src/gossip_promises.rs index 9538622c0dc..bdf58b74fc2 100644 --- a/protocols/gossipsub/src/gossip_promises.rs +++ b/protocols/gossipsub/src/gossip_promises.rs @@ -21,9 +21,9 @@ use crate::peer_score::RejectReason; use crate::MessageId; use crate::ValidationError; -use instant::Instant; use libp2p_identity::PeerId; use std::collections::HashMap; +use web_time::Instant; /// Tracks recently sent `IWANT` messages and checks if peers respond to them. #[derive(Default)] diff --git a/protocols/gossipsub/src/handler.rs b/protocols/gossipsub/src/handler.rs index e91f81776e7..88def13a521 100644 --- a/protocols/gossipsub/src/handler.rs +++ b/protocols/gossipsub/src/handler.rs @@ -26,7 +26,6 @@ use asynchronous_codec::Framed; use futures::future::Either; use futures::prelude::*; use futures::StreamExt; -use instant::Instant; use libp2p_core::upgrade::DeniedUpgrade; use libp2p_swarm::handler::{ ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, DialUpgradeError, @@ -38,6 +37,7 @@ use std::{ pin::Pin, task::{Context, Poll}, }; +use web_time::Instant; /// The event emitted by the Handler. This informs the behaviour of various events created /// by the handler. diff --git a/protocols/gossipsub/src/peer_score.rs b/protocols/gossipsub/src/peer_score.rs index 386cc85bd3c..ac24fc91970 100644 --- a/protocols/gossipsub/src/peer_score.rs +++ b/protocols/gossipsub/src/peer_score.rs @@ -24,11 +24,11 @@ use crate::metrics::{Metrics, Penalty}; use crate::time_cache::TimeCache; use crate::{MessageId, TopicHash}; -use instant::Instant; use libp2p_identity::PeerId; use std::collections::{hash_map, HashMap, HashSet}; use std::net::IpAddr; use std::time::Duration; +use web_time::Instant; mod params; use crate::ValidationError; diff --git a/protocols/gossipsub/src/time_cache.rs b/protocols/gossipsub/src/time_cache.rs index 89fd4afee09..a3e5c01ac4c 100644 --- a/protocols/gossipsub/src/time_cache.rs +++ b/protocols/gossipsub/src/time_cache.rs @@ -21,13 +21,13 @@ //! This implements a time-based LRU cache for checking gossipsub message duplicates. use fnv::FnvHashMap; -use instant::Instant; use std::collections::hash_map::{ self, Entry::{Occupied, Vacant}, }; use std::collections::VecDeque; use std::time::Duration; +use web_time::Instant; struct ExpiringElement { /// The element that expires diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index bd0c9857cb5..57ac92d2f6f 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -17,6 +17,8 @@ See [PR 5148](https://github.com/libp2p/rust-libp2p/pull/5148). - Derive `Copy` for `kbucket::key::Key`. See [PR 5317](https://github.com/libp2p/rust-libp2p/pull/5317). +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). ## 0.45.3 diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 7d3e3caa047..494d812c6ec 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] arrayvec = "0.7.4" bytes = "1" -either = "1.12" +either = "1.11" fnv = "1.0" asynchronous-codec = { workspace = true } futures = { workspace = true } @@ -29,7 +29,7 @@ smallvec = "1.13.2" uint = "0.9" void = "1.0" futures-timer = "3.0.3" -instant = "0.1.13" +web-time = { workspace = true } serde = { version = "1.0", optional = true, features = ["derive"] } thiserror = "1" tracing = { workspace = true } diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index fb77f3c0e0f..302433a8d70 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -36,7 +36,6 @@ use crate::record::{ use crate::K_VALUE; use crate::{jobs::*, protocol}; use fnv::{FnvHashMap, FnvHashSet}; -use instant::Instant; use libp2p_core::{ConnectedPoint, Endpoint, Multiaddr}; use libp2p_identity::PeerId; use libp2p_swarm::behaviour::{ @@ -57,6 +56,7 @@ use std::time::Duration; use std::vec; use thiserror::Error; use tracing::Level; +use web_time::Instant; pub use crate::query::QueryStats; diff --git a/protocols/kad/src/bootstrap.rs b/protocols/kad/src/bootstrap.rs index 58fa662d414..bcb9d0cccf3 100644 --- a/protocols/kad/src/bootstrap.rs +++ b/protocols/kad/src/bootstrap.rs @@ -171,7 +171,7 @@ impl futures::Future for ThrottleTimer { #[cfg(test)] mod tests { use super::*; - use instant::Instant; + use web_time::Instant; const MS_5: Duration = Duration::from_millis(5); const MS_100: Duration = Duration::from_millis(100); diff --git a/protocols/kad/src/jobs.rs b/protocols/kad/src/jobs.rs index f1631ed6ad1..537f652b7a4 100644 --- a/protocols/kad/src/jobs.rs +++ b/protocols/kad/src/jobs.rs @@ -64,13 +64,13 @@ use crate::record::{self, store::RecordStore, ProviderRecord, Record}; use futures::prelude::*; use futures_timer::Delay; -use instant::Instant; use libp2p_identity::PeerId; use std::collections::HashSet; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Duration; use std::vec; +use web_time::Instant; /// The maximum number of queries towards which background jobs /// are allowed to start new queries on an invocation of diff --git a/protocols/kad/src/kbucket.rs b/protocols/kad/src/kbucket.rs index 6eb2e42909a..7ed10f7f853 100644 --- a/protocols/kad/src/kbucket.rs +++ b/protocols/kad/src/kbucket.rs @@ -78,7 +78,8 @@ pub use entry::*; use arrayvec::ArrayVec; use bucket::KBucket; use std::collections::VecDeque; -use std::time::{Duration, Instant}; +use std::time::Duration; +use web_time::Instant; /// Maximum number of k-buckets. const NUM_BUCKETS: usize = 256; diff --git a/protocols/kad/src/protocol.rs b/protocols/kad/src/protocol.rs index 9803af00579..9d2ef56f5d8 100644 --- a/protocols/kad/src/protocol.rs +++ b/protocols/kad/src/protocol.rs @@ -31,7 +31,6 @@ use crate::record::{self, Record}; use asynchronous_codec::{Decoder, Encoder, Framed}; use bytes::BytesMut; use futures::prelude::*; -use instant::Instant; use libp2p_core::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo}; use libp2p_core::Multiaddr; use libp2p_identity::PeerId; @@ -40,6 +39,7 @@ use std::marker::PhantomData; use std::time::Duration; use std::{io, iter}; use tracing::debug; +use web_time::Instant; /// The protocol name used for negotiating with multistream-select. pub(crate) const DEFAULT_PROTO_NAME: StreamProtocol = StreamProtocol::new("/ipfs/kad/1.0.0"); diff --git a/protocols/kad/src/query.rs b/protocols/kad/src/query.rs index bb240d5864a..cf102040a7a 100644 --- a/protocols/kad/src/query.rs +++ b/protocols/kad/src/query.rs @@ -30,9 +30,9 @@ use crate::kbucket::{Key, KeyBytes}; use crate::{ALPHA_VALUE, K_VALUE}; use either::Either; use fnv::FnvHashMap; -use instant::Instant; use libp2p_identity::PeerId; use std::{num::NonZeroUsize, time::Duration}; +use web_time::Instant; /// A `QueryPool` provides an aggregate state machine for driving `Query`s to completion. /// diff --git a/protocols/kad/src/query/peers/closest.rs b/protocols/kad/src/query/peers/closest.rs index a0b5a96708a..2505ee2e9b2 100644 --- a/protocols/kad/src/query/peers/closest.rs +++ b/protocols/kad/src/query/peers/closest.rs @@ -22,9 +22,9 @@ use super::*; use crate::kbucket::{Distance, Key, KeyBytes}; use crate::{ALPHA_VALUE, K_VALUE}; -use instant::Instant; use std::collections::btree_map::{BTreeMap, Entry}; use std::{num::NonZeroUsize, time::Duration}; +use web_time::Instant; pub(crate) mod disjoint; /// A peer iterator for a dynamically changing list of peers, sorted by increasing diff --git a/protocols/kad/src/record.rs b/protocols/kad/src/record.rs index 4eb8e861c6f..cb7c4b866fc 100644 --- a/protocols/kad/src/record.rs +++ b/protocols/kad/src/record.rs @@ -23,13 +23,13 @@ pub mod store; use bytes::Bytes; -use instant::Instant; use libp2p_core::{multihash::Multihash, Multiaddr}; use libp2p_identity::PeerId; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::borrow::Borrow; use std::hash::{Hash, Hasher}; +use web_time::Instant; /// The (opaque) key of a record. #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/protocols/perf/CHANGELOG.md b/protocols/perf/CHANGELOG.md index 4e448d7f44a..d83e8b48472 100644 --- a/protocols/perf/CHANGELOG.md +++ b/protocols/perf/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.1 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.3.0 - Continuously measure on single connection (iperf-style). diff --git a/protocols/perf/Cargo.toml b/protocols/perf/Cargo.toml index 6ed6baa0714..0d379f77353 100644 --- a/protocols/perf/Cargo.toml +++ b/protocols/perf/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-perf" edition = "2021" rust-version = { workspace = true } description = "libp2p perf protocol implementation" -version = "0.3.0" +version = "0.3.1" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -16,7 +16,7 @@ clap = { version = "4.5.4", features = ["derive"] } futures = { workspace = true } futures-bounded = { workspace = true } futures-timer = "3.0" -instant = "0.1.13" +web-time = { workspace = true } libp2p = { workspace = true, features = ["tokio", "tcp", "quic", "tls", "yamux", "dns"] } libp2p-core = { workspace = true } libp2p-dns = { workspace = true, features = ["tokio"] } diff --git a/protocols/perf/src/bin/perf.rs b/protocols/perf/src/bin/perf.rs index 9ac8f0a6cde..9a4cfb8bcac 100644 --- a/protocols/perf/src/bin/perf.rs +++ b/protocols/perf/src/bin/perf.rs @@ -23,7 +23,6 @@ use std::{net::SocketAddr, str::FromStr}; use anyhow::{bail, Result}; use clap::Parser; use futures::StreamExt; -use instant::{Duration, Instant}; use libp2p::core::{multiaddr::Protocol, upgrade, Multiaddr}; use libp2p::identity::PeerId; use libp2p::swarm::{NetworkBehaviour, Swarm, SwarmEvent}; @@ -32,6 +31,7 @@ use libp2p_perf::{client, server}; use libp2p_perf::{Final, Intermediate, Run, RunParams, RunUpdate}; use serde::{Deserialize, Serialize}; use tracing_subscriber::EnvFilter; +use web_time::{Duration, Instant}; #[derive(Debug, Parser)] #[clap(name = "libp2p perf client")] diff --git a/protocols/perf/src/lib.rs b/protocols/perf/src/lib.rs index f9db96aa9d9..be950ac87a2 100644 --- a/protocols/perf/src/lib.rs +++ b/protocols/perf/src/lib.rs @@ -26,8 +26,8 @@ use std::fmt::Display; -use instant::Duration; use libp2p_swarm::StreamProtocol; +use web_time::Duration; pub mod client; mod protocol; diff --git a/protocols/perf/src/protocol.rs b/protocols/perf/src/protocol.rs index d2d65b42303..f995bbe2d3b 100644 --- a/protocols/perf/src/protocol.rs +++ b/protocols/perf/src/protocol.rs @@ -19,8 +19,8 @@ // DEALINGS IN THE SOFTWARE. use futures_timer::Delay; -use instant::Instant; use std::time::Duration; +use web_time::Instant; use futures::{ future::{select, Either}, diff --git a/protocols/ping/CHANGELOG.md b/protocols/ping/CHANGELOG.md index 17338a4ba9a..65d45a69f23 100644 --- a/protocols/ping/CHANGELOG.md +++ b/protocols/ping/CHANGELOG.md @@ -4,6 +4,9 @@ `ping::Event` can now be shared between threads. See [PR 5250] +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + [PR 5250]: https://github.com/libp2p/rust-libp2p/pull/5250 ## 0.44.0 diff --git a/protocols/ping/Cargo.toml b/protocols/ping/Cargo.toml index c436478668c..99597fd5fe8 100644 --- a/protocols/ping/Cargo.toml +++ b/protocols/ping/Cargo.toml @@ -11,10 +11,10 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -either = "1.12.0" +either = "1.11.0" futures = { workspace = true } futures-timer = "3.0.3" -instant = "0.1.13" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } diff --git a/protocols/ping/src/protocol.rs b/protocols/ping/src/protocol.rs index fe84cb4ea59..9b4d7da98db 100644 --- a/protocols/ping/src/protocol.rs +++ b/protocols/ping/src/protocol.rs @@ -19,10 +19,10 @@ // DEALINGS IN THE SOFTWARE. use futures::prelude::*; -use instant::Instant; use libp2p_swarm::StreamProtocol; use rand::{distributions, prelude::*}; use std::{io, time::Duration}; +use web_time::Instant; pub const PROTOCOL_NAME: StreamProtocol = StreamProtocol::new("/ipfs/ping/1.0.0"); diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index 83dbf4739ac..125f51e4961 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.17.3 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.17.2 - Fix support for unlimited relay connection according to spec. diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index aa185a42af0..4981c94d9c8 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-relay" edition = "2021" rust-version = { workspace = true } description = "Communications relaying for libp2p" -version = "0.17.2" +version = "0.17.3" authors = ["Parity Technologies ", "Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -17,6 +17,7 @@ either = "1.12.0" futures = { workspace = true } futures-timer = "3" futures-bounded = { workspace = true } +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } @@ -27,7 +28,6 @@ static_assertions = "1" thiserror = "1.0" tracing = { workspace = true } void = "1" -web-time = "1" [dev-dependencies] libp2p-identity = { workspace = true, features = ["rand"] } diff --git a/protocols/rendezvous/CHANGELOG.md b/protocols/rendezvous/CHANGELOG.md index e60699da734..4aa18985f1e 100644 --- a/protocols/rendezvous/CHANGELOG.md +++ b/protocols/rendezvous/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.14.1 +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). + ## 0.14.0 diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 2d344e5e250..6879a4093ce 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-rendezvous" edition = "2021" rust-version = { workspace = true } description = "Rendezvous protocol for libp2p" -version = "0.14.0" +version = "0.14.1" authors = ["The COMIT guys "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -16,7 +16,7 @@ async-trait = "0.1" bimap = "0.6.3" futures = { workspace = true, features = ["std"] } futures-timer = "3.0.3" -instant = "0.1.13" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } diff --git a/protocols/rendezvous/src/server.rs b/protocols/rendezvous/src/server.rs index a6e523302d7..bee91f28e88 100644 --- a/protocols/rendezvous/src/server.rs +++ b/protocols/rendezvous/src/server.rs @@ -527,7 +527,7 @@ pub struct CookieNamespaceMismatch; #[cfg(test)] mod tests { - use instant::SystemTime; + use web_time::SystemTime; use libp2p_core::PeerRecord; use libp2p_identity as identity; diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index e9d92b08857..a181adc8c52 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -10,6 +10,8 @@ - Deprecate `Behaviour::add_address` in favor of `Swarm::add_peer_address`. See [PR 4371](https://github.com/libp2p/rust-libp2p/pull/4371). +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). ## 0.26.1 diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 794a3e74956..900efd70d8b 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -14,7 +14,7 @@ categories = ["network-programming", "asynchronous"] async-trait = "0.1" cbor4ii = { version = "0.3.2", features = ["serde1", "use_std"], optional = true } futures = { workspace = true } -instant = "0.1.13" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 75e18a6a5af..b669bb0091a 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -5,6 +5,8 @@ The address is broadcast to all behaviours via `FromSwarm::NewExternalAddrOfPeer`. Protocols that want to collect these addresses can use the new `PeerAddresses` utility. See [PR 4371](https://github.com/libp2p/rust-libp2p/pull/4371). +- Use `web-time` instead of `instant`. + See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). ## 0.44.1 diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index 17a66abba0a..714e8a8f349 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -11,12 +11,12 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -either = "1.12.0" +either = "1.11.0" fnv = "1.0" futures = { workspace = true } futures-timer = "3.0.3" getrandom = { version = "0.2.15", features = ["js"], optional = true } # Explicit dependency to be used in `wasm-bindgen` feature -instant = "0.1.13" +web-time = { workspace = true } libp2p-core = { workspace = true } libp2p-identity = { workspace = true } libp2p-swarm-derive = { workspace = true, optional = true } @@ -41,7 +41,7 @@ wasm-bindgen = ["dep:wasm-bindgen-futures", "dep:getrandom"] [dev-dependencies] async-std = { version = "1.6.2", features = ["attributes"] } -either = "1.12.0" +either = "1.11.0" futures = { workspace = true } libp2p-identify = { path = "../protocols/identify" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. libp2p-identity = { workspace = true, features = ["ed25519"] } @@ -54,7 +54,7 @@ libp2p-yamux = { path = "../muxers/yamux" } # Using `pat quickcheck = { workspace = true } void = "1" once_cell = "1.19.0" -trybuild = "1.0.96" +trybuild = "1.0.95" tokio = { workspace = true, features = ["time", "rt", "macros", "rt-multi-thread"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/swarm/src/connection.rs b/swarm/src/connection.rs index c701f1773e6..69f95bca1d3 100644 --- a/swarm/src/connection.rs +++ b/swarm/src/connection.rs @@ -44,7 +44,6 @@ use futures::stream::FuturesUnordered; use futures::StreamExt; use futures::{stream, FutureExt}; use futures_timer::Delay; -use instant::Instant; use libp2p_core::connection::ConnectedPoint; use libp2p_core::multiaddr::Multiaddr; use libp2p_core::muxing::{StreamMuxerBox, StreamMuxerEvent, StreamMuxerExt, SubstreamBox}; @@ -59,6 +58,7 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::task::Waker; use std::time::Duration; use std::{fmt, io, mem, pin::Pin, task::Context, task::Poll}; +use web_time::Instant; static NEXT_CONNECTION_ID: AtomicUsize = AtomicUsize::new(1); diff --git a/swarm/src/connection/pool.rs b/swarm/src/connection/pool.rs index f876c39f12c..236f76e2fcc 100644 --- a/swarm/src/connection/pool.rs +++ b/swarm/src/connection/pool.rs @@ -37,7 +37,6 @@ use futures::{ ready, stream::FuturesUnordered, }; -use instant::{Duration, Instant}; use libp2p_core::connection::Endpoint; use libp2p_core::muxing::{StreamMuxerBox, StreamMuxerExt}; use std::task::Waker; @@ -51,6 +50,7 @@ use std::{ }; use tracing::Instrument; use void::Void; +use web_time::{Duration, Instant}; mod concurrent_dial; mod task;