mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Use SpawnNamed instead of Spawn in Overseer (#1430)
* Use SpawnNamed instead of Spawn in Overseer * reexport SpawnNamed and fix doc tests * Fix deps
This commit is contained in:
@@ -10,7 +10,6 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
polkadot-primitives = { path = "../../../primitives" }
|
||||
polkadot-node-primitives = { path = "../../primitives" }
|
||||
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
|
||||
@@ -20,6 +19,7 @@ derive_more = "0.99.9"
|
||||
bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] }
|
||||
|
||||
[dev-dependencies]
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
futures = { version = "0.3.5", features = ["thread-pool"] }
|
||||
subsystem-test = { package = "polkadot-subsystem-test-helpers", path = "../../test-helpers/subsystem" }
|
||||
|
||||
@@ -24,7 +24,6 @@ use std::sync::Arc;
|
||||
use bitvec::vec::BitVec;
|
||||
use futures::{
|
||||
channel::{mpsc, oneshot},
|
||||
task::{Spawn, SpawnError},
|
||||
Future, FutureExt, SinkExt, StreamExt,
|
||||
};
|
||||
|
||||
@@ -37,7 +36,7 @@ use polkadot_primitives::v1::{
|
||||
};
|
||||
use polkadot_node_primitives::{
|
||||
FromTableMisbehavior, Statement, SignedFullStatement, MisbehaviorReport,
|
||||
ValidationOutputs, ValidationResult,
|
||||
ValidationOutputs, ValidationResult, SpawnNamed,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
Subsystem, SubsystemContext, SpawnedSubsystem,
|
||||
@@ -77,8 +76,6 @@ enum Error {
|
||||
#[from]
|
||||
Mpsc(mpsc::SendError),
|
||||
#[from]
|
||||
Spawn(SpawnError),
|
||||
#[from]
|
||||
UtilError(util::Error),
|
||||
}
|
||||
|
||||
@@ -735,7 +732,7 @@ pub struct CandidateBackingSubsystem<Spawner, Context> {
|
||||
|
||||
impl<Spawner, Context> CandidateBackingSubsystem<Spawner, Context>
|
||||
where
|
||||
Spawner: Clone + Spawn + Send + Unpin,
|
||||
Spawner: Clone + SpawnNamed + Send + Unpin,
|
||||
Context: SubsystemContext,
|
||||
ToJob: From<<Context as SubsystemContext>::Message>,
|
||||
{
|
||||
@@ -754,7 +751,7 @@ where
|
||||
|
||||
impl<Spawner, Context> Subsystem<Context> for CandidateBackingSubsystem<Spawner, Context>
|
||||
where
|
||||
Spawner: Spawn + Send + Clone + Unpin + 'static,
|
||||
Spawner: SpawnNamed + Send + Clone + Unpin + 'static,
|
||||
Context: SubsystemContext,
|
||||
<Context as SubsystemContext>::Message: Into<ToJob>,
|
||||
{
|
||||
@@ -769,10 +766,7 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
use assert_matches::assert_matches;
|
||||
use futures::{
|
||||
executor::{self, ThreadPool},
|
||||
future, Future,
|
||||
};
|
||||
use futures::{executor, future, Future};
|
||||
use polkadot_primitives::v1::{
|
||||
AssignmentKind, BlockData, CandidateCommitments, CollatorId, CoreAssignment, CoreIndex,
|
||||
LocalValidationData, GlobalValidationSchedule, GroupIndex, HeadData,
|
||||
@@ -905,7 +899,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn test_harness<T: Future<Output=()>>(keystore: KeyStorePtr, test: impl FnOnce(TestHarness) -> T) {
|
||||
let pool = ThreadPool::new().unwrap();
|
||||
let pool = sp_core::testing::SpawnBlockingExecutor::new();
|
||||
|
||||
let (context, virtual_overseer) = subsystem_test::make_subsystem_context(pool.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user