Add the code for compiling node-cli for WASM-browser (#3974)

* Extract CLI to separate module in node/cli

* Make node/cli compile for WASM

* More work on node/cli browser

* More work on browser node

* More work

* More work

* Purge a bit the CI script

* More clean up

* Remove substrate-finality-grandpa from the CI

Its tests use tokio, which fails to compile.

* Address review

* Add rocksdb feature to the service

* Fix substrate-service WASM CI

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Don't WASM-compile substrate-service altogether
This commit is contained in:
Pierre Krieger
2019-10-31 16:34:12 +01:00
committed by Gavin Wood
parent c0a1926704
commit 4264613a96
18 changed files with 687 additions and 224 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ header-metadata = { package = "substrate-header-metadata", path = "../../core/cl
network = { package = "substrate-network", path = "../../core/network" }
sr-primitives = { path = "../../core/sr-primitives" }
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
service = { package = "substrate-service", path = "../../core/service" }
service = { package = "substrate-service", path = "../../core/service", default-features = false }
state-machine = { package = "substrate-state-machine", path = "../../core/state-machine" }
substrate-telemetry = { path = "../../core/telemetry" }
keyring = { package = "substrate-keyring", path = "../keyring" }
+7 -1
View File
@@ -4,6 +4,12 @@ version = "2.0.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[features]
default = ["rocksdb"]
# The RocksDB feature activates the RocksDB database backend. If it is not activated, and you pass
# a path to a database, an error will be produced at runtime.
rocksdb = ["client_db/kvdb-rocksdb"]
[dependencies]
derive_more = "0.15.0"
futures = "0.1.29"
@@ -29,7 +35,7 @@ consensus_common = { package = "substrate-consensus-common", path = "../../core/
network = { package = "substrate-network", path = "../../core/network" }
chain-spec = { package = "substrate-chain-spec", path = "../chain-spec" }
client = { package = "substrate-client", path = "../../core/client" }
client_db = { package = "substrate-client-db", path = "../../core/client/db", features = ["kvdb-rocksdb"] }
client_db = { package = "substrate-client-db", path = "../../core/client/db" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
substrate-executor = { path = "../../core/executor" }
transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }
+3 -2
View File
@@ -541,15 +541,16 @@ fn start_rpc_servers<C, G, E, H: FnMut() -> rpc_servers::RpcHandler<rpc::Metadat
/// Starts RPC servers that run in their own thread, and returns an opaque object that keeps them alive.
#[cfg(target_os = "unknown")]
fn start_rpc_servers<C, G, E, H: FnMut() -> components::RpcHandler>(
fn start_rpc_servers<C, G, E, H: FnMut() -> rpc_servers::RpcHandler<rpc::Metadata>>(
_: &Configuration<C, G, E>,
_: H
) -> Result<Box<std::any::Any + Send + Sync>, error::Error> {
) -> Result<Box<dyn std::any::Any + Send + Sync>, error::Error> {
Ok(Box::new(()))
}
/// An RPC session. Used to perform in-memory RPC queries (ie. RPC queries that don't go through
/// the HTTP or WebSockets server).
#[derive(Clone)]
pub struct RpcSession {
metadata: rpc::Metadata,
}
+1 -1
View File
@@ -12,7 +12,7 @@ log = "0.4.8"
env_logger = "0.7.0"
fdlimit = "0.1.1"
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.19", features = ["compat"] }
service = { package = "substrate-service", path = "../../../core/service" }
service = { package = "substrate-service", path = "../../../core/service", default-features = false }
network = { package = "substrate-network", path = "../../../core/network" }
consensus = { package = "substrate-consensus-common", path = "../../../core/consensus/common" }
client = { package = "substrate-client", path = "../../../core/client" }