diff --git a/Cargo.lock b/Cargo.lock index 70164c2e5171..c4d5bab2bd63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2594,6 +2594,7 @@ dependencies = [ "env_logger 0.10.0", "fnv", "futures", + "getrandom 0.2.9", "hex", "hex_fmt", "instant", diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 80645f509ba4..38a0936f9367 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -10,6 +10,9 @@ repository = "https://github.com/libp2p/rust-libp2p" keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] +[features] +wasm-bindgen = ["getrandom/js", "instant/wasm-bindgen"] + [dependencies] either = "1.5" libp2p-swarm = { workspace = true } @@ -32,10 +35,11 @@ hex_fmt = "0.3.0" regex = "1.8.1" serde = { version = "1", optional = true, features = ["derive"] } wasm-timer = "0.2.5" -instant = "0.1.11" void = "1.0.2" # Metrics dependencies prometheus-client = "0.21.0" +instant = "0.1.11" +getrandom = "0.2.9" [dev-dependencies] async-std = { version = "1.6.3", features = ["unstable"] } diff --git a/protocols/gossipsub/src/peer_score.rs b/protocols/gossipsub/src/peer_score.rs index 5d3f387a478a..10f56994a202 100644 --- a/protocols/gossipsub/src/peer_score.rs +++ b/protocols/gossipsub/src/peer_score.rs @@ -24,12 +24,12 @@ use crate::metrics::{Metrics, Penalty}; use crate::time_cache::TimeCache; use crate::{MessageId, TopicHash}; +use instant::Instant; use libp2p_identity::PeerId; use log::{debug, trace, warn}; use std::collections::{hash_map, HashMap, HashSet}; use std::net::IpAddr; use std::time::Duration; -use wasm_timer::Instant; mod params; use crate::ValidationError;