From b2edf8782dade6dff5aaa96cce243501912f9f6c Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 11 Nov 2019 14:59:22 +1300 Subject: [PATCH 01/14] Migrate node and node-template --- node-template/Cargo.toml | 4 ++-- node-template/src/cli.rs | 30 +++++++++++++++++++++--------- node/cli/Cargo.toml | 8 +++----- node/cli/bin/main.rs | 8 ++++---- node/cli/src/cli.rs | 23 +++++++++++++++++------ node/cli/src/service.rs | 4 ++-- 6 files changed, 49 insertions(+), 28 deletions(-) diff --git a/node-template/Cargo.toml b/node-template/Cargo.toml index e68cbc189379b..fe4fec1efe9f4 100644 --- a/node-template/Cargo.toml +++ b/node-template/Cargo.toml @@ -11,11 +11,11 @@ path = "src/main.rs" [dependencies] derive_more = "0.15.0" -futures = "0.1.29" +futures = { version = "0.3.1", features = ["compat"] } +futures01 = { package = "futures", version = "0.1.29" } ctrlc = { version = "3.1.3", features = ["termination"] } log = "0.4.8" tokio = "0.1.22" -exit-future = "0.1.4" parking_lot = "0.9.0" codec = { package = "parity-scale-codec", version = "1.0.0" } trie-root = "0.15.2" diff --git a/node-template/src/cli.rs b/node-template/src/cli.rs index ec463a236b2e0..d436a3061f8f0 100644 --- a/node-template/src/cli.rs +++ b/node-template/src/cli.rs @@ -1,5 +1,5 @@ use crate::service; -use futures::{future, Future, sync::oneshot}; +use futures::{future::{select, Map}, FutureExt, TryFutureExt, channel::oneshot, compat::*}; use std::cell::RefCell; use tokio::runtime::Runtime; pub use substrate_cli::{VersionInfo, IntoExit, error}; @@ -69,25 +69,37 @@ where T: AbstractService, E: IntoExit, { - let (exit_send, exit) = exit_future::signal(); + let (exit_send, exit) = oneshot::channel(); let informant = informant::build(&service); - runtime.executor().spawn(exit.until(informant).map(|_| ())); + + let future = select(exit, informant) + .map(|_| Ok(())) + .compat(); + + runtime.executor().spawn(future); // we eagerly drop the service so that the internal exit future is fired, // but we need to keep holding a reference to the global telemetry guard let _telemetry = service.telemetry(); let service_res = { - let exit = e.into_exit().map_err(|_| error::Error::Other("Exit future failed.".into())); - let service = service.map_err(|err| error::Error::Service(err)); - let select = service.select(exit).map(|_| ()).map_err(|(err, _)| err); + let exit = e.into_exit(); + let service = service + .map_err(|err| error::Error::Service(err)) + .compat(); + let select = select(service, exit) + .map(|_| Ok(())) + .compat(); runtime.block_on(select) }; - exit_send.fire(); + let _ = exit_send.send(()); // TODO [andre]: timeout this future #1318 + + use futures01::Future; + let _ = runtime.shutdown_on_idle().wait(); service_res @@ -96,7 +108,7 @@ where // handles ctrl-c pub struct Exit; impl IntoExit for Exit { - type Exit = future::MapErr, fn(oneshot::Canceled) -> ()>; + type Exit = Map, fn(Result<(), oneshot::Canceled>) -> ()>; fn into_exit(self) -> Self::Exit { // can't use signal directly here because CtrlC takes only `Fn`. let (exit_send, exit) = oneshot::channel(); @@ -109,6 +121,6 @@ impl IntoExit for Exit { } }).expect("Error setting Ctrl-C handler"); - exit.map_err(drop) + exit.map(|_| ()) } } diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index 931488d3bcaeb..3e4403eee9e05 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -24,8 +24,9 @@ crate-type = ["cdylib", "rlib"] [dependencies] # third-party dependencies codec = { package = "parity-scale-codec", version = "1.0.6" } -serde = { version = "1.0.102", features = [ "derive" ] } -futures = "0.1.29" +serde = { version = "1.0.102", features = ["derive"] } +futures = { version = "0.3.1", features = ["compat"] } +futures01 = { package = "futures", version = "0.1.29" } hex-literal = "0.2.1" jsonrpc-core = "14.0.3" log = "0.4.8" @@ -74,7 +75,6 @@ node-executor = { path = "../executor" } # CLI-specific dependencies tokio = { version = "0.1.22", optional = true } -exit-future = { version = "0.1.4", optional = true } substrate-cli = { path = "../../core/cli", optional = true } transaction-factory = { path = "../../test-utils/transaction-factory", optional = true } ctrlc = { version = "3.1.3", features = ["termination"], optional = true } @@ -95,7 +95,6 @@ keystore = { package = "substrate-keystore", path = "../../core/keystore" } babe = { package = "substrate-consensus-babe", path = "../../core/consensus/babe", features = ["test-helpers"] } consensus-common = { package = "substrate-consensus-common", path = "../../core/consensus/common" } service-test = { package = "substrate-service-test", path = "../../core/service/test" } -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19" } tempfile = "3.1.0" [build-dependencies] @@ -122,7 +121,6 @@ cli = [ "substrate-cli", "transaction-factory", "tokio", - "exit-future", "ctrlc", "substrate-service/rocksdb" ] diff --git a/node/cli/bin/main.rs b/node/cli/bin/main.rs index e4415a2a89e66..45cf173efb3e9 100644 --- a/node/cli/bin/main.rs +++ b/node/cli/bin/main.rs @@ -18,8 +18,8 @@ #![warn(missing_docs)] -use futures::sync::oneshot; -use futures::{future, Future}; +use futures::channel::oneshot; +use futures::{future, FutureExt}; use substrate_cli::VersionInfo; use std::cell::RefCell; @@ -27,7 +27,7 @@ use std::cell::RefCell; // handles ctrl-c struct Exit; impl substrate_cli::IntoExit for Exit { - type Exit = future::MapErr, fn(oneshot::Canceled) -> ()>; + type Exit = future::Map, fn(Result<(), oneshot::Canceled>) -> ()>; fn into_exit(self) -> Self::Exit { // can't use signal directly here because CtrlC takes only `Fn`. let (exit_send, exit) = oneshot::channel(); @@ -39,7 +39,7 @@ impl substrate_cli::IntoExit for Exit { } }).expect("Error setting Ctrl-C handler"); - exit.map_err(drop) + exit.map(|_| ()) } } diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index 4bddb50b4bcac..9dd2278a1a6a2 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -185,23 +185,34 @@ where T: AbstractService, E: IntoExit, { - let (exit_send, exit) = exit_future::signal(); + use futures::{FutureExt, TryFutureExt, channel::oneshot, future::select, compat::*}; + + let (exit_send, exit) = oneshot::channel(); let informant = substrate_cli::informant::build(&service); - runtime.executor().spawn(exit.until(informant).map(|_| ())); + + let future = select(informant, exit) + .map(|_| Ok(())) + .compat(); + + runtime.executor().spawn(future); // we eagerly drop the service so that the internal exit future is fired, // but we need to keep holding a reference to the global telemetry guard let _telemetry = service.telemetry(); let service_res = { - let exit = e.into_exit().map_err(|_| error::Error::Other("Exit future failed.".into())); - let service = service.map_err(|err| error::Error::Service(err)); - let select = service.select(exit).map(|_| ()).map_err(|(err, _)| err); + let exit = e.into_exit(); + let service = service + .map_err(|err| error::Error::Service(err)) + .compat(); + let select = select(service, exit) + .map(|_| Ok(())) + .compat(); runtime.block_on(select) }; - exit_send.fire(); + let _ = exit_send.send(()); // TODO [andre]: timeout this future #1318 let _ = runtime.shutdown_on_idle().wait(); diff --git a/node/cli/src/service.rs b/node/cli/src/service.rs index c5780d9f3556c..029732610c8bf 100644 --- a/node/cli/src/service.rs +++ b/node/cli/src/service.rs @@ -110,7 +110,7 @@ macro_rules! new_full_start { /// concrete types instead. macro_rules! new_full { ($config:expr, $with_startup_data: expr) => {{ - use futures::sync::mpsc; + use futures01::sync::mpsc; use network::DhtEvent; let ( @@ -497,7 +497,7 @@ mod tests { digest.push(::babe_pre_digest(babe_pre_digest)); let mut proposer = proposer_factory.init(&parent_header).unwrap(); - let new_block = futures03::executor::block_on(proposer.propose( + let new_block = futures::executor::block_on(proposer.propose( inherent_data, digest, std::time::Duration::from_secs(1), From e0e31542c1f125e1649f00821b37ad8e17df384d Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 11 Nov 2019 14:59:29 +1300 Subject: [PATCH 02/14] Migrate srml --- srml/system/rpc/Cargo.toml | 2 +- srml/system/rpc/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/srml/system/rpc/Cargo.toml b/srml/system/rpc/Cargo.toml index e71e1f588a7ef..e66869e61d074 100644 --- a/srml/system/rpc/Cargo.toml +++ b/srml/system/rpc/Cargo.toml @@ -20,4 +20,4 @@ transaction_pool = { package = "substrate-transaction-pool", path = "../../../co [dev-dependencies] test-client = { package = "substrate-test-runtime-client", path = "../../../core/test-runtime/client" } env_logger = "0.7.0" -futures03 = { package = "futures-preview", version = "=0.3.0-alpha.19" } +futures = "0.3.1" diff --git a/srml/system/rpc/src/lib.rs b/srml/system/rpc/src/lib.rs index c6c0a658fba53..48990806dd694 100644 --- a/srml/system/rpc/src/lib.rs +++ b/srml/system/rpc/src/lib.rs @@ -119,7 +119,7 @@ where mod tests { use super::*; - use futures03::executor::block_on; + use futures::executor::block_on; use test_client::{ runtime::Transfer, AccountKeyring, From 9a8c4f253c2c043b36e8efe2202f878c9da8a398 Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 11 Nov 2019 15:07:22 +1300 Subject: [PATCH 03/14] Simple changes --- core/authority-discovery/Cargo.toml | 2 +- core/basic-authorship/Cargo.toml | 2 +- core/cli/Cargo.toml | 3 +-- core/cli/src/informant.rs | 20 +++++++++++--------- core/cli/src/lib.rs | 19 +++++++++++++------ core/client/Cargo.toml | 4 +--- core/client/src/client.rs | 2 +- core/client/src/light/blockchain.rs | 2 +- core/client/src/light/fetcher.rs | 6 +++--- core/client/src/notifications.rs | 20 ++++++++++---------- core/consensus/aura/Cargo.toml | 2 +- core/consensus/babe/Cargo.toml | 2 +- core/consensus/common/Cargo.toml | 2 +- core/consensus/pow/Cargo.toml | 2 +- core/consensus/slots/Cargo.toml | 4 ++-- core/consensus/slots/src/lib.rs | 4 +--- core/consensus/slots/src/slots.rs | 3 +-- core/finality-grandpa/Cargo.toml | 2 +- core/network/Cargo.toml | 2 +- core/offchain/Cargo.toml | 4 ++-- core/peerset/Cargo.toml | 2 +- core/rpc/Cargo.toml | 4 ++-- core/rpc/api/Cargo.toml | 2 +- core/rpc/api/src/helpers.rs | 2 +- core/rpc/src/author/mod.rs | 4 ++-- core/rpc/src/chain/chain_light.rs | 2 +- core/rpc/src/chain/mod.rs | 2 +- core/rpc/src/state/state_full.rs | 2 +- core/rpc/src/state/state_light.rs | 4 ++-- core/rpc/src/state/tests.rs | 2 +- core/rpc/src/system/mod.rs | 2 +- core/rpc/src/system/tests.rs | 6 +++--- core/service/Cargo.toml | 2 +- core/service/test/Cargo.toml | 2 +- core/telemetry/Cargo.toml | 4 ++-- core/telemetry/src/worker/node.rs | 6 +----- core/test-client/Cargo.toml | 2 +- core/transaction-pool/Cargo.toml | 2 +- core/transaction-pool/graph/Cargo.toml | 2 +- 39 files changed, 80 insertions(+), 81 deletions(-) diff --git a/core/authority-discovery/Cargo.toml b/core/authority-discovery/Cargo.toml index 823977668a0e5..29286d4521be8 100644 --- a/core/authority-discovery/Cargo.toml +++ b/core/authority-discovery/Cargo.toml @@ -14,7 +14,7 @@ bytes = "0.4.12" client = { package = "substrate-client", path = "../../core/client" } codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" } derive_more = "0.15.0" -futures-preview = "0.3.0-alpha.19" +futures = "0.3.1" libp2p = { version = "0.13.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" network = { package = "substrate-network", path = "../../core/network" } diff --git a/core/basic-authorship/Cargo.toml b/core/basic-authorship/Cargo.toml index 0a98c151d6eaf..3eb8cdc2bed91 100644 --- a/core/basic-authorship/Cargo.toml +++ b/core/basic-authorship/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] log = "0.4.8" -futures-preview = "0.3.0-alpha.19" +futures = "0.3.1" codec = { package = "parity-scale-codec", version = "1.0.0" } sr-primitives = { path = "../../core/sr-primitives" } primitives = { package = "substrate-primitives", path = "../../core/primitives" } diff --git a/core/cli/Cargo.toml b/core/cli/Cargo.toml index 9fb528e66cf56..098f7bbdc83b9 100644 --- a/core/cli/Cargo.toml +++ b/core/cli/Cargo.toml @@ -17,8 +17,7 @@ ansi_term = "0.12.1" lazy_static = "1.4.0" app_dirs = "1.2.1" tokio = "0.1.22" -futures = "0.1.29" -futures03 = { package = "futures-preview", version = "=0.3.0-alpha.19", features = ["compat"] } +futures = { version = "0.3.1", features = ["compat"] } fdlimit = "0.1.1" exit-future = "0.1.4" serde_json = "1.0.41" diff --git a/core/cli/src/informant.rs b/core/cli/src/informant.rs index f7c23ba47918a..efb8de2c8c4cc 100644 --- a/core/cli/src/informant.rs +++ b/core/cli/src/informant.rs @@ -17,8 +17,7 @@ //! Console informant. Prints sync progress and block events. Runs on the calling thread. use client::BlockchainEvents; -use futures::{Future, Stream}; -use futures03::{StreamExt as _, TryStreamExt as _}; +use futures::{StreamExt, TryStreamExt, FutureExt, future, compat::*}; use log::{info, warn}; use sr_primitives::traits::Header; use service::AbstractService; @@ -27,17 +26,18 @@ use std::time::Duration; mod display; /// Creates an informant in the form of a `Future` that must be polled regularly. -pub fn build(service: &impl AbstractService) -> impl Future { +pub fn build(service: &impl AbstractService) -> impl futures::Future { let client = service.client(); let mut display = display::InformantDisplay::new(); let display_notifications = service .network_status(Duration::from_millis(5000)) - .for_each(move |(net_status, _)| { + .compat() + .try_for_each(move |(net_status, _)| { let info = client.info(); display.display(&info, net_status); - Ok(()) + future::ok(()) }); let client = service.client(); @@ -46,7 +46,7 @@ pub fn build(service: &impl AbstractService) -> impl Future(v)).compat().for_each(move |n| { + let display_block_import = client.import_notification_stream().for_each(move |n| { // detect and log reorganizations. if let Some((ref last_num, ref last_hash)) = last_best { if n.header.parent_hash() != last_hash && n.is_new_best { @@ -74,9 +74,11 @@ pub fn build(service: &impl AbstractService) -> impl Future + Send + 'static; + type Exit: Future + Unpin + Send + 'static; /// Convert into exit signal. fn into_exit(self) -> Self::Exit; } @@ -388,7 +387,11 @@ impl<'a> ParseAndPrepareExport<'a> { None => Box::new(stdout()), }; - builder(config)?.export_blocks(exit.into_exit(), file, from.into(), to.map(Into::into), json)?; + let exit = exit.into_exit() + .map(|_| Ok(())) + .compat(); + + builder(config)?.export_blocks(exit, file, from.into(), to.map(Into::into), json)?; Ok(()) } } @@ -432,7 +435,11 @@ impl<'a> ParseAndPrepareImport<'a> { }, }; - let fut = builder(config)?.import_blocks(exit.into_exit(), file)?; + let exit = exit.into_exit() + .map(|_| Ok(())) + .compat(); + + let fut = builder(config)?.import_blocks(exit, file)?; tokio::run(fut); Ok(()) } diff --git a/core/client/Cargo.toml b/core/client/Cargo.toml index 761b2a9da21b0..bb1d862db4bfc 100644 --- a/core/client/Cargo.toml +++ b/core/client/Cargo.toml @@ -10,8 +10,7 @@ fnv = { version = "1.0.6", optional = true } log = { version = "0.4.8", optional = true } parking_lot = { version = "0.9.0", optional = true } hex-literal = { version = "0.2.1", optional = true } -futures = { version = "0.1.29", optional = true } -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"], optional = true } +futures = { version = "0.3.1", features = ["compat"], optional = true } consensus = { package = "substrate-consensus-common", path = "../consensus/common", optional = true } executor = { package = "substrate-executor", path = "../executor", optional = true } state-machine = { package = "substrate-state-machine", path = "../state-machine", optional = true } @@ -55,7 +54,6 @@ std = [ "log", "hex-literal", "futures", - "futures03", "executor", "state-machine", "keyring", diff --git a/core/client/src/client.rs b/core/client/src/client.rs index fdd50b0d01e8b..b0ddd8951e9f2 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -21,7 +21,7 @@ use std::{ panic::UnwindSafe, result, cell::RefCell, rc::Rc, }; use log::{info, trace, warn}; -use futures03::channel::mpsc; +use futures::channel::mpsc; use parking_lot::{Mutex, RwLock}; use codec::{Encode, Decode}; use hash_db::{Hasher, Prefix}; diff --git a/core/client/src/light/blockchain.rs b/core/client/src/light/blockchain.rs index 202f94cd74fed..79a3e6dd0a515 100644 --- a/core/client/src/light/blockchain.rs +++ b/core/client/src/light/blockchain.rs @@ -231,7 +231,7 @@ pub fn future_header>( fetcher: &F, id: BlockId, ) -> impl Future, ClientError>> { - use futures03::future::{ready, Either, FutureExt}; + use futures::future::{ready, Either, FutureExt}; match blockchain.header(id) { Ok(LocalOrRemote::Remote(request)) => Either::Left( diff --git a/core/client/src/light/fetcher.rs b/core/client/src/light/fetcher.rs index 6ae28b748c527..fa48d42fee3c3 100644 --- a/core/client/src/light/fetcher.rs +++ b/core/client/src/light/fetcher.rs @@ -499,7 +499,7 @@ impl<'a, H, Number, Hash> ChangesTrieRootsStorage for RootsStorage<'a #[cfg(test)] pub mod tests { - use futures03::future::Ready; + use futures::future::Ready; use parking_lot::Mutex; use codec::Decode; use crate::client::tests::prepare_client_with_key_changes; @@ -527,7 +527,7 @@ pub mod tests { where E: std::convert::From<&'static str>, { - futures03::future::ready(Err("Not implemented on test node".into())) + futures::future::ready(Err("Not implemented on test node".into())) } impl Fetcher for OkCallFetcher { @@ -550,7 +550,7 @@ pub mod tests { } fn remote_call(&self, _request: RemoteCallRequest
) -> Self::RemoteCallResult { - futures03::future::ready(Ok((*self.lock()).clone())) + futures::future::ready(Ok((*self.lock()).clone())) } fn remote_changes(&self, _request: RemoteChangesRequest
) -> Self::RemoteChangesResult { diff --git a/core/client/src/notifications.rs b/core/client/src/notifications.rs index 37f90dcc0ba64..0ddc4c72cdb55 100644 --- a/core/client/src/notifications.rs +++ b/core/client/src/notifications.rs @@ -22,7 +22,7 @@ use std::{ }; use fnv::{FnvHashSet, FnvHashMap}; -use futures03::channel::mpsc; +use futures::channel::mpsc; use primitives::storage::{StorageKey, StorageData}; use sr_primitives::traits::Block as BlockT; @@ -347,7 +347,7 @@ mod tests { // given let mut notifications = StorageNotifications::::default(); let child_filter = [(StorageKey(vec![4]), None)]; - let mut recv = futures03::executor::block_on_stream( + let mut recv = futures::executor::block_on_stream( notifications.listen(None, Some(&child_filter[..])) ); @@ -382,13 +382,13 @@ mod tests { // given let mut notifications = StorageNotifications::::default(); let child_filter = [(StorageKey(vec![4]), Some(vec![StorageKey(vec![5])]))]; - let mut recv1 = futures03::executor::block_on_stream( + let mut recv1 = futures::executor::block_on_stream( notifications.listen(Some(&[StorageKey(vec![1])]), None) ); - let mut recv2 = futures03::executor::block_on_stream( + let mut recv2 = futures::executor::block_on_stream( notifications.listen(Some(&[StorageKey(vec![2])]), None) ); - let mut recv3 = futures03::executor::block_on_stream( + let mut recv3 = futures::executor::block_on_stream( notifications.listen(Some(&[]), Some(&child_filter)) ); @@ -429,16 +429,16 @@ mod tests { let mut notifications = StorageNotifications::::default(); { let child_filter = [(StorageKey(vec![4]), Some(vec![StorageKey(vec![5])]))]; - let _recv1 = futures03::executor::block_on_stream( + let _recv1 = futures::executor::block_on_stream( notifications.listen(Some(&[StorageKey(vec![1])]), None) ); - let _recv2 = futures03::executor::block_on_stream( + let _recv2 = futures::executor::block_on_stream( notifications.listen(Some(&[StorageKey(vec![2])]), None) ); - let _recv3 = futures03::executor::block_on_stream( + let _recv3 = futures::executor::block_on_stream( notifications.listen(None, None) ); - let _recv4 = futures03::executor::block_on_stream( + let _recv4 = futures::executor::block_on_stream( notifications.listen(None, Some(&child_filter)) ); assert_eq!(notifications.listeners.len(), 2); @@ -465,7 +465,7 @@ mod tests { // given let mut recv = { let mut notifications = StorageNotifications::::default(); - let recv = futures03::executor::block_on_stream(notifications.listen(None, None)); + let recv = futures::executor::block_on_stream(notifications.listen(None, None)); // when let changeset = vec![]; diff --git a/core/consensus/aura/Cargo.toml b/core/consensus/aura/Cargo.toml index a09d51095018e..c352242722040 100644 --- a/core/consensus/aura/Cargo.toml +++ b/core/consensus/aura/Cargo.toml @@ -21,7 +21,7 @@ substrate-telemetry = { path = "../../telemetry" } keystore = { package = "substrate-keystore", path = "../../keystore" } consensus_common = { package = "substrate-consensus-common", path = "../common" } sr-primitives = { path = "../../sr-primitives" } -futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] } +futures = { version = "0.3.1", features = ["compat"] } futures01 = { package = "futures", version = "0.1" } futures-timer = "0.4.0" parking_lot = "0.9.0" diff --git a/core/consensus/babe/Cargo.toml b/core/consensus/babe/Cargo.toml index 30b7c1f8d6b1c..4bb987f4cbf3e 100644 --- a/core/consensus/babe/Cargo.toml +++ b/core/consensus/babe/Cargo.toml @@ -27,7 +27,7 @@ uncles = { package = "substrate-consensus-uncles", path = "../uncles" } slots = { package = "substrate-consensus-slots", path = "../slots" } sr-primitives = { path = "../../sr-primitives" } fork-tree = { path = "../../utils/fork-tree" } -futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] } +futures = { version = "0.3.1", features = ["compat"] } futures01 = { package = "futures", version = "0.1" } futures-timer = "0.4.0" parking_lot = "0.9.0" diff --git a/core/consensus/common/Cargo.toml b/core/consensus/common/Cargo.toml index 9c4e96f65dcee..1fe138c8bc16e 100644 --- a/core/consensus/common/Cargo.toml +++ b/core/consensus/common/Cargo.toml @@ -11,7 +11,7 @@ libp2p = { version = "0.13.0", default-features = false } log = "0.4.8" primitives = { package = "substrate-primitives", path= "../../primitives" } inherents = { package = "substrate-inherents", path = "../../inherents" } -futures-preview = "0.3.0-alpha.19" +futures = { version = "0.3.1", features = ["thread-pool"] } futures-timer = "0.4.0" rstd = { package = "sr-std", path = "../../sr-std" } runtime_version = { package = "sr-version", path = "../../sr-version" } diff --git a/core/consensus/pow/Cargo.toml b/core/consensus/pow/Cargo.toml index 86efcbb95da2b..515dc0ce54107 100644 --- a/core/consensus/pow/Cargo.toml +++ b/core/consensus/pow/Cargo.toml @@ -15,5 +15,5 @@ inherents = { package = "substrate-inherents", path = "../../inherents" } pow-primitives = { package = "substrate-consensus-pow-primitives", path = "primitives" } consensus-common = { package = "substrate-consensus-common", path = "../common" } log = "0.4.8" -futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] } +futures = { version = "0.3.1", features = ["compat"] } derive_more = "0.15.0" diff --git a/core/consensus/slots/Cargo.toml b/core/consensus/slots/Cargo.toml index 4074242502b71..6d20f251a4003 100644 --- a/core/consensus/slots/Cargo.toml +++ b/core/consensus/slots/Cargo.toml @@ -14,8 +14,8 @@ sr-primitives = { path = "../../sr-primitives" } substrate-telemetry = { path = "../../telemetry" } consensus_common = { package = "substrate-consensus-common", path = "../common" } inherents = { package = "substrate-inherents", path = "../../inherents" } -futures-preview = "0.3.0-alpha.19" -futures-timer = "0.4.0" +futures = "0.3.1" +futures-timer = "2.0" parking_lot = "0.9.0" log = "0.4.8" diff --git a/core/consensus/slots/src/lib.rs b/core/consensus/slots/src/lib.rs index e33d00d25531f..728f9f80a81ea 100644 --- a/core/consensus/slots/src/lib.rs +++ b/core/consensus/slots/src/lib.rs @@ -191,12 +191,10 @@ pub trait SimpleSlotWorker { remaining_duration, ).map_err(|e| consensus_common::Error::ClientImport(format!("{:?}", e))), Delay::new(remaining_duration) - .map_err(consensus_common::Error::FaultyTimer) ).map(|v| match v { futures::future::Either::Left((b, _)) => b.map(|b| (b, claim)), - futures::future::Either::Right((Ok(_), _)) => + futures::future::Either::Right(_) => Err(consensus_common::Error::ClientImport("Timeout in the Slots proposer".into())), - futures::future::Either::Right((Err(err), _)) => Err(err), }); let block_import_params_maker = self.block_import_params(); diff --git a/core/consensus/slots/src/slots.rs b/core/consensus/slots/src/slots.rs index 98310bbf2e27c..085f8117fc383 100644 --- a/core/consensus/slots/src/slots.rs +++ b/core/consensus/slots/src/slots.rs @@ -137,8 +137,7 @@ impl Stream for Slots { if let Some(ref mut inner_delay) = self.inner_delay { match Future::poll(Pin::new(inner_delay), cx) { Poll::Pending => return Poll::Pending, - Poll::Ready(Err(err)) => return Poll::Ready(Some(Err(Error::FaultyTimer(err)))), - Poll::Ready(Ok(())) => {} + Poll::Ready(()) => {} } } diff --git a/core/finality-grandpa/Cargo.toml b/core/finality-grandpa/Cargo.toml index a4c6a0278a445..800b9b72665b1 100644 --- a/core/finality-grandpa/Cargo.toml +++ b/core/finality-grandpa/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] fork-tree = { path = "../../core/utils/fork-tree" } futures = "0.1.29" -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } +futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } log = "0.4.8" parking_lot = "0.9.0" tokio-executor = "0.1.8" diff --git a/core/network/Cargo.toml b/core/network/Cargo.toml index 216b898277b4b..63a765970606e 100644 --- a/core/network/Cargo.toml +++ b/core/network/Cargo.toml @@ -15,7 +15,7 @@ parking_lot = "0.9.0" bitflags = "1.2.0" fnv = "1.0.6" futures = "0.1.29" -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } +futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } futures-timer = "0.4.0" linked-hash-map = "0.5.2" linked_hash_set = "0.1.3" diff --git a/core/offchain/Cargo.toml b/core/offchain/Cargo.toml index 9e16150938f1e..fa931b5fed838 100644 --- a/core/offchain/Cargo.toml +++ b/core/offchain/Cargo.toml @@ -11,8 +11,8 @@ bytes = "0.4.12" client = { package = "substrate-client", path = "../../core/client" } fnv = "1.0.6" futures01 = { package = "futures", version = "0.1" } -futures-preview = "0.3.0-alpha.19" -futures-timer = "0.4.0" +futures = "0.3.1" +futures-timer = "2.0" log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" diff --git a/core/peerset/Cargo.toml b/core/peerset/Cargo.toml index 1b46737d2ac44..4d38353604c7e 100644 --- a/core/peerset/Cargo.toml +++ b/core/peerset/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -futures-preview = "0.3.0-alpha.19" +futures = "0.3.1" libp2p = { version = "0.13.0", default-features = false } linked-hash-map = "0.5.2" log = "0.4.8" diff --git a/core/rpc/Cargo.toml b/core/rpc/Cargo.toml index 109db34240ccd..dbadd521669f9 100644 --- a/core/rpc/Cargo.toml +++ b/core/rpc/Cargo.toml @@ -8,7 +8,8 @@ edition = "2018" api = { package = "substrate-rpc-api", path = "./api" } client = { package = "substrate-client", path = "../client" } codec = { package = "parity-scale-codec", version = "1.0.0" } -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } +futures = { version = "0.3.1", features = ["compat"] } +futures01 = { package = "futures", version = "0.1.29" } jsonrpc-pubsub = "14.0.3" log = "0.4.8" primitives = { package = "substrate-primitives", path = "../primitives" } @@ -27,7 +28,6 @@ parking_lot = { version = "0.9.0" } [dev-dependencies] assert_matches = "1.3.0" -futures = "0.1.29" network = { package = "substrate-network", path = "../network" } rustc-hex = "2.0.1" sr-io = { path = "../sr-io" } diff --git a/core/rpc/api/Cargo.toml b/core/rpc/api/Cargo.toml index 5fb0e4cbaec71..dd1cd80c68cd5 100644 --- a/core/rpc/api/Cargo.toml +++ b/core/rpc/api/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0" } derive_more = "0.15.0" -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } +futures = { version = "0.3.1", features = ["compat"] } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.3" jsonrpc-derive = "14.0.3" diff --git a/core/rpc/api/src/helpers.rs b/core/rpc/api/src/helpers.rs index d500a50a869b4..2735879daf56b 100644 --- a/core/rpc/api/src/helpers.rs +++ b/core/rpc/api/src/helpers.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use jsonrpc_core::futures::prelude::*; -use futures03::{channel::oneshot, compat::Compat}; +use futures::{channel::oneshot, compat::Compat}; /// Wraps around `oneshot::Receiver` and adjusts the error type to produce an internal error if the /// sender gets dropped. diff --git a/core/rpc/src/author/mod.rs b/core/rpc/src/author/mod.rs index 82122dcf3d21f..dfb8ba2d40c51 100644 --- a/core/rpc/src/author/mod.rs +++ b/core/rpc/src/author/mod.rs @@ -20,7 +20,7 @@ mod tests; use std::{sync::Arc, convert::TryInto}; -use futures03::future::{FutureExt, TryFutureExt}; +use futures::future::{FutureExt, TryFutureExt}; use log::warn; use client::{self, Client}; @@ -28,7 +28,7 @@ use rpc::futures::{ Sink, Future, future::result, }; -use futures03::{StreamExt as _, compat::Compat, future::ready}; +use futures::{StreamExt as _, compat::Compat, future::ready}; use api::Subscriptions; use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; use codec::{Encode, Decode}; diff --git a/core/rpc/src/chain/chain_light.rs b/core/rpc/src/chain/chain_light.rs index d969d6ca93702..5a3a46e5ad14c 100644 --- a/core/rpc/src/chain/chain_light.rs +++ b/core/rpc/src/chain/chain_light.rs @@ -17,7 +17,7 @@ //! Blockchain API backend for light nodes. use std::sync::Arc; -use futures03::{future::ready, FutureExt, TryFutureExt}; +use futures::{future::ready, FutureExt, TryFutureExt}; use rpc::futures::future::{result, Future, Either}; use api::Subscriptions; diff --git a/core/rpc/src/chain/mod.rs b/core/rpc/src/chain/mod.rs index 61ecf96711383..beeb32a727fb7 100644 --- a/core/rpc/src/chain/mod.rs +++ b/core/rpc/src/chain/mod.rs @@ -23,7 +23,7 @@ mod chain_light; mod tests; use std::sync::Arc; -use futures03::{future, StreamExt as _, TryStreamExt as _}; +use futures::{future, StreamExt, TryStreamExt}; use log::warn; use rpc::{ Result as RpcResult, diff --git a/core/rpc/src/state/state_full.rs b/core/rpc/src/state/state_full.rs index ff4c5e5599a8a..a6fe199accec5 100644 --- a/core/rpc/src/state/state_full.rs +++ b/core/rpc/src/state/state_full.rs @@ -19,7 +19,7 @@ use std::collections::{BTreeMap, HashMap}; use std::sync::Arc; use std::ops::Range; -use futures03::{future, StreamExt as _, TryStreamExt as _}; +use futures::{future, StreamExt as _, TryStreamExt as _}; use log::warn; use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; use rpc::{ diff --git a/core/rpc/src/state/state_light.rs b/core/rpc/src/state/state_light.rs index 3d0c7979e3995..d5fe4cdcda7d0 100644 --- a/core/rpc/src/state/state_light.rs +++ b/core/rpc/src/state/state_light.rs @@ -21,7 +21,7 @@ use std::{ collections::{HashSet, HashMap, hash_map::Entry}, }; use codec::Decode; -use futures03::{ +use futures::{ future::{ready, Either}, channel::oneshot::{channel, Sender}, FutureExt, TryFutureExt, @@ -752,7 +752,7 @@ mod tests { #[test] fn maybe_share_remote_request_shares_request() { - type UnreachableFuture = futures03::future::Ready>; + type UnreachableFuture = futures::future::Ready>; let shared_requests = SimpleSubscriptions::default(); diff --git a/core/rpc/src/state/tests.rs b/core/rpc/src/state/tests.rs index 5dfa234337afa..c935ea927af06 100644 --- a/core/rpc/src/state/tests.rs +++ b/core/rpc/src/state/tests.rs @@ -20,7 +20,7 @@ use self::error::Error; use std::sync::Arc; use assert_matches::assert_matches; -use futures::stream::Stream; +use futures01::stream::Stream; use primitives::storage::well_known_keys; use sr_io::blake2_256; use test_client::{ diff --git a/core/rpc/src/system/mod.rs b/core/rpc/src/system/mod.rs index 8907151d9ac69..88d2938665528 100644 --- a/core/rpc/src/system/mod.rs +++ b/core/rpc/src/system/mod.rs @@ -19,7 +19,7 @@ #[cfg(test)] mod tests; -use futures03::{channel::{mpsc, oneshot}, compat::Compat}; +use futures::{channel::{mpsc, oneshot}, compat::Compat}; use api::Receiver; use sr_primitives::traits::{self, Header as HeaderT}; use self::error::Result; diff --git a/core/rpc/src/system/tests.rs b/core/rpc/src/system/tests.rs index 1c532be372660..b4b3e67cee878 100644 --- a/core/rpc/src/system/tests.rs +++ b/core/rpc/src/system/tests.rs @@ -20,7 +20,7 @@ use network::{self, PeerId}; use network::config::Roles; use test_client::runtime::Block; use assert_matches::assert_matches; -use futures03::{prelude::*, channel::mpsc}; +use futures::{prelude::*, channel::mpsc}; use std::thread; struct Status { @@ -46,7 +46,7 @@ fn api>>(sync: T) -> System { let should_have_peers = !status.is_dev; let (tx, rx) = mpsc::unbounded(); thread::spawn(move || { - futures03::executor::block_on(rx.for_each(move |request| { + futures::executor::block_on(rx.for_each(move |request| { match request { Request::Health(sender) => { let _ = sender.send(Health { @@ -231,4 +231,4 @@ fn system_node_roles() { wait_receiver(api(None).system_node_roles()), vec![NodeRole::Authority] ); -} \ No newline at end of file +} diff --git a/core/service/Cargo.toml b/core/service/Cargo.toml index 3d40550c8c5b5..7abdc40b43601 100644 --- a/core/service/Cargo.toml +++ b/core/service/Cargo.toml @@ -16,7 +16,7 @@ wasmtime = [ [dependencies] derive_more = "0.15.0" futures = "0.1.29" -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } +futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } parking_lot = "0.9.0" lazy_static = "1.4.0" log = "0.4.8" diff --git a/core/service/test/Cargo.toml b/core/service/test/Cargo.toml index 4415369a6a1d3..ae37b8d0ed6ed 100644 --- a/core/service/test/Cargo.toml +++ b/core/service/test/Cargo.toml @@ -11,7 +11,7 @@ futures = "0.1.29" 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"] } +futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } 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" } diff --git a/core/telemetry/Cargo.toml b/core/telemetry/Cargo.toml index 82096a2cbf788..07a296b02f8e0 100644 --- a/core/telemetry/Cargo.toml +++ b/core/telemetry/Cargo.toml @@ -9,8 +9,8 @@ edition = "2018" bytes = "0.4.12" parking_lot = "0.9.0" futures01 = { package = "futures", version = "0.1" } -futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] } -futures-timer = "0.4.0" +futures = { version = "0.3.1", features = ["compat"] } +futures-timer = "2.0.0" libp2p = { version = "0.13.0", default-features = false, features = ["libp2p-websocket"] } log = "0.4.8" rand = "0.7.2" diff --git a/core/telemetry/src/worker/node.rs b/core/telemetry/src/worker/node.rs index 0f606e4063802..6d9c6c241b669 100644 --- a/core/telemetry/src/worker/node.rs +++ b/core/telemetry/src/worker/node.rs @@ -254,11 +254,7 @@ where TTrans::Output: Sink if let Some(timeout) = self.timeout.as_mut() { match Future::poll(Pin::new(timeout), cx) { Poll::Pending => {}, - Poll::Ready(Err(err)) => { - self.timeout = None; - warn!(target: "telemetry", "Connection timeout error for {} {:?}", my_addr, err); - } - Poll::Ready(Ok(_)) => { + Poll::Ready(()) => { self.timeout = None; return Poll::Ready(Err(ConnectionError::Timeout)) } diff --git a/core/test-client/Cargo.toml b/core/test-client/Cargo.toml index de13b34d69753..bd970f5743710 100644 --- a/core/test-client/Cargo.toml +++ b/core/test-client/Cargo.toml @@ -9,7 +9,7 @@ client = { package = "substrate-client", path = "../client" } client-db = { package = "substrate-client-db", path = "../client/db", features = ["test-helpers"] } consensus = { package = "substrate-consensus-common", path = "../consensus/common" } executor = { package = "substrate-executor", path = "../executor" } -futures-preview = "0.3.0-alpha.19" +futures = "0.3.1" hash-db = "0.15.2" keyring = { package = "substrate-keyring", path = "../keyring" } codec = { package = "parity-scale-codec", version = "1.0.0" } diff --git a/core/transaction-pool/Cargo.toml b/core/transaction-pool/Cargo.toml index 60803fd42a9c3..c0e600e9deaf2 100644 --- a/core/transaction-pool/Cargo.toml +++ b/core/transaction-pool/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] derive_more = "0.15.0" log = "0.4.8" -futures = { version = "0.3.0", features = ["thread-pool"] } +futures = { version = "0.3.1", features = ["thread-pool"] } codec = { package = "parity-scale-codec", version = "1.0.0" } parking_lot = "0.9.0" sr-primitives = { path = "../sr-primitives" } diff --git a/core/transaction-pool/graph/Cargo.toml b/core/transaction-pool/graph/Cargo.toml index 4b628079cd3ce..be51ad451b8bb 100644 --- a/core/transaction-pool/graph/Cargo.toml +++ b/core/transaction-pool/graph/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] derive_more = "0.15.0" -futures-preview = "0.3.0-alpha.19" +futures = "0.3.1" log = "0.4.8" parking_lot = "0.9.0" serde = { version = "1.0.101", features = ["derive"] } From e7e32f53c77c639c02cd78537f2b2afca58712c6 Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 11 Nov 2019 15:23:58 +1300 Subject: [PATCH 04/14] Add async-std for interval --- Cargo.lock | 268 +++++++++++++++++----------- core/authority-discovery/Cargo.toml | 2 +- core/authority-discovery/src/lib.rs | 6 +- core/network/Cargo.toml | 1 + core/network/src/debug_info.rs | 4 +- core/network/src/protocol.rs | 5 +- 6 files changed, 176 insertions(+), 110 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c215ddd12611..50ae2e8f73a88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,6 +124,49 @@ name = "assert_matches" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "async-macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "async-std" +version = "0.99.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "async-task 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "broadcaster 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "async-task" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "atty" version = "0.2.13" @@ -283,6 +326,19 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "broadcaster" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bs58" version = "0.3.0" @@ -1211,25 +1267,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-channel" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1243,7 +1299,7 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1262,38 +1318,23 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-executor-preview" -version = "0.3.0-alpha.19" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-io" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures-io-preview" -version = "0.3.0-alpha.19" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-macro" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1302,22 +1343,9 @@ dependencies = [ "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "futures-preview" -version = "0.3.0-alpha.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "futures-sink" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1327,7 +1355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-task" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1340,17 +1368,36 @@ dependencies = [ "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "futures-timer" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-timer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "futures-util" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1363,12 +1410,8 @@ name = "futures-util-preview" version = "0.3.0-alpha.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1912,6 +1955,14 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "kv-log-macro" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "kvdb" version = "0.1.0" @@ -2646,9 +2697,8 @@ dependencies = [ "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "console_log 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2832,8 +2882,8 @@ version = "2.0.0" dependencies = [ "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "node-template-runtime 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3005,6 +3055,11 @@ name = "once_cell" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "once_cell" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "opaque-debug" version = "0.2.3" @@ -3291,6 +3346,11 @@ dependencies = [ "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pin-project-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "pin-utils" version = "0.1.0-alpha.4" @@ -4925,7 +4985,7 @@ name = "srml-system-rpc" version = "2.0.0" dependencies = [ "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5150,10 +5210,10 @@ dependencies = [ name = "substrate-authority-discovery" version = "2.0.0" dependencies = [ + "async-std 0.99.12 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5184,7 +5244,7 @@ dependencies = [ name = "substrate-basic-authorship" version = "2.0.0" dependencies = [ - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -5248,8 +5308,7 @@ dependencies = [ "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5279,8 +5338,7 @@ dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", @@ -5340,7 +5398,7 @@ dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5387,7 +5445,7 @@ dependencies = [ "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "fork-tree 2.0.0", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "merlin 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5442,7 +5500,7 @@ name = "substrate-consensus-common" version = "2.0.0" dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5461,7 +5519,7 @@ name = "substrate-consensus-pow" version = "2.0.0" dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -5512,8 +5570,8 @@ dependencies = [ name = "substrate-consensus-slots" version = "2.0.0" dependencies = [ - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5605,7 +5663,7 @@ dependencies = [ "finality-grandpa 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "fork-tree 2.0.0", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5702,7 +5760,7 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fork-tree 2.0.0", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5746,8 +5804,8 @@ dependencies = [ "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-rustls 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5788,7 +5846,7 @@ dependencies = [ name = "substrate-peerset" version = "2.0.0" dependencies = [ - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5866,7 +5924,7 @@ version = "2.0.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-pubsub 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5897,7 +5955,7 @@ name = "substrate-rpc-api" version = "2.0.0" dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5962,7 +6020,7 @@ dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "node-executor 2.0.0", @@ -6009,7 +6067,7 @@ dependencies = [ "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", @@ -6067,8 +6125,8 @@ version = "2.0.0" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6086,7 +6144,7 @@ dependencies = [ name = "substrate-test-client" version = "2.0.0" dependencies = [ - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -6154,7 +6212,7 @@ dependencies = [ "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6169,7 +6227,7 @@ name = "substrate-transaction-pool" version = "2.0.0" dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -7380,6 +7438,9 @@ dependencies = [ "checksum asn1_der 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" "checksum asn1_der_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" "checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" +"checksum async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e421d59b24c1feea2496e409b3e0a8de23e5fc130a2ddc0b012e551f3b272bba" +"checksum async-std 0.99.12 (registry+https://github.com/rust-lang/crates.io-index)" = "44501a9f7961bb539b67be0c428b3694e26557046a52759ca7eaf790030a64cc" +"checksum async-task 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de6bd58f7b9cc49032559422595c81cbfcf04db2f2133592f70af19e258a1ced" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "690a62be8920ccf773ee00ef0968649b0e724cda8bd5b12286302b4ae955fdf5" @@ -7398,6 +7459,7 @@ dependencies = [ "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" +"checksum broadcaster 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "07a1446420a56f1030271649ba0da46d23239b3a68c73591cea5247f15a788a0" "checksum bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b170cd256a3f9fa6b9edae3e44a7dfdfc77e8124dbc3e2612d75f9c3e2396dae" "checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245" "checksum build-helper 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bdce191bf3fa4995ce948c8c83b4640a1745457a149e73c6db75b4ffe36aad5f" @@ -7499,23 +7561,22 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" -"checksum futures 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98fcd817da24593c8e88e1be8a8d7371d87f777285b9324634e4f05d2c1dc266" -"checksum futures-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f9d78ee44e3067fa297c8c2c2313b98d014be8a3783387c500b50d7b769603" +"checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" +"checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" "checksum futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d5e5f4df964fa9c1c2f8bddeb5c3611631cacd93baf810fc8bb2fb4b495c263a" -"checksum futures-core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30f0ab78f035d7ed5d52689f4b05a56c15ad80097f1d860e644bdc9dba3831f2" +"checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" "checksum futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "b35b6263fb1ef523c3056565fa67b1d16f0a8604ff12b11b08c25f28a734c60a" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" -"checksum futures-executor 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e36969e0468b1725a2db2930039be052459f40a8aa00070c02de8ceb3673c100" -"checksum futures-executor-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "75236e88bd9fe88e5e8bfcd175b665d0528fe03ca4c5207fabc028c8f9d93e98" -"checksum futures-io 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3376fa54783931f5d59e44ff3b95ff9762ba191674bf23c0e16cdcf1faf49b99" -"checksum futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "f4914ae450db1921a56c91bde97a27846287d062087d4a652efc09bb3a01ebda" -"checksum futures-macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e7c97ef88dd44b07643c0667d3cfdac3bb6d8ca96940df755934e0c94047d1ac" -"checksum futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3b1dce2a0267ada5c6ff75a8ba864b4e679a9e2aa44262af7a3b5516d530d76e" -"checksum futures-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "346db18b3daf3e81f94023cd628230a01f34b1e64c5849f2a8308e678e1a21de" +"checksum futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" +"checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" +"checksum futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" +"checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" "checksum futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "86f148ef6b69f75bb610d4f9a2336d4fc88c4b5b67129d1a340dd0fd362efeec" -"checksum futures-task 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4ace133f7db73ad31e358cf07b495e45dd767c552f321602b8158da059359a2" +"checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" "checksum futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "878f1d2fc31355fa02ed2372e741b0c17e58373341e6a122569b4623a14a7d33" -"checksum futures-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4c1d6c4ceb5fcff9e8d84d76bc20ed918c61d64fe68325c0c3b611b3d9cffe" +"checksum futures-timer 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7946248e9429ff093345d3e8fdf4eb0f9b2d79091611c9c14f744971a6f8be45" +"checksum futures-timer 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "527936b95e804a42c1cf05999e175892bde27464b459785a5fa2664a06ecb172" +"checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" "checksum futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce968633c17e5f97936bd2797b6e38fb56cf16a7422319f7ec2e30d3c470e8d" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" @@ -7574,6 +7635,7 @@ dependencies = [ "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum keccak-hasher 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3468207deea1359a0e921591ae9b4c928733d94eb9d6a2eeda994cfd59f42cf8" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb" "checksum kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" @@ -7644,6 +7706,7 @@ dependencies = [ "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" "checksum once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37" "checksum once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d584f08c2d717d5c23a6414fc2822b71c651560713e54fa7eace675f758a355e" +"checksum once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "891f486f630e5c5a4916c7e16c4b24a53e78c860b646e9f8e005e4f16847bfed" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2f372b2b53ce10fb823a337aaa674e3a7d072b957c6264d0f4ff0bd86e657449" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" @@ -7675,6 +7738,7 @@ dependencies = [ "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +"checksum pin-project-lite 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f1f61fedcfa3b402e157c23e235b1ab6c30d52c219492c63504059e2bdd3408" "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" "checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea" "checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" diff --git a/core/authority-discovery/Cargo.toml b/core/authority-discovery/Cargo.toml index 29286d4521be8..7f86b92388763 100644 --- a/core/authority-discovery/Cargo.toml +++ b/core/authority-discovery/Cargo.toml @@ -22,7 +22,7 @@ primitives = { package = "substrate-primitives", path = "../primitives" } prost = "0.5.0" serde_json = "1.0.41" sr-primitives = { path = "../../core/sr-primitives" } -futures-timer = "0.4" +async-std = { version = "0.99.12", features = ["unstable"] } [dev-dependencies] parking_lot = "0.9.0" diff --git a/core/authority-discovery/src/lib.rs b/core/authority-discovery/src/lib.rs index 35237e251c895..e3fe36eb813f4 100644 --- a/core/authority-discovery/src/lib.rs +++ b/core/authority-discovery/src/lib.rs @@ -54,7 +54,7 @@ use futures::channel::mpsc::Receiver; use futures::stream::StreamExt; use futures::task::{Context, Poll}; use futures::Future; -use futures_timer::Interval; +use async_std::stream::{interval, Interval}; use authority_discovery_primitives::{AuthorityDiscoveryApi, AuthorityId, Signature}; use client::blockchain::HeaderBackend; @@ -117,11 +117,11 @@ where // Kademlia's default time-to-live for Dht records is 36h, republishing records every 24h. Given that a node // could restart at any point in time, one can not depend on the republishing process, thus publishing own // external addresses should happen on an interval < 36h. - let publish_interval = Interval::new(Duration::from_secs(12 * 60 * 60)); + let publish_interval = interval(Duration::from_secs(12 * 60 * 60)); // External addresses of other authorities can change at any given point in time. The interval on which to query // for external addresses of other authorities is a trade off between efficiency and performance. - let query_interval = Interval::new(Duration::from_secs(10 * 60)); + let query_interval = interval(Duration::from_secs(10 * 60)); let address_cache = HashMap::new(); diff --git a/core/network/Cargo.toml b/core/network/Cargo.toml index 63a765970606e..0c6e21beff03b 100644 --- a/core/network/Cargo.toml +++ b/core/network/Cargo.toml @@ -17,6 +17,7 @@ fnv = "1.0.6" futures = "0.1.29" futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } futures-timer = "0.4.0" +async-std = { version = "0.99.12", features = ["unstable"] } linked-hash-map = "0.5.2" linked_hash_set = "0.1.3" lru-cache = "0.1.2" diff --git a/core/network/src/debug_info.rs b/core/network/src/debug_info.rs index 0283853a5fa14..fbf9f4e5b377b 100644 --- a/core/network/src/debug_info.rs +++ b/core/network/src/debug_info.rs @@ -27,7 +27,7 @@ use log::{debug, trace, error}; use std::collections::hash_map::Entry; use std::time::{Duration, Instant}; use tokio_io::{AsyncRead, AsyncWrite}; -use futures_timer::Interval; +use async_std::stream::interval; /// Time after we disconnect from a node before we purge its information from the cache. const CACHE_EXPIRE: Duration = Duration::from_secs(10 * 60); @@ -76,7 +76,7 @@ impl DebugInfoBehaviour { ping: Ping::new(PingConfig::new()), identify, nodes_info: FnvHashMap::default(), - garbage_collect: Box::new(Interval::new(GARBAGE_COLLECT_INTERVAL).map(|()| Ok(())).compat()), + garbage_collect: Box::new(interval(GARBAGE_COLLECT_INTERVAL).map(|()| Ok(())).compat()), } } diff --git a/core/network/src/protocol.rs b/core/network/src/protocol.rs index f06f0cd937b5f..8de7f7e01f29e 100644 --- a/core/network/src/protocol.rs +++ b/core/network/src/protocol.rs @@ -53,6 +53,7 @@ use crate::chain::{Client, FinalityProofProvider}; use client::light::fetcher::{FetchChecker, ChangesProof, StorageProof}; use crate::error; use util::LruHashSet; +use async_std::stream::interval; mod util; pub mod consensus_gossip; @@ -425,8 +426,8 @@ impl, H: ExHashT> Protocol { let behaviour = LegacyProto::new(protocol_id, versions, peerset); let protocol = Protocol { - tick_timeout: Box::new(futures_timer::Interval::new(TICK_TIMEOUT).map(|v| Ok::<_, ()>(v)).compat()), - propagate_timeout: Box::new(futures_timer::Interval::new(PROPAGATE_TIMEOUT).map(|v| Ok::<_, ()>(v)).compat()), + tick_timeout: Box::new(interval(TICK_TIMEOUT).map(|v| Ok::<_, ()>(v)).compat()), + propagate_timeout: Box::new(interval(PROPAGATE_TIMEOUT).map(|v| Ok::<_, ()>(v)).compat()), config, context_data: ContextData { peers: HashMap::new(), From 0df0d052801ca3eabec9180e9481d9f711190d71 Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 11 Nov 2019 15:24:17 +1300 Subject: [PATCH 05/14] Fix test-runtime warning --- core/test-runtime/src/system.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/test-runtime/src/system.rs b/core/test-runtime/src/system.rs index ba0f25590d793..cfbe17db49f1d 100644 --- a/core/test-runtime/src/system.rs +++ b/core/test-runtime/src/system.rs @@ -19,8 +19,7 @@ use rstd::prelude::*; use runtime_io::{storage_root, storage_changes_root, blake2_256}; -use runtime_support::storage::{self, StorageMap}; -use runtime_support::{decl_storage, decl_module}; +use runtime_support::{storage, decl_storage, decl_module}; use sr_primitives::{ traits::{Hash as HashT, BlakeTwo256, Header as _}, generic, ApplyError, ApplyResult, transaction_validity::{TransactionValidity, ValidTransaction, InvalidTransaction}, From f156aeaa910f4e67d755236fc63f1f77ece28b9f Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 11 Nov 2019 18:48:20 +1300 Subject: [PATCH 06/14] Small changes --- Cargo.lock | 1 - core/cli/Cargo.toml | 1 - core/cli/src/informant.rs | 2 +- core/cli/src/lib.rs | 2 +- node-template/src/cli.rs | 2 +- node/cli/src/cli.rs | 2 +- 6 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0fd58dd674da1..4c036b9c8777e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5348,7 +5348,6 @@ dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/core/cli/Cargo.toml b/core/cli/Cargo.toml index 098f7bbdc83b9..e44e1f929f84f 100644 --- a/core/cli/Cargo.toml +++ b/core/cli/Cargo.toml @@ -19,7 +19,6 @@ app_dirs = "1.2.1" tokio = "0.1.22" futures = { version = "0.3.1", features = ["compat"] } fdlimit = "0.1.1" -exit-future = "0.1.4" serde_json = "1.0.41" panic-handler = { package = "substrate-panic-handler", path = "../../core/panic-handler" } client = { package = "substrate-client", path = "../../core/client" } diff --git a/core/cli/src/informant.rs b/core/cli/src/informant.rs index efb8de2c8c4cc..534500dea7ded 100644 --- a/core/cli/src/informant.rs +++ b/core/cli/src/informant.rs @@ -17,7 +17,7 @@ //! Console informant. Prints sync progress and block events. Runs on the calling thread. use client::BlockchainEvents; -use futures::{StreamExt, TryStreamExt, FutureExt, future, compat::*}; +use futures::{StreamExt, TryStreamExt, FutureExt, future, compat::Stream01CompatExt}; use log::{info, warn}; use sr_primitives::traits::Header; use service::AbstractService; diff --git a/core/cli/src/lib.rs b/core/cli/src/lib.rs index d36416dac406c..7b3e20987bb82 100644 --- a/core/cli/src/lib.rs +++ b/core/cli/src/lib.rs @@ -43,7 +43,7 @@ use primitives::H256; use std::{ io::{Write, Read, Seek, Cursor, stdin, stdout, ErrorKind}, iter, fs::{self, File}, - net::{Ipv4Addr, SocketAddr}, path::{Path, PathBuf}, str::FromStr, marker::Unpin + net::{Ipv4Addr, SocketAddr}, path::{Path, PathBuf}, str::FromStr, }; use names::{Generator, Name}; diff --git a/node-template/src/cli.rs b/node-template/src/cli.rs index d436a3061f8f0..4e01604c25ee3 100644 --- a/node-template/src/cli.rs +++ b/node-template/src/cli.rs @@ -1,5 +1,5 @@ use crate::service; -use futures::{future::{select, Map}, FutureExt, TryFutureExt, channel::oneshot, compat::*}; +use futures::{future::{select, Map}, FutureExt, TryFutureExt, channel::oneshot, compat::Future01CompatExt}; use std::cell::RefCell; use tokio::runtime::Runtime; pub use substrate_cli::{VersionInfo, IntoExit, error}; diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index 9dd2278a1a6a2..f648038d82cb5 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -185,7 +185,7 @@ where T: AbstractService, E: IntoExit, { - use futures::{FutureExt, TryFutureExt, channel::oneshot, future::select, compat::*}; + use futures::{FutureExt, TryFutureExt, channel::oneshot, future::select, compat::Future01CompatExt}; let (exit_send, exit) = oneshot::channel(); From fa51644ab657fceb59b447e5a235b6789183d214 Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 11 Nov 2019 23:08:38 +1300 Subject: [PATCH 07/14] move futures01 in core/rpc to dev-deps --- core/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/rpc/Cargo.toml b/core/rpc/Cargo.toml index dbadd521669f9..c825918b09d68 100644 --- a/core/rpc/Cargo.toml +++ b/core/rpc/Cargo.toml @@ -9,7 +9,6 @@ api = { package = "substrate-rpc-api", path = "./api" } client = { package = "substrate-client", path = "../client" } codec = { package = "parity-scale-codec", version = "1.0.0" } futures = { version = "0.3.1", features = ["compat"] } -futures01 = { package = "futures", version = "0.1.29" } jsonrpc-pubsub = "14.0.3" log = "0.4.8" primitives = { package = "substrate-primitives", path = "../primitives" } @@ -28,6 +27,7 @@ parking_lot = { version = "0.9.0" } [dev-dependencies] assert_matches = "1.3.0" +futures01 = { package = "futures", version = "0.1.29" } network = { package = "substrate-network", path = "../network" } rustc-hex = "2.0.1" sr-io = { path = "../sr-io" } From 00fe4c2f9ef6c27ba0c490a12e7b486a5e47cab3 Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 12 Nov 2019 17:41:36 +1300 Subject: [PATCH 08/14] Change wasm CI builds --- .gitlab-ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c8c5abddce982..f82d07b50e57f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -210,14 +210,14 @@ check-web-wasm: script: # WASM support is in progress. As more and more crates support WASM, we # should add entries here. See https://github.com/paritytech/substrate/issues/2416 - - time cargo web build -p sr-io - - time cargo web build -p sr-primitives - - time cargo web build -p sr-std - - time cargo web build -p substrate-client - - time cargo web build -p substrate-consensus-aura - - time cargo web build -p substrate-consensus-babe - - time cargo web build -p substrate-consensus-common - - time cargo web build -p substrate-telemetry + - time cargo build --target=wasm32-unknown-unknown -p sr-io + - time cargo build --target=wasm32-unknown-unknown -p sr-primitives + - time cargo build --target=wasm32-unknown-unknown -p sr-std + - time cargo build --target=wasm32-unknown-unknown -p substrate-client + - time cargo build --target=wasm32-unknown-unknown -p substrate-consensus-aura + - time cargo build --target=wasm32-unknown-unknown -p substrate-consensus-babe + - time cargo build --target=wasm32-unknown-unknown -p substrate-consensus-common + - time cargo build --target=wasm32-unknown-unknown -p substrate-telemetry # Note: the command below is a bit weird because several Cargo issues prevent us from compiling the node in a more straight-forward way. - time cargo build --manifest-path=node/cli/Cargo.toml --no-default-features --features "browser" --target=wasm32-unknown-unknown - sccache -s From fceb4b11ba50095a0972a1801af99462b4cf94f1 Mon Sep 17 00:00:00 2001 From: Ashley Date: Wed, 13 Nov 2019 15:36:13 +1300 Subject: [PATCH 09/14] Switch to async-std 1.0.1 --- Cargo.lock | 8 ++++---- core/authority-discovery/Cargo.toml | 2 +- core/network/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 863d71d9a5370..43466079986b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -144,7 +144,7 @@ dependencies = [ [[package]] name = "async-std" -version = "0.99.12" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5281,7 +5281,7 @@ dependencies = [ name = "substrate-authority-discovery" version = "2.0.0" dependencies = [ - "async-std 0.99.12 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5855,7 +5855,7 @@ dependencies = [ name = "substrate-network" version = "2.0.0" dependencies = [ - "async-std 0.99.12 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -7614,7 +7614,7 @@ dependencies = [ "checksum asn1_der_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" "checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" "checksum async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e421d59b24c1feea2496e409b3e0a8de23e5fc130a2ddc0b012e551f3b272bba" -"checksum async-std 0.99.12 (registry+https://github.com/rust-lang/crates.io-index)" = "44501a9f7961bb539b67be0c428b3694e26557046a52759ca7eaf790030a64cc" +"checksum async-std 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6ee33a6cfdd96bfde032d14b29905244a70868bd8dda1f3b13504d6cbc3b7bc" "checksum async-task 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de6bd58f7b9cc49032559422595c81cbfcf04db2f2133592f70af19e258a1ced" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" diff --git a/core/authority-discovery/Cargo.toml b/core/authority-discovery/Cargo.toml index 2eaa94e7d5e4e..b30d5c344e642 100644 --- a/core/authority-discovery/Cargo.toml +++ b/core/authority-discovery/Cargo.toml @@ -22,7 +22,7 @@ primitives = { package = "substrate-primitives", path = "../primitives" } prost = "0.5.0" serde_json = "1.0.41" sr-primitives = { path = "../../core/sr-primitives" } -async-std = { version = "0.99.12", features = ["unstable"] } +async-std = { version = "1.0.1", features = ["unstable"] } [dev-dependencies] parking_lot = "0.9.0" diff --git a/core/network/Cargo.toml b/core/network/Cargo.toml index 9020aa52ab7ae..116b9db1d6795 100644 --- a/core/network/Cargo.toml +++ b/core/network/Cargo.toml @@ -17,7 +17,7 @@ fnv = "1.0.6" futures = "0.1.29" futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } futures-timer = "0.4.0" -async-std = { version = "0.99.12", features = ["unstable"] } +async-std = { version = "1.0.1", features = ["unstable"] } linked-hash-map = "0.5.2" linked_hash_set = "0.1.3" lru-cache = "0.1.2" From e93cd7fc782fda013918bb22e3241d4d23d9aed5 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 14 Nov 2019 16:05:59 +1300 Subject: [PATCH 10/14] Remove async-std dep of network --- core/network/Cargo.toml | 1 - core/network/src/debug_info.rs | 2 +- core/network/src/lib.rs | 1 + core/network/src/protocol.rs | 2 +- core/network/src/utils.rs | 25 +++++++++++++++++++++++++ 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 core/network/src/utils.rs diff --git a/core/network/Cargo.toml b/core/network/Cargo.toml index 116b9db1d6795..7dfeba7d34e20 100644 --- a/core/network/Cargo.toml +++ b/core/network/Cargo.toml @@ -17,7 +17,6 @@ fnv = "1.0.6" futures = "0.1.29" futures03 = { package = "futures", version = "0.3.1", features = ["compat"] } futures-timer = "0.4.0" -async-std = { version = "1.0.1", features = ["unstable"] } linked-hash-map = "0.5.2" linked_hash_set = "0.1.3" lru-cache = "0.1.2" diff --git a/core/network/src/debug_info.rs b/core/network/src/debug_info.rs index fbf9f4e5b377b..daf49df637540 100644 --- a/core/network/src/debug_info.rs +++ b/core/network/src/debug_info.rs @@ -27,7 +27,7 @@ use log::{debug, trace, error}; use std::collections::hash_map::Entry; use std::time::{Duration, Instant}; use tokio_io::{AsyncRead, AsyncWrite}; -use async_std::stream::interval; +use crate::utils::interval; /// Time after we disconnect from a node before we purge its information from the cache. const CACHE_EXPIRE: Duration = Duration::from_secs(10 * 60); diff --git a/core/network/src/lib.rs b/core/network/src/lib.rs index d0977d90c9005..96efd49958763 100644 --- a/core/network/src/lib.rs +++ b/core/network/src/lib.rs @@ -177,6 +177,7 @@ mod on_demand_layer; mod protocol; mod service; mod transport; +mod utils; pub mod config; pub mod error; diff --git a/core/network/src/protocol.rs b/core/network/src/protocol.rs index ec8eb0f4ade31..0d82ab177d4d6 100644 --- a/core/network/src/protocol.rs +++ b/core/network/src/protocol.rs @@ -16,6 +16,7 @@ use crate::{DiscoveryNetBehaviour, config::ProtocolId}; use crate::legacy_proto::{LegacyProto, LegacyProtoOut}; +use crate::utils::interval; use bytes::BytesMut; use futures::prelude::*; use futures03::{StreamExt as _, TryStreamExt as _}; @@ -53,7 +54,6 @@ use crate::chain::{Client, FinalityProofProvider}; use client::light::fetcher::{FetchChecker, ChangesProof, StorageProof}; use crate::error; use util::LruHashSet; -use async_std::stream::interval; mod util; pub mod consensus_gossip; diff --git a/core/network/src/utils.rs b/core/network/src/utils.rs new file mode 100644 index 0000000000000..db8bf2086ff28 --- /dev/null +++ b/core/network/src/utils.rs @@ -0,0 +1,25 @@ +// Copyright 2019 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +use std::time::Duration; +use futures03::{FutureExt, Stream, StreamExt, stream::unfold}; +use futures_timer::Delay; + +pub fn interval(duration: Duration) -> impl Stream + Unpin { + unfold((), move |_| { + Delay::new(duration).map(|_| Some(((), ()))) + }).map(drop) +} From dfcc774d9fbf97793dee1ebee19a3454cea163bd Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 14 Nov 2019 16:09:14 +1300 Subject: [PATCH 11/14] Add modified lockfile --- Cargo.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index c01eaad49c77c..e40e992a353b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5867,7 +5867,6 @@ dependencies = [ name = "substrate-network" version = "2.0.0" dependencies = [ - "async-std 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", From de94b1195a22e208f81574aba1112ed082333db3 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 14 Nov 2019 18:54:35 +1300 Subject: [PATCH 12/14] Fix node cli browser build --- node/cli/src/browser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/cli/src/browser.rs b/node/cli/src/browser.rs index ada8a52e1e8b3..93df41402b9f2 100644 --- a/node/cli/src/browser.rs +++ b/node/cli/src/browser.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use crate::ChainSpec; -use futures::{prelude::*, sync::oneshot, sync::mpsc}; +use futures01::{prelude::*, sync::oneshot, sync::mpsc}; use libp2p::wasm_ext; use log::{debug, info}; use std::sync::Arc; @@ -71,7 +71,7 @@ fn start_inner(wasm_ext: wasm_ext::ffi::Transport) -> Result(); - wasm_bindgen_futures::spawn_local(futures::future::poll_fn(move || { + wasm_bindgen_futures::spawn_local(futures01::future::poll_fn(move || { loop { match rpc_send_rx.poll() { Ok(Async::Ready(Some(message))) => { From 8a6a071f193a73661783aa0371c579a569ada8d2 Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 19 Nov 2019 16:59:24 +0100 Subject: [PATCH 13/14] Remove authority-discovery async-std dep --- Cargo.lock | 94 +-------------------------- client/authority-discovery/Cargo.toml | 3 +- client/authority-discovery/src/lib.rs | 31 +++++++-- 3 files changed, 28 insertions(+), 100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ec878a22b1cf..16b278360eb7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,49 +138,6 @@ name = "assert_matches" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "async-macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "async-std" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "async-task 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "broadcaster 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "async-task" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "atty" version = "0.2.13" @@ -340,19 +297,6 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "broadcaster" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bs58" version = "0.3.0" @@ -1410,15 +1354,6 @@ dependencies = [ "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "futures-timer" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "futures-timer" version = "2.0.2" @@ -2015,14 +1950,6 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "kv-log-macro" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "kvdb" version = "0.1.0" @@ -3134,11 +3061,6 @@ name = "once_cell" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "once_cell" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "opaque-debug" version = "0.2.3" @@ -4166,11 +4088,6 @@ dependencies = [ "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "pin-project-lite" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "pin-utils" version = "0.1.0-alpha.4" @@ -5329,11 +5246,10 @@ dependencies = [ name = "substrate-authority-discovery" version = "2.0.0" dependencies = [ - "async-std 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -7699,9 +7615,6 @@ dependencies = [ "checksum asn1_der 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" "checksum asn1_der_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" "checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" -"checksum async-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e421d59b24c1feea2496e409b3e0a8de23e5fc130a2ddc0b012e551f3b272bba" -"checksum async-std 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6ee33a6cfdd96bfde032d14b29905244a70868bd8dda1f3b13504d6cbc3b7bc" -"checksum async-task 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de6bd58f7b9cc49032559422595c81cbfcf04db2f2133592f70af19e258a1ced" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea" @@ -7720,7 +7633,6 @@ dependencies = [ "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -"checksum broadcaster 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "07a1446420a56f1030271649ba0da46d23239b3a68c73591cea5247f15a788a0" "checksum bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b170cd256a3f9fa6b9edae3e44a7dfdfc77e8124dbc3e2612d75f9c3e2396dae" "checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245" "checksum build-helper 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bdce191bf3fa4995ce948c8c83b4640a1745457a149e73c6db75b4ffe36aad5f" @@ -7838,7 +7750,6 @@ dependencies = [ "checksum futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "86f148ef6b69f75bb610d4f9a2336d4fc88c4b5b67129d1a340dd0fd362efeec" "checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" "checksum futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "878f1d2fc31355fa02ed2372e741b0c17e58373341e6a122569b4623a14a7d33" -"checksum futures-timer 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7946248e9429ff093345d3e8fdf4eb0f9b2d79091611c9c14f744971a6f8be45" "checksum futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" "checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" "checksum futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce968633c17e5f97936bd2797b6e38fb56cf16a7422319f7ec2e30d3c470e8d" @@ -7900,7 +7811,6 @@ dependencies = [ "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum keccak-hasher 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3468207deea1359a0e921591ae9b4c928733d94eb9d6a2eeda994cfd59f42cf8" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb" "checksum kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" @@ -7972,7 +7882,6 @@ dependencies = [ "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" "checksum once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37" "checksum once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d584f08c2d717d5c23a6414fc2822b71c651560713e54fa7eace675f758a355e" -"checksum once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "891f486f630e5c5a4916c7e16c4b24a53e78c860b646e9f8e005e4f16847bfed" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2f372b2b53ce10fb823a337aaa674e3a7d072b957c6264d0f4ff0bd86e657449" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" @@ -8005,7 +7914,6 @@ dependencies = [ "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" -"checksum pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f0af6cbca0e6e3ce8692ee19fb8d734b641899e07b68eb73e9bbbd32f1703991" "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" "checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" "checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml index e4aa56e49ffea..c45eb4168468f 100644 --- a/client/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -15,7 +15,7 @@ client-api = { package = "substrate-client-api", path = "../api" } codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" } derive_more = "0.15.0" futures = "0.3.1" -futures-timer = "0.4" +futures-timer = "2.0" keystore = { package = "substrate-keystore", path = "../keystore" } libp2p = { version = "0.13.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" @@ -23,7 +23,6 @@ network = { package = "substrate-network", path = "../network" } primitives = { package = "substrate-primitives", path = "../../primitives/core" } prost = "0.5.0" serde_json = "1.0.41" -async-std = { version = "1.0.1", features = ["unstable"] } sr-primitives = { path = "../../primitives/sr-primitives" } [dev-dependencies] diff --git a/client/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs index 9e505a0273ffc..764ae6ea033a8 100644 --- a/client/authority-discovery/src/lib.rs +++ b/client/authority-discovery/src/lib.rs @@ -48,11 +48,11 @@ use std::iter::FromIterator; use std::marker::PhantomData; use std::pin::Pin; use std::sync::Arc; -use std::time::{Duration}; +use std::time::{Duration, Instant}; use futures::task::{Context, Poll}; -use futures::{Future, Stream, StreamExt}; -use async_std::stream::{interval, Interval}; +use futures::{Future, FutureExt, Stream, StreamExt}; +use futures_timer::Delay; use authority_discovery_primitives::{AuthorityDiscoveryApi, AuthorityId, AuthoritySignature, AuthorityPair}; use client_api::blockchain::HeaderBackend; @@ -67,6 +67,8 @@ use prost::Message; use sr_primitives::generic::BlockId; use sr_primitives::traits::{Block as BlockT, ProvideRuntimeApi}; +type Interval = Box + Unpin>; + mod error; /// Dht payload schemas generated from Protobuf definitions via Prost crate in build.rs. mod schema { @@ -128,11 +130,17 @@ where // Kademlia's default time-to-live for Dht records is 36h, republishing records every 24h. Given that a node // could restart at any point in time, one can not depend on the republishing process, thus publishing own // external addresses should happen on an interval < 36h. - let publish_interval = interval(Duration::from_secs(12 * 60 * 60)); + let publish_interval = interval_at( + Instant::now() + LIBP2P_KADEMLIA_BOOTSTRAP_TIME, + Duration::from_secs(12 * 60 * 60), + ); // External addresses of other authorities can change at any given point in time. The interval on which to query // for external addresses of other authorities is a trade off between efficiency and performance. - let query_interval = interval(Duration::from_secs(10 * 60)); + let query_interval = interval_at( + Instant::now() + LIBP2P_KADEMLIA_BOOTSTRAP_TIME, + Duration::from_secs(10 * 60), + ); let address_cache = HashMap::new(); @@ -448,6 +456,19 @@ fn hash_authority_id(id: &[u8]) -> Result { .map_err(Error::HashingAuthorityId) } +fn interval_at(start: Instant, duration: Duration) -> Interval { + let stream = futures::stream::unfold((), move |_| { + let wait_time = start.saturating_duration_since(Instant::now()); + + futures::future::join( + Delay::new(wait_time), + Delay::new(duration) + ).map(|_| Some(((), ()))) + }).map(drop); + + Box::new(stream) +} + #[cfg(test)] mod tests { use super::*; From 12c1f3e7a1c4e3f6b3f1401a4d3ebb15a2aea5cd Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 19 Nov 2019 17:11:02 +0100 Subject: [PATCH 14/14] Add Send + Sync to interval dyn stream --- client/authority-discovery/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs index 764ae6ea033a8..0c9d8e59ac382 100644 --- a/client/authority-discovery/src/lib.rs +++ b/client/authority-discovery/src/lib.rs @@ -67,7 +67,7 @@ use prost::Message; use sr_primitives::generic::BlockId; use sr_primitives::traits::{Block as BlockT, ProvideRuntimeApi}; -type Interval = Box + Unpin>; +type Interval = Box + Unpin + Send + Sync>; mod error; /// Dht payload schemas generated from Protobuf definitions via Prost crate in build.rs.