diff --git a/bin/node-template/src/service.rs b/bin/node-template/src/service.rs index 7f6ff67d282d1..92db95b5c7d89 100644 --- a/bin/node-template/src/service.rs +++ b/bin/node-template/src/service.rs @@ -12,7 +12,6 @@ pub use sc_executor::NativeExecutor; use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair}; use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider}; use sc_basic_authority; -use futures::{FutureExt, compat::Future01CompatExt}; // Our native executor instance. native_executor_instance!( @@ -164,7 +163,7 @@ pub fn new_full(config: Configuration { // start the full GRANDPA voter @@ -181,7 +180,7 @@ pub fn new_full(config: Configuration { grandpa::setup_disabled_grandpa( diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index 2f53fb7637d64..fa45ffd89bf4a 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -112,10 +112,7 @@ macro_rules! new_full_start { /// concrete types instead. macro_rules! new_full { ($config:expr, $with_startup_data: expr) => {{ - use futures::{ - prelude::*, - compat::Future01CompatExt - }; + use futures::prelude::*; use sc_network::Event; let ( @@ -222,7 +219,7 @@ macro_rules! new_full { service.network(), service.on_exit(), service.spawn_task_handle(), - )?.compat().map(drop)); + )?); }, (true, false) => { // start the full GRANDPA voter @@ -239,7 +236,7 @@ macro_rules! new_full { // the GRANDPA voter task is considered infallible, i.e. // if it fails we take down the service with it. service.spawn_essential_task( - grandpa::run_grandpa_voter(grandpa_config)?.compat().map(drop) + grandpa::run_grandpa_voter(grandpa_config)? ); }, (_, true) => { diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index dbecd9c9a4b7f..56d7b6498f547 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -547,7 +547,7 @@ pub struct GrandpaParams { /// block import worker that has already been instantiated with `block_import`. pub fn run_grandpa_voter( grandpa_params: GrandpaParams, -) -> sp_blockchain::Result + Send + 'static> where +) -> sp_blockchain::Result + Send + 'static> where Block::Hash: Ord, B: Backend + 'static, E: CallExecutor + Send + Sync + 'static, @@ -639,9 +639,9 @@ pub fn run_grandpa_voter( let telemetry_task = telemetry_task .then(|_| futures::future::empty::<(), ()>()); - use futures03::{FutureExt, TryFutureExt}; + use futures03::{FutureExt, TryFutureExt, future::select, compat::Future01CompatExt}; - Ok(voter_work.select(on_exit.map(Ok).compat()).select2(telemetry_task).then(|_| Ok(()))) + Ok(select(select(voter_work.compat(), telemetry_task.compat()), on_exit).map(drop)) } /// Future that powers the voter. @@ -885,7 +885,7 @@ where #[deprecated(since = "1.1.0", note = "Please switch to run_grandpa_voter.")] pub fn run_grandpa( grandpa_params: GrandpaParams, -) -> sp_blockchain::Result + Send + 'static> where +) -> sp_blockchain::Result + Send + 'static> where Block::Hash: Ord, B: Backend + 'static, E: CallExecutor + Send + Sync + 'static, diff --git a/client/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs index 3dbb2aff6a9cf..615cb72e0775f 100644 --- a/client/finality-grandpa/src/observer.rs +++ b/client/finality-grandpa/src/observer.rs @@ -156,7 +156,7 @@ pub fn run_grandpa_observer( network: N, on_exit: impl futures03::Future + Clone + Send + Unpin + 'static, executor: Sp, -) -> sp_blockchain::Result + Send + 'static> where +) -> sp_blockchain::Result + Send + 'static> where B: Backend + 'static, E: CallExecutor + Send + Sync + 'static, N: NetworkT + Send + Clone + 'static, @@ -195,9 +195,9 @@ pub fn run_grandpa_observer( warn!("GRANDPA Observer failed: {:?}", e); }); - use futures03::{FutureExt, TryFutureExt}; + use futures03::{FutureExt, future::select, compat::Future01CompatExt}; - Ok(observer_work.select(on_exit.map(Ok).compat()).map(|_| ()).map_err(|_| ())) + Ok(select(observer_work.compat(), on_exit).map(drop)) } /// Future that powers the observer. @@ -359,12 +359,12 @@ where } match self.voter_commands_rx.poll() { - Ok(Async::NotReady) => {} - Err(_) => { + Ok(Async::No{ // the `voter_commands_rx` stream should not fail. return Ok(Async::Ready(())) } - Ok(Async::Ready(None)) => { + Ok(Async::Ready(None)) => tReady) => {} + Err(_) => { // the `voter_commands_rx` stream should never conclude since it's never closed. return Ok(Async::Ready(())) } diff --git a/utils/prometheus/README.pdf b/utils/prometheus/README.pdf new file mode 100644 index 0000000000000..8e8adbd1f8e01 Binary files /dev/null and b/utils/prometheus/README.pdf differ