Update the service to std futures (#4447)

* Switch service to futures03

* Fix tests

* Fix service test and cli

* Re-add Executor trait to SpawnTaskHandle

* Fix node-service

* Update babe

* Fix browser node

* Update aura

* Revert back to tokio-executor to fix runtime panic

* Add todo item

* Fix service tests again

* Timeout test futures

* Fix tests

* nits

* Fix service test

* Remove zstd patch

* Re-add futures01 to aura and babe tests as a dev-dep

* Change failing test to tee

* Fix node

* Upgrade tokio

* fix society

* Start switching grandpa to stable futures

* Revert "Start switching grandpa to stable futures"

This reverts commit 9c1976346237637effc07c13f7d0403daf5e71cf.

* Fix utils

* Revert substrate service test

* Revert gitlab

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Ashley
2020-01-14 15:43:45 +01:00
committed by GitHub
parent 972be34e38
commit 3219be2508
24 changed files with 246 additions and 312 deletions
+2 -2
View File
@@ -14,8 +14,7 @@ sc-client-api = { version = "2.0.0", path = "../../api" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
sp-consensus = { version = "0.8", path = "../../../primitives/consensus/common" }
derive_more = "0.99.2"
futures = { version = "0.3.1", features = ["compat"] }
futures01 = { package = "futures", version = "0.1" }
futures = "0.3.1"
futures-timer = "0.4.0"
sp-inherents = { version = "2.0.0", path = "../../../primitives/inherents" }
sc-keystore = { version = "2.0.0", path = "../../keystore" }
@@ -41,3 +40,4 @@ substrate-test-runtime-client = { version = "2.0.0", path = "../../../test-utils
tokio = "0.1.22"
env_logger = "0.7.0"
tempfile = "3.1.0"
futures01 = { package = "futures", version = "0.1" }
+7 -4
View File
@@ -153,7 +153,7 @@ pub fn start_aura<B, C, SC, E, I, P, SO, CAW, Error>(
force_authoring: bool,
keystore: KeyStorePtr,
can_author_with: CAW,
) -> Result<impl futures01::Future<Item = (), Error = ()>, sp_consensus::Error> where
) -> Result<impl Future<Output = ()>, sp_consensus::Error> where
B: BlockT,
C: ProvideRuntimeApi<B> + BlockOf + ProvideCache<B> + AuxStore + Send + Sync,
C::Api: AuraApi<B, AuthorityId<P>>,
@@ -189,7 +189,7 @@ pub fn start_aura<B, C, SC, E, I, P, SO, CAW, Error>(
inherent_data_providers,
AuraSlotCompatible,
can_author_with,
).map(|()| Ok::<(), ()>(())).compat())
))
}
struct AuraWorker<C, E, I, P, SO> {
@@ -1019,7 +1019,10 @@ mod tests {
false,
keystore,
sp_consensus::AlwaysCanAuthor,
).expect("Starts aura");
)
.expect("Starts aura")
.unit_error()
.compat();
runtime.spawn(aura);
}
@@ -1030,7 +1033,7 @@ mod tests {
}));
runtime.block_on(future::join_all(import_notifications)
.map(|_| Ok::<(), ()>(())).compat()).unwrap();
.unit_error().compat()).unwrap();
}
#[test]
+2 -2
View File
@@ -29,8 +29,7 @@ sc-consensus-uncles = { version = "0.8", path = "../uncles" }
sc-consensus-slots = { version = "0.8", path = "../slots" }
sp-runtime = { version = "2.0.0", path = "../../../primitives/runtime" }
fork-tree = { version = "2.0.0", path = "../../../utils/fork-tree" }
futures = { version = "0.3.1", features = ["compat"] }
futures01 = { package = "futures", version = "0.1" }
futures = "0.3.1"
futures-timer = "0.4.0"
parking_lot = "0.9.0"
log = "0.4.8"
@@ -51,6 +50,7 @@ sc-block-builder = { version = "2.0.0", path = "../../block-builder" }
tokio = "0.1.22"
env_logger = "0.7.0"
tempfile = "3.1.0"
futures01 = { package = "futures", version = "0.1" }
[features]
test-helpers = []
+3 -5
View File
@@ -289,7 +289,7 @@ pub fn start_babe<B, C, SC, E, I, SO, CAW, Error>(BabeParams {
babe_link,
can_author_with,
}: BabeParams<B, C, E, I, SO, SC, CAW>) -> Result<
impl futures01::Future<Item=(), Error=()>,
impl futures::Future<Output=()>,
sp_consensus::Error,
> where
B: BlockT,
@@ -325,7 +325,7 @@ pub fn start_babe<B, C, SC, E, I, SO, CAW, Error>(BabeParams {
)?;
babe_info!("Starting BABE Authorship worker");
let slot_worker = sc_consensus_slots::start_slot_worker(
Ok(sc_consensus_slots::start_slot_worker(
config.0,
select_chain,
worker,
@@ -333,9 +333,7 @@ pub fn start_babe<B, C, SC, E, I, SO, CAW, Error>(BabeParams {
inherent_data_providers,
babe_link.time_source,
can_author_with,
);
Ok(slot_worker.map(|_| Ok::<(), ()>(())).compat())
))
}
struct BabeWorker<B: BlockT, C, E, I, SO> {
+2 -2
View File
@@ -419,7 +419,7 @@ fn run_one_test(
babe_link: data.link.clone(),
keystore,
can_author_with: sp_consensus::AlwaysCanAuthor,
}).expect("Starts babe"));
}).expect("Starts babe").unit_error().compat());
}
runtime.spawn(futures01::future::poll_fn(move || {
@@ -428,7 +428,7 @@ fn run_one_test(
}));
runtime.block_on(future::join_all(import_notifications)
.map(|_| Ok::<(), ()>(())).compat()).unwrap();
.unit_error().compat()).unwrap();
}
#[test]