diff --git a/polkadot/network/src/protocol/mod.rs b/polkadot/network/src/protocol/mod.rs index 22e72dcfd6e46f5fda64558bea660dabf93eabb4..6dfef09da8ba57fa8437351d977fc82987ae6a30 100644 --- a/polkadot/network/src/protocol/mod.rs +++ b/polkadot/network/src/protocol/mod.rs @@ -222,7 +222,7 @@ pub fn start<C, Api, SP>( C: ChainContext + 'static, Api: ProvideRuntimeApi<Block> + Send + Sync + 'static, Api::Api: ParachainHost<Block, Error = sp_blockchain::Error>, - SP: SpawnNamed + Clone + Send + 'static, + SP: SpawnNamed + Clone + Send + Unpin + 'static, { const SERVICE_TO_WORKER_BUF: usize = 256; @@ -830,7 +830,7 @@ struct Worker<Api, Sp, Gossip> { impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where Api: ProvideRuntimeApi<Block> + Send + Sync + 'static, Api::Api: ParachainHost<Block, Error = sp_blockchain::Error>, - Sp: SpawnNamed + Clone, + Sp: SpawnNamed + Clone + Unpin + 'static, Gossip: GossipOps, { // spawns a background task to spawn consensus networking. @@ -882,6 +882,7 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where self.gossip_handle.clone(), self.background_to_main_sender.clone(), exit, + self.executor.clone(), ).boxed(), ); } @@ -1062,7 +1063,7 @@ async fn worker_loop<Api, Sp>( ) where Api: ProvideRuntimeApi<Block> + Send + Sync + 'static, Api::Api: ParachainHost<Block, Error = sp_blockchain::Error>, - Sp: SpawnNamed + Clone, + Sp: SpawnNamed + Clone + Unpin + 'static, { const BACKGROUND_TO_MAIN_BUF: usize = 16; @@ -1149,6 +1150,7 @@ async fn statement_import_loop<Api>( gossip_handle: impl GossipOps, mut to_worker: mpsc::Sender<BackgroundToWorkerMsg>, mut exit: exit_future::Exit, + spawner: impl SpawnNamed + Clone + Unpin + 'static, ) where Api: ProvideRuntimeApi<Block> + Send + Sync + 'static, Api::Api: ParachainHost<Block, Error = sp_blockchain::Error>, @@ -1221,7 +1223,7 @@ async fn statement_import_loop<Api>( let table = table.clone(); let gossip_handle = gossip_handle.clone(); - let work = producer.prime(api.clone()).validate().map(move |res| { + let work = producer.prime(api.clone(), spawner.clone()).validate().map(move |res| { let validated = match res { Err(e) => { debug!(target: "p_net", "Failed to act on statement: {}", e); diff --git a/polkadot/validation/src/shared_table/mod.rs b/polkadot/validation/src/shared_table/mod.rs index 58cc56cb7fe022008b27718a2abaae3009c24b25..1e77c21b38cceac529f4aabaa7b64f5a33afb1af 100644 --- a/polkadot/validation/src/shared_table/mod.rs +++ b/polkadot/validation/src/shared_table/mod.rs @@ -37,7 +37,7 @@ use bitvec::bitvec; use super::GroupInfo; use self::includable::IncludabilitySender; -use primitives::Pair; +use primitives::{Pair, traits::SpawnNamed}; use sp_api::ProvideRuntimeApi; use crate::pipeline::{FullOutput, ValidationPool}; @@ -287,8 +287,11 @@ pub struct ParachainWork<Fetch> { impl<Fetch: Future + Unpin> ParachainWork<Fetch> { /// Prime the parachain work with an API reference for extracting /// chain information. - pub fn prime<P: ProvideRuntimeApi<Block>>(self, api: Arc<P>) - -> PrimedParachainWork< + pub fn prime<P: ProvideRuntimeApi<Block>>( + self, + api: Arc<P>, + spawner: impl SpawnNamed + Clone + Unpin + 'static, + ) -> PrimedParachainWork< Fetch, impl Send + FnMut(&PoVBlock, &AbridgedCandidateReceipt) -> Result<FullOutput, Error> + Unpin, @@ -312,7 +315,7 @@ impl<Fetch: Future + Unpin> ParachainWork<Fetch> { &expected_relay_parent, max_block_data_size, n_validators, - primitives::testing::TaskExecutor::new(), + spawner.clone(), )?; full_output.check_consistency(candidate)?;