diff --git a/substrate/bin/node/cli/Cargo.toml b/substrate/bin/node/cli/Cargo.toml index dad76ae4bf..528d7e5faa 100644 --- a/substrate/bin/node/cli/Cargo.toml +++ b/substrate/bin/node/cli/Cargo.toml @@ -8,6 +8,11 @@ edition = "2018" license = "GPL-3.0" default-run = "substrate" +[package.metadata.wasm-pack.profile.release] +# `wasm-opt` has some problems on linux, see +# https://github.com/rustwasm/wasm-pack/issues/781 etc. +wasm-opt = false + [badges] travis-ci = { repository = "paritytech/substrate", branch = "master" } maintenance = { status = "actively-developed" } diff --git a/substrate/client/network/src/protocol/light_client_handler.rs b/substrate/client/network/src/protocol/light_client_handler.rs index b31877d928..77cf71408d 100644 --- a/substrate/client/network/src/protocol/light_client_handler.rs +++ b/substrate/client/network/src/protocol/light_client_handler.rs @@ -63,10 +63,11 @@ use std::{ iter, io, sync::Arc, - time::{Duration, Instant}, + time::Duration, task::{Context, Poll} }; use void::Void; +use wasm_timer::Instant; /// Configuration options for `LightClientHandler` behaviour. #[derive(Debug, Clone)] diff --git a/substrate/client/network/src/transport.rs b/substrate/client/network/src/transport.rs index ba0face137..75ee2d5db8 100644 --- a/substrate/client/network/src/transport.rs +++ b/substrate/client/network/src/transport.rs @@ -17,10 +17,10 @@ use futures::prelude::*; use libp2p::{ InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport, - mplex, identity, bandwidth, wasm_ext + mplex, identity, bandwidth, wasm_ext, noise }; #[cfg(not(target_os = "unknown"))] -use libp2p::{tcp, dns, websocket, noise}; +use libp2p::{tcp, dns, websocket}; use libp2p::core::{self, upgrade, transport::boxed::Boxed, transport::OptionalTransport, muxing::StreamMuxerBox}; use std::{io, sync::Arc, time::Duration, usize}; @@ -40,7 +40,6 @@ pub fn build_transport( use_yamux_flow_control: bool ) -> (Boxed<(PeerId, StreamMuxerBox), io::Error>, Arc) { // Build configuration objects for encryption mechanisms. - #[cfg(not(target_os = "unknown"))] let noise_config = { let noise_keypair = noise::Keypair::new().into_authentic(&keypair) // For more information about this panic, see in "On the Importance of Checking @@ -95,9 +94,6 @@ pub fn build_transport( let (transport, sinks) = bandwidth::BandwidthLogging::new(transport, Duration::from_secs(5)); // Encryption - - // For non-WASM, we support both secio and noise. - #[cfg(not(target_os = "unknown"))] let transport = transport.and_then(move |stream, endpoint| { core::upgrade::apply(stream, noise_config, endpoint, upgrade::Version::V1) .and_then(|(remote_id, out)| async move { @@ -109,15 +105,6 @@ pub fn build_transport( }) }); - // We refuse all WASM connections for now. It is intended that we negotiate noise in the - // future. See https://github.com/libp2p/rust-libp2p/issues/1414 - #[cfg(target_os = "unknown")] - let transport = transport.and_then(move |_, _| async move { - let r: Result<(wasm_ext::Connection, PeerId), _> = - Err(io::Error::new(io::ErrorKind::Other, format!("No encryption protocol supported"))); - r - }); - // Multiplexing let transport = transport.and_then(move |(stream, peer_id), endpoint| { let peer_id2 = peer_id.clone(); @@ -129,16 +116,10 @@ pub fn build_transport( .map_ok(|(id, muxer)| (id, core::muxing::StreamMuxerBox::new(muxer))) }); - let transport = if cfg!(not(target_os = "unknown")) { - transport + let transport = transport .timeout(Duration::from_secs(20)) .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) - .boxed() - } else { - transport - .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) - .boxed() - }; + .boxed(); (transport, sinks) } diff --git a/substrate/client/telemetry/src/worker.rs b/substrate/client/telemetry/src/worker.rs index ef1f9fa067..8f43bb612a 100644 --- a/substrate/client/telemetry/src/worker.rs +++ b/substrate/client/telemetry/src/worker.rs @@ -98,10 +98,10 @@ impl TelemetryWorker { .map_ok(|data| BytesMut::from(data.as_ref())); future::ready(Ok::<_, io::Error>(connec)) }) - }) - .timeout(CONNECT_TIMEOUT); + }); let transport = transport + .timeout(CONNECT_TIMEOUT) .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) .map(|out, _| { let out = out