Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,697 changes: 878 additions & 819 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2018"

[dependencies]
cli = { package = "polkadot-cli", path = "cli" }
futures = "0.1.29"
futures = "0.3.1"
ctrlc = { version = "3.1.3", features = ["termination"] }
service = { package = "polkadot-service", path = "service" }

Expand Down
2 changes: 1 addition & 1 deletion availability-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ polkadot-primitives = { path = "../primitives" }
parking_lot = "0.9.0"
log = "0.4.8"
codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/expenses/substrate", branch = "futures03" }
kvdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
6 changes: 3 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ edition = "2018"
[dependencies]
log = "0.4.8"
tokio = "0.1.22"
futures = "0.1.29"
exit-future = "0.1.4"
futures = { version = "0.3.1", features = ["compat"] }
futures01 = { package = "futures", version = "0.1.29" }
structopt = "0.3.4"
cli = { package = "substrate-cli", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
cli = { package = "substrate-cli", git = "https://github.com/expenses/substrate", branch = "futures03" }
service = { package = "polkadot-service", path = "../service" }

[features]
Expand Down
28 changes: 20 additions & 8 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
mod chain_spec;

use chain_spec::ChainSpec;
use futures::Future;
use futures::{Future, FutureExt, TryFutureExt, future::select, channel::oneshot, compat::Future01CompatExt};
use tokio::runtime::Runtime;
use std::sync::Arc;
use log::{info, error};
Expand All @@ -37,7 +37,8 @@ pub use cli::{VersionInfo, IntoExit, NoCustom};
pub use cli::{display_role, error};

/// Abstraction over an executor that lets you spawn tasks in the background.
pub type TaskExecutor = Arc<dyn futures::future::Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync>;
type BoxedFuture = Box<dyn futures01::Future<Item = (), Error = ()> + Send>;
pub type TaskExecutor = Arc<dyn futures01::future::Executor<BoxedFuture> + Send + Sync>;

fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> {
Ok(match ChainSpec::from(id) {
Expand All @@ -53,7 +54,7 @@ fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> {
pub trait Worker: IntoExit {
/// A future that resolves when the work is done or the node should exit.
/// This will be run on a tokio runtime.
type Work: Future<Item=(),Error=()> + Send + 'static;
type Work: Future<Output=()> + Unpin + Send + 'static;

/// Return configuration for the polkadot node.
// TODO: make this the full configuration, so embedded nodes don't need
Expand Down Expand Up @@ -143,20 +144,31 @@ fn run_until_exit<T, SC, B, CE, W>(
CE: service::CallExecutor<service::Block, service::Blake2Hasher> + Clone + Send + Sync + 'static,
W: Worker,
{
let (exit_send, exit) = exit_future::signal();
let (exit_send, exit) = oneshot::channel();

let executor = runtime.executor();
let informant = cli::informant::build(&service);
executor.spawn(exit.until(informant).map(|_| ()));
let future = select(exit, informant)
.map(|_| Ok(()))
.compat();

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 work = worker.work(&service, Arc::new(executor));
let service = service.map_err(|err| error!("Error while running Service: {}", err));
let _ = runtime.block_on(service.select(work));
exit_send.fire();
let service = service
.map_err(|err| error!("Error while running Service: {}", err))
.compat();
let future = select(service, work)
.map(|_| Ok::<_, ()>(()))
.compat();
let _ = runtime.block_on(future);
let _ = exit_send.send(());

use futures01::Future;

// TODO [andre]: timeout this future substrate/#1318
let _ = runtime.shutdown_on_idle().wait();
Expand Down
17 changes: 9 additions & 8 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ description = "Collator node implementation"
edition = "2018"

[dependencies]
futures = "0.1.29"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] }
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client-api = { package = "substrate-client-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
consensus_common = { package = "substrate-consensus-common", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
futures01 = { package = "futures", version = "0.1.17" }
futures = { version = "0.3.1", features = ["compat"] }
client = { package = "substrate-client", git = "https://github.com/expenses/substrate", branch = "futures03" }
client-api = { package = "substrate-client-api", git = "https://github.com/expenses/substrate", branch = "futures03" }
primitives = { package = "substrate-primitives", git = "https://github.com/expenses/substrate", branch = "futures03" }
substrate-network = { git = "https://github.com/expenses/substrate", branch = "futures03" }
consensus_common = { package = "substrate-consensus-common", git = "https://github.com/expenses/substrate", branch = "futures03" }
polkadot-runtime = { path = "../runtime" }
polkadot-primitives = { path = "../primitives" }
polkadot-cli = { path = "../cli" }
Expand All @@ -21,6 +21,7 @@ polkadot-validation = { path = "../validation" }
polkadot-service = { path = "../service" }
log = "0.4.8"
tokio = "0.1.22"
futures-timer = "1.0"

[dev-dependencies]
keyring = { package = "substrate-keyring", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
keyring = { package = "substrate-keyring", git = "https://github.com/expenses/substrate", branch = "futures03" }
Loading