Skip to content

Commit

Permalink
Rework light client (#1475)
Browse files Browse the repository at this point in the history
* WIP second pass over light client code for simpler API

* First pass new light client

* pub(crate) LightClientRpc::new_raw(), and fmt

* Update examples and add back a way to configure boot nodes and fetch chainspec from a URL

* Fix light client examples

* remove unused deps and tidy lightclient feature flags

* fix wasm error

* LightClientRpc can be cloned

* update light client tests

* Other small fixes

* exclude mod unless jsonrpsee

* Fix wasm-lightclient-tests

* add back docsrs bit and web+native feature flag compile error

* update book and light client example names

* fix docs
  • Loading branch information
jsdw committed Mar 15, 2024
1 parent 4831f81 commit b069c44
Show file tree
Hide file tree
Showing 32 changed files with 1,216 additions and 1,570 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

28 changes: 8 additions & 20 deletions lightclient/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,14 @@ default = ["native"]
# Exactly 1 of "web" and "native" is expected.
native = [
"smoldot-light/std",
"tokio-stream",
"tokio/sync",
"tokio/rt",
"futures-util",
]

# Enable this for web/wasm builds.
# Exactly 1 of "web" and "native" is expected.
web = [
"getrandom/js",

"smoldot",
"smoldot/std",
"smoldot-light",
"tokio-stream",
"tokio/sync",
"futures-util",

# For the light-client platform.
"wasm-bindgen-futures",
Expand All @@ -56,29 +47,26 @@ web = [
]

[dependencies]
futures = { workspace = true }
futures = { workspace = true, features = ["async-await"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["default", "raw_value"] }
thiserror = { workspace = true }
tracing = { workspace = true }
smoldot-light = { workspace = true }
tokio-stream = { workspace = true }
tokio = { workspace = true, features = ["sync"] }
futures-util = { workspace = true }

# Light client support:
smoldot = { workspace = true, optional = true }
smoldot-light = { workspace = true, optional = true }
either = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }
tokio-stream = { workspace = true, optional = true }
futures-util = { workspace = true, optional = true }
# Only needed for web
js-sys = { workspace = true, optional = true }
send_wrapper = { workspace = true, optional = true }
web-sys = { workspace = true, optional = true }
wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }
smoldot = { workspace = true, optional = true }
pin-project = { workspace = true, optional = true }
futures-timer = { workspace = true, optional = true }
instant = { workspace = true, optional = true }
pin-project = { workspace = true, optional = true }

# Included if "web" feature is enabled, to enable its js feature.
getrandom = { workspace = true, optional = true }

[package.metadata.docs.rs]
Expand Down
Loading

0 comments on commit b069c44

Please sign in to comment.