Skip to content

Commit

Permalink
provide wasm compatibility for gossipsub protocol
Browse files Browse the repository at this point in the history
Signed-off-by: ozkanonur <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed May 22, 2023
1 parent 9867fce commit d72d9a7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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-webrtc?/tokio"]
uds = ["dep:libp2p-uds"]
wasm-bindgen = ["futures-timer/wasm-bindgen", "instant/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen"]
wasm-bindgen = ["futures-timer/wasm-bindgen", "instant/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"]
wasm-ext = ["dep:libp2p-wasm-ext"]
wasm-ext-websocket = ["wasm-ext", "libp2p-wasm-ext?/websocket"]
webrtc = ["dep:libp2p-webrtc", "libp2p-webrtc?/pem"]
Expand Down
4 changes: 4 additions & 0 deletions protocols/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -36,6 +39,7 @@ instant = "0.1.11"
void = "1.0.2"
# Metrics dependencies
prometheus-client = "0.21.0"
getrandom = "0.2.9"

[dev-dependencies]
async-std = { version = "1.6.3", features = ["unstable"] }
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/peer_score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d72d9a7

Please sign in to comment.