Skip to content

Commit

Permalink
feat: small wasm support
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Nov 18, 2024
1 parent c5ef755 commit 73c7557
Show file tree
Hide file tree
Showing 47 changed files with 666 additions and 326 deletions.
102 changes: 78 additions & 24 deletions Cargo.lock

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

7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@ bench-test:

.PHONY: ci
ci: ## Run recipes for CI.
ci: fmt clippy test bench-test check-cargo-metadata check-cargotoml check-whitespaces check-dirty-rpc-doc security-audit check-crates check-licenses
ci: fmt clippy wasm test bench-test check-cargo-metadata check-cargotoml check-whitespaces check-dirty-rpc-doc security-audit check-crates check-licenses
git diff --exit-code Cargo.lock

.PHONY: wasm
wasm:
rustup target add wasm32-unknown-unknown
cd network && cargo c --target wasm32-unknown-unknown

.PHONY: check-cargotoml
check-cargotoml:
./devtools/ci/check-cargotoml.sh
Expand Down
6 changes: 5 additions & 1 deletion db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ ckb-app-config = { path = "../util/app-config", version = "= 0.120.0-pre" }
ckb-logger = { path = "../util/logger", version = "= 0.120.0-pre" }
ckb-error = { path = "../error", version = "= 0.120.0-pre" }
libc = "0.2"
rocksdb = { package = "ckb-rocksdb", version ="=0.21.1", features = ["snappy", "lz4"], default-features = false }
rocksdb = { package = "ckb-rocksdb", version = "=0.21.1", features = [
"snappy",
"lz4",
], default-features = false }
ckb-db-schema = { path = "../db-schema", version = "= 0.120.0-pre" }


[dev-dependencies]
tempfile.workspace = true

Expand Down
17 changes: 14 additions & 3 deletions network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,33 @@ bs58 = { version = "0.5.0", optional = true }
sentry = { version = "0.34.0", optional = true }
faster-hex = { version = "0.6", optional = true }
ckb-hash = { path = "../util/hash", version = "= 0.120.0-pre" }
secp256k1 = { version = "0.29", features = ["recovery"], optional = true }
secp256k1 = { version = "0.30", features = ["recovery"], optional = true }
trust-dns-resolver = { version = "0.23", optional = true }
snap = "1"
ckb-types = { path = "../util/types", version = "= 0.120.0-pre" }
ipnetwork = "0.20"
serde_json = "1.0"
bloom-filters = "0.1"
ckb-spawn = { path = "../util/spawn", version = "= 0.120.0-pre" }
socket2 = "0.5"
bitflags = "1.0"
p2p = { version = "0.6.2", package = "tentacle", default-features = false }

p2p = { version = "0.6.1", package = "tentacle", features = [
[target.'cfg(not(target_family = "wasm"))'.dependencies]
p2p = { version = "0.6.2", package = "tentacle", default-features = false, features = [
"upnp",
"parking_lot",
"openssl-vendored",
"tokio-runtime",
"tokio-timer",
"ws",
] }
socket2 = "0.5"

[target.'cfg(target_family = "wasm")'.dependencies]
p2p = { version = "0.6.2", package = "tentacle", default-features = false, features = [
"wasm-timer",
] }


[features]
with_sentry = ["sentry"]
Expand Down
6 changes: 3 additions & 3 deletions network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ pub use crate::{
peer_registry::PeerRegistry,
peer_store::Score,
protocols::{
identify::Flags, support_protocols::SupportProtocols, CKBProtocol, CKBProtocolContext,
CKBProtocolHandler, PeerIndex,
identify::Flags, support_protocols::SupportProtocols, BoxedCKBProtocolContext, CKBProtocol,
CKBProtocolContext, CKBProtocolHandler, PeerIndex,
},
};
pub use p2p::{
async_trait,
builder::ServiceBuilder,
bytes, multiaddr,
bytes, multiaddr, runtime,
secio::{PeerId, PublicKey},
service::{ServiceControl, SessionType, TargetProtocol, TargetSession},
traits::ServiceProtocol,
Expand Down
Loading

0 comments on commit 73c7557

Please sign in to comment.