mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
replace instant with web-time (#5800)
* replace instant with web_time * Merge branch 'unstable' into replace-instant-gossipsub # Conflicts: # Cargo.lock # beacon_node/lighthouse_network/Cargo.toml
This commit is contained in:
13
Cargo.lock
generated
13
Cargo.lock
generated
@@ -3376,7 +3376,6 @@ dependencies = [
|
||||
"futures-timer",
|
||||
"getrandom",
|
||||
"hex_fmt",
|
||||
"instant",
|
||||
"libp2p",
|
||||
"prometheus-client",
|
||||
"quick-protobuf",
|
||||
@@ -3388,6 +3387,7 @@ dependencies = [
|
||||
"sha2 0.10.8",
|
||||
"tracing",
|
||||
"void",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4956,7 +4956,6 @@ dependencies = [
|
||||
"futures",
|
||||
"gossipsub",
|
||||
"hex",
|
||||
"instant",
|
||||
"lazy_static",
|
||||
"libp2p",
|
||||
"libp2p-mplex",
|
||||
@@ -9365,6 +9364,16 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-time"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web3signer_tests"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -45,7 +45,6 @@ bytes = { workspace = true }
|
||||
either = { workspace = true }
|
||||
|
||||
# Local dependencies
|
||||
instant = "0.1.12"
|
||||
void = "1.0.2"
|
||||
libp2p-mplex = "0.41"
|
||||
|
||||
@@ -64,4 +63,3 @@ async-channel = { workspace = true }
|
||||
|
||||
[features]
|
||||
libp2p-websocket = []
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
|
||||
categories = ["network-programming", "asynchronous"]
|
||||
|
||||
[features]
|
||||
wasm-bindgen = ["getrandom/js", "instant/wasm-bindgen"]
|
||||
wasm-bindgen = ["getrandom/js"]
|
||||
|
||||
[dependencies]
|
||||
async-channel = { workspace = true }
|
||||
@@ -25,7 +25,6 @@ futures-ticker = "0.0.3"
|
||||
futures-timer = "3.0.2"
|
||||
getrandom = "0.2.12"
|
||||
hex_fmt = "0.3.0"
|
||||
instant = "0.1.12"
|
||||
libp2p = { version = "0.53", default-features = false }
|
||||
quick-protobuf = "0.8"
|
||||
quick-protobuf-codec = "0.3"
|
||||
@@ -35,8 +34,8 @@ serde = { version = "1", optional = true, features = ["derive"] }
|
||||
sha2 = "0.10.8"
|
||||
tracing = "0.1.37"
|
||||
void = "1.0.2"
|
||||
|
||||
prometheus-client = "0.22.0"
|
||||
web-time = "1.1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = { workspace = true }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 super::gossip_promises::GossipPromises;
|
||||
use super::handler::{Handler, HandlerEvent, HandlerIn};
|
||||
@@ -67,7 +67,6 @@ use super::{
|
||||
types::RpcOut,
|
||||
};
|
||||
use super::{PublishError, SubscriptionError, TopicScoreParams, ValidationError};
|
||||
use instant::SystemTime;
|
||||
use quick_protobuf::{MessageWrite, Writer};
|
||||
use std::{cmp::Ordering::Equal, fmt::Debug};
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
use super::peer_score::RejectReason;
|
||||
use super::MessageId;
|
||||
use super::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)]
|
||||
|
||||
@@ -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,
|
||||
@@ -37,6 +36,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.
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
use super::metrics::{Metrics, Penalty};
|
||||
use super::time_cache::TimeCache;
|
||||
use super::{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 super::ValidationError;
|
||||
|
||||
@@ -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<Element> {
|
||||
/// The element that expires
|
||||
|
||||
@@ -25,7 +25,6 @@ use async_channel::{Receiver, Sender};
|
||||
use futures::stream::Peekable;
|
||||
use futures::{Future, Stream, StreamExt};
|
||||
use futures_timer::Delay;
|
||||
use instant::Duration;
|
||||
use libp2p::identity::PeerId;
|
||||
use libp2p::swarm::ConnectionId;
|
||||
use prometheus_client::encoding::EncodeLabelValue;
|
||||
@@ -36,6 +35,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::task::{Context, Poll};
|
||||
use std::{fmt, pin::Pin};
|
||||
use web_time::Duration;
|
||||
|
||||
use crate::rpc_proto::proto;
|
||||
#[cfg(feature = "serde")]
|
||||
|
||||
Reference in New Issue
Block a user