Unverified Commit 976a319e authored by Peter Goodspeed-Niklaus's avatar Peter Goodspeed-Niklaus Committed by GitHub
Browse files

break out subsystem-util and subsystem-test-helpers into individual crates (#1553)

* break out subsystem-util and subsystem-test-helpers into individual crates

* cause all packages to check successfully
parent a39d8803
Pipeline #103358 passed with stages
in 21 minutes and 51 seconds
......@@ -4342,6 +4342,7 @@ dependencies = [
"polkadot-network-bridge",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"sc-network",
"smol 0.2.0",
......@@ -4494,6 +4495,7 @@ dependencies = [
"parking_lot 0.10.2",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"sc-network",
"sp-core",
......@@ -4536,6 +4538,7 @@ dependencies = [
"parity-scale-codec",
"polkadot-erasure-coding",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-overseer",
"polkadot-primitives",
"sp-core",
......@@ -4553,6 +4556,8 @@ dependencies = [
"polkadot-erasure-coding",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-node-subsystem-util",
"polkadot-primitives",
"polkadot-statement-table",
"sc-client-api",
......@@ -4572,6 +4577,7 @@ dependencies = [
"futures 0.3.5",
"log 0.4.8",
"polkadot-node-subsystem",
"polkadot-node-subsystem-util",
"polkadot-primitives",
"sc-keystore",
"wasm-timer",
......@@ -4588,6 +4594,7 @@ dependencies = [
"parity-scale-codec",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-parachain",
"polkadot-primitives",
"sp-blockchain",
......@@ -4602,6 +4609,7 @@ dependencies = [
"futures 0.3.5",
"maplit",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"sp-blockchain",
"sp-core",
......@@ -4643,6 +4651,7 @@ dependencies = [
"lazy_static",
"log 0.4.8",
"polkadot-node-subsystem",
"polkadot-node-subsystem-util",
"polkadot-primitives",
"sp-core",
"tokio 0.2.21",
......@@ -4655,6 +4664,7 @@ dependencies = [
"futures 0.3.5",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"sp-api",
"sp-blockchain",
......@@ -4665,7 +4675,6 @@ dependencies = [
name = "polkadot-node-primitives"
version = "0.1.0"
dependencies = [
"async-trait",
"parity-scale-codec",
"polkadot-primitives",
"polkadot-statement-table",
......@@ -4687,6 +4696,51 @@ dependencies = [
"parking_lot 0.10.2",
"pin-project",
"polkadot-node-primitives",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"polkadot-statement-table",
"sc-network",
"smallvec 1.4.1",
"sp-core",
]
[[package]]
name = "polkadot-node-subsystem-test-helpers"
version = "0.1.0"
dependencies = [
"async-trait",
"derive_more 0.99.9",
"futures 0.3.5",
"futures-timer 3.0.2",
"log 0.4.8",
"parity-scale-codec",
"parking_lot 0.10.2",
"pin-project",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-primitives",
"polkadot-statement-table",
"sc-network",
"smallvec 1.4.1",
"sp-core",
]
[[package]]
name = "polkadot-node-subsystem-util"
version = "0.1.0"
dependencies = [
"assert_matches",
"async-trait",
"derive_more 0.99.9",
"futures 0.3.5",
"futures-timer 3.0.2",
"log 0.4.8",
"parity-scale-codec",
"parking_lot 0.10.2",
"pin-project",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"polkadot-statement-table",
"sc-keystore",
......@@ -4746,6 +4800,7 @@ dependencies = [
"parking_lot 0.10.2",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"sc-network",
"sp-core",
......@@ -5102,6 +5157,7 @@ dependencies = [
"parking_lot 0.10.2",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-primitives",
"sp-core",
"sp-keyring",
......
......@@ -61,6 +61,8 @@ members = [
"node/primitives",
"node/service",
"node/subsystem",
"node/subsystem-test-helpers",
"node/subsystem-util",
"node/test-service",
"parachain/test-parachains",
......
......@@ -19,6 +19,6 @@ derive_more = "0.99.9"
[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.5", features = ["thread-pool"] }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = [ "test-helpers" ] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
kvdb-memorydb = "0.7.0"
assert_matches = "1.3.0"
......@@ -316,7 +316,7 @@ mod tests {
AvailableData, BlockData, HeadData, GlobalValidationData, LocalValidationData, PoV,
OmittedValidationData,
};
use polkadot_subsystem::test_helpers;
use polkadot_node_subsystem_test_helpers as test_helpers;
struct TestHarness {
virtual_overseer: test_helpers::TestSubsystemContextHandle<AvailabilityStoreMessage>,
......
......@@ -13,6 +13,7 @@ keystore = { package = "sc-keystore", git = "https://github.com/paritytech/subst
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" }
derive_more = "0.99.9"
......@@ -24,4 +25,4 @@ 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"] }
assert_matches = "1.3.0"
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = [ "test-helpers" ] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
......@@ -45,14 +45,14 @@ use polkadot_subsystem::{
ProvisionerMessage, RuntimeApiMessage, StatementDistributionMessage, ValidationFailed,
RuntimeApiRequest,
},
util::{
self,
request_session_index_for_child,
request_validator_groups,
request_validators,
request_from_runtime,
Validator,
},
};
use polkadot_node_subsystem_util::{
self as util,
request_session_index_for_child,
request_validator_groups,
request_validators,
request_from_runtime,
Validator,
delegated_subsystem,
};
use statement_table::{
......@@ -896,13 +896,13 @@ mod tests {
}
struct TestHarness {
virtual_overseer: polkadot_subsystem::test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
virtual_overseer: polkadot_node_subsystem_test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
}
fn test_harness<T: Future<Output=()>>(keystore: KeyStorePtr, test: impl FnOnce(TestHarness) -> T) {
let pool = sp_core::testing::TaskExecutor::new();
let (context, virtual_overseer) = polkadot_subsystem::test_helpers::make_subsystem_context(pool.clone());
let (context, virtual_overseer) = polkadot_node_subsystem_test_helpers::make_subsystem_context(pool.clone());
let subsystem = CandidateBackingSubsystem::run(context, keystore, pool.clone());
......@@ -960,7 +960,7 @@ mod tests {
// Tests that the subsystem performs actions that are requied on startup.
async fn test_startup(
virtual_overseer: &mut polkadot_subsystem::test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
virtual_overseer: &mut polkadot_node_subsystem_test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
test_state: &TestState,
) {
// Start work on some new parent.
......
......@@ -11,5 +11,6 @@ futures = "0.3.5"
log = "0.4.8"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "master" }
wasm-timer = "0.2.4"
......@@ -29,7 +29,9 @@ use polkadot_node_subsystem::{
BitfieldSigningMessage, CandidateBackingMessage, RuntimeApiMessage,
},
errors::RuntimeApiError,
util::{self, JobManager, JobTrait, ToJobTrait, Validator},
};
use polkadot_node_subsystem_util::{
self as util, JobManager, JobTrait, ToJobTrait, Validator
};
use polkadot_primitives::v1::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex};
use std::{convert::TryFrom, pin::Pin, time::Duration};
......
......@@ -21,4 +21,4 @@ log = "0.4.8"
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.5", features = ["thread-pool"] }
assert_matches = "1.3.0"
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = ["test-helpers"] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
......@@ -470,7 +470,7 @@ fn validate_candidate_exhaustive<B: ValidationBackend, S: SpawnNamed + 'static>(
#[cfg(test)]
mod tests {
use super::*;
use polkadot_subsystem::test_helpers;
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_primitives::v1::{HeadData, BlockData};
use sp_core::testing::TaskExecutor;
use futures::executor;
......
......@@ -13,5 +13,5 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
[dev-dependencies]
futures = { version = "0.3.5", features = ["thread-pool"] }
maplit = "1.0.2"
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = ["test-helpers"] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
......@@ -121,7 +121,7 @@ mod tests {
use futures::{future::BoxFuture, channel::oneshot};
use polkadot_primitives::v1::{Hash, BlockNumber, BlockId, Header};
use polkadot_subsystem::test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
use sp_blockchain::Info as BlockInfo;
use sp_core::testing::TaskExecutor;
......
......@@ -11,6 +11,7 @@ futures = "0.3.5"
log = "0.4.8"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
[dev-dependencies]
lazy_static = "1.4"
......
......@@ -25,16 +25,17 @@ use futures::{
prelude::*,
};
use polkadot_node_subsystem::{
delegated_subsystem,
errors::{ChainApiError, RuntimeApiError},
messages::{
AllMessages, ChainApiMessage, ProvisionableData, ProvisionerInherentData,
ProvisionerMessage, RuntimeApiMessage,
},
util::{
self, request_availability_cores, request_global_validation_data,
request_local_validation_data, JobTrait, ToJobTrait,
},
};
use polkadot_node_subsystem_util::{
self as util,
delegated_subsystem,
request_availability_cores, request_global_validation_data,
request_local_validation_data, JobTrait, ToJobTrait,
};
use polkadot_primitives::v1::{
validation_data_hash, BackedCandidate, BlockNumber, CoreState, Hash, OccupiedCoreAssumption,
......
......@@ -16,4 +16,4 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.5", features = ["thread-pool"] }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = ["test-helpers"] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
......@@ -123,7 +123,7 @@ mod tests {
Id as ParaId, OccupiedCoreAssumption, LocalValidationData, SessionIndex, ValidationCode,
CommittedCandidateReceipt, CandidateEvent,
};
use polkadot_subsystem::test_helpers;
use polkadot_node_subsystem_test_helpers as test_helpers;
use sp_core::testing::TaskExecutor;
use std::collections::HashMap;
......
......@@ -18,7 +18,7 @@ polkadot-network = { path = "../../../network" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
[dev-dependencies]
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = [ "test-helpers" ] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
parking_lot = "0.10.0"
......
......@@ -607,7 +607,7 @@ mod test {
use futures::executor;
use maplit::hashmap;
use polkadot_primitives::v1::{Signed, ValidatorPair, AvailabilityBitfield};
use polkadot_subsystem::test_helpers::make_subsystem_context;
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
use smol_timeout::TimeoutExt;
use sp_core::crypto::Pair;
use std::time::Duration;
......
......@@ -19,5 +19,5 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
[dev-dependencies]
assert_matches = "1.3.0"
parking_lot = "0.10.0"
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = [ "test-helpers" ] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
......@@ -521,7 +521,7 @@ mod tests {
use assert_matches::assert_matches;
use polkadot_subsystem::messages::{StatementDistributionMessage, BitfieldDistributionMessage};
use polkadot_subsystem::test_helpers::{SingleItemSink, SingleItemStream};
use polkadot_node_subsystem_test_helpers::{SingleItemSink, SingleItemStream};
// The subsystem's view of the network - only supports a single call to `event_stream`.
struct TestNetwork {
......@@ -540,7 +540,7 @@ mod tests {
TestNetwork,
TestNetworkHandle,
) {
let (net_tx, net_rx) = polkadot_subsystem::test_helpers::single_item_sink();
let (net_tx, net_rx) = polkadot_node_subsystem_test_helpers::single_item_sink();
let (action_tx, action_rx) = mpsc::unbounded();
(
......@@ -621,13 +621,13 @@ mod tests {
struct TestHarness {
network_handle: TestNetworkHandle,
virtual_overseer: polkadot_subsystem::test_helpers::TestSubsystemContextHandle<NetworkBridgeMessage>,
virtual_overseer: polkadot_node_subsystem_test_helpers::TestSubsystemContextHandle<NetworkBridgeMessage>,
}
fn test_harness<T: Future<Output=()>>(test: impl FnOnce(TestHarness) -> T) {
let pool = sp_core::testing::TaskExecutor::new();
let (network, network_handle) = new_test_network();
let (context, virtual_overseer) = polkadot_subsystem::test_helpers::make_subsystem_context(pool);
let (context, virtual_overseer) = polkadot_node_subsystem_test_helpers::make_subsystem_context(pool);
let network_bridge = run_network(
network,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment