mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 07:11:06 +00:00
overseer becomes orchestra (#5542)
* rename overseer-gen to orchestra Also drop `gum` and use `tracing`. * make orchestra compile as standalone * introduce Spawner trait to split from sp_core Finalizes the independence of orchestra from polkadot-overseer * slip of the pen * other fixins * remove unused import * Update node/overseer/orchestra/proc-macro/src/impl_builder.rs Co-authored-by: Vsevolod Stakhov <vsevolod.stakhov@parity.io> * Update node/overseer/orchestra/proc-macro/src/impl_builder.rs Co-authored-by: Vsevolod Stakhov <vsevolod.stakhov@parity.io> * orchestra everywhere * leaky data * Bump scale-info from 2.1.1 to 2.1.2 (#5552) Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/paritytech/scale-info/releases) - [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/scale-info/compare/v2.1.1...v2.1.2) --- updated-dependencies: - dependency-name: scale-info dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add missing markdown code block delimiter (#5555) * bitfield-signing: remove util::jobs usage (#5523) * Switch to pooling copy-on-write instantiation strategy for WASM (companion for Substrate#11232) (#5337) * Switch to pooling copy-on-write instantiation strategy for WASM * Fix compilation of `polkadot-test-service` * Update comments * Move `max_memory_size` to `Semantics` * Rename `WasmInstantiationStrategy` to `WasmtimeInstantiationStrategy` * Update a safety comment * update lockfile for {"substrate"} Co-authored-by: parity-processbot <> * Fix build Co-authored-by: Vsevolod Stakhov <vsevolod.stakhov@parity.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Malte Kliemann <mail@maltekliemann.com> Co-authored-by: Chris Sosnin <48099298+slumber@users.noreply.github.com> Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d9eff4ecd4
commit
450ca2baca
Generated
+35
-37
@@ -4339,7 +4339,6 @@ dependencies = [
|
||||
"nanorand",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"tracing-gum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4826,6 +4825,39 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "orchestra"
|
||||
version = "0.9.22"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"dyn-clonable",
|
||||
"futures 0.3.21",
|
||||
"futures-timer",
|
||||
"metered-channel",
|
||||
"orchestra-proc-macro",
|
||||
"pin-project 1.0.10",
|
||||
"rustversion",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"trybuild",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "orchestra-proc-macro"
|
||||
version = "0.9.22"
|
||||
dependencies = [
|
||||
"assert_matches",
|
||||
"expander 0.0.6",
|
||||
"orchestra",
|
||||
"petgraph",
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
version = "1.1.1"
|
||||
@@ -6887,10 +6919,10 @@ version = "0.9.22"
|
||||
dependencies = [
|
||||
"derive_more",
|
||||
"futures 0.3.21",
|
||||
"orchestra",
|
||||
"polkadot-node-jaeger",
|
||||
"polkadot-node-network-protocol",
|
||||
"polkadot-node-primitives",
|
||||
"polkadot-overseer-gen",
|
||||
"polkadot-primitives",
|
||||
"polkadot-statement-table",
|
||||
"sc-network",
|
||||
@@ -6949,13 +6981,13 @@ dependencies = [
|
||||
"futures-timer",
|
||||
"lru 0.7.5",
|
||||
"metered-channel",
|
||||
"orchestra",
|
||||
"parity-util-mem",
|
||||
"parking_lot 0.12.0",
|
||||
"polkadot-node-metrics",
|
||||
"polkadot-node-network-protocol",
|
||||
"polkadot-node-primitives",
|
||||
"polkadot-node-subsystem-types",
|
||||
"polkadot-overseer-gen",
|
||||
"polkadot-primitives",
|
||||
"polkadot-primitives-test-helpers",
|
||||
"sc-client-api",
|
||||
@@ -6964,40 +6996,6 @@ dependencies = [
|
||||
"tracing-gum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polkadot-overseer-gen"
|
||||
version = "0.9.22"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures 0.3.21",
|
||||
"futures-timer",
|
||||
"metered-channel",
|
||||
"pin-project 1.0.10",
|
||||
"polkadot-node-network-protocol",
|
||||
"polkadot-node-primitives",
|
||||
"polkadot-overseer-gen-proc-macro",
|
||||
"rustversion",
|
||||
"thiserror",
|
||||
"tracing-gum",
|
||||
"trybuild",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polkadot-overseer-gen-proc-macro"
|
||||
version = "0.9.22"
|
||||
dependencies = [
|
||||
"assert_matches",
|
||||
"expander 0.0.6",
|
||||
"petgraph",
|
||||
"polkadot-overseer-gen",
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"thiserror",
|
||||
"tracing-gum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polkadot-parachain"
|
||||
version = "0.9.22"
|
||||
|
||||
+2
-2
@@ -83,8 +83,8 @@ members = [
|
||||
"node/network/gossip-support",
|
||||
"node/network/dispute-distribution",
|
||||
"node/overseer",
|
||||
"node/overseer/overseer-gen",
|
||||
"node/overseer/overseer-gen/proc-macro",
|
||||
"node/overseer/orchestra",
|
||||
"node/overseer/orchestra/proc-macro",
|
||||
"node/malus",
|
||||
"node/primitives",
|
||||
"node/service",
|
||||
|
||||
@@ -190,7 +190,7 @@ impl OverseerGen for BehaveMaleficient {
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin,
|
||||
Spawner: 'static + overseer::gen::Spawner + Clone + Unpin,
|
||||
{
|
||||
let spawner = args.spawner.clone();
|
||||
let leaves = args.leaves.clone();
|
||||
|
||||
@@ -23,8 +23,8 @@ use parity_scale_codec::Encode;
|
||||
use polkadot_node_primitives::{AvailableData, CollationGenerationConfig, PoV};
|
||||
use polkadot_node_subsystem::{
|
||||
messages::{CollationGenerationMessage, CollatorProtocolMessage},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext,
|
||||
SubsystemError, SubsystemResult,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem,
|
||||
SubsystemContext, SubsystemError, SubsystemResult,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{
|
||||
request_availability_cores, request_persisted_validation_data, request_validation_code,
|
||||
@@ -103,12 +103,12 @@ impl CollationGenerationSubsystem {
|
||||
// it should hopefully therefore be ok that it's an async function mutably borrowing self.
|
||||
async fn handle_incoming<Context>(
|
||||
&mut self,
|
||||
incoming: SubsystemResult<FromOverseer<<Context as SubsystemContext>::Message>>,
|
||||
incoming: SubsystemResult<FromOrchestra<<Context as SubsystemContext>::Message>>,
|
||||
ctx: &mut Context,
|
||||
sender: &mpsc::Sender<overseer::CollationGenerationOutgoingMessages>,
|
||||
) -> bool {
|
||||
match incoming {
|
||||
Ok(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated,
|
||||
..
|
||||
}))) => {
|
||||
@@ -130,8 +130,8 @@ impl CollationGenerationSubsystem {
|
||||
|
||||
false
|
||||
},
|
||||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => true,
|
||||
Ok(FromOverseer::Communication {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => true,
|
||||
Ok(FromOrchestra::Communication {
|
||||
msg: CollationGenerationMessage::Initialize(config),
|
||||
}) => {
|
||||
if self.config.is_some() {
|
||||
@@ -141,7 +141,7 @@ impl CollationGenerationSubsystem {
|
||||
}
|
||||
false
|
||||
},
|
||||
Ok(FromOverseer::Signal(OverseerSignal::BlockFinalized(..))) => false,
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::BlockFinalized(..))) => false,
|
||||
Err(err) => {
|
||||
gum::error!(
|
||||
target: LOG_TARGET,
|
||||
|
||||
@@ -37,7 +37,7 @@ use polkadot_node_subsystem::{
|
||||
ChainSelectionMessage, DisputeCoordinatorMessage, HighestApprovedAncestorBlock,
|
||||
RuntimeApiMessage, RuntimeApiRequest,
|
||||
},
|
||||
overseer, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError, SubsystemResult,
|
||||
overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError, SubsystemResult,
|
||||
SubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{
|
||||
@@ -1093,12 +1093,12 @@ async fn handle_from_overseer<Context>(
|
||||
state: &mut State,
|
||||
db: &mut OverlayedBackend<'_, impl Backend>,
|
||||
metrics: &Metrics,
|
||||
x: FromOverseer<ApprovalVotingMessage>,
|
||||
x: FromOrchestra<ApprovalVotingMessage>,
|
||||
last_finalized_height: &mut Option<BlockNumber>,
|
||||
wakeups: &mut Wakeups,
|
||||
) -> SubsystemResult<Vec<Action>> {
|
||||
let actions = match x {
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
let mut actions = Vec::new();
|
||||
|
||||
for activated in update.activated {
|
||||
@@ -1152,7 +1152,7 @@ async fn handle_from_overseer<Context>(
|
||||
|
||||
actions
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(block_hash, block_number)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(block_hash, block_number)) => {
|
||||
gum::debug!(target: LOG_TARGET, ?block_hash, ?block_number, "Block finalized");
|
||||
*last_finalized_height = Some(block_number);
|
||||
|
||||
@@ -1163,10 +1163,10 @@ async fn handle_from_overseer<Context>(
|
||||
|
||||
Vec::new()
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => {
|
||||
vec![Action::Conclude]
|
||||
},
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
FromOrchestra::Communication { msg } => match msg {
|
||||
ApprovalVotingMessage::CheckAndImportAssignment(a, claimed_core, res) => {
|
||||
let (check_outcome, actions) =
|
||||
check_and_import_assignment(state, db, a, claimed_core)?;
|
||||
|
||||
@@ -514,7 +514,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
async fn overseer_send(overseer: &mut VirtualOverseer, msg: FromOverseer<ApprovalVotingMessage>) {
|
||||
async fn overseer_send(overseer: &mut VirtualOverseer, msg: FromOrchestra<ApprovalVotingMessage>) {
|
||||
gum::trace!("Sending message:\n{:?}", &msg);
|
||||
overseer
|
||||
.send(msg)
|
||||
@@ -544,7 +544,7 @@ async fn overseer_recv_with_timeout(
|
||||
const TIMEOUT: Duration = Duration::from_millis(2000);
|
||||
async fn overseer_signal(overseer: &mut VirtualOverseer, signal: OverseerSignal) {
|
||||
overseer
|
||||
.send(FromOverseer::Signal(signal))
|
||||
.send(FromOrchestra::Signal(signal))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect(&format!("{:?} is more than enough for sending signals.", TIMEOUT));
|
||||
@@ -586,7 +586,7 @@ async fn check_and_import_approval(
|
||||
let (tx, rx) = oneshot::channel();
|
||||
overseer_send(
|
||||
overseer,
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: ApprovalVotingMessage::CheckAndImportApproval(
|
||||
IndirectSignedApprovalVote { block_hash, candidate_index, validator, signature },
|
||||
tx,
|
||||
@@ -626,7 +626,7 @@ async fn check_and_import_assignment(
|
||||
let (tx, rx) = oneshot::channel();
|
||||
overseer_send(
|
||||
overseer,
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: ApprovalVotingMessage::CheckAndImportAssignment(
|
||||
IndirectAssignmentCert {
|
||||
block_hash,
|
||||
@@ -785,7 +785,7 @@ async fn import_block(
|
||||
|
||||
overseer_send(
|
||||
overseer,
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
|
||||
ActivatedLeaf {
|
||||
hash: *new_head,
|
||||
number,
|
||||
@@ -1078,7 +1078,7 @@ fn blank_subsystem_act_on_bad_block() {
|
||||
|
||||
overseer_send(
|
||||
&mut virtual_overseer,
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: ApprovalVotingMessage::CheckAndImportAssignment(
|
||||
IndirectAssignmentCert {
|
||||
block_hash: bad_block_hash.clone(),
|
||||
@@ -1752,7 +1752,7 @@ fn linear_import_act_on_leaf() {
|
||||
|
||||
overseer_send(
|
||||
&mut virtual_overseer,
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: ApprovalVotingMessage::CheckAndImportAssignment(
|
||||
IndirectAssignmentCert {
|
||||
block_hash: head,
|
||||
@@ -1822,7 +1822,7 @@ fn forkful_import_at_same_height_act_on_leaf() {
|
||||
|
||||
overseer_send(
|
||||
&mut virtual_overseer,
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: ApprovalVotingMessage::CheckAndImportAssignment(
|
||||
IndirectAssignmentCert {
|
||||
block_hash: head,
|
||||
@@ -2219,7 +2219,7 @@ fn approved_ancestor_test(
|
||||
let (tx, rx) = oneshot::channel();
|
||||
overseer_send(
|
||||
&mut virtual_overseer,
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: ApprovalVotingMessage::ApprovedAncestor(target, 0, tx),
|
||||
},
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ use polkadot_node_primitives::{AvailableData, ErasureChunk};
|
||||
use polkadot_node_subsystem::{
|
||||
errors::{ChainApiError, RuntimeApiError},
|
||||
messages::{AvailabilityStoreMessage, ChainApiMessage},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
};
|
||||
use polkadot_node_subsystem_util as util;
|
||||
use polkadot_primitives::v2::{
|
||||
@@ -558,8 +558,8 @@ async fn run_iteration<Context>(
|
||||
select! {
|
||||
incoming = ctx.recv().fuse() => {
|
||||
match incoming.map_err(|_| Error::ContextChannelClosed)? {
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(true),
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(true),
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate { activated, .. })
|
||||
) => {
|
||||
for activated in activated.into_iter() {
|
||||
@@ -567,7 +567,7 @@ async fn run_iteration<Context>(
|
||||
process_block_activated(ctx, subsystem, activated.hash).await?;
|
||||
}
|
||||
}
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(hash, number)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(hash, number)) => {
|
||||
let _timer = subsystem.metrics.time_process_block_finalized();
|
||||
|
||||
subsystem.finalized_number = Some(number);
|
||||
@@ -579,7 +579,7 @@ async fn run_iteration<Context>(
|
||||
number,
|
||||
).await?;
|
||||
}
|
||||
FromOverseer::Communication { msg } => {
|
||||
FromOrchestra::Communication { msg } => {
|
||||
let _timer = subsystem.metrics.time_process_message();
|
||||
process_message(subsystem, msg)?;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ const TIMEOUT: Duration = Duration::from_millis(100);
|
||||
async fn overseer_send(overseer: &mut VirtualOverseer, msg: AvailabilityStoreMessage) {
|
||||
gum::trace!(meg = ?msg, "sending message");
|
||||
overseer
|
||||
.send(FromOverseer::Communication { msg })
|
||||
.send(FromOrchestra::Communication { msg })
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect(&format!("{:?} is more than enough for sending messages.", TIMEOUT));
|
||||
@@ -172,7 +172,7 @@ async fn overseer_recv_with_timeout(
|
||||
|
||||
async fn overseer_signal(overseer: &mut VirtualOverseer, signal: OverseerSignal) {
|
||||
overseer
|
||||
.send(FromOverseer::Signal(signal))
|
||||
.send(FromOrchestra::Signal(signal))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect(&format!("{:?} is more than enough for sending signals.", TIMEOUT));
|
||||
@@ -426,7 +426,7 @@ fn store_block_works() {
|
||||
tx,
|
||||
};
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: block_msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: block_msg }).await;
|
||||
assert_eq!(rx.await.unwrap(), Ok(()));
|
||||
|
||||
let pov = query_available_data(&mut virtual_overseer, candidate_hash).await.unwrap();
|
||||
@@ -479,7 +479,7 @@ fn store_pov_and_query_chunk_works() {
|
||||
tx,
|
||||
};
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: block_msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: block_msg }).await;
|
||||
|
||||
assert_eq!(rx.await.unwrap(), Ok(()));
|
||||
|
||||
@@ -525,7 +525,7 @@ fn query_all_chunks_works() {
|
||||
tx,
|
||||
};
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: block_msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: block_msg }).await;
|
||||
assert_eq!(rx.await.unwrap(), Ok(()));
|
||||
}
|
||||
|
||||
@@ -557,7 +557,7 @@ fn query_all_chunks_works() {
|
||||
};
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication { msg: store_chunk_msg })
|
||||
.send(FromOrchestra::Communication { msg: store_chunk_msg })
|
||||
.await;
|
||||
assert_eq!(rx.await.unwrap(), Ok(()));
|
||||
}
|
||||
@@ -566,7 +566,7 @@ fn query_all_chunks_works() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
let msg = AvailabilityStoreMessage::QueryAllChunks(candidate_hash_1, tx);
|
||||
virtual_overseer.send(FromOverseer::Communication { msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
assert_eq!(rx.await.unwrap().len(), n_validators as usize);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ fn query_all_chunks_works() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
let msg = AvailabilityStoreMessage::QueryAllChunks(candidate_hash_2, tx);
|
||||
virtual_overseer.send(FromOverseer::Communication { msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
assert_eq!(rx.await.unwrap().len(), 1);
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ fn query_all_chunks_works() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
let msg = AvailabilityStoreMessage::QueryAllChunks(candidate_hash_3, tx);
|
||||
virtual_overseer.send(FromOverseer::Communication { msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
assert_eq!(rx.await.unwrap().len(), 0);
|
||||
}
|
||||
virtual_overseer
|
||||
@@ -613,7 +613,7 @@ fn stored_but_not_included_data_is_pruned() {
|
||||
tx,
|
||||
};
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: block_msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: block_msg }).await;
|
||||
|
||||
rx.await.unwrap().unwrap();
|
||||
|
||||
@@ -665,7 +665,7 @@ fn stored_data_kept_until_finalized() {
|
||||
tx,
|
||||
};
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: block_msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: block_msg }).await;
|
||||
|
||||
rx.await.unwrap().unwrap();
|
||||
|
||||
@@ -900,7 +900,7 @@ fn forkfullness_works() {
|
||||
tx,
|
||||
};
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
|
||||
rx.await.unwrap().unwrap();
|
||||
|
||||
@@ -912,7 +912,7 @@ fn forkfullness_works() {
|
||||
tx,
|
||||
};
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
|
||||
rx.await.unwrap().unwrap();
|
||||
|
||||
@@ -1003,7 +1003,7 @@ async fn query_available_data(
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
let query = AvailabilityStoreMessage::QueryAvailableData(candidate_hash, tx);
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: query }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: query }).await;
|
||||
|
||||
rx.await.unwrap()
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ async fn query_chunk(
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
let query = AvailabilityStoreMessage::QueryChunk(candidate_hash, index, tx);
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: query }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: query }).await;
|
||||
|
||||
rx.await.unwrap()
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ use polkadot_node_subsystem::{
|
||||
CandidateValidationMessage, CollatorProtocolMessage, DisputeCoordinatorMessage,
|
||||
ProvisionableData, ProvisionerMessage, RuntimeApiRequest, StatementDistributionMessage,
|
||||
},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, PerLeafSpan, SpawnedSubsystem,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, PerLeafSpan, SpawnedSubsystem,
|
||||
Stage, SubsystemError,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{
|
||||
@@ -201,7 +201,7 @@ async fn run_iteration<Context>(
|
||||
}
|
||||
from_overseer = ctx.recv().fuse() => {
|
||||
match from_overseer? {
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => handle_active_leaves_update(
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => handle_active_leaves_update(
|
||||
&mut *ctx,
|
||||
update,
|
||||
jobs,
|
||||
@@ -209,9 +209,9 @@ async fn run_iteration<Context>(
|
||||
&background_validation_tx,
|
||||
&metrics,
|
||||
).await?,
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {}
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOverseer::Communication { msg } => handle_communication(&mut *ctx, jobs, msg).await?,
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {}
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOrchestra::Communication { msg } => handle_communication(&mut *ctx, jobs, msg).await?,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ use polkadot_node_subsystem::{
|
||||
AllMessages, CollatorProtocolMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
ValidationFailed,
|
||||
},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_primitives::v2::{
|
||||
@@ -169,7 +169,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
|
||||
futures::executor::block_on(future::join(
|
||||
async move {
|
||||
let mut virtual_overseer = test_fut.await;
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
},
|
||||
subsystem,
|
||||
));
|
||||
@@ -222,7 +222,7 @@ impl TestCandidateBuilder {
|
||||
async fn test_startup(virtual_overseer: &mut VirtualOverseer, test_state: &TestState) {
|
||||
// Start work on some new parent.
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
|
||||
ActivatedLeaf {
|
||||
hash: test_state.relay_parent,
|
||||
number: 1,
|
||||
@@ -330,7 +330,7 @@ fn backing_second_works() {
|
||||
pov.clone(),
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: second }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: second }).await;
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
@@ -391,7 +391,7 @@ fn backing_second_works() {
|
||||
);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(test_state.relay_parent),
|
||||
)))
|
||||
.await;
|
||||
@@ -467,7 +467,7 @@ fn backing_works() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -558,7 +558,7 @@ fn backing_works() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_b.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -569,7 +569,7 @@ fn backing_works() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(test_state.relay_parent),
|
||||
)))
|
||||
.await;
|
||||
@@ -662,7 +662,7 @@ fn backing_works_while_validation_ongoing() {
|
||||
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone());
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -709,7 +709,7 @@ fn backing_works_while_validation_ongoing() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_b.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -736,7 +736,7 @@ fn backing_works_while_validation_ongoing() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_c.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -753,7 +753,7 @@ fn backing_works_while_validation_ongoing() {
|
||||
tx,
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
|
||||
let candidates = rx.await.unwrap();
|
||||
assert_eq!(1, candidates.len());
|
||||
@@ -774,7 +774,7 @@ fn backing_works_while_validation_ongoing() {
|
||||
);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(test_state.relay_parent),
|
||||
)))
|
||||
.await;
|
||||
@@ -843,7 +843,7 @@ fn backing_misbehavior_works() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, seconded_2.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -935,7 +935,7 @@ fn backing_misbehavior_works() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, valid_2.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1024,7 +1024,7 @@ fn backing_dont_second_invalid() {
|
||||
pov_block_a.clone(),
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: second }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: second }).await;
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
@@ -1053,7 +1053,7 @@ fn backing_dont_second_invalid() {
|
||||
pov_block_b.clone(),
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: second }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: second }).await;
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
@@ -1108,7 +1108,7 @@ fn backing_dont_second_invalid() {
|
||||
);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(test_state.relay_parent),
|
||||
)))
|
||||
.await;
|
||||
@@ -1161,7 +1161,7 @@ fn backing_second_after_first_fails_works() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1208,7 +1208,7 @@ fn backing_second_after_first_fails_works() {
|
||||
pov.clone(),
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: second }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: second }).await;
|
||||
|
||||
let pov_to_second = PoV { block_data: BlockData(vec![3, 2, 1]) };
|
||||
|
||||
@@ -1232,7 +1232,7 @@ fn backing_second_after_first_fails_works() {
|
||||
// In order to trigger _some_ actions from subsystem ask it to second another
|
||||
// candidate. The only reason to do so is to make sure that no actions were
|
||||
// triggered on the prev step.
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: second }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: second }).await;
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
@@ -1295,7 +1295,7 @@ fn backing_works_after_failed_validation() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1343,7 +1343,7 @@ fn backing_works_after_failed_validation() {
|
||||
tx,
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
assert_eq!(rx.await.unwrap().len(), 0);
|
||||
virtual_overseer
|
||||
});
|
||||
@@ -1383,7 +1383,7 @@ fn backing_doesnt_second_wrong_collator() {
|
||||
pov.clone(),
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: second }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: second }).await;
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
@@ -1394,7 +1394,7 @@ fn backing_doesnt_second_wrong_collator() {
|
||||
);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(test_state.relay_parent),
|
||||
)))
|
||||
.await;
|
||||
@@ -1451,11 +1451,11 @@ fn validation_work_ignores_wrong_collator() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, seconding.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
// The statement will be ignored because it has the wrong collator.
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(test_state.relay_parent),
|
||||
)))
|
||||
.await;
|
||||
@@ -1613,7 +1613,7 @@ fn retry_works() {
|
||||
// Send in a `Statement` with a candidate.
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone());
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1640,7 +1640,7 @@ fn retry_works() {
|
||||
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_b.clone());
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1672,7 +1672,7 @@ fn retry_works() {
|
||||
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_c.clone());
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1799,12 +1799,12 @@ fn observes_backing_even_if_not_validator() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_a.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_b.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1829,7 +1829,7 @@ fn observes_backing_even_if_not_validator() {
|
||||
let statement =
|
||||
CandidateBackingMessage::Statement(test_state.relay_parent, signed_c.clone());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication { msg: statement }).await;
|
||||
virtual_overseer.send(FromOrchestra::Communication { msg: statement }).await;
|
||||
|
||||
test_dispute_coordinator_notifications(
|
||||
&mut virtual_overseer,
|
||||
@@ -1840,7 +1840,7 @@ fn observes_backing_even_if_not_validator() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(test_state.relay_parent),
|
||||
)))
|
||||
.await;
|
||||
|
||||
@@ -32,7 +32,7 @@ use polkadot_node_subsystem::{
|
||||
messages::{
|
||||
AvailabilityStoreMessage, BitfieldDistributionMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
},
|
||||
overseer, ActivatedLeaf, FromOverseer, LeafStatus, OverseerSignal, PerLeafSpan,
|
||||
overseer, ActivatedLeaf, FromOrchestra, LeafStatus, OverseerSignal, PerLeafSpan,
|
||||
SpawnedSubsystem, SubsystemError, SubsystemResult, SubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{self as util, Validator};
|
||||
@@ -217,7 +217,7 @@ async fn run<Context>(
|
||||
|
||||
loop {
|
||||
match ctx.recv().await? {
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
// Abort jobs for deactivated leaves.
|
||||
for leaf in &update.deactivated {
|
||||
if let Some(handle) = running.remove(leaf) {
|
||||
@@ -241,9 +241,9 @@ async fn run<Context>(
|
||||
ctx.spawn("bitfield-signing-job", fut.map(drop).boxed())?;
|
||||
}
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOverseer::Communication { .. } => {},
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOrchestra::Communication { .. } => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ use polkadot_node_subsystem::{
|
||||
CandidateValidationMessage, PreCheckOutcome, RuntimeApiMessage, RuntimeApiRequest,
|
||||
ValidationFailed,
|
||||
},
|
||||
overseer, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError, SubsystemResult,
|
||||
overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError, SubsystemResult,
|
||||
SubsystemSender,
|
||||
};
|
||||
use polkadot_parachain::primitives::{ValidationParams, ValidationResult as WasmValidationResult};
|
||||
@@ -125,10 +125,10 @@ async fn run<Context>(
|
||||
|
||||
loop {
|
||||
match ctx.recv().await? {
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(_)) => {},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(_)) => {},
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOrchestra::Communication { msg } => match msg {
|
||||
CandidateValidationMessage::ValidateFromChainState(
|
||||
candidate_receipt,
|
||||
pov,
|
||||
|
||||
@@ -38,7 +38,7 @@ use sc_client_api::AuxStore;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
|
||||
use polkadot_node_subsystem::{
|
||||
messages::ChainApiMessage, overseer, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
messages::ChainApiMessage, overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem,
|
||||
SubsystemError, SubsystemResult,
|
||||
};
|
||||
use polkadot_primitives::v2::{Block, BlockId};
|
||||
@@ -87,10 +87,10 @@ where
|
||||
{
|
||||
loop {
|
||||
match ctx.recv().await? {
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(_)) => {},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(_)) => {},
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOrchestra::Communication { msg } => match msg {
|
||||
ChainApiMessage::BlockNumber(hash, response_channel) => {
|
||||
let _timer = subsystem.metrics.time_block_number();
|
||||
let result = subsystem.client.number(hash).map_err(|e| e.to_string().into());
|
||||
|
||||
@@ -184,7 +184,7 @@ fn request_block_number() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::BlockNumber(*hash, tx),
|
||||
})
|
||||
.await;
|
||||
@@ -192,7 +192,7 @@ fn request_block_number() {
|
||||
assert_eq!(rx.await.unwrap().unwrap(), *expected);
|
||||
}
|
||||
|
||||
sender.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
sender.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
.boxed()
|
||||
})
|
||||
@@ -211,7 +211,7 @@ fn request_block_header() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::BlockHeader(*hash, tx),
|
||||
})
|
||||
.await;
|
||||
@@ -219,7 +219,7 @@ fn request_block_header() {
|
||||
assert_eq!(rx.await.unwrap().unwrap(), *expected);
|
||||
}
|
||||
|
||||
sender.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
sender.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
.boxed()
|
||||
})
|
||||
@@ -239,7 +239,7 @@ fn request_block_weight() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::BlockWeight(*hash, tx),
|
||||
})
|
||||
.await;
|
||||
@@ -247,7 +247,7 @@ fn request_block_weight() {
|
||||
assert_eq!(rx.await.unwrap().unwrap(), *expected);
|
||||
}
|
||||
|
||||
sender.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
sender.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
.boxed()
|
||||
})
|
||||
@@ -265,7 +265,7 @@ fn request_finalized_hash() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::FinalizedBlockHash(*number, tx),
|
||||
})
|
||||
.await;
|
||||
@@ -273,7 +273,7 @@ fn request_finalized_hash() {
|
||||
assert_eq!(rx.await.unwrap().unwrap(), *expected);
|
||||
}
|
||||
|
||||
sender.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
sender.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
.boxed()
|
||||
})
|
||||
@@ -287,14 +287,14 @@ fn request_last_finalized_number() {
|
||||
|
||||
let expected = client.info().finalized_number;
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::FinalizedBlockNumber(tx),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), expected);
|
||||
|
||||
sender.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
sender.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
.boxed()
|
||||
})
|
||||
@@ -306,7 +306,7 @@ fn request_ancestors() {
|
||||
async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::Ancestors { hash: THREE, k: 4, response_channel: tx },
|
||||
})
|
||||
.await;
|
||||
@@ -315,7 +315,7 @@ fn request_ancestors() {
|
||||
// Limit the number of ancestors.
|
||||
let (tx, rx) = oneshot::channel();
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::Ancestors { hash: TWO, k: 1, response_channel: tx },
|
||||
})
|
||||
.await;
|
||||
@@ -324,7 +324,7 @@ fn request_ancestors() {
|
||||
// Ancestor of block #1 is returned.
|
||||
let (tx, rx) = oneshot::channel();
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::Ancestors { hash: ONE, k: 10, response_channel: tx },
|
||||
})
|
||||
.await;
|
||||
@@ -333,7 +333,7 @@ fn request_ancestors() {
|
||||
// No ancestors of genesis block.
|
||||
let (tx, rx) = oneshot::channel();
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::Ancestors { hash: GENESIS, k: 10, response_channel: tx },
|
||||
})
|
||||
.await;
|
||||
@@ -341,7 +341,7 @@ fn request_ancestors() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
sender
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainApiMessage::Ancestors {
|
||||
hash: ERROR_PATH,
|
||||
k: 2,
|
||||
@@ -351,7 +351,7 @@ fn request_ancestors() {
|
||||
.await;
|
||||
assert!(rx.await.unwrap().is_err());
|
||||
|
||||
sender.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
sender.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
.boxed()
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ use polkadot_node_subsystem::{
|
||||
errors::ChainApiError,
|
||||
messages::{ChainApiMessage, ChainSelectionMessage},
|
||||
overseer::{self, SubsystemSender},
|
||||
FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
};
|
||||
use polkadot_node_subsystem_util::database::Database;
|
||||
use polkadot_primitives::v2::{BlockNumber, ConsensusLog, Hash, Header};
|
||||
@@ -392,10 +392,10 @@ where
|
||||
msg = ctx.recv().fuse() => {
|
||||
let msg = msg?;
|
||||
match msg {
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => {
|
||||
return Ok(())
|
||||
}
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
for leaf in update.activated {
|
||||
let write_ops = handle_active_leaf(
|
||||
ctx.sender(),
|
||||
@@ -407,10 +407,10 @@ where
|
||||
backend.write(write_ops)?;
|
||||
}
|
||||
}
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(h, n)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n)) => {
|
||||
handle_finalized_block(backend, h, n)?
|
||||
}
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
FromOrchestra::Communication { msg } => match msg {
|
||||
ChainSelectionMessage::Approved(hash) => {
|
||||
handle_approved_block(backend, hash)?
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ async fn assert_leaves_query(virtual_overseer: &mut VirtualOverseer, leaves: Vec
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication { msg: ChainSelectionMessage::Leaves(tx) })
|
||||
.send(FromOrchestra::Communication { msg: ChainSelectionMessage::Leaves(tx) })
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap(), leaves);
|
||||
@@ -598,7 +598,7 @@ async fn assert_finalized_leaves_query(
|
||||
) {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication { msg: ChainSelectionMessage::Leaves(tx) })
|
||||
.send(FromOrchestra::Communication { msg: ChainSelectionMessage::Leaves(tx) })
|
||||
.await;
|
||||
|
||||
answer_finalized_block_info(virtual_overseer, finalized_number, finalized_hash).await;
|
||||
@@ -612,7 +612,7 @@ async fn best_leaf_containing(
|
||||
) -> Option<Hash> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainSelectionMessage::BestLeafContaining(required, tx),
|
||||
})
|
||||
.await;
|
||||
@@ -627,7 +627,7 @@ async fn approve_block(
|
||||
) {
|
||||
let (_, write_rx) = backend.await_next_write();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication { msg: ChainSelectionMessage::Approved(approved) })
|
||||
.send(FromOrchestra::Communication { msg: ChainSelectionMessage::Approved(approved) })
|
||||
.await;
|
||||
|
||||
write_rx.await.unwrap()
|
||||
@@ -1709,7 +1709,9 @@ fn approve_nonexistent_has_no_effect() {
|
||||
|
||||
let nonexistent = Hash::repeat_byte(1);
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication { msg: ChainSelectionMessage::Approved(nonexistent) })
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: ChainSelectionMessage::Approved(nonexistent),
|
||||
})
|
||||
.await;
|
||||
|
||||
// None are approved.
|
||||
|
||||
@@ -34,7 +34,7 @@ use polkadot_node_subsystem::{
|
||||
BlockDescription, DisputeCoordinatorMessage, DisputeDistributionMessage,
|
||||
ImportStatementsResult,
|
||||
},
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, OverseerSignal,
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, OverseerSignal,
|
||||
};
|
||||
use polkadot_node_subsystem_util::rolling_session_window::{
|
||||
RollingSessionWindow, SessionWindowUpdate, SessionsUnavailable,
|
||||
@@ -220,8 +220,8 @@ impl Initialized {
|
||||
default_confirm
|
||||
},
|
||||
MuxedMessage::Subsystem(msg) => match msg {
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
self.process_active_leaves_update(
|
||||
ctx,
|
||||
&mut overlay_db,
|
||||
@@ -231,11 +231,11 @@ impl Initialized {
|
||||
.await?;
|
||||
default_confirm
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(_, n)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, n)) => {
|
||||
self.scraper.process_finalized_block(&n);
|
||||
default_confirm
|
||||
},
|
||||
FromOverseer::Communication { msg } =>
|
||||
FromOrchestra::Communication { msg } =>
|
||||
self.handle_incoming(ctx, &mut overlay_db, msg, clock.now()).await?,
|
||||
},
|
||||
};
|
||||
@@ -1044,7 +1044,7 @@ impl Initialized {
|
||||
/// Messages to be handled in this subsystem.
|
||||
enum MuxedMessage {
|
||||
/// Messages from other subsystems.
|
||||
Subsystem(FromOverseer<DisputeCoordinatorMessage>),
|
||||
Subsystem(FromOrchestra<DisputeCoordinatorMessage>),
|
||||
/// Messages from participation workers.
|
||||
Participation(participation::WorkerMessage),
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ use sc_keystore::LocalKeystore;
|
||||
|
||||
use polkadot_node_primitives::{CandidateVotes, DISPUTE_WINDOW};
|
||||
use polkadot_node_subsystem::{
|
||||
overseer, ActivatedLeaf, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
overseer, ActivatedLeaf, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{
|
||||
database::Database, rolling_session_window::RollingSessionWindow,
|
||||
@@ -369,14 +369,14 @@ async fn get_rolling_session_window<Context>(
|
||||
async fn wait_for_first_leaf<Context>(ctx: &mut Context) -> Result<Option<ActivatedLeaf>> {
|
||||
loop {
|
||||
match ctx.recv().await? {
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(None),
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(None),
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
if let Some(activated) = update.activated {
|
||||
return Ok(Some(activated))
|
||||
}
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(_, _)) => {},
|
||||
FromOverseer::Communication { msg } =>
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, _)) => {},
|
||||
FromOrchestra::Communication { msg } =>
|
||||
// NOTE: We could technically actually handle a couple of message types, even if
|
||||
// not initialized (e.g. all requests that only query the database). The problem
|
||||
// is, we would deliver potentially outdated information, especially in the event
|
||||
|
||||
@@ -33,7 +33,7 @@ use polkadot_node_subsystem::{
|
||||
AllMessages, DisputeCoordinatorMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
ValidationFailed,
|
||||
},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SpawnGlue,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
make_subsystem_context, TestSubsystemContext, TestSubsystemContextHandle,
|
||||
@@ -45,12 +45,12 @@ use polkadot_primitives::v2::{
|
||||
type VirtualOverseer = TestSubsystemContextHandle<DisputeCoordinatorMessage>;
|
||||
|
||||
pub fn make_our_subsystem_context<S>(
|
||||
spawn: S,
|
||||
spawner: S,
|
||||
) -> (
|
||||
TestSubsystemContext<DisputeCoordinatorMessage, S>,
|
||||
TestSubsystemContext<DisputeCoordinatorMessage, SpawnGlue<S>>,
|
||||
TestSubsystemContextHandle<DisputeCoordinatorMessage>,
|
||||
) {
|
||||
make_subsystem_context(spawn)
|
||||
make_subsystem_context(spawner)
|
||||
}
|
||||
|
||||
#[overseer::contextbounds(DisputeCoordinator, prefix = self::overseer)]
|
||||
|
||||
@@ -29,7 +29,7 @@ use polkadot_node_subsystem::{
|
||||
AllMessages, ChainApiMessage, DisputeCoordinatorMessage, RuntimeApiMessage,
|
||||
RuntimeApiRequest,
|
||||
},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SpawnGlue,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
make_subsystem_context, TestSubsystemContext, TestSubsystemContextHandle, TestSubsystemSender,
|
||||
@@ -59,7 +59,7 @@ async fn overseer_recv(virtual_overseer: &mut VirtualOverseer) -> AllMessages {
|
||||
struct TestState {
|
||||
chain: Vec<Hash>,
|
||||
scraper: ChainScraper,
|
||||
ctx: TestSubsystemContext<DisputeCoordinatorMessage, TaskExecutor>,
|
||||
ctx: TestSubsystemContext<DisputeCoordinatorMessage, SpawnGlue<TaskExecutor>>,
|
||||
}
|
||||
|
||||
impl TestState {
|
||||
|
||||
@@ -37,7 +37,7 @@ use polkadot_node_subsystem::{
|
||||
ChainApiMessage, DisputeCoordinatorMessage, DisputeDistributionMessage,
|
||||
ImportStatementsResult,
|
||||
},
|
||||
overseer::FromOverseer,
|
||||
overseer::FromOrchestra,
|
||||
OverseerSignal,
|
||||
};
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
@@ -225,7 +225,7 @@ impl TestState {
|
||||
|
||||
gum::debug!(?block_number, "Activating block in activate_leaf_at_session.");
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: block_hash,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
@@ -347,7 +347,7 @@ impl TestState {
|
||||
"Activating block in handle resume sync."
|
||||
);
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: *leaf,
|
||||
number: n as u32,
|
||||
@@ -511,7 +511,7 @@ fn too_many_unconfirmed_statements_are_considered_spam() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash: candidate_hash1,
|
||||
candidate_receipt: candidate_receipt1.clone(),
|
||||
@@ -531,7 +531,7 @@ fn too_many_unconfirmed_statements_are_considered_spam() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -540,7 +540,7 @@ fn too_many_unconfirmed_statements_are_considered_spam() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash1)],
|
||||
tx,
|
||||
@@ -555,7 +555,7 @@ fn too_many_unconfirmed_statements_are_considered_spam() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash: candidate_hash2,
|
||||
candidate_receipt: candidate_receipt2.clone(),
|
||||
@@ -572,7 +572,7 @@ fn too_many_unconfirmed_statements_are_considered_spam() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash2)],
|
||||
tx,
|
||||
@@ -586,7 +586,7 @@ fn too_many_unconfirmed_statements_are_considered_spam() {
|
||||
// Result should be invalid, because it should be considered spam.
|
||||
assert_matches!(confirmation_rx.await, Ok(ImportStatementsResult::InvalidImport));
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
|
||||
// No more messages expected:
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
@@ -628,7 +628,7 @@ fn dispute_gets_confirmed_via_participation() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash: candidate_hash1,
|
||||
candidate_receipt: candidate_receipt1.clone(),
|
||||
@@ -652,7 +652,7 @@ fn dispute_gets_confirmed_via_participation() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -661,7 +661,7 @@ fn dispute_gets_confirmed_via_participation() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash1)],
|
||||
tx,
|
||||
@@ -676,7 +676,7 @@ fn dispute_gets_confirmed_via_participation() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash: candidate_hash2,
|
||||
candidate_receipt: candidate_receipt2.clone(),
|
||||
@@ -695,7 +695,7 @@ fn dispute_gets_confirmed_via_participation() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash2)],
|
||||
tx,
|
||||
@@ -711,7 +711,7 @@ fn dispute_gets_confirmed_via_participation() {
|
||||
// Result should be valid, because our node participated, so spam slots are cleared:
|
||||
assert_matches!(confirmation_rx.await, Ok(ImportStatementsResult::ValidImport));
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
|
||||
// No more messages expected:
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
@@ -761,7 +761,7 @@ fn dispute_gets_confirmed_at_byzantine_threshold() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash: candidate_hash1,
|
||||
candidate_receipt: candidate_receipt1.clone(),
|
||||
@@ -782,7 +782,7 @@ fn dispute_gets_confirmed_at_byzantine_threshold() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -791,7 +791,7 @@ fn dispute_gets_confirmed_at_byzantine_threshold() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash1)],
|
||||
tx,
|
||||
@@ -806,7 +806,7 @@ fn dispute_gets_confirmed_at_byzantine_threshold() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash: candidate_hash2,
|
||||
candidate_receipt: candidate_receipt2.clone(),
|
||||
@@ -825,7 +825,7 @@ fn dispute_gets_confirmed_at_byzantine_threshold() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash2)],
|
||||
tx,
|
||||
@@ -842,7 +842,7 @@ fn dispute_gets_confirmed_at_byzantine_threshold() {
|
||||
// import, so spam slots are cleared:
|
||||
assert_matches!(confirmation_rx.await, Ok(ImportStatementsResult::ValidImport));
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
|
||||
// No more messages expected:
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
@@ -873,7 +873,7 @@ fn backing_statements_import_works_and_no_spam() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -892,7 +892,7 @@ fn backing_statements_import_works_and_no_spam() {
|
||||
// Just backing votes - we should not have any active disputes now.
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -901,7 +901,7 @@ fn backing_statements_import_works_and_no_spam() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash)],
|
||||
tx,
|
||||
@@ -927,7 +927,7 @@ fn backing_statements_import_works_and_no_spam() {
|
||||
// Backing vote import should not have accounted to spam slots, so this should succeed
|
||||
// as well:
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -944,7 +944,7 @@ fn backing_statements_import_works_and_no_spam() {
|
||||
// Result should be valid, because our node participated, so spam slots are cleared:
|
||||
assert_matches!(confirmation_rx.await, Ok(ImportStatementsResult::ValidImport));
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
|
||||
// No more messages expected:
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
@@ -980,7 +980,7 @@ fn conflicting_votes_lead_to_dispute_participation() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1004,7 +1004,7 @@ fn conflicting_votes_lead_to_dispute_participation() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1013,7 +1013,7 @@ fn conflicting_votes_lead_to_dispute_participation() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash)],
|
||||
tx,
|
||||
@@ -1027,7 +1027,7 @@ fn conflicting_votes_lead_to_dispute_participation() {
|
||||
}
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1041,7 +1041,7 @@ fn conflicting_votes_lead_to_dispute_participation() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash)],
|
||||
tx,
|
||||
@@ -1054,7 +1054,7 @@ fn conflicting_votes_lead_to_dispute_participation() {
|
||||
assert_eq!(votes.invalid.len(), 2);
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
|
||||
// This confirms that the second vote doesn't lead to participation again.
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
@@ -1086,7 +1086,7 @@ fn positive_votes_dont_trigger_participation() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1100,7 +1100,7 @@ fn positive_votes_dont_trigger_participation() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1109,7 +1109,7 @@ fn positive_votes_dont_trigger_participation() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash)],
|
||||
tx,
|
||||
@@ -1123,7 +1123,7 @@ fn positive_votes_dont_trigger_participation() {
|
||||
}
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1137,7 +1137,7 @@ fn positive_votes_dont_trigger_participation() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1146,7 +1146,7 @@ fn positive_votes_dont_trigger_participation() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash)],
|
||||
tx,
|
||||
@@ -1159,7 +1159,7 @@ fn positive_votes_dont_trigger_participation() {
|
||||
assert!(votes.invalid.is_empty());
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
|
||||
// This confirms that no participation request is made.
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
@@ -1191,7 +1191,7 @@ fn wrong_validator_index_is_ignored() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1208,7 +1208,7 @@ fn wrong_validator_index_is_ignored() {
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1217,7 +1217,7 @@ fn wrong_validator_index_is_ignored() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::QueryCandidateVotes(
|
||||
vec![(session, candidate_hash)],
|
||||
tx,
|
||||
@@ -1230,7 +1230,7 @@ fn wrong_validator_index_is_ignored() {
|
||||
assert!(votes.invalid.is_empty());
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
|
||||
// This confirms that no participation request is made.
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
@@ -1262,7 +1262,7 @@ fn finality_votes_ignore_disputed_candidates() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1291,7 +1291,7 @@ fn finality_votes_ignore_disputed_candidates() {
|
||||
let block_hash_b = Hash::repeat_byte(0x0b);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::DetermineUndisputedChain {
|
||||
base: (10, base_block),
|
||||
block_descriptions: vec![BlockDescription {
|
||||
@@ -1308,7 +1308,7 @@ fn finality_votes_ignore_disputed_candidates() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::DetermineUndisputedChain {
|
||||
base: (10, base_block),
|
||||
block_descriptions: vec![
|
||||
@@ -1331,7 +1331,7 @@ fn finality_votes_ignore_disputed_candidates() {
|
||||
assert_eq!(rx.await.unwrap(), (11, block_hash_a));
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1364,7 +1364,7 @@ fn supermajority_valid_dispute_may_be_finalized() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1395,7 +1395,7 @@ fn supermajority_valid_dispute_may_be_finalized() {
|
||||
}
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1414,7 +1414,7 @@ fn supermajority_valid_dispute_may_be_finalized() {
|
||||
let block_hash_b = Hash::repeat_byte(0x0b);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::DetermineUndisputedChain {
|
||||
base: (10, base_hash),
|
||||
block_descriptions: vec![BlockDescription {
|
||||
@@ -1431,7 +1431,7 @@ fn supermajority_valid_dispute_may_be_finalized() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::DetermineUndisputedChain {
|
||||
base: (10, base_hash),
|
||||
block_descriptions: vec![
|
||||
@@ -1454,7 +1454,7 @@ fn supermajority_valid_dispute_may_be_finalized() {
|
||||
assert_eq!(rx.await.unwrap(), (12, block_hash_b));
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1487,7 +1487,7 @@ fn concluded_supermajority_for_non_active_after_time() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1519,7 +1519,7 @@ fn concluded_supermajority_for_non_active_after_time() {
|
||||
}
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1536,7 +1536,7 @@ fn concluded_supermajority_for_non_active_after_time() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1546,7 +1546,7 @@ fn concluded_supermajority_for_non_active_after_time() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::RecentDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1554,7 +1554,7 @@ fn concluded_supermajority_for_non_active_after_time() {
|
||||
assert_eq!(rx.await.unwrap().len(), 1);
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1589,7 +1589,7 @@ fn concluded_supermajority_against_non_active_after_time() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1625,7 +1625,7 @@ fn concluded_supermajority_against_non_active_after_time() {
|
||||
}
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1642,7 +1642,7 @@ fn concluded_supermajority_against_non_active_after_time() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1651,7 +1651,7 @@ fn concluded_supermajority_against_non_active_after_time() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::RecentDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1659,7 +1659,7 @@ fn concluded_supermajority_against_non_active_after_time() {
|
||||
assert_eq!(rx.await.unwrap().len(), 1);
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert_matches!(
|
||||
virtual_overseer.try_recv().await,
|
||||
None => {}
|
||||
@@ -1693,7 +1693,7 @@ fn resume_dispute_without_local_statement() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1716,7 +1716,7 @@ fn resume_dispute_without_local_statement() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1724,7 +1724,7 @@ fn resume_dispute_without_local_statement() {
|
||||
assert_eq!(rx.await.unwrap().len(), 1);
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1766,7 +1766,7 @@ fn resume_dispute_without_local_statement() {
|
||||
.await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1792,7 +1792,7 @@ fn resume_dispute_without_local_statement() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1800,7 +1800,7 @@ fn resume_dispute_without_local_statement() {
|
||||
assert!(rx.await.unwrap().is_empty());
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1835,7 +1835,7 @@ fn resume_dispute_with_local_statement() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1856,7 +1856,7 @@ fn resume_dispute_with_local_statement() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1864,7 +1864,7 @@ fn resume_dispute_with_local_statement() {
|
||||
assert_eq!(rx.await.unwrap().len(), 1);
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1879,7 +1879,7 @@ fn resume_dispute_with_local_statement() {
|
||||
// Assert that subsystem is not sending Participation messages because we issued a local statement
|
||||
assert!(virtual_overseer.recv().timeout(TEST_TIMEOUT).await.is_none());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1913,7 +1913,7 @@ fn resume_dispute_without_local_statement_or_local_key() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -1933,7 +1933,7 @@ fn resume_dispute_without_local_statement_or_local_key() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -1941,7 +1941,7 @@ fn resume_dispute_without_local_statement_or_local_key() {
|
||||
assert_eq!(rx.await.unwrap().len(), 1);
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert_matches!(
|
||||
virtual_overseer.try_recv().await,
|
||||
None => {}
|
||||
@@ -1959,7 +1959,7 @@ fn resume_dispute_without_local_statement_or_local_key() {
|
||||
// Assert that subsystem is not sending Participation messages because we issued a local statement
|
||||
assert!(virtual_overseer.recv().timeout(TEST_TIMEOUT).await.is_none());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -1995,7 +1995,7 @@ fn resume_dispute_with_local_statement_without_local_key() {
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -2016,7 +2016,7 @@ fn resume_dispute_with_local_statement_without_local_key() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ActiveDisputes(tx),
|
||||
})
|
||||
.await;
|
||||
@@ -2024,7 +2024,7 @@ fn resume_dispute_with_local_statement_without_local_key() {
|
||||
assert_eq!(rx.await.unwrap().len(), 1);
|
||||
}
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -2043,7 +2043,7 @@ fn resume_dispute_with_local_statement_without_local_key() {
|
||||
// have a key.
|
||||
assert!(virtual_overseer.recv().timeout(TEST_TIMEOUT).await.is_none());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -2079,7 +2079,7 @@ fn issue_local_statement_does_cause_distribution_but_not_duplicate_participation
|
||||
|
||||
let (pending_confirmation, confirmation_rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -2094,7 +2094,7 @@ fn issue_local_statement_does_cause_distribution_but_not_duplicate_participation
|
||||
|
||||
// Initiate dispute locally:
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::IssueLocalStatement(
|
||||
session,
|
||||
candidate_hash,
|
||||
@@ -2118,7 +2118,7 @@ fn issue_local_statement_does_cause_distribution_but_not_duplicate_participation
|
||||
// Make sure we won't participate:
|
||||
assert!(virtual_overseer.recv().timeout(TEST_TIMEOUT).await.is_none());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -2140,7 +2140,7 @@ fn negative_issue_local_statement_only_triggers_import() {
|
||||
test_state.activate_leaf_at_session(&mut virtual_overseer, session, 1).await;
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::IssueLocalStatement(
|
||||
session,
|
||||
candidate_hash,
|
||||
@@ -2162,7 +2162,7 @@ fn negative_issue_local_statement_only_triggers_import() {
|
||||
// Assert that subsystem is not participating.
|
||||
assert!(virtual_overseer.recv().timeout(TEST_TIMEOUT).await.is_none());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -2185,7 +2185,7 @@ fn empty_import_still_writes_candidate_receipt() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -2205,7 +2205,7 @@ fn empty_import_still_writes_candidate_receipt() {
|
||||
assert_eq!(votes.valid.len(), 0);
|
||||
assert_eq!(votes.candidate_receipt, candidate_receipt);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
@@ -2236,7 +2236,7 @@ fn redundant_votes_ignored() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -2251,7 +2251,7 @@ fn redundant_votes_ignored() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeCoordinatorMessage::ImportStatements {
|
||||
candidate_hash,
|
||||
candidate_receipt: candidate_receipt.clone(),
|
||||
@@ -2271,7 +2271,7 @@ fn redundant_votes_ignored() {
|
||||
assert_eq!(votes.valid.len(), 1);
|
||||
assert_eq!(&votes.valid[0].2, valid_vote.validator_signature());
|
||||
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
assert!(virtual_overseer.try_recv().await.is_none());
|
||||
|
||||
test_state
|
||||
|
||||
@@ -23,7 +23,7 @@ use futures::{channel::oneshot, future::BoxFuture, prelude::*, stream::FuturesUn
|
||||
|
||||
use polkadot_node_subsystem::{
|
||||
messages::{CandidateValidationMessage, PreCheckOutcome, PvfCheckerMessage, RuntimeApiMessage},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
SubsystemResult, SubsystemSender,
|
||||
};
|
||||
use polkadot_primitives::v2::{
|
||||
@@ -244,22 +244,22 @@ async fn handle_from_overseer(
|
||||
sender: &mut impl overseer::PvfCheckerSenderTrait,
|
||||
keystore: &SyncCryptoStorePtr,
|
||||
metrics: &Metrics,
|
||||
from_overseer: FromOverseer<PvfCheckerMessage>,
|
||||
from_overseer: FromOrchestra<PvfCheckerMessage>,
|
||||
) -> Option<Conclude> {
|
||||
match from_overseer {
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => {
|
||||
gum::info!(target: LOG_TARGET, "Received `Conclude` signal, exiting");
|
||||
Some(Conclude)
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(_, _)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, _)) => {
|
||||
// ignore
|
||||
None
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
handle_leaves_update(state, sender, keystore, metrics, update).await;
|
||||
None
|
||||
},
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
FromOrchestra::Communication { msg } => match msg {
|
||||
// uninhabited type, thus statically unreachable.
|
||||
},
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use polkadot_node_subsystem::{
|
||||
AllMessages, CandidateValidationMessage, PreCheckOutcome, PvfCheckerMessage,
|
||||
RuntimeApiMessage, RuntimeApiRequest,
|
||||
},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal, RuntimeApiError,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal, RuntimeApiError,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
|
||||
use polkadot_primitives::v2::{
|
||||
@@ -134,7 +134,7 @@ impl TestState {
|
||||
},
|
||||
}
|
||||
|
||||
handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
|
||||
/// Convenience function to invoke [`active_leaves_update`] with the new leaf that starts a new
|
||||
@@ -206,7 +206,7 @@ impl TestState {
|
||||
};
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated,
|
||||
deactivated: deactivated.into_iter().cloned().collect(),
|
||||
})))
|
||||
|
||||
@@ -12,7 +12,6 @@ parity-util-mem = { version = "0.11.0", default-features = false }
|
||||
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
polkadot-primitives = { path = "../../../primitives" }
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
use polkadot_node_subsystem::{
|
||||
errors::RuntimeApiError,
|
||||
messages::{RuntimeApiMessage, RuntimeApiRequest as Request},
|
||||
overseer, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError, SubsystemResult,
|
||||
overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError, SubsystemResult,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
runtime_api::ParachainHost,
|
||||
@@ -35,7 +35,6 @@ use polkadot_primitives::{
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_authority_discovery::AuthorityDiscoveryApi;
|
||||
use sp_consensus_babe::BabeApi;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
use cache::{RequestResult, RequestResultCache};
|
||||
use futures::{channel::oneshot, prelude::*, select, stream::FuturesUnordered};
|
||||
@@ -62,7 +61,7 @@ const API_REQUEST_TASK_NAME: &str = "polkadot-runtime-api-request";
|
||||
pub struct RuntimeApiSubsystem<Client> {
|
||||
client: Arc<Client>,
|
||||
metrics: Metrics,
|
||||
spawn_handle: Box<dyn SpawnNamed>,
|
||||
spawn_handle: Box<dyn overseer::gen::Spawner>,
|
||||
/// All the active runtime API requests that are currently being executed.
|
||||
active_requests: FuturesUnordered<oneshot::Receiver<Option<RequestResult>>>,
|
||||
/// Requests results cache
|
||||
@@ -74,12 +73,12 @@ impl<Client> RuntimeApiSubsystem<Client> {
|
||||
pub fn new(
|
||||
client: Arc<Client>,
|
||||
metrics: Metrics,
|
||||
spawn_handle: impl SpawnNamed + 'static,
|
||||
spawner: impl overseer::gen::Spawner + 'static,
|
||||
) -> Self {
|
||||
RuntimeApiSubsystem {
|
||||
client,
|
||||
metrics,
|
||||
spawn_handle: Box::new(spawn_handle),
|
||||
spawn_handle: Box::new(spawner),
|
||||
active_requests: Default::default(),
|
||||
requests_cache: RequestResultCache::default(),
|
||||
}
|
||||
@@ -335,10 +334,10 @@ where
|
||||
|
||||
select! {
|
||||
req = ctx.recv().fuse() => match req? {
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(_)) => {},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(_)) => {},
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOrchestra::Communication { msg } => match msg {
|
||||
RuntimeApiMessage::Request(relay_parent, request) => {
|
||||
subsystem.spawn_request(relay_parent, request);
|
||||
},
|
||||
|
||||
@@ -18,6 +18,7 @@ use super::*;
|
||||
|
||||
use ::test_helpers::{dummy_committed_candidate_receipt, dummy_validation_code};
|
||||
use polkadot_node_primitives::{BabeAllowedSlots, BabeEpoch, BabeEpochConfiguration};
|
||||
use polkadot_node_subsystem::SpawnGlue;
|
||||
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, BlockNumber, CandidateEvent, CandidateHash, CommittedCandidateReceipt,
|
||||
@@ -241,20 +242,21 @@ fn requests_authorities() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::Authorities(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), runtime_api.authorities);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -267,20 +269,21 @@ fn requests_validators() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::Validators(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), runtime_api.validators);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -293,20 +296,21 @@ fn requests_validator_groups() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::ValidatorGroups(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap().0, runtime_api.validator_groups);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -319,20 +323,21 @@ fn requests_availability_cores() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::AvailabilityCores(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), runtime_api.availability_cores);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -350,13 +355,14 @@ fn requests_persisted_validation_data() {
|
||||
runtime_api.validation_data.insert(para_a, Default::default());
|
||||
let runtime_api = Arc::new(runtime_api);
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::PersistedValidationData(para_a, OccupiedCoreAssumption::Included, tx),
|
||||
@@ -368,7 +374,7 @@ fn requests_persisted_validation_data() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::PersistedValidationData(para_b, OccupiedCoreAssumption::Included, tx),
|
||||
@@ -378,7 +384,7 @@ fn requests_persisted_validation_data() {
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), None);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -402,13 +408,14 @@ fn requests_assumed_validation_data() {
|
||||
runtime_api.validation_data.insert(para_b, Default::default());
|
||||
let runtime_api = Arc::new(runtime_api);
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::AssumedValidationData(para_a, expected_data_hash, tx),
|
||||
@@ -420,7 +427,7 @@ fn requests_assumed_validation_data() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::AssumedValidationData(para_a, Hash::zero(), tx),
|
||||
@@ -430,7 +437,7 @@ fn requests_assumed_validation_data() {
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), None);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -451,13 +458,14 @@ fn requests_check_validation_outputs() {
|
||||
|
||||
let runtime_api = Arc::new(runtime_api);
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::CheckValidationOutputs(para_a, commitments.clone(), tx),
|
||||
@@ -468,7 +476,7 @@ fn requests_check_validation_outputs() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::CheckValidationOutputs(para_b, commitments, tx),
|
||||
@@ -477,7 +485,7 @@ fn requests_check_validation_outputs() {
|
||||
.await;
|
||||
assert_eq!(rx.await.unwrap().unwrap(), runtime_api.validation_outputs_results[¶_b]);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -490,20 +498,21 @@ fn requests_session_index_for_child() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::SessionIndexForChild(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), runtime_api.session_index_for_child);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -537,13 +546,14 @@ fn requests_session_info() {
|
||||
|
||||
let relay_parent = [1; 32].into();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::SessionInfo(session_index, tx),
|
||||
@@ -553,7 +563,7 @@ fn requests_session_info() {
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), Some(dummy_session_info()));
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -573,13 +583,14 @@ fn requests_validation_code() {
|
||||
runtime_api.validation_code.insert(para_a, validation_code.clone());
|
||||
let runtime_api = Arc::new(runtime_api);
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::ValidationCode(para_a, OccupiedCoreAssumption::Included, tx),
|
||||
@@ -591,7 +602,7 @@ fn requests_validation_code() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::ValidationCode(para_b, OccupiedCoreAssumption::Included, tx),
|
||||
@@ -601,7 +612,7 @@ fn requests_validation_code() {
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), None);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -622,13 +633,14 @@ fn requests_candidate_pending_availability() {
|
||||
.insert(para_a, candidate_receipt.clone());
|
||||
let runtime_api = Arc::new(runtime_api);
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::CandidatePendingAvailability(para_a, tx),
|
||||
@@ -641,7 +653,7 @@ fn requests_candidate_pending_availability() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::CandidatePendingAvailability(para_b, tx),
|
||||
@@ -651,7 +663,7 @@ fn requests_candidate_pending_availability() {
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), None);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -664,20 +676,21 @@ fn requests_candidate_events() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::CandidateEvents(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), runtime_api.candidate_events);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -704,12 +717,13 @@ fn requests_dmq_contents() {
|
||||
runtime_api
|
||||
});
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::DmqContents(para_a, tx)),
|
||||
})
|
||||
.await;
|
||||
@@ -717,7 +731,7 @@ fn requests_dmq_contents() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::DmqContents(para_b, tx)),
|
||||
})
|
||||
.await;
|
||||
@@ -726,7 +740,7 @@ fn requests_dmq_contents() {
|
||||
vec![InboundDownwardMessage { sent_at: 228, msg: b"Novus Ordo Seclorum".to_vec() }]
|
||||
);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
}
|
||||
@@ -758,12 +772,13 @@ fn requests_inbound_hrmp_channels_contents() {
|
||||
runtime_api
|
||||
});
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::InboundHrmpChannelsContents(para_a, tx),
|
||||
@@ -774,7 +789,7 @@ fn requests_inbound_hrmp_channels_contents() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::InboundHrmpChannelsContents(para_b, tx),
|
||||
@@ -783,7 +798,7 @@ fn requests_inbound_hrmp_channels_contents() {
|
||||
.await;
|
||||
assert_eq!(rx.await.unwrap().unwrap(), para_b_inbound_channels);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
}
|
||||
@@ -806,7 +821,8 @@ fn requests_validation_code_by_hash() {
|
||||
(runtime_api, validation_code)
|
||||
};
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(Arc::new(runtime_api), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(Arc::new(runtime_api), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
|
||||
let relay_parent = [1; 32].into();
|
||||
@@ -814,7 +830,7 @@ fn requests_validation_code_by_hash() {
|
||||
for code in validation_code {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::ValidationCodeByHash(code.hash(), tx),
|
||||
@@ -825,7 +841,7 @@ fn requests_validation_code_by_hash() {
|
||||
assert_eq!(rx.await.unwrap().unwrap(), Some(code));
|
||||
}
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -839,7 +855,8 @@ fn multiple_requests_in_parallel_are_working() {
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
let mutex = runtime_api.availability_cores_wait.clone();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
// Make all requests block until we release this mutex.
|
||||
@@ -850,7 +867,7 @@ fn multiple_requests_in_parallel_are_working() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::AvailabilityCores(tx)),
|
||||
})
|
||||
.await;
|
||||
@@ -864,7 +881,7 @@ fn multiple_requests_in_parallel_are_working() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::AvailabilityCores(tx)),
|
||||
})
|
||||
.await;
|
||||
@@ -877,7 +894,7 @@ fn multiple_requests_in_parallel_are_working() {
|
||||
.into_iter()
|
||||
.for_each(|r| assert_eq!(r.unwrap().unwrap(), runtime_api.availability_cores));
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -900,19 +917,20 @@ fn requests_babe_epoch() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::CurrentBabeEpoch(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), epoch);
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -924,7 +942,8 @@ fn requests_submit_pvf_check_statement() {
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let runtime_api = Arc::new(MockRuntimeApi::default());
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
|
||||
let relay_parent = [1; 32].into();
|
||||
@@ -936,7 +955,7 @@ fn requests_submit_pvf_check_statement() {
|
||||
// Here we just want to ensure that those requests do not go through the cache.
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::SubmitPvfCheckStatement(stmt.clone(), sig.clone(), tx),
|
||||
@@ -946,7 +965,7 @@ fn requests_submit_pvf_check_statement() {
|
||||
assert_eq!(rx.await.unwrap().unwrap(), ());
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::SubmitPvfCheckStatement(stmt.clone(), sig.clone(), tx),
|
||||
@@ -960,7 +979,7 @@ fn requests_submit_pvf_check_statement() {
|
||||
&[(stmt.clone(), sig.clone()), (stmt.clone(), sig.clone())]
|
||||
);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -988,7 +1007,8 @@ fn requests_pvfs_require_precheck() {
|
||||
runtime_api
|
||||
});
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
|
||||
let relay_parent = [1; 32].into();
|
||||
@@ -996,13 +1016,13 @@ fn requests_pvfs_require_precheck() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(relay_parent, Request::PvfsRequirePrecheck(tx)),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), vec![[1; 32].into(), [2; 32].into()]);
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
@@ -1022,13 +1042,14 @@ fn requests_validation_code_hash() {
|
||||
runtime_api.validation_code_hash.insert(para_a, validation_code_hash.clone());
|
||||
let runtime_api = Arc::new(runtime_api);
|
||||
|
||||
let subsystem = RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), spawner);
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(runtime_api.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::ValidationCodeHash(para_a, OccupiedCoreAssumption::Included, tx),
|
||||
@@ -1040,7 +1061,7 @@ fn requests_validation_code_hash() {
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
ctx_handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: RuntimeApiMessage::Request(
|
||||
relay_parent,
|
||||
Request::ValidationCodeHash(para_b, OccupiedCoreAssumption::Included, tx),
|
||||
@@ -1050,7 +1071,7 @@ fn requests_validation_code_hash() {
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), None);
|
||||
|
||||
ctx_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(subsystem_task, test_task));
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! messages on the overseer level.
|
||||
|
||||
use polkadot_node_subsystem::*;
|
||||
pub use polkadot_node_subsystem::{messages, messages::*, overseer, FromOverseer};
|
||||
pub use polkadot_node_subsystem::{messages, messages::*, overseer, FromOrchestra};
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
/// Filter incoming and outgoing messages.
|
||||
@@ -42,8 +42,8 @@ where
|
||||
fn intercept_incoming(
|
||||
&self,
|
||||
_sender: &mut Sender,
|
||||
msg: FromOverseer<Self::Message>,
|
||||
) -> Option<FromOverseer<Self::Message>> {
|
||||
msg: FromOrchestra<Self::Message>,
|
||||
) -> Option<FromOrchestra<Self::Message>> {
|
||||
Some(msg)
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ where
|
||||
type OutgoingMessages = <<Context as overseer::SubsystemContext>::Message as overseer::AssociateOutgoing>::OutgoingMessages;
|
||||
type Signal = OverseerSignal;
|
||||
|
||||
async fn try_recv(&mut self) -> Result<Option<FromOverseer<Self::Message>>, ()> {
|
||||
async fn try_recv(&mut self) -> Result<Option<FromOrchestra<Self::Message>>, ()> {
|
||||
loop {
|
||||
match self.inner.try_recv().await? {
|
||||
None => return Ok(None),
|
||||
@@ -188,7 +188,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
async fn recv(&mut self) -> SubsystemResult<FromOverseer<Self::Message>> {
|
||||
async fn recv(&mut self) -> SubsystemResult<FromOrchestra<Self::Message>> {
|
||||
loop {
|
||||
let msg = self.inner.recv().await?;
|
||||
if let Some(msg) = self.message_filter.intercept_incoming(self.inner.sender(), msg) {
|
||||
@@ -243,10 +243,6 @@ where
|
||||
<Context as overseer::SubsystemContext>::Sender,
|
||||
Message = <Context as overseer::SubsystemContext>::Message,
|
||||
>,
|
||||
// <Context as overseer::SubsystemContext>::Sender:
|
||||
// overseer::SubsystemSender<
|
||||
// <Interceptor as MessageInterceptor<<Context as overseer::SubsystemContext>::Sender>>::Message,
|
||||
// >,
|
||||
<Context as overseer::SubsystemContext>::Message:
|
||||
overseer::AssociateOutgoing,
|
||||
<Context as overseer::SubsystemContext>::Sender:
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use futures::prelude::*;
|
||||
use polkadot_node_primitives::SpawnNamed;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
pub const MALUS: &str = "MALUS";
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ where
|
||||
fn intercept_incoming(
|
||||
&self,
|
||||
_sender: &mut Sender,
|
||||
msg: FromOverseer<Self::Message>,
|
||||
) -> Option<FromOverseer<Self::Message>> {
|
||||
msg: FromOrchestra<Self::Message>,
|
||||
) -> Option<FromOrchestra<Self::Message>> {
|
||||
match msg {
|
||||
FromOverseer::Communication { msg: _msg } => None,
|
||||
FromOrchestra::Communication { msg: _msg } => None,
|
||||
// to conclude the test cleanly
|
||||
sig => Some(sig),
|
||||
}
|
||||
@@ -60,18 +60,20 @@ where
|
||||
}
|
||||
|
||||
async fn overseer_send<T: Into<AllMessages>>(overseer: &mut TestSubsystemContextHandle<T>, msg: T) {
|
||||
overseer.send(FromOverseer::Communication { msg }).await;
|
||||
overseer.send(FromOrchestra::Communication { msg }).await;
|
||||
}
|
||||
|
||||
use sp_core::testing::TaskExecutor;
|
||||
|
||||
fn launch_harness<F, M, Sub, G>(test_gen: G)
|
||||
where
|
||||
F: Future<Output = TestSubsystemContextHandle<M>> + Send,
|
||||
M: AssociateOutgoing + std::fmt::Debug + Send + 'static,
|
||||
// <M as AssociateOutgoing>::OutgoingMessages: From<M>,
|
||||
Sub: Subsystem<TestSubsystemContext<M, sp_core::testing::TaskExecutor>, SubsystemError>,
|
||||
Sub: Subsystem<TestSubsystemContext<M, SpawnGlue<TaskExecutor>>, SubsystemError>,
|
||||
G: Fn(TestSubsystemContextHandle<M>) -> (F, Sub),
|
||||
{
|
||||
let pool = sp_core::testing::TaskExecutor::new();
|
||||
let pool = TaskExecutor::new();
|
||||
let (context, overseer) = make_subsystem_context(pool);
|
||||
|
||||
let (test_fut, subsystem) = test_gen(overseer);
|
||||
@@ -84,7 +86,7 @@ where
|
||||
futures::executor::block_on(futures::future::join(
|
||||
async move {
|
||||
let mut overseer = test_fut.await;
|
||||
overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
},
|
||||
subsystem,
|
||||
))
|
||||
|
||||
@@ -23,9 +23,11 @@ use polkadot_cli::{
|
||||
service::{
|
||||
AuthorityDiscoveryApi, AuxStore, BabeApi, Block, Error, HeaderBackend, Overseer,
|
||||
OverseerConnector, OverseerGen, OverseerGenArgs, OverseerHandle, ParachainHost,
|
||||
ProvideRuntimeApi, SpawnNamed,
|
||||
ProvideRuntimeApi,
|
||||
},
|
||||
};
|
||||
use polkadot_node_subsystem::SpawnGlue;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
use crate::{
|
||||
interceptor::*,
|
||||
@@ -43,7 +45,7 @@ impl OverseerGen for BackGarbageCandidate {
|
||||
&self,
|
||||
connector: OverseerConnector,
|
||||
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
) -> Result<(Overseer<SpawnGlue<Spawner>, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
@@ -53,7 +55,7 @@ impl OverseerGen for BackGarbageCandidate {
|
||||
let validation_filter = ReplaceValidationResult::new(
|
||||
FakeCandidateValidation::BackingAndApprovalValid,
|
||||
FakeCandidateValidationError::InvalidOutputs,
|
||||
spawner.clone(),
|
||||
SpawnGlue(spawner),
|
||||
);
|
||||
|
||||
prepared_overseer_builder(args)?
|
||||
|
||||
@@ -23,14 +23,15 @@ use crate::{
|
||||
|
||||
use polkadot_node_core_candidate_validation::find_validation_data;
|
||||
use polkadot_node_primitives::{InvalidCandidate, ValidationResult};
|
||||
use polkadot_node_subsystem::messages::{CandidateValidationMessage, ValidationFailed};
|
||||
use polkadot_node_subsystem::{
|
||||
messages::{CandidateValidationMessage, ValidationFailed},
|
||||
overseer,
|
||||
};
|
||||
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateCommitments, CandidateDescriptor, CandidateReceipt, PersistedValidationData,
|
||||
};
|
||||
|
||||
use polkadot_cli::service::SpawnNamed;
|
||||
|
||||
use futures::channel::oneshot;
|
||||
|
||||
#[derive(clap::ArgEnum, Clone, Copy, Debug, PartialEq)]
|
||||
@@ -113,7 +114,7 @@ pub struct ReplaceValidationResult<Spawner> {
|
||||
|
||||
impl<Spawner> ReplaceValidationResult<Spawner>
|
||||
where
|
||||
Spawner: SpawnNamed,
|
||||
Spawner: overseer::gen::Spawner,
|
||||
{
|
||||
pub fn new(
|
||||
fake_validation: FakeCandidateValidation,
|
||||
@@ -197,7 +198,7 @@ fn create_validation_response(
|
||||
impl<Sender, Spawner> MessageInterceptor<Sender> for ReplaceValidationResult<Spawner>
|
||||
where
|
||||
Sender: overseer::CandidateValidationSenderTrait + Clone + Send + 'static,
|
||||
Spawner: SpawnNamed + Clone + 'static,
|
||||
Spawner: overseer::gen::Spawner + Clone + 'static,
|
||||
{
|
||||
type Message = CandidateValidationMessage;
|
||||
|
||||
@@ -205,10 +206,10 @@ where
|
||||
fn intercept_incoming(
|
||||
&self,
|
||||
subsystem_sender: &mut Sender,
|
||||
msg: FromOverseer<Self::Message>,
|
||||
) -> Option<FromOverseer<Self::Message>> {
|
||||
msg: FromOrchestra<Self::Message>,
|
||||
) -> Option<FromOrchestra<Self::Message>> {
|
||||
match msg {
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg:
|
||||
CandidateValidationMessage::ValidateFromExhaustive(
|
||||
validation_data,
|
||||
@@ -224,7 +225,7 @@ where
|
||||
FakeCandidateValidation::BackingAndApprovalValid => {
|
||||
// Behave normally if the `PoV` is not known to be malicious.
|
||||
if pov.block_data.0.as_slice() != MALICIOUS_POV {
|
||||
return Some(FromOverseer::Communication {
|
||||
return Some(FromOrchestra::Communication {
|
||||
msg: CandidateValidationMessage::ValidateFromExhaustive(
|
||||
validation_data,
|
||||
validation_code,
|
||||
@@ -257,7 +258,7 @@ where
|
||||
sender.send(Ok(validation_result)).unwrap();
|
||||
None
|
||||
},
|
||||
_ => Some(FromOverseer::Communication {
|
||||
_ => Some(FromOrchestra::Communication {
|
||||
msg: CandidateValidationMessage::ValidateFromExhaustive(
|
||||
validation_data,
|
||||
validation_code,
|
||||
@@ -269,7 +270,7 @@ where
|
||||
}),
|
||||
}
|
||||
},
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg:
|
||||
CandidateValidationMessage::ValidateFromChainState(
|
||||
candidate_receipt,
|
||||
@@ -283,7 +284,7 @@ where
|
||||
FakeCandidateValidation::BackingAndApprovalValid => {
|
||||
// Behave normally if the `PoV` is not known to be malicious.
|
||||
if pov.block_data.0.as_slice() != MALICIOUS_POV {
|
||||
return Some(FromOverseer::Communication {
|
||||
return Some(FromOrchestra::Communication {
|
||||
msg: CandidateValidationMessage::ValidateFromChainState(
|
||||
candidate_receipt,
|
||||
pov,
|
||||
@@ -314,7 +315,7 @@ where
|
||||
response_sender.send(Ok(validation_result)).unwrap();
|
||||
None
|
||||
},
|
||||
_ => Some(FromOverseer::Communication {
|
||||
_ => Some(FromOrchestra::Communication {
|
||||
msg: CandidateValidationMessage::ValidateFromChainState(
|
||||
candidate_receipt,
|
||||
pov,
|
||||
|
||||
@@ -27,10 +27,12 @@ use polkadot_cli::{
|
||||
service::{
|
||||
AuthorityDiscoveryApi, AuxStore, BabeApi, Block, Error, HeaderBackend, Overseer,
|
||||
OverseerConnector, OverseerGen, OverseerGenArgs, OverseerHandle, ParachainHost,
|
||||
ProvideRuntimeApi, SpawnNamed,
|
||||
ProvideRuntimeApi,
|
||||
},
|
||||
RunCmd,
|
||||
};
|
||||
use polkadot_node_subsystem::SpawnGlue;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
// Filter wrapping related types.
|
||||
use super::common::{FakeCandidateValidation, FakeCandidateValidationError};
|
||||
@@ -73,7 +75,7 @@ impl OverseerGen for DisputeValidCandidates {
|
||||
&self,
|
||||
connector: OverseerConnector,
|
||||
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
) -> Result<(Overseer<SpawnGlue<Spawner>, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
@@ -83,7 +85,7 @@ impl OverseerGen for DisputeValidCandidates {
|
||||
let validation_filter = ReplaceValidationResult::new(
|
||||
self.opts.fake_validation,
|
||||
self.opts.fake_validation_error,
|
||||
spawner.clone(),
|
||||
SpawnGlue(spawner.clone()),
|
||||
);
|
||||
|
||||
prepared_overseer_builder(args)?
|
||||
|
||||
@@ -27,7 +27,7 @@ use polkadot_cli::{
|
||||
service::{
|
||||
AuthorityDiscoveryApi, AuxStore, BabeApi, Block, Error, HeaderBackend, Overseer,
|
||||
OverseerConnector, OverseerGen, OverseerGenArgs, OverseerHandle, ParachainHost,
|
||||
ProvideRuntimeApi, SpawnNamed,
|
||||
ProvideRuntimeApi,
|
||||
},
|
||||
};
|
||||
use polkadot_node_core_candidate_validation::find_validation_data;
|
||||
@@ -35,6 +35,7 @@ use polkadot_node_primitives::{AvailableData, BlockData, PoV};
|
||||
use polkadot_primitives::v2::{CandidateDescriptor, CandidateHash};
|
||||
|
||||
use polkadot_node_subsystem_util::request_validators;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
// Filter wrapping related types.
|
||||
use crate::{
|
||||
@@ -48,7 +49,10 @@ use crate::{
|
||||
|
||||
// Import extra types relevant to the particular
|
||||
// subsystem.
|
||||
use polkadot_node_subsystem::messages::{CandidateBackingMessage, CollatorProtocolMessage};
|
||||
use polkadot_node_subsystem::{
|
||||
messages::{CandidateBackingMessage, CollatorProtocolMessage},
|
||||
SpawnGlue,
|
||||
};
|
||||
use polkadot_primitives::v2::CandidateReceipt;
|
||||
|
||||
use std::{
|
||||
@@ -72,7 +76,7 @@ struct NoteCandidate<Spawner> {
|
||||
impl<Sender, Spawner> MessageInterceptor<Sender> for NoteCandidate<Spawner>
|
||||
where
|
||||
Sender: overseer::CandidateBackingSenderTrait + Clone + Send + 'static,
|
||||
Spawner: SpawnNamed + Clone + 'static,
|
||||
Spawner: overseer::gen::Spawner + Clone + 'static,
|
||||
{
|
||||
type Message = CandidateBackingMessage;
|
||||
|
||||
@@ -80,10 +84,10 @@ where
|
||||
fn intercept_incoming(
|
||||
&self,
|
||||
subsystem_sender: &mut Sender,
|
||||
msg: FromOverseer<Self::Message>,
|
||||
) -> Option<FromOverseer<Self::Message>> {
|
||||
msg: FromOrchestra<Self::Message>,
|
||||
) -> Option<FromOrchestra<Self::Message>> {
|
||||
match msg {
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: CandidateBackingMessage::Second(relay_parent, candidate, _pov),
|
||||
} => {
|
||||
gum::debug!(
|
||||
@@ -204,14 +208,14 @@ where
|
||||
.map
|
||||
.insert(malicious_candidate_hash, candidate.hash());
|
||||
|
||||
let message = FromOverseer::Communication {
|
||||
let message = FromOrchestra::Communication {
|
||||
msg: CandidateBackingMessage::Second(relay_parent, malicious_candidate, pov),
|
||||
};
|
||||
|
||||
Some(message)
|
||||
},
|
||||
FromOverseer::Communication { msg } => Some(FromOverseer::Communication { msg }),
|
||||
FromOverseer::Signal(signal) => Some(FromOverseer::Signal(signal)),
|
||||
FromOrchestra::Communication { msg } => Some(FromOrchestra::Communication { msg }),
|
||||
FromOrchestra::Signal(signal) => Some(FromOrchestra::Signal(signal)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +249,7 @@ impl OverseerGen for BackGarbageCandidateWrapper {
|
||||
&self,
|
||||
connector: OverseerConnector,
|
||||
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
) -> Result<(Overseer<SpawnGlue<Spawner>, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
@@ -254,12 +258,12 @@ impl OverseerGen for BackGarbageCandidateWrapper {
|
||||
let inner = Inner { map: std::collections::HashMap::new() };
|
||||
let inner_mut = Arc::new(Mutex::new(inner));
|
||||
let note_candidate =
|
||||
NoteCandidate { inner: inner_mut.clone(), spawner: args.spawner.clone() };
|
||||
NoteCandidate { inner: inner_mut.clone(), spawner: SpawnGlue(args.spawner.clone()) };
|
||||
|
||||
let validation_filter = ReplaceValidationResult::new(
|
||||
FakeCandidateValidation::BackingAndApprovalValid,
|
||||
FakeCandidateValidationError::InvalidOutputs,
|
||||
args.spawner.clone(),
|
||||
SpawnGlue(args.spawner.clone()),
|
||||
);
|
||||
|
||||
prepared_overseer_builder(args)?
|
||||
|
||||
@@ -4,12 +4,13 @@ version = "0.9.22"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Channels with attached Meters"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.2"
|
||||
derive_more = "0.99"
|
||||
gum = { package = "tracing-gum", path = "../gum" }
|
||||
tracing = "0.1.34"
|
||||
thiserror = "1.0.31"
|
||||
crossbeam-queue = "0.3.5"
|
||||
nanorand = { version = "0.7.0", default-features = false, features = ["wyrand"] }
|
||||
|
||||
@@ -225,7 +225,7 @@ impl<T> Future for MeteredReceiver<T> {
|
||||
.get_or_insert_with(move || Delay::new(soft_timeout).fuse());
|
||||
|
||||
if Pin::new(soft_timeout).poll(ctx).is_ready() {
|
||||
gum::warn!("Oneshot `{name}` exceeded the soft threshold", name = &self.name);
|
||||
tracing::warn!(target: "oneshot", "Oneshot `{name}` exceeded the soft threshold", name = &self.name);
|
||||
}
|
||||
|
||||
let hard_timeout = self.hard_timeout.clone().into();
|
||||
|
||||
@@ -34,7 +34,7 @@ use polkadot_node_subsystem::{
|
||||
ApprovalCheckResult, ApprovalDistributionMessage, ApprovalVotingMessage,
|
||||
AssignmentCheckResult, NetworkBridgeEvent, NetworkBridgeMessage,
|
||||
},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
};
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CandidateIndex, Hash, SessionIndex, ValidatorIndex, ValidatorSignature,
|
||||
@@ -1617,9 +1617,9 @@ impl ApprovalDistribution {
|
||||
},
|
||||
};
|
||||
match message {
|
||||
FromOverseer::Communication { msg } =>
|
||||
FromOrchestra::Communication { msg } =>
|
||||
Self::handle_incoming(&mut ctx, state, msg, &self.metrics, rng).await,
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
..
|
||||
})) => {
|
||||
gum::trace!(target: LOG_TARGET, "active leaves signal (ignored)");
|
||||
@@ -1627,11 +1627,11 @@ impl ApprovalDistribution {
|
||||
// are those that are available, but not finalized yet
|
||||
// actived and deactivated heads hence are irrelevant to this subsystem
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(_hash, number)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_hash, number)) => {
|
||||
gum::trace!(target: LOG_TARGET, number = %number, "finalized signal");
|
||||
state.handle_block_finalized(&mut ctx, &self.metrics, number).await;
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return,
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
|
||||
async move {
|
||||
let mut overseer = test_fut.await;
|
||||
overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::Conclude))
|
||||
.send(FromOrchestra::Signal(OverseerSignal::Conclude))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect("Conclude send timeout");
|
||||
@@ -80,7 +80,7 @@ const TIMEOUT: Duration = Duration::from_millis(200);
|
||||
async fn overseer_send(overseer: &mut VirtualOverseer, msg: ApprovalDistributionMessage) {
|
||||
gum::trace!(msg = ?msg, "Sending message");
|
||||
overseer
|
||||
.send(FromOverseer::Communication { msg })
|
||||
.send(FromOrchestra::Communication { msg })
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect("msg send timeout");
|
||||
@@ -90,7 +90,7 @@ async fn overseer_signal_block_finalized(overseer: &mut VirtualOverseer, number:
|
||||
gum::trace!(?number, "Sending a finalized signal");
|
||||
// we don't care about the block hash
|
||||
overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::BlockFinalized(Hash::zero(), number)))
|
||||
.send(FromOrchestra::Signal(OverseerSignal::BlockFinalized(Hash::zero(), number)))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect("signal send timeout");
|
||||
|
||||
@@ -20,7 +20,7 @@ use sp_keystore::SyncCryptoStorePtr;
|
||||
|
||||
use polkadot_node_network_protocol::request_response::{v1, IncomingRequestReceiver};
|
||||
use polkadot_node_subsystem::{
|
||||
messages::AvailabilityDistributionMessage, overseer, FromOverseer, OverseerSignal,
|
||||
messages::AvailabilityDistributionMessage, overseer, FromOrchestra, OverseerSignal,
|
||||
SpawnedSubsystem, SubsystemError,
|
||||
};
|
||||
|
||||
@@ -134,7 +134,7 @@ impl AvailabilityDistributionSubsystem {
|
||||
},
|
||||
};
|
||||
match message {
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
log_error(
|
||||
requester
|
||||
.get_mut()
|
||||
@@ -143,9 +143,9 @@ impl AvailabilityDistributionSubsystem {
|
||||
"Error in Requester::update_fetching_heads",
|
||||
)?;
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {},
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
|
||||
FromOrchestra::Communication {
|
||||
msg:
|
||||
AvailabilityDistributionMessage::FetchPoV {
|
||||
relay_parent,
|
||||
|
||||
@@ -19,18 +19,20 @@ use std::{future::Future, sync::Arc};
|
||||
use futures::FutureExt;
|
||||
|
||||
use polkadot_node_network_protocol::jaeger;
|
||||
use polkadot_node_primitives::{BlockData, ErasureChunk, PoV, SpawnNamed};
|
||||
use polkadot_node_primitives::{BlockData, ErasureChunk, PoV};
|
||||
use polkadot_node_subsystem_util::runtime::RuntimeInfo;
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CoreState, GroupIndex, Hash, Id, ScheduledCore, SessionIndex, SessionInfo,
|
||||
BlockNumber, CoreState, GroupIndex, Hash, Id as ParaId, ScheduledCore, SessionIndex,
|
||||
SessionInfo,
|
||||
};
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
use polkadot_node_subsystem::{
|
||||
messages::{
|
||||
AllMessages, AvailabilityDistributionMessage, AvailabilityStoreMessage, ChainApiMessage,
|
||||
NetworkBridgeMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SpawnGlue,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
make_subsystem_context, mock::make_ferdie_keystore, TestSubsystemContext,
|
||||
@@ -117,7 +119,7 @@ fn spawn_virtual_overseer(
|
||||
.expect("Receiver should be alive.");
|
||||
},
|
||||
RuntimeApiRequest::AvailabilityCores(tx) => {
|
||||
let para_id = Id::from(1);
|
||||
let para_id = ParaId::from(1_u32);
|
||||
let maybe_block_position =
|
||||
test_state.relay_chain.iter().position(|h| *h == hash);
|
||||
let cores = match maybe_block_position {
|
||||
@@ -173,7 +175,9 @@ fn spawn_virtual_overseer(
|
||||
|
||||
fn test_harness<T: Future<Output = ()>>(
|
||||
test_state: TestState,
|
||||
test_fx: impl FnOnce(TestSubsystemContext<AvailabilityDistributionMessage, TaskExecutor>) -> T,
|
||||
test_fx: impl FnOnce(
|
||||
TestSubsystemContext<AvailabilityDistributionMessage, SpawnGlue<TaskExecutor>>,
|
||||
) -> T,
|
||||
) {
|
||||
let pool = TaskExecutor::new();
|
||||
let (ctx, ctx_handle) = make_subsystem_context(pool.clone());
|
||||
|
||||
@@ -44,7 +44,7 @@ use polkadot_node_subsystem::{
|
||||
AllMessages, AvailabilityDistributionMessage, AvailabilityStoreMessage, ChainApiMessage,
|
||||
NetworkBridgeMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_primitives::v2::{
|
||||
@@ -295,12 +295,14 @@ impl TestState {
|
||||
}
|
||||
|
||||
async fn overseer_signal(
|
||||
mut tx: SingleItemSink<FromOverseer<AvailabilityDistributionMessage>>,
|
||||
mut tx: SingleItemSink<FromOrchestra<AvailabilityDistributionMessage>>,
|
||||
msg: impl Into<OverseerSignal>,
|
||||
) {
|
||||
let msg = msg.into();
|
||||
gum::trace!(target: LOG_TARGET, msg = ?msg, "sending message");
|
||||
tx.send(FromOverseer::Signal(msg)).await.expect("Test subsystem no longer live");
|
||||
tx.send(FromOrchestra::Signal(msg))
|
||||
.await
|
||||
.expect("Test subsystem no longer live");
|
||||
}
|
||||
|
||||
async fn overseer_recv(rx: &mut mpsc::UnboundedReceiver<AllMessages>) -> AllMessages {
|
||||
|
||||
@@ -51,7 +51,7 @@ use polkadot_node_subsystem::{
|
||||
errors::RecoveryError,
|
||||
jaeger,
|
||||
messages::{AvailabilityRecoveryMessage, AvailabilityStoreMessage, NetworkBridgeMessage},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
SubsystemResult,
|
||||
};
|
||||
use polkadot_node_subsystem_util::request_session_info;
|
||||
@@ -988,13 +988,13 @@ impl AvailabilityRecoverySubsystem {
|
||||
futures::select! {
|
||||
v = ctx.recv().fuse() => {
|
||||
match v? {
|
||||
FromOverseer::Signal(signal) => if handle_signal(
|
||||
FromOrchestra::Signal(signal) => if handle_signal(
|
||||
&mut state,
|
||||
signal,
|
||||
).await? {
|
||||
return Ok(());
|
||||
}
|
||||
FromOverseer::Communication { msg } => {
|
||||
FromOrchestra::Communication { msg } => {
|
||||
match msg {
|
||||
AvailabilityRecoveryMessage::RecoverAvailableData(
|
||||
receipt,
|
||||
|
||||
@@ -124,7 +124,7 @@ async fn overseer_signal(
|
||||
) {
|
||||
delay!(50);
|
||||
overseer
|
||||
.send(FromOverseer::Signal(signal))
|
||||
.send(FromOrchestra::Signal(signal))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect("10ms is more than enough for sending signals.");
|
||||
@@ -136,7 +136,7 @@ async fn overseer_send(
|
||||
) {
|
||||
gum::trace!(msg = ?msg, "sending message");
|
||||
overseer
|
||||
.send(FromOverseer::Communication { msg })
|
||||
.send(FromOrchestra::Communication { msg })
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect("10ms is more than enough for sending messages.");
|
||||
|
||||
@@ -32,7 +32,7 @@ use polkadot_node_network_protocol::{
|
||||
v1 as protocol_v1, OurView, PeerId, UnifiedReputationChange as Rep, Versioned, View,
|
||||
};
|
||||
use polkadot_node_subsystem::{
|
||||
jaeger, messages::*, overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, PerLeafSpan,
|
||||
jaeger, messages::*, overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, PerLeafSpan,
|
||||
SpawnedSubsystem, SubsystemError, SubsystemResult,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{self as util};
|
||||
@@ -202,7 +202,7 @@ impl BitfieldDistribution {
|
||||
},
|
||||
};
|
||||
match message {
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg:
|
||||
BitfieldDistributionMessage::DistributeBitfield(
|
||||
relay_parent,
|
||||
@@ -220,14 +220,14 @@ impl BitfieldDistribution {
|
||||
)
|
||||
.await;
|
||||
},
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: BitfieldDistributionMessage::NetworkBridgeUpdate(event),
|
||||
} => {
|
||||
gum::trace!(target: LOG_TARGET, "Processing NetworkMessage");
|
||||
// a network message was received
|
||||
handle_network_msg(&mut ctx, state, &self.metrics, event, rng).await;
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated,
|
||||
..
|
||||
})) => {
|
||||
@@ -260,10 +260,10 @@ impl BitfieldDistribution {
|
||||
}
|
||||
}
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(hash, number)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(hash, number)) => {
|
||||
gum::trace!(target: LOG_TARGET, ?hash, %number, "block finalized");
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => {
|
||||
gum::info!(target: LOG_TARGET, "Conclude");
|
||||
return
|
||||
},
|
||||
|
||||
@@ -42,9 +42,9 @@ use polkadot_node_subsystem::{
|
||||
GossipSupportMessage, NetworkBridgeEvent, NetworkBridgeMessage,
|
||||
StatementDistributionMessage,
|
||||
},
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem,
|
||||
};
|
||||
use polkadot_overseer::gen::OverseerError;
|
||||
use polkadot_overseer::gen::OrchestraError as OverseerError;
|
||||
use polkadot_primitives::v2::{AuthorityDiscoveryId, BlockNumber, Hash, ValidatorIndex};
|
||||
|
||||
/// Peer set info for network initialization.
|
||||
@@ -208,7 +208,7 @@ where
|
||||
loop {
|
||||
futures::select! {
|
||||
msg = ctx.recv().fuse() => match msg {
|
||||
Ok(FromOverseer::Signal(OverseerSignal::ActiveLeaves(active_leaves))) => {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(active_leaves))) => {
|
||||
let ActiveLeavesUpdate { activated, deactivated } = active_leaves;
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
@@ -248,7 +248,7 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(FromOverseer::Signal(OverseerSignal::BlockFinalized(_hash, number))) => {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::BlockFinalized(_hash, number))) => {
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
action = "BlockFinalized"
|
||||
@@ -261,10 +261,10 @@ where
|
||||
// that we never send the same `ActiveLeavesUpdate`
|
||||
finalized_number = number;
|
||||
}
|
||||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => {
|
||||
return Ok(());
|
||||
}
|
||||
Ok(FromOverseer::Communication { msg }) => match msg {
|
||||
Ok(FromOrchestra::Communication { msg }) => match msg {
|
||||
NetworkBridgeMessage::ReportPeer(peer, rep) => {
|
||||
if !rep.is_benefit() {
|
||||
gum::debug!(
|
||||
|
||||
@@ -37,7 +37,7 @@ use polkadot_node_subsystem::{
|
||||
AllMessages, ApprovalDistributionMessage, BitfieldDistributionMessage,
|
||||
GossipSupportMessage, StatementDistributionMessage,
|
||||
},
|
||||
ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal,
|
||||
ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
SingleItemSink, SingleItemStream, TestSubsystemContextHandle,
|
||||
@@ -303,7 +303,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
|
||||
let _ = executor::block_on(future::join(
|
||||
async move {
|
||||
let mut virtual_overseer = test_fut.await;
|
||||
virtual_overseer.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
virtual_overseer.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
},
|
||||
network_bridge,
|
||||
));
|
||||
@@ -367,7 +367,7 @@ fn send_our_view_upon_connection() {
|
||||
|
||||
let head = Hash::repeat_byte(1);
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: head,
|
||||
number: 1,
|
||||
@@ -418,7 +418,7 @@ fn sends_view_updates_to_peers() {
|
||||
let peer_b = PeerId::random();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated: Default::default(),
|
||||
deactivated: Default::default(),
|
||||
})))
|
||||
@@ -450,7 +450,7 @@ fn sends_view_updates_to_peers() {
|
||||
let hash_a = Hash::repeat_byte(1);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -518,7 +518,7 @@ fn do_not_send_view_update_until_synced() {
|
||||
let hash_b = Hash::repeat_byte(1);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -534,7 +534,7 @@ fn do_not_send_view_update_until_synced() {
|
||||
handle.set_done();
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_b,
|
||||
number: 1,
|
||||
@@ -589,19 +589,21 @@ fn do_not_send_view_update_when_only_finalized_block_changed() {
|
||||
let hash_a = Hash::repeat_byte(1);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::BlockFinalized(Hash::random(), 5)))
|
||||
.send(FromOrchestra::Signal(OverseerSignal::BlockFinalized(Hash::random(), 5)))
|
||||
.await;
|
||||
|
||||
// Send some empty active leaves update
|
||||
//
|
||||
// This should not trigger a view update to our peers.
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::default())))
|
||||
.send(FromOrchestra::Signal(
|
||||
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::default()),
|
||||
))
|
||||
.await;
|
||||
|
||||
// This should trigger the view update to our peers.
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -797,7 +799,7 @@ fn peer_disconnect_from_just_one_peerset() {
|
||||
let hash_a = Hash::repeat_byte(1);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -1009,10 +1011,10 @@ fn sent_views_include_finalized_number_update() {
|
||||
let hash_b = Hash::repeat_byte(2);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::BlockFinalized(hash_a, 1)))
|
||||
.send(FromOrchestra::Signal(OverseerSignal::BlockFinalized(hash_a, 1)))
|
||||
.await;
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_b,
|
||||
number: 1,
|
||||
@@ -1139,7 +1141,7 @@ fn send_messages_to_peers() {
|
||||
);
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: NetworkBridgeMessage::SendValidationMessage(
|
||||
vec![peer.clone()],
|
||||
Versioned::V1(message_v1.clone()),
|
||||
@@ -1170,7 +1172,7 @@ fn send_messages_to_peers() {
|
||||
protocol_v1::CollationProtocol::CollatorProtocol(collator_protocol_message.clone());
|
||||
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: NetworkBridgeMessage::SendCollationMessage(
|
||||
vec![peer.clone()],
|
||||
Versioned::V1(message_v1.clone()),
|
||||
@@ -1204,7 +1206,7 @@ fn our_view_updates_decreasing_order_and_limited_to_max() {
|
||||
// These are in reverse order, so the subsystem must sort internally to
|
||||
// get the correct view.
|
||||
virtual_overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash,
|
||||
number: i as _,
|
||||
|
||||
@@ -41,7 +41,7 @@ use polkadot_node_subsystem::{
|
||||
messages::{
|
||||
CollatorProtocolMessage, NetworkBridgeEvent, NetworkBridgeMessage, RuntimeApiMessage,
|
||||
},
|
||||
overseer, FromOverseer, OverseerSignal, PerLeafSpan,
|
||||
overseer, FromOrchestra, OverseerSignal, PerLeafSpan,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{
|
||||
metrics::{self, prometheus},
|
||||
@@ -1012,15 +1012,15 @@ pub(crate) async fn run<Context>(
|
||||
pin_mut!(recv_req);
|
||||
select! {
|
||||
msg = ctx.recv().fuse() => match msg.map_err(FatalError::SubsystemReceive)? {
|
||||
FromOverseer::Communication { msg } => {
|
||||
FromOrchestra::Communication { msg } => {
|
||||
log_error(
|
||||
process_msg(&mut ctx, &mut runtime, &mut state, msg).await,
|
||||
"Failed to process message"
|
||||
)?;
|
||||
},
|
||||
FromOverseer::Signal(ActiveLeaves(_update)) => {}
|
||||
FromOverseer::Signal(BlockFinalized(..)) => {}
|
||||
FromOverseer::Signal(Conclude) => return Ok(()),
|
||||
FromOrchestra::Signal(ActiveLeaves(_update)) => {}
|
||||
FromOrchestra::Signal(BlockFinalized(..)) => {}
|
||||
FromOrchestra::Signal(Conclude) => return Ok(()),
|
||||
},
|
||||
(relay_parent, peer_id) = state.active_collation_fetches.select_next_some() => {
|
||||
let next = if let Some(waiting) = state.waiting_collation_fetches.get_mut(&relay_parent) {
|
||||
|
||||
@@ -228,7 +228,7 @@ const TIMEOUT: Duration = Duration::from_millis(100);
|
||||
async fn overseer_send(overseer: &mut VirtualOverseer, msg: CollatorProtocolMessage) {
|
||||
gum::trace!(?msg, "sending message");
|
||||
overseer
|
||||
.send(FromOverseer::Communication { msg })
|
||||
.send(FromOrchestra::Communication { msg })
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect(&format!("{:?} is more than enough for sending messages.", TIMEOUT));
|
||||
@@ -254,7 +254,7 @@ async fn overseer_recv_with_timeout(
|
||||
|
||||
async fn overseer_signal(overseer: &mut VirtualOverseer, signal: OverseerSignal) {
|
||||
overseer
|
||||
.send(FromOverseer::Signal(signal))
|
||||
.send(FromOrchestra::Signal(signal))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect(&format!("{:?} is more than enough for sending signals.", TIMEOUT));
|
||||
|
||||
@@ -50,7 +50,7 @@ use polkadot_node_subsystem::{
|
||||
CandidateBackingMessage, CollatorProtocolMessage, IfDisconnected, NetworkBridgeEvent,
|
||||
NetworkBridgeMessage, RuntimeApiMessage,
|
||||
},
|
||||
overseer, FromOverseer, OverseerSignal, PerLeafSpan, SubsystemSender,
|
||||
overseer, FromOrchestra, OverseerSignal, PerLeafSpan, SubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_primitives::v2::{CandidateReceipt, CollatorId, Hash, Id as ParaId};
|
||||
@@ -1206,7 +1206,7 @@ pub(crate) async fn run<Context>(
|
||||
select! {
|
||||
res = ctx.recv().fuse() => {
|
||||
match res {
|
||||
Ok(FromOverseer::Communication { msg }) => {
|
||||
Ok(FromOrchestra::Communication { msg }) => {
|
||||
gum::trace!(target: LOG_TARGET, msg = ?msg, "received a message");
|
||||
process_msg(
|
||||
&mut ctx,
|
||||
@@ -1215,8 +1215,8 @@ pub(crate) async fn run<Context>(
|
||||
&mut state,
|
||||
).await;
|
||||
}
|
||||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) | Err(_) => break,
|
||||
Ok(FromOverseer::Signal(_)) => continue,
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) | Err(_) => break,
|
||||
Ok(FromOrchestra::Signal(_)) => continue,
|
||||
}
|
||||
}
|
||||
_ = next_inactivity_stream.next() => {
|
||||
|
||||
@@ -168,7 +168,7 @@ const TIMEOUT: Duration = Duration::from_millis(200);
|
||||
async fn overseer_send(overseer: &mut VirtualOverseer, msg: CollatorProtocolMessage) {
|
||||
gum::trace!("Sending message:\n{:?}", &msg);
|
||||
overseer
|
||||
.send(FromOverseer::Communication { msg })
|
||||
.send(FromOrchestra::Communication { msg })
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect(&format!("{:?} is enough for sending messages.", TIMEOUT));
|
||||
@@ -194,7 +194,7 @@ async fn overseer_recv_with_timeout(
|
||||
|
||||
async fn overseer_signal(overseer: &mut VirtualOverseer, signal: OverseerSignal) {
|
||||
overseer
|
||||
.send(FromOverseer::Signal(signal))
|
||||
.send(FromOrchestra::Signal(signal))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect(&format!("{:?} is more than enough for sending signals.", TIMEOUT));
|
||||
|
||||
@@ -32,8 +32,8 @@ use sp_keystore::SyncCryptoStorePtr;
|
||||
use polkadot_node_network_protocol::request_response::{incoming::IncomingRequestReceiver, v1};
|
||||
use polkadot_node_primitives::DISPUTE_WINDOW;
|
||||
use polkadot_node_subsystem::{
|
||||
messages::DisputeDistributionMessage, overseer, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
SubsystemError,
|
||||
messages::DisputeDistributionMessage, overseer, FromOrchestra, OverseerSignal,
|
||||
SpawnedSubsystem, SubsystemError,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{runtime, runtime::RuntimeInfo};
|
||||
|
||||
@@ -177,17 +177,17 @@ where
|
||||
match message {
|
||||
MuxedMessage::Subsystem(result) => {
|
||||
let result = match result? {
|
||||
FromOverseer::Signal(signal) => {
|
||||
FromOrchestra::Signal(signal) => {
|
||||
match self.handle_signals(&mut ctx, signal).await {
|
||||
Ok(SignalResult::Conclude) => return Ok(()),
|
||||
Ok(SignalResult::Continue) => Ok(()),
|
||||
Err(f) => Err(f),
|
||||
}
|
||||
},
|
||||
FromOverseer::Communication { msg } =>
|
||||
FromOrchestra::Communication { msg } =>
|
||||
self.handle_subsystem_message(&mut ctx, msg).await,
|
||||
};
|
||||
log_error(result, "on FromOverseer")?;
|
||||
log_error(result, "on FromOrchestra")?;
|
||||
},
|
||||
MuxedMessage::Sender(result) => {
|
||||
self.disputes_sender
|
||||
@@ -232,7 +232,7 @@ where
|
||||
#[derive(Debug)]
|
||||
enum MuxedMessage {
|
||||
/// Messages from other subsystems.
|
||||
Subsystem(FatalResult<FromOverseer<DisputeDistributionMessage>>),
|
||||
Subsystem(FatalResult<FromOrchestra<DisputeDistributionMessage>>),
|
||||
/// Messages from spawned sender background tasks.
|
||||
Sender(Option<TaskFinish>),
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ use polkadot_node_subsystem::{
|
||||
AllMessages, DisputeCoordinatorMessage, DisputeDistributionMessage, ImportStatementsResult,
|
||||
NetworkBridgeMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal, Span,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal, Span,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
mock::make_ferdie_keystore, subsystem_test_harness, TestSubsystemContextHandle,
|
||||
@@ -74,7 +74,7 @@ fn send_dispute_sends_dispute() {
|
||||
let candidate = make_candidate_receipt(relay_parent);
|
||||
let message = make_dispute_message(candidate.clone(), ALICE_INDEX, FERDIE_INDEX).await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeDistributionMessage::SendDispute(message.clone()),
|
||||
})
|
||||
.await;
|
||||
@@ -315,7 +315,7 @@ fn send_dispute_gets_cleaned_up() {
|
||||
let candidate = make_candidate_receipt(relay_parent);
|
||||
let message = make_dispute_message(candidate.clone(), ALICE_INDEX, FERDIE_INDEX).await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeDistributionMessage::SendDispute(message.clone()),
|
||||
})
|
||||
.await;
|
||||
@@ -380,7 +380,7 @@ fn dispute_retries_and_works_across_session_boundaries() {
|
||||
let candidate = make_candidate_receipt(relay_parent);
|
||||
let message = make_dispute_message(candidate.clone(), ALICE_INDEX, FERDIE_INDEX).await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: DisputeDistributionMessage::SendDispute(message.clone()),
|
||||
})
|
||||
.await;
|
||||
@@ -588,7 +588,7 @@ async fn conclude(handle: &mut TestSubsystemContextHandle<DisputeDistributionMes
|
||||
})
|
||||
.await;
|
||||
|
||||
handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
}
|
||||
|
||||
/// Pass a `new_session` if you expect the subsystem to retrieve `SessionInfo` when given the
|
||||
@@ -605,7 +605,7 @@ async fn activate_leaf(
|
||||
) {
|
||||
let has_active_disputes = !active_disputes.is_empty();
|
||||
handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated: Some(ActivatedLeaf {
|
||||
hash: activate,
|
||||
number: 10,
|
||||
|
||||
@@ -48,7 +48,7 @@ use polkadot_node_subsystem::{
|
||||
GossipSupportMessage, NetworkBridgeEvent, NetworkBridgeMessage, RuntimeApiMessage,
|
||||
RuntimeApiRequest,
|
||||
},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
|
||||
};
|
||||
use polkadot_node_subsystem_util as util;
|
||||
use polkadot_primitives::v2::{
|
||||
@@ -164,10 +164,10 @@ where
|
||||
}
|
||||
);
|
||||
match message {
|
||||
FromOverseer::Communication {
|
||||
FromOrchestra::Communication {
|
||||
msg: GossipSupportMessage::NetworkBridgeUpdate(ev),
|
||||
} => self.handle_connect_disconnect(ev),
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated,
|
||||
..
|
||||
})) => {
|
||||
@@ -178,8 +178,8 @@ where
|
||||
gum::debug!(target: LOG_TARGET, error = ?e);
|
||||
}
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(_hash, _number)) => {},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return self,
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_hash, _number)) => {},
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return self,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>, AD: AuthorityDiscovery>(
|
||||
async move {
|
||||
let mut overseer = test_fut.await;
|
||||
overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::Conclude))
|
||||
.send(FromOrchestra::Signal(OverseerSignal::Conclude))
|
||||
.timeout(TIMEOUT)
|
||||
.await
|
||||
.expect("Conclude send timeout");
|
||||
@@ -199,7 +199,7 @@ async fn overseer_signal_active_leaves(overseer: &mut VirtualOverseer, leaf: Has
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
};
|
||||
overseer
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
|
||||
leaf,
|
||||
))))
|
||||
.timeout(TIMEOUT)
|
||||
|
||||
@@ -42,7 +42,7 @@ use polkadot_node_subsystem::{
|
||||
CandidateBackingMessage, NetworkBridgeEvent, NetworkBridgeMessage,
|
||||
StatementDistributionMessage,
|
||||
},
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, PerLeafSpan, SpawnedSubsystem,
|
||||
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, PerLeafSpan, SpawnedSubsystem,
|
||||
SubsystemError,
|
||||
};
|
||||
use polkadot_primitives::v2::{
|
||||
@@ -620,7 +620,7 @@ struct FetchingInfo {
|
||||
/// Messages to be handled in this subsystem.
|
||||
enum MuxedMessage {
|
||||
/// Messages from other subsystems.
|
||||
Subsystem(FatalResult<FromOverseer<StatementDistributionMessage>>),
|
||||
Subsystem(FatalResult<FromOrchestra<StatementDistributionMessage>>),
|
||||
/// Messages from spawned requester background tasks.
|
||||
Requester(Option<RequesterMessage>),
|
||||
/// Messages from spawned responder background task.
|
||||
@@ -1978,12 +1978,12 @@ impl<R: rand::Rng> StatementDistributionSubsystem<R> {
|
||||
active_heads: &mut HashMap<Hash, ActiveHeadData>,
|
||||
recent_outdated_heads: &mut RecentOutdatedHeads,
|
||||
req_sender: &mpsc::Sender<RequesterMessage>,
|
||||
message: FromOverseer<StatementDistributionMessage>,
|
||||
message: FromOrchestra<StatementDistributionMessage>,
|
||||
) -> Result<bool> {
|
||||
let metrics = &self.metrics;
|
||||
|
||||
match message {
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated,
|
||||
deactivated,
|
||||
})) => {
|
||||
@@ -2025,11 +2025,11 @@ impl<R: rand::Rng> StatementDistributionSubsystem<R> {
|
||||
));
|
||||
}
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {
|
||||
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {
|
||||
// do nothing
|
||||
},
|
||||
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(true),
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(true),
|
||||
FromOrchestra::Communication { msg } => match msg {
|
||||
StatementDistributionMessage::Share(relay_parent, statement) => {
|
||||
let _timer = metrics.time_share();
|
||||
|
||||
|
||||
@@ -739,7 +739,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
let test_fut = async move {
|
||||
// register our active heads.
|
||||
handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -773,7 +773,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(peer_a.clone(), ObservedRole::Full, 1, None),
|
||||
),
|
||||
@@ -781,7 +781,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(peer_b.clone(), ObservedRole::Full, 1, None),
|
||||
),
|
||||
@@ -789,7 +789,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
@@ -797,7 +797,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_b.clone(), view![hash_a]),
|
||||
),
|
||||
@@ -832,7 +832,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
};
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
@@ -874,7 +874,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
assert_eq!(s, statement.into());
|
||||
}
|
||||
);
|
||||
handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::pin_mut!(test_fut);
|
||||
@@ -932,7 +932,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
let test_fut = async move {
|
||||
// register our active heads.
|
||||
handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -966,7 +966,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_a.clone(),
|
||||
@@ -979,7 +979,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_b.clone(),
|
||||
@@ -991,7 +991,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_c.clone(),
|
||||
@@ -1003,7 +1003,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_bad.clone(),
|
||||
@@ -1016,7 +1016,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
@@ -1024,21 +1024,21 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_b.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_c.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_bad.clone(), view![hash_a]),
|
||||
),
|
||||
@@ -1076,7 +1076,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
let metadata = derive_metadata_assuming_seconded(hash_a, statement.clone().into());
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
@@ -1114,7 +1114,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
Delay::new(Duration::from_millis(20)).await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_c.clone(),
|
||||
@@ -1128,7 +1128,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
|
||||
// Malicious peer:
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_bad.clone(),
|
||||
@@ -1369,7 +1369,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
Decode::decode(&mut response_rx.await.unwrap().result.unwrap().as_ref()).unwrap();
|
||||
assert_eq!(committed, candidate);
|
||||
|
||||
handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::pin_mut!(test_fut);
|
||||
@@ -1444,7 +1444,7 @@ fn share_prioritizes_backing_group() {
|
||||
let test_fut = async move {
|
||||
// register our active heads.
|
||||
handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -1479,7 +1479,7 @@ fn share_prioritizes_backing_group() {
|
||||
// notify of dummy peers and view
|
||||
for (peer, pair) in dummy_peers.clone().into_iter().zip(dummy_pairs) {
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer,
|
||||
@@ -1492,7 +1492,7 @@ fn share_prioritizes_backing_group() {
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer, view![hash_a]),
|
||||
),
|
||||
@@ -1502,7 +1502,7 @@ fn share_prioritizes_backing_group() {
|
||||
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_a.clone(),
|
||||
@@ -1514,7 +1514,7 @@ fn share_prioritizes_backing_group() {
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_b.clone(),
|
||||
@@ -1526,7 +1526,7 @@ fn share_prioritizes_backing_group() {
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_c.clone(),
|
||||
@@ -1538,7 +1538,7 @@ fn share_prioritizes_backing_group() {
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_bad.clone(),
|
||||
@@ -1550,7 +1550,7 @@ fn share_prioritizes_backing_group() {
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_other_group.clone(),
|
||||
@@ -1563,7 +1563,7 @@ fn share_prioritizes_backing_group() {
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
@@ -1571,28 +1571,28 @@ fn share_prioritizes_backing_group() {
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_b.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_c.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_bad.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_other_group.clone(), view![hash_a]),
|
||||
),
|
||||
@@ -1630,7 +1630,7 @@ fn share_prioritizes_backing_group() {
|
||||
let metadata = derive_metadata_assuming_seconded(hash_a, statement.clone().into());
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::Share(hash_a, statement.clone()),
|
||||
})
|
||||
.await;
|
||||
@@ -1682,7 +1682,7 @@ fn share_prioritizes_backing_group() {
|
||||
Decode::decode(&mut response_rx.await.unwrap().result.unwrap().as_ref()).unwrap();
|
||||
assert_eq!(committed, candidate);
|
||||
|
||||
handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::pin_mut!(test_fut);
|
||||
@@ -1738,7 +1738,7 @@ fn peer_cant_flood_with_large_statements() {
|
||||
let test_fut = async move {
|
||||
// register our active heads.
|
||||
handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
@@ -1772,7 +1772,7 @@ fn peer_cant_flood_with_large_statements() {
|
||||
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_a.clone(),
|
||||
@@ -1785,7 +1785,7 @@ fn peer_cant_flood_with_large_statements() {
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
@@ -1822,7 +1822,7 @@ fn peer_cant_flood_with_large_statements() {
|
||||
|
||||
for _ in 0..MAX_LARGE_STATEMENTS_PER_SENDER + 1 {
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
@@ -1872,7 +1872,7 @@ fn peer_cant_flood_with_large_statements() {
|
||||
assert!(requested, "large data has not been requested.");
|
||||
assert!(punished, "Peer should have been punished for flooding.");
|
||||
|
||||
handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::pin_mut!(test_fut);
|
||||
@@ -1943,7 +1943,7 @@ fn handle_multiple_seconded_statements() {
|
||||
let test_fut = async move {
|
||||
// register our active heads.
|
||||
handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: relay_parent_hash,
|
||||
number: 1,
|
||||
@@ -1978,7 +1978,7 @@ fn handle_multiple_seconded_statements() {
|
||||
// notify of peers and view
|
||||
for peer in all_peers.iter() {
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer.clone(),
|
||||
@@ -1990,7 +1990,7 @@ fn handle_multiple_seconded_statements() {
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), view![relay_parent_hash]),
|
||||
),
|
||||
@@ -2037,7 +2037,7 @@ fn handle_multiple_seconded_statements() {
|
||||
};
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::NewGossipTopology(gossip_topology),
|
||||
),
|
||||
@@ -2073,7 +2073,7 @@ fn handle_multiple_seconded_statements() {
|
||||
|
||||
// `PeerA` sends a `Seconded` message
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
@@ -2125,7 +2125,7 @@ fn handle_multiple_seconded_statements() {
|
||||
|
||||
// `PeerB` sends a `Seconded` message: valid but known
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_b.clone(),
|
||||
@@ -2176,7 +2176,7 @@ fn handle_multiple_seconded_statements() {
|
||||
|
||||
// `PeerA` sends a `Valid` message
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
@@ -2227,7 +2227,7 @@ fn handle_multiple_seconded_statements() {
|
||||
|
||||
// `PeerB` sends a `Valid` message
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
.send(FromOrchestra::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_b.clone(),
|
||||
@@ -2252,7 +2252,7 @@ fn handle_multiple_seconded_statements() {
|
||||
}
|
||||
);
|
||||
|
||||
handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
|
||||
futures::pin_mut!(test_fut);
|
||||
|
||||
@@ -15,10 +15,11 @@ polkadot-node-primitives = { path = "../primitives" }
|
||||
polkadot-node-subsystem-types = { path = "../subsystem-types" }
|
||||
polkadot-node-metrics = { path = "../metrics" }
|
||||
polkadot-primitives = { path = "../../primitives" }
|
||||
polkadot-overseer-gen = { path = "./overseer-gen" }
|
||||
orchestra = { path = "./orchestra" }
|
||||
gum = { package = "tracing-gum", path = "../gum" }
|
||||
lru = "0.7"
|
||||
parity-util-mem = { version = "0.11.0", default-features = false }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[dev-dependencies]
|
||||
metered-channel = { path = "../metered-channel" }
|
||||
@@ -30,4 +31,4 @@ test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../pri
|
||||
|
||||
[features]
|
||||
default = []
|
||||
expand = ["polkadot-overseer-gen/expand"]
|
||||
expand = ["orchestra/expand"]
|
||||
|
||||
@@ -28,7 +28,7 @@ use polkadot_node_subsystem_types::messages::CandidateValidationMessage;
|
||||
use polkadot_overseer::{
|
||||
self as overseer,
|
||||
dummy::dummy_overseer_builder,
|
||||
gen::{FromOverseer, SpawnedSubsystem},
|
||||
gen::{FromOrchestra, SpawnedSubsystem},
|
||||
HeadSupportsParachains, SubsystemError,
|
||||
};
|
||||
use polkadot_primitives::v2::{CandidateReceipt, Hash};
|
||||
@@ -50,7 +50,7 @@ impl Subsystem1 {
|
||||
'louy: loop {
|
||||
match ctx.try_recv().await {
|
||||
Ok(Some(msg)) => {
|
||||
if let FromOverseer::Communication { msg } = msg {
|
||||
if let FromOrchestra::Communication { msg } = msg {
|
||||
gum::info!("msg {:?}", msg);
|
||||
}
|
||||
continue 'louy
|
||||
|
||||
+7
-9
@@ -1,30 +1,28 @@
|
||||
[package]
|
||||
name = "polkadot-overseer-gen"
|
||||
name = "orchestra"
|
||||
version = "0.9.22"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Generate an overseer including builder pattern and message wrapper from a single struct."
|
||||
description = "Generate an orchestra of subsystems from a single struct."
|
||||
license = "MIT OR Apache-2.0"
|
||||
autoexamples = false
|
||||
|
||||
[dependencies]
|
||||
gum = { package = "tracing-gum", path = "../../gum" }
|
||||
tracing = "0.1.34"
|
||||
futures = "0.3"
|
||||
async-trait = "0.1"
|
||||
thiserror = "1"
|
||||
metered = { package = "metered-channel", path = "../../metered-channel" }
|
||||
polkadot-overseer-gen-proc-macro = { path = "./proc-macro" }
|
||||
polkadot-node-network-protocol = { path = "../../network/protocol"}
|
||||
# trait SpawnNamed
|
||||
polkadot-node-primitives = { path = "../../primitives" }
|
||||
orchestra-proc-macro = { path = "./proc-macro" }
|
||||
futures-timer = "3.0.2"
|
||||
pin-project = "1.0"
|
||||
dyn-clonable = "0.9"
|
||||
|
||||
[dev-dependencies]
|
||||
trybuild = "1.0.61"
|
||||
rustversion = "1.0.6"
|
||||
|
||||
|
||||
|
||||
[[example]]
|
||||
name = "duo"
|
||||
crate-type = ["bin"]
|
||||
@@ -35,4 +33,4 @@ crate-type = ["bin"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
expand = ["polkadot-overseer-gen-proc-macro/expand"]
|
||||
expand = ["orchestra-proc-macro/expand"]
|
||||
+19
-19
@@ -1,6 +1,7 @@
|
||||
# overseer pattern
|
||||
# orchestra
|
||||
|
||||
The overseer pattern is a partial actor pattern
|
||||
The orchestra pattern is a partial actor pattern, with a global orchestrator regarding
|
||||
relevant work items.
|
||||
|
||||
## proc-macro
|
||||
|
||||
@@ -9,8 +10,8 @@ where at it's core it creates and spawns a set of subsystems, which are purely
|
||||
declarative.
|
||||
|
||||
```rust
|
||||
#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
|
||||
pub struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
pub struct Opera {
|
||||
#[subsystem(MsgA, sends: [MsgB])]
|
||||
sub_a: AwesomeSubSysA,
|
||||
|
||||
@@ -23,24 +24,25 @@ declarative.
|
||||
being consumed by that particular subsystem. Each of those subsystems is required to implement the subsystem
|
||||
trait with the correct trait bounds. Commonly this is achieved
|
||||
by using `#[subsystem]` and `#[contextbounds]` macro.
|
||||
* `#[contextbounds(Foo, error=Yikes, prefix=wherethetraitsat)]` can applied to `impl`-blocks and `fn`-blocks. It will add additional trait bounds for the generic `Context` with `Context: FooContextTrait` for `<Context as FooContextTrait>::Sender: FooSenderTrait` besides a few more. Note that `Foo` here references the name of the subsystem as declared in `#[overlord(..)]` macro.
|
||||
* `#[contextbounds(Foo, error=Yikes, prefix=wherethetraitsat)]` can applied to `impl`-blocks and `fn`-blocks. It will add additional trait bounds for the generic `Context` with `Context: FooContextTrait` for `<Context as FooContextTrait>::Sender: FooSenderTrait` besides a few more. Note that `Foo` here references the name of the subsystem as declared in `#[orchestra(..)]` macro.
|
||||
* `#[subsystem(Foo, error=Yikes, prefix=wherethetraitsat)]` is a extension to the above, implementing `trait Subsystem<Context, Yikes>`.
|
||||
* `error=` tells the overseer to use the user provided
|
||||
* `error=` tells the orchestra to use the user provided
|
||||
error type, if not provided a builtin one is used. Note that this is the one error type used throughout all calls, so make sure it does impl `From<E>` for all other error types `E` that are relevant to your application.
|
||||
* `event=` declares an external event type, that injects certain events
|
||||
into the overseer, without participating in the subsystem pattern.
|
||||
* `signal=` defines a signal type to be used for the overseer. This is a shared "clock" for all subsystems.
|
||||
into the orchestra, without participating in the subsystem pattern.
|
||||
* `signal=` defines a signal type to be used for the orchestra. This is a shared "tick" or "clock" for all subsystems.
|
||||
* `gen=` defines a wrapping `enum` type that is used to wrap all messages that can be consumed by _any_ subsystem.
|
||||
|
||||
```rust
|
||||
/// Execution context, always requred.
|
||||
/// Execution context, always required.
|
||||
pub struct DummyCtx;
|
||||
|
||||
/// Task spawner, always required.
|
||||
/// Task spawner, always required
|
||||
/// and must implement `trait orchestra::Spawner`.
|
||||
pub struct DummySpawner;
|
||||
|
||||
fn main() {
|
||||
let _overseer = Overseer::builder()
|
||||
let _orchestra = Opera::builder()
|
||||
.sub_a(AwesomeSubSysA::default())
|
||||
.sub_b(AwesomeSubSysB::default())
|
||||
.spawner(DummySpawner)
|
||||
@@ -48,7 +50,7 @@ into the overseer, without participating in the subsystem pattern.
|
||||
}
|
||||
```
|
||||
|
||||
In the shown `main`, the overseer is created by means of a generated, compile time erroring
|
||||
In the shown `main`, the orchestra is created by means of a generated, compile time erroring
|
||||
builder pattern.
|
||||
|
||||
The builder requires all subsystems, baggage fields (additional struct data) and spawner to be
|
||||
@@ -61,11 +63,11 @@ for the specific struct field. Therefore, if you see a compile time error that b
|
||||
not set prior to the `build` call.
|
||||
|
||||
To exclude subsystems from such a check, one can set `wip` attribute on some subsystem that
|
||||
is not ready to be included in the Overseer:
|
||||
is not ready to be included in the Orchestra:
|
||||
|
||||
```rust
|
||||
#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
|
||||
pub struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
pub struct Opera {
|
||||
#[subsystem(MsgA, sends: MsgB)]
|
||||
sub_a: AwesomeSubSysA,
|
||||
|
||||
@@ -78,13 +80,11 @@ Baggage fields can be initialized more than one time, however, it is not true fo
|
||||
subsystems must be initialized only once (another compile time check) or be _replaced_ by
|
||||
a special setter like method `replace_<subsystem>`.
|
||||
|
||||
A task spawner and subsystem context are required to be defined with `SpawnNamed` and respectively `SubsystemContext` implemented.
|
||||
A task spawner and subsystem context are required to be defined with `Spawner` and respectively `SubsystemContext` implemented.
|
||||
|
||||
## Debugging
|
||||
|
||||
As always, debugging is notoriously annoying with bugged proc-macros.
|
||||
|
||||
Therefore [`expander`](https://github.com/drahnr/expander) is employed to yield better
|
||||
error messages. Enable with `--feature=polkadot-overseer-gen/expand` or
|
||||
`--feature=polkadot-overseer/expand` from the root of the project or
|
||||
make `"expand"` part of the default feature set.
|
||||
error messages. Enable with `--feature=orchestra/expand`.
|
||||
+4
-4
@@ -10,12 +10,12 @@ Previously, there was no way to limit and hence reason about a subset of subsyst
|
||||
|
||||
## Decision
|
||||
|
||||
Annotate the `#[overlord]` inner `#[subsystem(..)]` annotation
|
||||
Annotate the `#[orchestra]` inner `#[subsystem(..)]` annotation
|
||||
with an aditional set of outgoing messages and enforce this via more fine grained trait bounds on the `Sender` and `<Context>::Sender` bounds.
|
||||
|
||||
## Consequences
|
||||
|
||||
* A graph will be spawn for every compilation under the `OUT_DIR` of the crate where `#[overlord]` is specified.
|
||||
* Each subsystem has a consuming message which is often referred to as generic `M` (no change on that, is as before), but now we have trait `AssociateOutgoing { type OutgoingMessages = ..; }` which defines an outgoing helper `enum` that is generated with an ident constructed as `${Subsystem}OutgoingMessages` where `${Subsystem}` is the subsystem identifier as used in the overseer declaration. `${Subsystem}OutgoingMessages` is used throughout everywhere to constrain the outgoing messages (commonly referred to as `OutgoingMessage` generic bounded by `${Subsystem}OutgoingMessages: From<OutgoingMessage>` or `::OutgoingMessages: From`. It's what allows the construction of the graph and compile time verification.
|
||||
* `${Subsystem}SenderTrait` and `${Subsystem}ContextTrait` are accumulation traits or wrapper traits, that combine over all annotated M or `OutgoingMessages` from the overseer declaration or their respective outgoing types. It is usage convenience and assures consistency within a subsystem while also maintaining a single source of truth for which messages can be sent by a particular subsystem. Note that this is sidestepped for the test subsystem, which may consume `gen=AllMessages`, the global message wrapper type.
|
||||
* A graph will be spawn for every compilation under the `OUT_DIR` of the crate where `#[orchestra]` is specified.
|
||||
* Each subsystem has a consuming message which is often referred to as generic `M` (no change on that, is as before), but now we have trait `AssociateOutgoing { type OutgoingMessages = ..; }` which defines an outgoing helper `enum` that is generated with an ident constructed as `${Subsystem}OutgoingMessages` where `${Subsystem}` is the subsystem identifier as used in the orchestra declaration. `${Subsystem}OutgoingMessages` is used throughout everywhere to constrain the outgoing messages (commonly referred to as `OutgoingMessage` generic bounded by `${Subsystem}OutgoingMessages: From<OutgoingMessage>` or `::OutgoingMessages: From`. It's what allows the construction of the graph and compile time verification.
|
||||
* `${Subsystem}SenderTrait` and `${Subsystem}ContextTrait` are accumulation traits or wrapper traits, that combine over all annotated M or `OutgoingMessages` from the orchestra declaration or their respective outgoing types. It is usage convenience and assures consistency within a subsystem while also maintaining a single source of truth for which messages can be sent by a particular subsystem. Note that this is sidestepped for the test subsystem, which may consume `gen=AllMessages`, the global message wrapper type.
|
||||
* `Job`-based subsystems, being on their way out, are patched, but they now are generic over the `Sender` type, leaking that type.
|
||||
+12
-12
@@ -1,8 +1,8 @@
|
||||
#![allow(dead_code)] // overseer events are not used
|
||||
#![allow(dead_code)] // orchestra events are not used
|
||||
|
||||
//! A dummy to be used with cargo expand
|
||||
|
||||
use polkadot_overseer_gen::{self as overseer, SpawnNamed, *};
|
||||
use orchestra::{self as orchestra, Spawner, *};
|
||||
use std::collections::HashMap;
|
||||
mod misc;
|
||||
|
||||
@@ -12,7 +12,7 @@ pub use self::misc::*;
|
||||
#[derive(Default)]
|
||||
pub struct AwesomeSubSys;
|
||||
|
||||
#[overseer::subsystem(Awesome, error=Yikes)]
|
||||
#[orchestra::subsystem(Awesome, error=Yikes)]
|
||||
impl<Context> AwesomeSubSys {
|
||||
fn start(self, mut ctx: Context) -> SpawnedSubsystem<Yikes> {
|
||||
let mut sender = ctx.sender().clone();
|
||||
@@ -30,7 +30,7 @@ impl<Context> AwesomeSubSys {
|
||||
#[derive(Default)]
|
||||
pub struct Fortified;
|
||||
|
||||
#[overseer::subsystem(GoblinTower, error=Yikes)]
|
||||
#[orchestra::subsystem(GoblinTower, error=Yikes)]
|
||||
impl<Context> Fortified {
|
||||
fn start(self, mut ctx: Context) -> SpawnedSubsystem<Yikes> {
|
||||
let mut sender = ctx.sender().clone();
|
||||
@@ -45,7 +45,7 @@ impl<Context> Fortified {
|
||||
}
|
||||
}
|
||||
|
||||
#[overlord(signal=SigSigSig, event=EvX, error=Yikes, gen=AllMessages)]
|
||||
#[orchestra(signal=SigSigSig, event=EvX, error=Yikes, gen=AllMessages)]
|
||||
struct Duo<T> {
|
||||
#[subsystem(consumes: MsgStrukt, sends: [Plinko])]
|
||||
sub0: Awesome,
|
||||
@@ -62,7 +62,7 @@ fn main() {
|
||||
use futures::{executor, pin_mut};
|
||||
|
||||
executor::block_on(async move {
|
||||
let (overseer, _handle): (Duo<_, f64>, _) = Duo::builder()
|
||||
let (orchestra, _handle): (Duo<_, f64>, _) = Duo::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.plinkos(Fortified::default())
|
||||
.i_like_pi(::std::f64::consts::PI)
|
||||
@@ -72,18 +72,18 @@ fn main() {
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(overseer.i_like_pi.floor() as i8, 3);
|
||||
assert_eq!(overseer.i_like_generic.floor() as i8, 42);
|
||||
assert_eq!(overseer.i_like_hash.len() as i8, 0);
|
||||
assert_eq!(orchestra.i_like_pi.floor() as i8, 3);
|
||||
assert_eq!(orchestra.i_like_generic.floor() as i8, 42);
|
||||
assert_eq!(orchestra.i_like_hash.len() as i8, 0);
|
||||
|
||||
let overseer_fut = overseer
|
||||
let orchestra_fut = orchestra
|
||||
.running_subsystems
|
||||
.into_future()
|
||||
.timeout(std::time::Duration::from_millis(300))
|
||||
.fuse();
|
||||
|
||||
pin_mut!(overseer_fut);
|
||||
pin_mut!(orchestra_fut);
|
||||
|
||||
overseer_fut.await
|
||||
orchestra_fut.await
|
||||
});
|
||||
}
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
use polkadot_overseer_gen::{SpawnNamed, *};
|
||||
use orchestra::{Spawner, *};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum SigSigSig {
|
||||
@@ -9,7 +9,7 @@ pub enum SigSigSig {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl SpawnNamed for DummySpawner {
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
@@ -50,14 +50,14 @@ impl std::fmt::Display for Yikes {
|
||||
|
||||
impl std::error::Error for Yikes {}
|
||||
|
||||
impl From<polkadot_overseer_gen::OverseerError> for Yikes {
|
||||
fn from(_: polkadot_overseer_gen::OverseerError) -> Yikes {
|
||||
impl From<orchestra::OrchestraError> for Yikes {
|
||||
fn from(_: orchestra::OrchestraError) -> Yikes {
|
||||
Yikes
|
||||
}
|
||||
}
|
||||
|
||||
impl From<polkadot_overseer_gen::mpsc::SendError> for Yikes {
|
||||
fn from(_: polkadot_overseer_gen::mpsc::SendError) -> Yikes {
|
||||
impl From<orchestra::mpsc::SendError> for Yikes {
|
||||
fn from(_: orchestra::mpsc::SendError) -> Yikes {
|
||||
Yikes
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
#![allow(dead_code)] // overseer events are not used
|
||||
#![allow(dead_code)] // orchestra events are not used
|
||||
|
||||
//! A minimal demo to be used with cargo expand.
|
||||
|
||||
use polkadot_overseer_gen::{self as overseer, SpawnNamed, *};
|
||||
use orchestra::{self as orchestra, Spawner, *};
|
||||
mod misc;
|
||||
|
||||
pub use self::misc::*;
|
||||
|
||||
#[overlord(signal=SigSigSig, event=EvX, error=Yikes, gen=AllMessages)]
|
||||
#[orchestra(signal=SigSigSig, event=EvX, error=Yikes, gen=AllMessages)]
|
||||
struct Solo<T> {
|
||||
#[subsystem(consumes: Plinko, sends: [MsgStrukt])]
|
||||
goblin_tower: GoblinTower,
|
||||
@@ -16,7 +16,7 @@ struct Solo<T> {
|
||||
#[derive(Default)]
|
||||
pub struct Fortified;
|
||||
|
||||
#[overseer::subsystem(GoblinTower, error=Yikes)]
|
||||
#[orchestra::subsystem(GoblinTower, error=Yikes)]
|
||||
impl<Context> Fortified {
|
||||
fn start(self, mut ctx: Context) -> SpawnedSubsystem<Yikes> {
|
||||
let mut sender = ctx.sender().clone();
|
||||
@@ -35,20 +35,20 @@ fn main() {
|
||||
use futures::{executor, pin_mut};
|
||||
|
||||
executor::block_on(async move {
|
||||
let (overseer, _handle): (Solo<_>, _) = Solo::builder()
|
||||
let (orchestra, _handle): (Solo<_>, _) = Solo::builder()
|
||||
.goblin_tower(Fortified::default())
|
||||
.spawner(DummySpawner)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let overseer_fut = overseer
|
||||
let orchestra_fut = orchestra
|
||||
.running_subsystems
|
||||
.into_future()
|
||||
.timeout(std::time::Duration::from_millis(300))
|
||||
.fuse();
|
||||
|
||||
pin_mut!(overseer_fut);
|
||||
pin_mut!(orchestra_fut);
|
||||
|
||||
overseer_fut.await
|
||||
orchestra_fut.await
|
||||
});
|
||||
}
|
||||
+8
-7
@@ -1,9 +1,10 @@
|
||||
[package]
|
||||
name = "polkadot-overseer-gen-proc-macro"
|
||||
name = "orchestra-proc-macro"
|
||||
version = "0.9.22"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Generate an overseer including builder pattern and message wrapper from a single annotated struct definition."
|
||||
description = "Generate an orchestra of subsystems from a single annotated struct definition."
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
@@ -20,16 +21,16 @@ expander = { version = "0.0.6", default-features = false }
|
||||
petgraph = "0.6.0"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5.0"
|
||||
polkadot-overseer-gen = { path = "../" }
|
||||
assert_matches = "1.5"
|
||||
orchestra = { path = "../" }
|
||||
thiserror = "1"
|
||||
gum = { package = "tracing-gum", path = "../../../gum" }
|
||||
tracing = "0.1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
# write the expanded version to a `overlord-expansion.[a-f0-9]{10}.rs`
|
||||
# write the expanded version to a `orchestra-expansion.[a-f0-9]{10}.rs`
|
||||
# in the `OUT_DIR` as defined by `cargo` for the `expander` crate.
|
||||
expand = []
|
||||
# Create directional message consuming / outgoing graph.
|
||||
# Generates: `${OUT_DIR}/${overseer|lowercase}-subsystem-messaging.dot`
|
||||
# Generates: `${OUT_DIR}/${orchestra|lowercase}-subsystem-messaging.dot`
|
||||
graph = []
|
||||
+47
-47
@@ -26,16 +26,16 @@ fn recollect_without_idx<T: Clone>(x: &[T], idx: usize) -> Vec<T> {
|
||||
v
|
||||
}
|
||||
|
||||
/// Implement a builder pattern for the `Overseer`-type,
|
||||
/// which acts as the gateway to constructing the overseer.
|
||||
/// Implement a builder pattern for the `Orchestra`-type,
|
||||
/// which acts as the gateway to constructing the orchestra.
|
||||
///
|
||||
/// Elements tagged with `wip` are not covered here.
|
||||
pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
let overseer_name = info.overseer_name.clone();
|
||||
let builder = format_ident!("{}Builder", overseer_name);
|
||||
let handle = format_ident!("{}Handle", overseer_name);
|
||||
let connector = format_ident!("{}Connector", overseer_name);
|
||||
let subsystem_ctx_name = format_ident!("{}SubsystemContext", overseer_name);
|
||||
pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream {
|
||||
let orchestra_name = info.orchestra_name.clone();
|
||||
let builder = format_ident!("{}Builder", orchestra_name);
|
||||
let handle = format_ident!("{}Handle", orchestra_name);
|
||||
let connector = format_ident!("{}Connector", orchestra_name);
|
||||
let subsystem_ctx_name = format_ident!("{}SubsystemContext", orchestra_name);
|
||||
|
||||
let subsystem_name = &info.subsystem_names_without_wip();
|
||||
let subsystem_generics = &info.subsystem_generic_types();
|
||||
@@ -83,7 +83,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
|
||||
// Helpers to use within quote! macros
|
||||
let spawner_where_clause: syn::TypeParam = parse_quote! {
|
||||
S: #support_crate ::SpawnNamed + Send
|
||||
S: #support_crate ::Spawner
|
||||
};
|
||||
|
||||
// Field names and real types
|
||||
@@ -305,7 +305,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
|
||||
let event = &info.extern_event_ty;
|
||||
let initialized_builder = format_ident!("Initialized{}", builder);
|
||||
// The direct generics as expected by the `Overseer<_,_,..>`, without states
|
||||
// The direct generics as expected by the `Orchestra<_,_,..>`, without states
|
||||
let initialized_builder_generics = quote! {
|
||||
S, #( #baggage_generic_ty, )* #( #subsystem_generics, )*
|
||||
};
|
||||
@@ -336,7 +336,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
/// Convenience alias.
|
||||
type SubsystemInitFn<T> = Box<dyn FnOnce(#handle) -> ::std::result::Result<T, #error_ty> >;
|
||||
|
||||
/// Type for the initialized field of the overseer builder
|
||||
/// Type for the initialized field of the orchestra builder
|
||||
pub enum Init<T> {
|
||||
/// Defer initialization to a point where the `handle` is available.
|
||||
Fn(SubsystemInitFn<T>),
|
||||
@@ -344,7 +344,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
/// Also used for baggage fields
|
||||
Value(T),
|
||||
}
|
||||
/// Type marker for the uninitialized field of the overseer builder.
|
||||
/// Type marker for the uninitialized field of the orchestra builder.
|
||||
/// `PhantomData` is used for type hinting when creating uninitialized
|
||||
/// builder, e.g. to avoid specifying the generics when instantiating
|
||||
/// the `FooBuilder` when calling `Foo::builder()`
|
||||
@@ -352,10 +352,10 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
pub struct Missing<T>(::core::marker::PhantomData<T>);
|
||||
|
||||
/// Trait used to mark fields status in a builder
|
||||
trait OverseerFieldState<T> {}
|
||||
trait OrchestraFieldState<T> {}
|
||||
|
||||
impl<T> OverseerFieldState<T> for Init<T> {}
|
||||
impl<T> OverseerFieldState<T> for Missing<T> {}
|
||||
impl<T> OrchestraFieldState<T> for Init<T> {}
|
||||
impl<T> OrchestraFieldState<T> for Missing<T> {}
|
||||
|
||||
impl<T> ::std::default::Default for Missing<T> {
|
||||
fn default() -> Self {
|
||||
@@ -363,11 +363,11 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
}
|
||||
}
|
||||
|
||||
impl<S #(, #baggage_generic_ty )*> #overseer_name <S #(, #baggage_generic_ty)*>
|
||||
impl<S #(, #baggage_generic_ty )*> #orchestra_name <S #(, #baggage_generic_ty)*>
|
||||
where
|
||||
#spawner_where_clause,
|
||||
{
|
||||
/// Create a new overseer utilizing the builder.
|
||||
/// Create a new orchestra utilizing the builder.
|
||||
pub fn builder< #( #subsystem_generics),* >() ->
|
||||
#builder<Missing<S> #(, Missing< #field_type > )* >
|
||||
where
|
||||
@@ -379,7 +379,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
};
|
||||
|
||||
ts.extend(quote! {
|
||||
/// Handle for an overseer.
|
||||
/// Handle for an orchestra.
|
||||
pub type #handle = #support_crate ::metered::MeteredSender< #event >;
|
||||
|
||||
/// External connector.
|
||||
@@ -390,16 +390,16 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
///
|
||||
/// For subsystems, use the `_with` variants of the builder.
|
||||
handle: #handle,
|
||||
/// The side consumed by the `spawned` side of the overseer pattern.
|
||||
/// The side consumed by the `spawned` side of the orchestra pattern.
|
||||
consumer: #support_crate ::metered::MeteredReceiver < #event >,
|
||||
}
|
||||
|
||||
impl #connector {
|
||||
/// Obtain access to the overseer handle.
|
||||
/// Obtain access to the orchestra handle.
|
||||
pub fn as_handle_mut(&mut self) -> &mut #handle {
|
||||
&mut self.handle
|
||||
}
|
||||
/// Obtain access to the overseer handle.
|
||||
/// Obtain access to the orchestra handle.
|
||||
pub fn as_handle(&self) -> &#handle {
|
||||
&self.handle
|
||||
}
|
||||
@@ -440,7 +440,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
)*
|
||||
spawner: InitStateSpawner,
|
||||
// user provided runtime overrides,
|
||||
// if `None`, the `overlord(message_capacity=123,..)` is used
|
||||
// if `None`, the `orchestra(message_capacity=123,..)` is used
|
||||
// or the default value.
|
||||
channel_capacity: Option<usize>,
|
||||
signal_capacity: Option<usize>,
|
||||
@@ -455,7 +455,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
// explicitly assure the required traits are implemented
|
||||
fn trait_from_must_be_implemented<E>()
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static + From<#support_crate ::OverseerError>
|
||||
E: ::std::error::Error + Send + Sync + 'static + From<#support_crate ::OrchestraError>
|
||||
{}
|
||||
|
||||
trait_from_must_be_implemented::< #error_ty >();
|
||||
@@ -530,7 +530,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
ts.extend(quote! {
|
||||
/// Type used to represent a builder where all fields are initialized and the overseer could be constructed.
|
||||
/// Type used to represent a builder where all fields are initialized and the orchestra could be constructed.
|
||||
pub type #initialized_builder<#initialized_builder_generics> = #builder<Init<S>, #( Init<#field_type>, )*>;
|
||||
|
||||
// A builder specialization where all fields are set
|
||||
@@ -539,18 +539,18 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
#spawner_where_clause,
|
||||
#builder_where_clause
|
||||
{
|
||||
/// Complete the construction and create the overseer type.
|
||||
/// Complete the construction and create the orchestra type.
|
||||
pub fn build(self)
|
||||
-> ::std::result::Result<(#overseer_name<S, #( #baggage_generic_ty, )*>, #handle), #error_ty> {
|
||||
-> ::std::result::Result<(#orchestra_name<S, #( #baggage_generic_ty, )*>, #handle), #error_ty> {
|
||||
let connector = #connector ::with_event_capacity(
|
||||
self.signal_capacity.unwrap_or(SIGNAL_CHANNEL_CAPACITY)
|
||||
);
|
||||
self.build_with_connector(connector)
|
||||
}
|
||||
|
||||
/// Complete the construction and create the overseer type based on an existing `connector`.
|
||||
/// Complete the construction and create the orchestra type based on an existing `connector`.
|
||||
pub fn build_with_connector(self, connector: #connector)
|
||||
-> ::std::result::Result<(#overseer_name<S, #( #baggage_generic_ty, )*>, #handle), #error_ty>
|
||||
-> ::std::result::Result<(#orchestra_name<S, #( #baggage_generic_ty, )*>, #handle), #error_ty>
|
||||
{
|
||||
let #connector {
|
||||
handle: events_tx,
|
||||
@@ -559,8 +559,8 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
|
||||
let handle = events_tx.clone();
|
||||
|
||||
let (to_overseer_tx, to_overseer_rx) = #support_crate ::metered::unbounded::<
|
||||
ToOverseer
|
||||
let (to_orchestra_tx, to_orchestra_rx) = #support_crate ::metered::unbounded::<
|
||||
ToOrchestra
|
||||
>();
|
||||
|
||||
#(
|
||||
@@ -618,11 +618,11 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
signal_rx,
|
||||
message_rx,
|
||||
channels_out.clone(),
|
||||
to_overseer_tx.clone(),
|
||||
to_orchestra_tx.clone(),
|
||||
#subsystem_name_str_literal
|
||||
);
|
||||
|
||||
let #subsystem_name: OverseenSubsystem< #consumes > =
|
||||
let #subsystem_name: OrchestratedSubsystem< #consumes > =
|
||||
spawn::<_,_, #blocking, _, _, _>(
|
||||
&mut spawner,
|
||||
#channel_name_tx,
|
||||
@@ -637,8 +637,8 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
|
||||
use #support_crate ::StreamExt;
|
||||
|
||||
let to_overseer_rx = to_overseer_rx.fuse();
|
||||
let overseer = #overseer_name {
|
||||
let to_orchestra_rx = to_orchestra_rx.fuse();
|
||||
let orchestra = #orchestra_name {
|
||||
#(
|
||||
#subsystem_name,
|
||||
)*
|
||||
@@ -653,10 +653,10 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
spawner,
|
||||
running_subsystems,
|
||||
events_rx,
|
||||
to_overseer_rx,
|
||||
to_orchestra_rx,
|
||||
};
|
||||
|
||||
Ok((overseer, handle))
|
||||
Ok((orchestra, handle))
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -667,7 +667,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
ts
|
||||
}
|
||||
|
||||
pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
pub(crate) fn impl_task_kind(info: &OrchestraInfo) -> proc_macro2::TokenStream {
|
||||
let signal = &info.extern_signal_ty;
|
||||
let error_ty = &info.extern_error_ty;
|
||||
let support_crate = info.support_crate_name();
|
||||
@@ -676,13 +676,13 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
/// Task kind to launch.
|
||||
pub trait TaskKind {
|
||||
/// Spawn a task, it depends on the implementer if this is blocking or not.
|
||||
fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>);
|
||||
fn launch_task<S: Spawner>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>);
|
||||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
struct Regular;
|
||||
impl TaskKind for Regular {
|
||||
fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) {
|
||||
fn launch_task<S: Spawner>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) {
|
||||
spawner.spawn(task_name, Some(subsystem_name), future)
|
||||
}
|
||||
}
|
||||
@@ -690,7 +690,7 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
#[allow(missing_docs)]
|
||||
struct Blocking;
|
||||
impl TaskKind for Blocking {
|
||||
fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) {
|
||||
fn launch_task<S: Spawner>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) {
|
||||
spawner.spawn_blocking(task_name, Some(subsystem_name), future)
|
||||
}
|
||||
}
|
||||
@@ -706,13 +706,13 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
s: SubSys,
|
||||
subsystem_name: &'static str,
|
||||
futures: &mut #support_crate ::FuturesUnordered<BoxFuture<'static, ::std::result::Result<(), #error_ty> >>,
|
||||
) -> ::std::result::Result<OverseenSubsystem<M>, #error_ty >
|
||||
) -> ::std::result::Result<OrchestratedSubsystem<M>, #error_ty >
|
||||
where
|
||||
S: #support_crate ::SpawnNamed,
|
||||
S: #support_crate ::Spawner,
|
||||
M: std::fmt::Debug + Send + 'static,
|
||||
TK: TaskKind,
|
||||
Ctx: #support_crate ::SubsystemContext<Message=M>,
|
||||
E: std::error::Error + Send + Sync + 'static + From<#support_crate ::OverseerError>,
|
||||
E: ::std::error::Error + Send + Sync + 'static + ::std::convert::From<#support_crate ::OrchestraError>,
|
||||
SubSys: #support_crate ::Subsystem<Ctx, E>,
|
||||
{
|
||||
let #support_crate ::SpawnedSubsystem::<E> { future, name } = s.start(ctx);
|
||||
@@ -721,9 +721,9 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
|
||||
let fut = Box::pin(async move {
|
||||
if let Err(e) = future.await {
|
||||
#support_crate ::gum::error!(subsystem=name, err = ?e, "subsystem exited with error");
|
||||
#support_crate ::tracing::error!(subsystem=name, err = ?e, "subsystem exited with error");
|
||||
} else {
|
||||
#support_crate ::gum::debug!(subsystem=name, "subsystem exited without an error");
|
||||
#support_crate ::tracing::debug!(subsystem=name, "subsystem exited without an error");
|
||||
}
|
||||
let _ = tx.send(());
|
||||
});
|
||||
@@ -732,7 +732,7 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
|
||||
futures.push(Box::pin(
|
||||
rx.map(|e| {
|
||||
gum::warn!(err = ?e, "dropping error");
|
||||
#support_crate ::tracing::warn!(err = ?e, "dropping error");
|
||||
Ok(())
|
||||
})
|
||||
));
|
||||
@@ -749,7 +749,7 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
name,
|
||||
});
|
||||
|
||||
Ok(OverseenSubsystem {
|
||||
Ok(OrchestratedSubsystem {
|
||||
instance,
|
||||
})
|
||||
}
|
||||
+6
-6
@@ -20,7 +20,7 @@ use syn::Result;
|
||||
use super::*;
|
||||
|
||||
/// Implement the helper type `ChannelsOut` and `MessagePacket<T>`.
|
||||
pub(crate) fn impl_channels_out_struct(info: &OverseerInfo) -> Result<proc_macro2::TokenStream> {
|
||||
pub(crate) fn impl_channels_out_struct(info: &OrchestraInfo) -> Result<proc_macro2::TokenStream> {
|
||||
let message_wrapper = info.message_wrapper.clone();
|
||||
|
||||
let channel_name = &info.channel_names_without_wip("");
|
||||
@@ -36,7 +36,7 @@ pub(crate) fn impl_channels_out_struct(info: &OverseerInfo) -> Result<proc_macro
|
||||
let ts = quote! {
|
||||
/// Collection of channels to the individual subsystems.
|
||||
///
|
||||
/// Naming is from the point of view of the overseer.
|
||||
/// Naming is from the point of view of the orchestra.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ChannelsOut {
|
||||
#(
|
||||
@@ -84,13 +84,13 @@ pub(crate) fn impl_channels_out_struct(info: &OverseerInfo) -> Result<proc_macro
|
||||
#[allow(unreachable_patterns)]
|
||||
// And everything that's not WIP but no subsystem consumes it
|
||||
unused_msg => {
|
||||
#support_crate :: gum :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
#support_crate :: tracing :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
Ok(())
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(subsystem_name) = res {
|
||||
#support_crate ::gum::debug!(
|
||||
#support_crate ::tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
"Failed to send (bounded) a message to {} subsystem",
|
||||
subsystem_name
|
||||
@@ -123,13 +123,13 @@ pub(crate) fn impl_channels_out_struct(info: &OverseerInfo) -> Result<proc_macro
|
||||
// And everything that's not WIP but no subsystem consumes it
|
||||
#[allow(unreachable_patterns)]
|
||||
unused_msg => {
|
||||
#support_crate :: gum :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
#support_crate :: tracing :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
Ok(())
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(subsystem_name) = res {
|
||||
#support_crate ::gum::debug!(
|
||||
#support_crate ::tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
"Failed to send_unbounded a message to {} subsystem",
|
||||
subsystem_name
|
||||
+1
-1
@@ -20,7 +20,7 @@ use syn::{spanned::Spanned, Result};
|
||||
use super::*;
|
||||
|
||||
/// Generates the wrapper type enum.
|
||||
pub(crate) fn impl_message_wrapper_enum(info: &OverseerInfo) -> Result<proc_macro2::TokenStream> {
|
||||
pub(crate) fn impl_message_wrapper_enum(info: &OrchestraInfo) -> Result<proc_macro2::TokenStream> {
|
||||
let consumes = info.any_message();
|
||||
let consumes_variant = info.variant_names();
|
||||
|
||||
+23
-23
@@ -18,9 +18,9 @@ use quote::quote;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
pub(crate) fn impl_orchestra_struct(info: &OrchestraInfo) -> proc_macro2::TokenStream {
|
||||
let message_wrapper = &info.message_wrapper.clone();
|
||||
let overseer_name = info.overseer_name.clone();
|
||||
let orchestra_name = info.orchestra_name.clone();
|
||||
let subsystem_name = &info.subsystem_names_without_wip();
|
||||
let support_crate = info.support_crate_name();
|
||||
|
||||
@@ -34,7 +34,7 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr
|
||||
|
||||
let where_clause = quote! {
|
||||
where
|
||||
S: #support_crate ::SpawnNamed,
|
||||
S: #support_crate ::Spawner,
|
||||
};
|
||||
// TODO add `where ..` clauses for baggage types
|
||||
// TODO <https://github.com/paritytech/polkadot/issues/3427>
|
||||
@@ -53,25 +53,25 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr
|
||||
let signal_channel_capacity = info.signal_channel_capacity;
|
||||
|
||||
let log_target =
|
||||
syn::LitStr::new(overseer_name.to_string().to_lowercase().as_str(), overseer_name.span());
|
||||
syn::LitStr::new(orchestra_name.to_string().to_lowercase().as_str(), orchestra_name.span());
|
||||
|
||||
let ts = quote! {
|
||||
/// Capacity of a bounded message channel between overseer and subsystem
|
||||
/// Capacity of a bounded message channel between orchestra and subsystem
|
||||
/// but also for bounded channels between two subsystems.
|
||||
const CHANNEL_CAPACITY: usize = #message_channel_capacity;
|
||||
|
||||
/// Capacity of a signal channel between a subsystem and the overseer.
|
||||
/// Capacity of a signal channel between a subsystem and the orchestra.
|
||||
const SIGNAL_CHANNEL_CAPACITY: usize = #signal_channel_capacity;
|
||||
|
||||
/// The log target tag.
|
||||
const LOG_TARGET: &'static str = #log_target;
|
||||
|
||||
/// The overseer.
|
||||
pub struct #overseer_name #generics {
|
||||
/// The orchestra.
|
||||
pub struct #orchestra_name #generics {
|
||||
|
||||
#(
|
||||
/// A subsystem instance.
|
||||
#subsystem_name: OverseenSubsystem< #consumes >,
|
||||
#subsystem_name: OrchestratedSubsystem< #consumes >,
|
||||
)*
|
||||
|
||||
#(
|
||||
@@ -88,15 +88,15 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr
|
||||
>,
|
||||
|
||||
/// Gather running subsystems' outbound streams into one.
|
||||
to_overseer_rx: #support_crate ::stream::Fuse<
|
||||
#support_crate ::metered::UnboundedMeteredReceiver< #support_crate ::ToOverseer >
|
||||
to_orchestra_rx: #support_crate ::stream::Fuse<
|
||||
#support_crate ::metered::UnboundedMeteredReceiver< #support_crate ::ToOrchestra >
|
||||
>,
|
||||
|
||||
/// Events that are sent to the overseer from the outside world.
|
||||
/// Events that are sent to the orchestra from the outside world.
|
||||
events_rx: #support_crate ::metered::MeteredReceiver< #event_ty >,
|
||||
}
|
||||
|
||||
impl #generics #overseer_name #generics #where_clause {
|
||||
impl #generics #orchestra_name #generics #where_clause {
|
||||
/// Send the given signal, a termination signal, to all subsystems
|
||||
/// and wait for all subsystems to go down.
|
||||
///
|
||||
@@ -141,7 +141,7 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr
|
||||
match message {
|
||||
#(
|
||||
#message_wrapper :: #consumes_variant ( inner ) =>
|
||||
OverseenSubsystem::< #consumes >::send_message2(&mut self. #subsystem_name, inner, origin ).await?,
|
||||
OrchestratedSubsystem::< #consumes >::send_message2(&mut self. #subsystem_name, inner, origin ).await?,
|
||||
)*
|
||||
// subsystems that are still work in progress
|
||||
#(
|
||||
@@ -152,7 +152,7 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr
|
||||
// And everything that's not WIP but no subsystem consumes it
|
||||
#[allow(unreachable_patterns)]
|
||||
unused_msg => {
|
||||
#support_crate :: gum :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
#support_crate :: tracing :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -163,7 +163,7 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr
|
||||
-> Vec<Output>
|
||||
where
|
||||
#(
|
||||
Mapper: MapSubsystem<&'a OverseenSubsystem< #consumes >, Output=Output>,
|
||||
Mapper: MapSubsystem<&'a OrchestratedSubsystem< #consumes >, Output=Output>,
|
||||
)*
|
||||
{
|
||||
vec![
|
||||
@@ -184,27 +184,27 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr
|
||||
ts
|
||||
}
|
||||
|
||||
pub(crate) fn impl_overseen_subsystem(info: &OverseerInfo) -> proc_macro2::TokenStream {
|
||||
pub(crate) fn impl_orchestrated_subsystem(info: &OrchestraInfo) -> proc_macro2::TokenStream {
|
||||
let signal = &info.extern_signal_ty;
|
||||
let error_ty = &info.extern_error_ty;
|
||||
let support_crate = info.support_crate_name();
|
||||
|
||||
let ts = quote::quote! {
|
||||
/// A subsystem that the overseer oversees.
|
||||
/// A subsystem that the orchestrator orchestrates.
|
||||
///
|
||||
/// Ties together the [`Subsystem`] itself and it's running instance
|
||||
/// (which may be missing if the [`Subsystem`] is not running at the moment
|
||||
/// for whatever reason).
|
||||
///
|
||||
/// [`Subsystem`]: trait.Subsystem.html
|
||||
pub struct OverseenSubsystem<M> {
|
||||
pub struct OrchestratedSubsystem<M> {
|
||||
/// The instance.
|
||||
pub instance: std::option::Option<
|
||||
#support_crate ::SubsystemInstance<M, #signal>
|
||||
>,
|
||||
}
|
||||
|
||||
impl<M> OverseenSubsystem<M> {
|
||||
impl<M> OrchestratedSubsystem<M> {
|
||||
/// Send a message to the wrapped subsystem.
|
||||
///
|
||||
/// If the inner `instance` is `None`, nothing is happening.
|
||||
@@ -218,14 +218,14 @@ pub(crate) fn impl_overseen_subsystem(info: &OverseerInfo) -> proc_macro2::Token
|
||||
}).timeout(MESSAGE_TIMEOUT).await
|
||||
{
|
||||
None => {
|
||||
#support_crate ::gum::error!(
|
||||
#support_crate ::tracing::error!(
|
||||
target: LOG_TARGET,
|
||||
%origin,
|
||||
"Subsystem {} appears unresponsive.",
|
||||
instance.name,
|
||||
);
|
||||
Err(#error_ty :: from(
|
||||
#support_crate ::OverseerError::SubsystemStalled(instance.name)
|
||||
#support_crate ::OrchestraError::SubsystemStalled(instance.name)
|
||||
))
|
||||
}
|
||||
Some(res) => res.map_err(Into::into),
|
||||
@@ -245,7 +245,7 @@ pub(crate) fn impl_overseen_subsystem(info: &OverseerInfo) -> proc_macro2::Token
|
||||
match instance.tx_signal.send(signal).timeout(SIGNAL_TIMEOUT).await {
|
||||
None => {
|
||||
Err(#error_ty :: from(
|
||||
#support_crate ::OverseerError::SubsystemStalled(instance.name)
|
||||
#support_crate ::OrchestraError::SubsystemStalled(instance.name)
|
||||
))
|
||||
}
|
||||
Some(res) => {
|
||||
+32
-32
@@ -52,11 +52,11 @@ fn graphviz(
|
||||
}
|
||||
|
||||
/// Generates all subsystem types and related accumulation traits.
|
||||
pub(crate) fn impl_subsystem_types_all(info: &OverseerInfo) -> Result<TokenStream> {
|
||||
pub(crate) fn impl_subsystem_types_all(info: &OrchestraInfo) -> Result<TokenStream> {
|
||||
let mut ts = TokenStream::new();
|
||||
|
||||
let overseer_name = &info.overseer_name;
|
||||
let span = overseer_name.span();
|
||||
let orchestra_name = &info.orchestra_name;
|
||||
let span = orchestra_name.span();
|
||||
let all_messages_wrapper = &info.message_wrapper;
|
||||
let support_crate = info.support_crate_name();
|
||||
let signal_ty = &info.extern_signal_ty;
|
||||
@@ -125,7 +125,7 @@ pub(crate) fn impl_subsystem_types_all(info: &OverseerInfo) -> Result<TokenStrea
|
||||
// And everything that's not WIP but no subsystem consumes it
|
||||
#[allow(unreachable_patterns)]
|
||||
unused_msg => {
|
||||
#support_crate :: gum :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
#support_crate :: tracing :: warn!("Nothing consumes {:?}", unused_msg);
|
||||
#all_messages_wrapper :: Empty
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ pub(crate) fn impl_subsystem_types_all(info: &OverseerInfo) -> Result<TokenStrea
|
||||
// Dump the graph to file.
|
||||
if cfg!(feature = "graph") || true {
|
||||
let path = std::path::PathBuf::from(env!("OUT_DIR"))
|
||||
.join(overseer_name.to_string().to_lowercase() + "-subsystem-messaging.dot");
|
||||
.join(orchestra_name.to_string().to_lowercase() + "-subsystem-messaging.dot");
|
||||
if let Err(e) = std::fs::OpenOptions::new()
|
||||
.truncate(true)
|
||||
.create(true)
|
||||
@@ -151,8 +151,8 @@ pub(crate) fn impl_subsystem_types_all(info: &OverseerInfo) -> Result<TokenStrea
|
||||
}
|
||||
}
|
||||
|
||||
let subsystem_sender_name = &Ident::new(&(overseer_name.to_string() + "Sender"), span);
|
||||
let subsystem_ctx_name = &Ident::new(&(overseer_name.to_string() + "SubsystemContext"), span);
|
||||
let subsystem_sender_name = &Ident::new(&(orchestra_name.to_string() + "Sender"), span);
|
||||
let subsystem_ctx_name = &Ident::new(&(orchestra_name.to_string() + "SubsystemContext"), span);
|
||||
ts.extend(impl_subsystem_context(info, &subsystem_sender_name, &subsystem_ctx_name));
|
||||
|
||||
ts.extend(impl_associate_outgoing_messages_trait(&all_messages_wrapper));
|
||||
@@ -300,7 +300,7 @@ pub(crate) fn impl_subsystem_sender(
|
||||
// Create the same for a wrapping enum:
|
||||
//
|
||||
// 1. subsystem specific `*OutgoingMessages`-type
|
||||
// 2. overseer-global-`AllMessages`-type
|
||||
// 2. orchestra-global-`AllMessages`-type
|
||||
let wrapped = |outgoing_wrapper: &TokenStream| {
|
||||
quote! {
|
||||
#[#support_crate ::async_trait]
|
||||
@@ -436,32 +436,32 @@ pub(crate) fn impl_subsystem_context_trait_for(
|
||||
type Sender = #subsystem_sender_name < #outgoing_wrapper >;
|
||||
type Error = #error_ty;
|
||||
|
||||
async fn try_recv(&mut self) -> ::std::result::Result<Option<FromOverseer< Self::Message, #signal>>, ()> {
|
||||
async fn try_recv(&mut self) -> ::std::result::Result<Option<FromOrchestra< Self::Message, #signal>>, ()> {
|
||||
match #support_crate ::poll!(self.recv()) {
|
||||
#support_crate ::Poll::Ready(msg) => Ok(Some(msg.map_err(|_| ())?)),
|
||||
#support_crate ::Poll::Pending => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
async fn recv(&mut self) -> ::std::result::Result<FromOverseer<Self::Message, #signal>, #error_ty> {
|
||||
async fn recv(&mut self) -> ::std::result::Result<FromOrchestra<Self::Message, #signal>, #error_ty> {
|
||||
loop {
|
||||
// If we have a message pending an overseer signal, we only poll for signals
|
||||
// If we have a message pending an orchestra signal, we only poll for signals
|
||||
// in the meantime.
|
||||
if let Some((needs_signals_received, msg)) = self.pending_incoming.take() {
|
||||
if needs_signals_received <= self.signals_received.load() {
|
||||
return Ok( #support_crate ::FromOverseer::Communication { msg });
|
||||
return Ok( #support_crate ::FromOrchestra::Communication { msg });
|
||||
} else {
|
||||
self.pending_incoming = Some((needs_signals_received, msg));
|
||||
|
||||
// wait for next signal.
|
||||
let signal = self.signals.next().await
|
||||
.ok_or(#support_crate ::OverseerError::Context(
|
||||
.ok_or(#support_crate ::OrchestraError::Context(
|
||||
"Signal channel is terminated and empty."
|
||||
.to_owned()
|
||||
))?;
|
||||
|
||||
self.signals_received.inc();
|
||||
return Ok( #support_crate ::FromOverseer::Signal(signal))
|
||||
return Ok( #support_crate ::FromOrchestra::Signal(signal))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,19 +471,19 @@ pub(crate) fn impl_subsystem_context_trait_for(
|
||||
let pending_incoming = &mut self.pending_incoming;
|
||||
|
||||
// Otherwise, wait for the next signal or incoming message.
|
||||
let from_overseer = #support_crate ::futures::select_biased! {
|
||||
let from_orchestra = #support_crate ::futures::select_biased! {
|
||||
signal = await_signal => {
|
||||
let signal = signal
|
||||
.ok_or( #support_crate ::OverseerError::Context(
|
||||
.ok_or( #support_crate ::OrchestraError::Context(
|
||||
"Signal channel is terminated and empty."
|
||||
.to_owned()
|
||||
))?;
|
||||
|
||||
#support_crate ::FromOverseer::Signal(signal)
|
||||
#support_crate ::FromOrchestra::Signal(signal)
|
||||
}
|
||||
msg = await_message => {
|
||||
let packet = msg
|
||||
.ok_or( #support_crate ::OverseerError::Context(
|
||||
.ok_or( #support_crate ::OrchestraError::Context(
|
||||
"Message channel is terminated and empty."
|
||||
.to_owned()
|
||||
))?;
|
||||
@@ -494,16 +494,16 @@ pub(crate) fn impl_subsystem_context_trait_for(
|
||||
continue;
|
||||
} else {
|
||||
// we know enough to return this message.
|
||||
#support_crate ::FromOverseer::Communication { msg: packet.message}
|
||||
#support_crate ::FromOrchestra::Communication { msg: packet.message}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if let #support_crate ::FromOverseer::Signal(_) = from_overseer {
|
||||
if let #support_crate ::FromOrchestra::Signal(_) = from_orchestra {
|
||||
self.signals_received.inc();
|
||||
}
|
||||
|
||||
return Ok(from_overseer);
|
||||
return Ok(from_orchestra);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,22 +514,22 @@ pub(crate) fn impl_subsystem_context_trait_for(
|
||||
fn spawn(&mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send>>)
|
||||
-> ::std::result::Result<(), #error_ty>
|
||||
{
|
||||
self.to_overseer.unbounded_send(#support_crate ::ToOverseer::SpawnJob {
|
||||
self.to_orchestra.unbounded_send(#support_crate ::ToOrchestra::SpawnJob {
|
||||
name,
|
||||
subsystem: Some(self.name()),
|
||||
s,
|
||||
}).map_err(|_| #support_crate ::OverseerError::TaskSpawn(name))?;
|
||||
}).map_err(|_| #support_crate ::OrchestraError::TaskSpawn(name))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn spawn_blocking(&mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send>>)
|
||||
-> ::std::result::Result<(), #error_ty>
|
||||
{
|
||||
self.to_overseer.unbounded_send(#support_crate ::ToOverseer::SpawnBlockingJob {
|
||||
self.to_orchestra.unbounded_send(#support_crate ::ToOrchestra::SpawnBlockingJob {
|
||||
name,
|
||||
subsystem: Some(self.name()),
|
||||
s,
|
||||
}).map_err(|_| #support_crate ::OverseerError::TaskSpawn(name))?;
|
||||
}).map_err(|_| #support_crate ::OrchestraError::TaskSpawn(name))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -539,7 +539,7 @@ pub(crate) fn impl_subsystem_context_trait_for(
|
||||
/// Implement the additional subsystem accumulation traits, for simplified usage,
|
||||
/// i.e. `${Subsystem}SenderTrait` and `${Subsystem}ContextTrait`.
|
||||
pub(crate) fn impl_per_subsystem_helper_traits(
|
||||
info: &OverseerInfo,
|
||||
info: &OrchestraInfo,
|
||||
subsystem_ctx_name: &Ident,
|
||||
subsystem_ctx_trait: &Ident,
|
||||
subsystem_sender_name: &Ident,
|
||||
@@ -645,7 +645,7 @@ pub(crate) fn impl_per_subsystem_helper_traits(
|
||||
///
|
||||
/// Note: The generated `fn new` is used by the [builder pattern](../impl_builder.rs).
|
||||
pub(crate) fn impl_subsystem_context(
|
||||
info: &OverseerInfo,
|
||||
info: &OrchestraInfo,
|
||||
subsystem_sender_name: &Ident,
|
||||
subsystem_ctx_name: &Ident,
|
||||
) -> TokenStream {
|
||||
@@ -657,7 +657,7 @@ pub(crate) fn impl_subsystem_context(
|
||||
/// It can be used by [`Subsystem`] to communicate with other [`Subsystem`]s
|
||||
/// or to spawn it's [`SubsystemJob`]s.
|
||||
///
|
||||
/// [`Overseer`]: struct.Overseer.html
|
||||
/// [`Orchestra`]: struct.Orchestra.html
|
||||
/// [`Subsystem`]: trait.Subsystem.html
|
||||
/// [`SubsystemJob`]: trait.SubsystemJob.html
|
||||
#[derive(Debug)]
|
||||
@@ -666,8 +666,8 @@ pub(crate) fn impl_subsystem_context(
|
||||
signals: #support_crate ::metered::MeteredReceiver< #signal_ty >,
|
||||
messages: SubsystemIncomingMessages< M >,
|
||||
to_subsystems: #subsystem_sender_name < <M as AssociateOutgoing>::OutgoingMessages >,
|
||||
to_overseer: #support_crate ::metered::UnboundedMeteredSender<
|
||||
#support_crate ::ToOverseer
|
||||
to_orchestra: #support_crate ::metered::UnboundedMeteredSender<
|
||||
#support_crate ::ToOrchestra
|
||||
>,
|
||||
signals_received: SignalsReceived,
|
||||
pending_incoming: Option<(usize, M)>,
|
||||
@@ -683,7 +683,7 @@ pub(crate) fn impl_subsystem_context(
|
||||
signals: #support_crate ::metered::MeteredReceiver< #signal_ty >,
|
||||
messages: SubsystemIncomingMessages< M >,
|
||||
to_subsystems: ChannelsOut,
|
||||
to_overseer: #support_crate ::metered::UnboundedMeteredSender<#support_crate:: ToOverseer>,
|
||||
to_orchestra: #support_crate ::metered::UnboundedMeteredSender<#support_crate:: ToOrchestra>,
|
||||
name: &'static str
|
||||
) -> Self {
|
||||
let signals_received = SignalsReceived::default();
|
||||
@@ -695,7 +695,7 @@ pub(crate) fn impl_subsystem_context(
|
||||
signals_received: signals_received.clone(),
|
||||
_phantom: ::core::marker::PhantomData::default(),
|
||||
},
|
||||
to_overseer,
|
||||
to_orchestra,
|
||||
signals_received,
|
||||
pending_incoming: None,
|
||||
name
|
||||
+7
-7
@@ -20,9 +20,9 @@ use syn::{parse_quote, spanned::Spanned, Path};
|
||||
mod impl_builder;
|
||||
mod impl_channels_out;
|
||||
mod impl_message_wrapper;
|
||||
mod impl_overseer;
|
||||
mod impl_orchestra;
|
||||
mod impl_subsystem_ctx_sender;
|
||||
mod overseer;
|
||||
mod orchestra;
|
||||
mod parse;
|
||||
mod subsystem;
|
||||
|
||||
@@ -32,11 +32,11 @@ mod tests;
|
||||
use impl_builder::*;
|
||||
use impl_channels_out::*;
|
||||
use impl_message_wrapper::*;
|
||||
use impl_overseer::*;
|
||||
use impl_orchestra::*;
|
||||
use impl_subsystem_ctx_sender::*;
|
||||
use parse::*;
|
||||
|
||||
use self::{overseer::*, subsystem::*};
|
||||
use self::{orchestra::*, subsystem::*};
|
||||
|
||||
/// Obtain the support crate `Path` as `TokenStream`.
|
||||
pub(crate) fn support_crate() -> Result<Path, proc_macro_crate::Error> {
|
||||
@@ -44,7 +44,7 @@ pub(crate) fn support_crate() -> Result<Path, proc_macro_crate::Error> {
|
||||
parse_quote! {crate}
|
||||
} else {
|
||||
use proc_macro_crate::{crate_name, FoundCrate};
|
||||
let crate_name = crate_name("polkadot-overseer-gen")?;
|
||||
let crate_name = crate_name("orchestra")?;
|
||||
match crate_name {
|
||||
FoundCrate::Itself => parse_quote! {crate},
|
||||
FoundCrate::Name(name) => Ident::new(&name, Span::call_site()).into(),
|
||||
@@ -53,13 +53,13 @@ pub(crate) fn support_crate() -> Result<Path, proc_macro_crate::Error> {
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn overlord(
|
||||
pub fn orchestra(
|
||||
attr: proc_macro::TokenStream,
|
||||
item: proc_macro::TokenStream,
|
||||
) -> proc_macro::TokenStream {
|
||||
let attr: TokenStream = attr.into();
|
||||
let item: TokenStream = item.into();
|
||||
impl_overseer_gen(attr, item)
|
||||
impl_orchestra_gen(attr, item)
|
||||
.unwrap_or_else(|err| err.to_compile_error())
|
||||
.into()
|
||||
}
|
||||
+9
-9
@@ -19,21 +19,21 @@ use syn::{parse2, Result};
|
||||
|
||||
use super::{parse::*, *};
|
||||
|
||||
pub(crate) fn impl_overseer_gen(
|
||||
pub(crate) fn impl_orchestra_gen(
|
||||
attr: TokenStream,
|
||||
orig: TokenStream,
|
||||
) -> Result<proc_macro2::TokenStream> {
|
||||
let args: OverseerAttrArgs = parse2(attr)?;
|
||||
let args: OrchestraAttrArgs = parse2(attr)?;
|
||||
let message_wrapper = args.message_wrapper;
|
||||
|
||||
let of: OverseerGuts = parse2(orig)?;
|
||||
let of: OrchestraGuts = parse2(orig)?;
|
||||
|
||||
let support_crate = support_crate().expect("The crate this macro is run for, includes the proc-macro support as dependency, otherwise it could not be run in the first place. qed");
|
||||
let info = OverseerInfo {
|
||||
let info = OrchestraInfo {
|
||||
support_crate,
|
||||
subsystems: of.subsystems,
|
||||
baggage: of.baggage,
|
||||
overseer_name: of.name,
|
||||
orchestra_name: of.name,
|
||||
message_wrapper,
|
||||
message_channel_capacity: args.message_channel_capacity,
|
||||
signal_channel_capacity: args.signal_channel_capacity,
|
||||
@@ -43,17 +43,17 @@ pub(crate) fn impl_overseer_gen(
|
||||
outgoing_ty: args.outgoing_ty,
|
||||
};
|
||||
|
||||
let mut additive = impl_overseer_struct(&info);
|
||||
let mut additive = impl_orchestra_struct(&info);
|
||||
additive.extend(impl_builder(&info));
|
||||
|
||||
additive.extend(impl_overseen_subsystem(&info));
|
||||
additive.extend(impl_orchestrated_subsystem(&info));
|
||||
additive.extend(impl_channels_out_struct(&info));
|
||||
additive.extend(impl_subsystem_types_all(&info)?);
|
||||
|
||||
additive.extend(impl_message_wrapper_enum(&info)?);
|
||||
|
||||
let ts = expander::Expander::new("overlord-expansion")
|
||||
.add_comment("Generated overseer code by `#[overlord(..)]`".to_owned())
|
||||
let ts = expander::Expander::new("orchestra-expansion")
|
||||
.add_comment("Generated orchestra code by `#[orchestra(..)]`".to_owned())
|
||||
.dry(!cfg!(feature = "expand"))
|
||||
.verbose(true)
|
||||
// once all our needed format options are available on stable
|
||||
+3
-3
@@ -26,14 +26,14 @@ mod kw {
|
||||
syn::custom_keyword!(prefix);
|
||||
}
|
||||
|
||||
mod parse_overseer_attr;
|
||||
mod parse_overseer_struct;
|
||||
mod parse_orchestra_attr;
|
||||
mod parse_orchestra_struct;
|
||||
|
||||
mod parse_subsystem_attr;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub(crate) use self::{parse_overseer_attr::*, parse_overseer_struct::*};
|
||||
pub(crate) use self::{parse_orchestra_attr::*, parse_orchestra_struct::*};
|
||||
|
||||
pub(crate) use self::parse_subsystem_attr::*;
|
||||
+25
-25
@@ -26,9 +26,9 @@ use syn::{
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum OverseerAttrItem {
|
||||
enum OrchestraAttrItem {
|
||||
ExternEventType { tag: kw::event, eq_token: Token![=], value: Path },
|
||||
ExternOverseerSignalType { tag: kw::signal, eq_token: Token![=], value: Path },
|
||||
ExternOrchestraSignalType { tag: kw::signal, eq_token: Token![=], value: Path },
|
||||
ExternErrorType { tag: kw::error, eq_token: Token![=], value: Path },
|
||||
OutgoingType { tag: kw::outgoing, eq_token: Token![=], value: Path },
|
||||
MessageWrapperName { tag: kw::gen, eq_token: Token![=], value: Ident },
|
||||
@@ -36,13 +36,13 @@ enum OverseerAttrItem {
|
||||
MessageChannelCapacity { tag: kw::message_capacity, eq_token: Token![=], value: usize },
|
||||
}
|
||||
|
||||
impl ToTokens for OverseerAttrItem {
|
||||
impl ToTokens for OrchestraAttrItem {
|
||||
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
|
||||
let ts = match self {
|
||||
Self::ExternEventType { tag, eq_token, value } => {
|
||||
quote! { #tag #eq_token, #value }
|
||||
},
|
||||
Self::ExternOverseerSignalType { tag, eq_token, value } => {
|
||||
Self::ExternOrchestraSignalType { tag, eq_token, value } => {
|
||||
quote! { #tag #eq_token, #value }
|
||||
},
|
||||
Self::ExternErrorType { tag, eq_token, value } => {
|
||||
@@ -65,47 +65,47 @@ impl ToTokens for OverseerAttrItem {
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for OverseerAttrItem {
|
||||
impl Parse for OrchestraAttrItem {
|
||||
fn parse(input: &ParseBuffer) -> Result<Self> {
|
||||
let lookahead = input.lookahead1();
|
||||
if lookahead.peek(kw::event) {
|
||||
Ok(OverseerAttrItem::ExternEventType {
|
||||
Ok(OrchestraAttrItem::ExternEventType {
|
||||
tag: input.parse::<kw::event>()?,
|
||||
eq_token: input.parse()?,
|
||||
value: input.parse()?,
|
||||
})
|
||||
} else if lookahead.peek(kw::signal) {
|
||||
Ok(OverseerAttrItem::ExternOverseerSignalType {
|
||||
Ok(OrchestraAttrItem::ExternOrchestraSignalType {
|
||||
tag: input.parse::<kw::signal>()?,
|
||||
eq_token: input.parse()?,
|
||||
value: input.parse()?,
|
||||
})
|
||||
} else if lookahead.peek(kw::error) {
|
||||
Ok(OverseerAttrItem::ExternErrorType {
|
||||
Ok(OrchestraAttrItem::ExternErrorType {
|
||||
tag: input.parse::<kw::error>()?,
|
||||
eq_token: input.parse()?,
|
||||
value: input.parse()?,
|
||||
})
|
||||
} else if lookahead.peek(kw::outgoing) {
|
||||
Ok(OverseerAttrItem::OutgoingType {
|
||||
Ok(OrchestraAttrItem::OutgoingType {
|
||||
tag: input.parse::<kw::outgoing>()?,
|
||||
eq_token: input.parse()?,
|
||||
value: input.parse()?,
|
||||
})
|
||||
} else if lookahead.peek(kw::gen) {
|
||||
Ok(OverseerAttrItem::MessageWrapperName {
|
||||
Ok(OrchestraAttrItem::MessageWrapperName {
|
||||
tag: input.parse::<kw::gen>()?,
|
||||
eq_token: input.parse()?,
|
||||
value: input.parse()?,
|
||||
})
|
||||
} else if lookahead.peek(kw::signal_capacity) {
|
||||
Ok(OverseerAttrItem::SignalChannelCapacity {
|
||||
Ok(OrchestraAttrItem::SignalChannelCapacity {
|
||||
tag: input.parse::<kw::signal_capacity>()?,
|
||||
eq_token: input.parse()?,
|
||||
value: input.parse::<LitInt>()?.base10_parse::<usize>()?,
|
||||
})
|
||||
} else if lookahead.peek(kw::message_capacity) {
|
||||
Ok(OverseerAttrItem::MessageChannelCapacity {
|
||||
Ok(OrchestraAttrItem::MessageChannelCapacity {
|
||||
tag: input.parse::<kw::message_capacity>()?,
|
||||
eq_token: input.parse()?,
|
||||
value: input.parse::<LitInt>()?.base10_parse::<usize>()?,
|
||||
@@ -118,7 +118,7 @@ impl Parse for OverseerAttrItem {
|
||||
|
||||
/// Attribute arguments
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct OverseerAttrArgs {
|
||||
pub(crate) struct OrchestraAttrArgs {
|
||||
pub(crate) message_wrapper: Ident,
|
||||
pub(crate) extern_event_ty: Path,
|
||||
pub(crate) extern_signal_ty: Path,
|
||||
@@ -137,7 +137,7 @@ macro_rules! extract_variant {
|
||||
};
|
||||
($unique:expr, $variant:ident) => {
|
||||
$unique.values().find_map(|item| {
|
||||
if let OverseerAttrItem::$variant { value, .. } = item {
|
||||
if let OrchestraAttrItem::$variant { value, .. } = item {
|
||||
Some(value.clone())
|
||||
} else {
|
||||
None
|
||||
@@ -146,21 +146,21 @@ macro_rules! extract_variant {
|
||||
};
|
||||
}
|
||||
|
||||
impl Parse for OverseerAttrArgs {
|
||||
impl Parse for OrchestraAttrArgs {
|
||||
fn parse(input: &ParseBuffer) -> Result<Self> {
|
||||
let items: Punctuated<OverseerAttrItem, Token![,]> =
|
||||
input.parse_terminated(OverseerAttrItem::parse)?;
|
||||
let items: Punctuated<OrchestraAttrItem, Token![,]> =
|
||||
input.parse_terminated(OrchestraAttrItem::parse)?;
|
||||
|
||||
let mut unique = HashMap::<
|
||||
std::mem::Discriminant<OverseerAttrItem>,
|
||||
OverseerAttrItem,
|
||||
std::mem::Discriminant<OrchestraAttrItem>,
|
||||
OrchestraAttrItem,
|
||||
RandomState,
|
||||
>::default();
|
||||
for item in items {
|
||||
if let Some(first) = unique.insert(std::mem::discriminant(&item), item.clone()) {
|
||||
let mut e = Error::new(
|
||||
item.span(),
|
||||
format!("Duplicate definition of overseer generation type found"),
|
||||
format!("Duplicate definition of orchestra generation type found"),
|
||||
);
|
||||
e.combine(Error::new(first.span(), "previously defined here."));
|
||||
return Err(e)
|
||||
@@ -172,13 +172,13 @@ impl Parse for OverseerAttrArgs {
|
||||
let message_channel_capacity =
|
||||
extract_variant!(unique, MessageChannelCapacity; default = 1024_usize);
|
||||
|
||||
let error = extract_variant!(unique, ExternErrorType; err = "Must declare the overseer error type via `error=..`.")?;
|
||||
let event = extract_variant!(unique, ExternEventType; err = "Must declare the overseer event type via `event=..`.")?;
|
||||
let signal = extract_variant!(unique, ExternOverseerSignalType; err = "Must declare the overseer signal type via `signal=..`.")?;
|
||||
let message_wrapper = extract_variant!(unique, MessageWrapperName; err = "Must declare the overseer generated wrapping message type via `gen=..`.")?;
|
||||
let error = extract_variant!(unique, ExternErrorType; err = "Must declare the orchestra error type via `error=..`.")?;
|
||||
let event = extract_variant!(unique, ExternEventType; err = "Must declare the orchestra event type via `event=..`.")?;
|
||||
let signal = extract_variant!(unique, ExternOrchestraSignalType; err = "Must declare the orchestra signal type via `signal=..`.")?;
|
||||
let message_wrapper = extract_variant!(unique, MessageWrapperName; err = "Must declare the orchestra generated wrapping message type via `gen=..`.")?;
|
||||
let outgoing = extract_variant!(unique, OutgoingType);
|
||||
|
||||
Ok(OverseerAttrArgs {
|
||||
Ok(OrchestraAttrArgs {
|
||||
signal_channel_capacity,
|
||||
message_channel_capacity,
|
||||
extern_event_ty: event,
|
||||
+9
-9
@@ -261,8 +261,8 @@ pub(crate) struct BaggageField {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct OverseerInfo {
|
||||
/// Where the support crate `::polkadot_overseer_gen` lives.
|
||||
pub(crate) struct OrchestraInfo {
|
||||
/// Where the support crate `::orchestra` lives.
|
||||
pub(crate) support_crate: Path,
|
||||
|
||||
/// Fields annotated with `#[subsystem(..)]`.
|
||||
@@ -272,9 +272,9 @@ pub(crate) struct OverseerInfo {
|
||||
pub(crate) baggage: Vec<BaggageField>,
|
||||
/// Name of the wrapping enum for all messages, defaults to `AllMessages`.
|
||||
pub(crate) message_wrapper: Ident,
|
||||
/// Name of the overseer struct, used as a prefix for
|
||||
/// Name of the orchestra struct, used as a prefix for
|
||||
/// almost all generated types.
|
||||
pub(crate) overseer_name: Ident,
|
||||
pub(crate) orchestra_name: Ident,
|
||||
|
||||
/// Size of the bounded channel.
|
||||
pub(crate) message_channel_capacity: usize,
|
||||
@@ -295,7 +295,7 @@ pub(crate) struct OverseerInfo {
|
||||
pub(crate) extern_error_ty: Path,
|
||||
}
|
||||
|
||||
impl OverseerInfo {
|
||||
impl OrchestraInfo {
|
||||
pub(crate) fn support_crate_name(&self) -> &Path {
|
||||
&self.support_crate
|
||||
}
|
||||
@@ -389,15 +389,15 @@ impl OverseerInfo {
|
||||
}
|
||||
}
|
||||
|
||||
/// Internals of the overseer.
|
||||
/// Internals of the orchestra.
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct OverseerGuts {
|
||||
pub(crate) struct OrchestraGuts {
|
||||
pub(crate) name: Ident,
|
||||
pub(crate) subsystems: Vec<SubSysField>,
|
||||
pub(crate) baggage: Vec<BaggageField>,
|
||||
}
|
||||
|
||||
impl OverseerGuts {
|
||||
impl OrchestraGuts {
|
||||
pub(crate) fn parse_fields(
|
||||
name: Ident,
|
||||
baggage_generics: HashSet<Ident>,
|
||||
@@ -497,7 +497,7 @@ impl OverseerGuts {
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for OverseerGuts {
|
||||
impl Parse for OrchestraGuts {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let ds: ItemStruct = input.parse()?;
|
||||
match ds.fields {
|
||||
+4
-4
@@ -29,13 +29,13 @@ use syn::{
|
||||
enum SubsystemAttrItem {
|
||||
/// Error type provided by the user.
|
||||
Error { tag: kw::error, eq_token: Token![=], value: Path },
|
||||
/// For which slot in the overseer this should be plugged.
|
||||
/// For which slot in the orchestra this should be plugged.
|
||||
///
|
||||
/// The subsystem implementation can and should have a different name
|
||||
/// from the declared parameter type in the overseer.
|
||||
/// from the declared parameter type in the orchestra.
|
||||
Subsystem { tag: Option<kw::subsystem>, eq_token: Option<Token![=]>, value: Ident },
|
||||
/// The prefix to apply when a subsystem is implemented in a different file/crate
|
||||
/// than the overseer itself.
|
||||
/// than the orchestra itself.
|
||||
///
|
||||
/// Important for `#[subsystem(..)]` to reference the traits correctly.
|
||||
TraitPrefix { tag: kw::prefix, eq_token: Token![=], value: Path },
|
||||
@@ -137,7 +137,7 @@ impl Parse for SubsystemAttrArgs {
|
||||
}
|
||||
}
|
||||
let error_path = extract_variant!(unique, Error);
|
||||
let subsystem_ident = extract_variant!(unique, Subsystem; err = "Must annotate the identical overseer error type via `subsystem=..` or plainly as `Subsystem` as specified in the overseer declaration.")?;
|
||||
let subsystem_ident = extract_variant!(unique, Subsystem; err = "Must annotate the identical orchestra error type via `subsystem=..` or plainly as `Subsystem` as specified in the orchestra declaration.")?;
|
||||
let trait_prefix_path = extract_variant!(unique, TraitPrefix);
|
||||
Ok(SubsystemAttrArgs { span, error_path, subsystem_ident, trait_prefix_path })
|
||||
}
|
||||
+9
-9
@@ -25,11 +25,11 @@ mod attr {
|
||||
|
||||
#[test]
|
||||
fn attr_full_works() {
|
||||
let attr: OverseerAttrArgs = parse_quote! {
|
||||
let attr: OrchestraAttrArgs = parse_quote! {
|
||||
gen=AllMessage, event=::some::why::ExternEvent, signal=SigSigSig, signal_capacity=111, message_capacity=222,
|
||||
error=OverseerError,
|
||||
error=OrchestraError,
|
||||
};
|
||||
assert_matches!(attr, OverseerAttrArgs {
|
||||
assert_matches!(attr, OrchestraAttrArgs {
|
||||
message_channel_capacity,
|
||||
signal_channel_capacity,
|
||||
..
|
||||
@@ -41,11 +41,11 @@ mod attr {
|
||||
|
||||
#[test]
|
||||
fn attr_partial_works() {
|
||||
let attr: OverseerAttrArgs = parse_quote! {
|
||||
let attr: OrchestraAttrArgs = parse_quote! {
|
||||
gen=AllMessage, event=::some::why::ExternEvent, signal=::foo::SigSigSig,
|
||||
error=OverseerError,
|
||||
error=OrchestraError,
|
||||
};
|
||||
assert_matches!(attr, OverseerAttrArgs {
|
||||
assert_matches!(attr, OrchestraAttrArgs {
|
||||
message_channel_capacity: _,
|
||||
signal_channel_capacity: _,
|
||||
..
|
||||
@@ -249,7 +249,7 @@ mod strukt {
|
||||
|
||||
#[test]
|
||||
fn struct_parse_baggage() {
|
||||
let item: OverseerGuts = parse_quote! {
|
||||
let item: OrchestraGuts = parse_quote! {
|
||||
pub struct Ooooh<X = Pffffffft> where X: Secrit {
|
||||
#[subsystem(consumes: Foo, sends: [])]
|
||||
sub0: FooSubsystem,
|
||||
@@ -262,7 +262,7 @@ mod strukt {
|
||||
|
||||
#[test]
|
||||
fn struct_parse_full() {
|
||||
let item: OverseerGuts = parse_quote! {
|
||||
let item: OrchestraGuts = parse_quote! {
|
||||
pub struct Ooooh<X = Pffffffft> where X: Secrit {
|
||||
#[subsystem(consumes: Foo, sends: [])]
|
||||
sub0: FooSubsystem,
|
||||
@@ -284,7 +284,7 @@ mod strukt {
|
||||
|
||||
#[test]
|
||||
fn struct_parse_basic() {
|
||||
let item: OverseerGuts = parse_quote! {
|
||||
let item: OrchestraGuts = parse_quote! {
|
||||
pub struct Ooooh {
|
||||
#[subsystem(consumes: Foo, sends: [])]
|
||||
sub0: FooSubsystem,
|
||||
+17
-17
@@ -20,16 +20,16 @@
|
||||
//! ## Implement `trait Subsystem<Context, Error>` via `subsystem`
|
||||
//!
|
||||
//! ```ignore
|
||||
//! # use polkadot_overseer_gen_proc_macro::subsystem;
|
||||
//! # use orchestra_proc_macro::subsystem;
|
||||
//! # mod somewhere {
|
||||
//! # use polkadot_overseer_gen_proc_macro::overlord;
|
||||
//! # pub use polkadot_overseer_gen::*;
|
||||
//! # use orchestra_proc_macro::orchestra;
|
||||
//! # pub use orchestra::*;
|
||||
//! #
|
||||
//! # #[derive(Debug, thiserror::Error)]
|
||||
//! # #[error("Yikes!")]
|
||||
//! # pub struct Yikes;
|
||||
//! # impl From<OverseerError> for Yikes {
|
||||
//! # fn from(_: OverseerError) -> Yikes { Yikes }
|
||||
//! # impl From<OrchestraError> for Yikes {
|
||||
//! # fn from(_: OrchestraError) -> Yikes { Yikes }
|
||||
//! # }
|
||||
//! # impl From<mpsc::SendError> for Yikes {
|
||||
//! # fn from(_: mpsc::SendError) -> Yikes { Yikes }
|
||||
@@ -46,7 +46,7 @@
|
||||
//! # #[derive(Debug, Clone, Copy)]
|
||||
//! # pub struct B;
|
||||
//! #
|
||||
//! # #[overlord(signal=Sig, gen=AllOfThem, event=Eve, error=Yikes)]
|
||||
//! # #[orchestra(signal=Sig, gen=AllOfThem, event=Eve, error=Yikes)]
|
||||
//! # pub struct Wonderland {
|
||||
//! # #[subsystem(A, sends: [B])]
|
||||
//! # foo: Foo,
|
||||
@@ -71,16 +71,16 @@
|
||||
//! expands to
|
||||
//!
|
||||
//! ```ignore
|
||||
//! # use polkadot_overseer_gen_proc_macro::subsystem;
|
||||
//! # use orchestra_proc_macro::subsystem;
|
||||
//! # mod somewhere {
|
||||
//! # use polkadot_overseer_gen_proc_macro::overlord;
|
||||
//! # pub use polkadot_overseer_gen::*;
|
||||
//! # use orchestra_proc_macro::orchestra;
|
||||
//! # pub use orchestra::*;
|
||||
//! #
|
||||
//! # #[derive(Debug, thiserror::Error)]
|
||||
//! # #[error("Yikes!")]
|
||||
//! # pub struct Yikes;
|
||||
//! # impl From<OverseerError> for Yikes {
|
||||
//! # fn from(_: OverseerError) -> Yikes { Yikes }
|
||||
//! # impl From<OrchestraError> for Yikes {
|
||||
//! # fn from(_: OrchestraError) -> Yikes { Yikes }
|
||||
//! # }
|
||||
//! # impl From<mpsc::SendError> for Yikes {
|
||||
//! # fn from(_: mpsc::SendError) -> Yikes { Yikes }
|
||||
@@ -97,7 +97,7 @@
|
||||
//! # #[derive(Debug, Clone, Copy)]
|
||||
//! # pub struct B;
|
||||
//! #
|
||||
//! # #[overlord(signal=Sig, gen=AllOfThem, event=Eve, error=Yikes)]
|
||||
//! # #[orchestra(signal=Sig, gen=AllOfThem, event=Eve, error=Yikes)]
|
||||
//! # pub struct Wonderland {
|
||||
//! # #[subsystem(A, sends: [B])]
|
||||
//! # foo: Foo,
|
||||
@@ -106,7 +106,7 @@
|
||||
//! # }
|
||||
//! # }
|
||||
//! # use somewhere::{Yikes, SpawnedSubsystem};
|
||||
//! # use polkadot_overseer_gen as support_crate;
|
||||
//! # use orchestra as support_crate;
|
||||
//! #
|
||||
//! # struct FooSubsystem;
|
||||
//! #
|
||||
@@ -204,15 +204,15 @@ pub(crate) fn impl_subsystem_context_trait_bounds(
|
||||
// a `prefix=*` provided. Either is ok.
|
||||
|
||||
// Technically this is two different things:
|
||||
// The place where the `#[overlord]` is annotated is where all `trait *SenderTrait` and
|
||||
// The place where the `#[orchestra]` is annotated is where all `trait *SenderTrait` and
|
||||
// `trait *ContextTrait` types exist.
|
||||
// The other usage is the true support crate `polkadot-overseer-gen`, where the static ones
|
||||
// The other usage is the true support crate `orchestra`, where the static ones
|
||||
// are declared.
|
||||
// Right now, if the `support_crate` is not included, it falls back silently to the `trait_prefix_path`.
|
||||
let support_crate = support_crate()
|
||||
.or_else(|_e| {
|
||||
trait_prefix_path.clone().ok_or_else(|| {
|
||||
syn::Error::new(attr.span(), "Couldn't find `polkadot-overseer-gen` in manifest, but also missing a `prefix=` to help trait bound resolution")
|
||||
syn::Error::new(attr.span(), "Couldn't find `orchestra` in manifest, but also missing a `prefix=` to help trait bound resolution")
|
||||
})
|
||||
})?;
|
||||
|
||||
@@ -255,7 +255,7 @@ pub(crate) fn impl_subsystem_context_trait_bounds(
|
||||
let error_path = error_path.ok_or_else(|| {
|
||||
syn::Error::new(
|
||||
span,
|
||||
"Must annotate the identical overseer error type via `error=..`.",
|
||||
"Must annotate the identical orchestra error type via `error=..`.",
|
||||
)
|
||||
})?;
|
||||
// Only replace the subsystem trait if it's desired.
|
||||
+10
-10
@@ -27,7 +27,7 @@ fn print() {
|
||||
signal=SigSigSig,
|
||||
signal_capacity=111,
|
||||
message_capacity=222,
|
||||
error=OverseerError,
|
||||
error=OrchestraError,
|
||||
};
|
||||
|
||||
let item = quote! {
|
||||
@@ -48,14 +48,14 @@ fn print() {
|
||||
}
|
||||
};
|
||||
|
||||
let output = impl_overseer_gen(attr, item).expect("Simple example always works. qed");
|
||||
let output = impl_orchestra_gen(attr, item).expect("Simple example always works. qed");
|
||||
println!("//generated:");
|
||||
println!("{}", output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_parse_full() {
|
||||
let item: OverseerGuts = parse_quote! {
|
||||
let item: OrchestraGuts = parse_quote! {
|
||||
pub struct Ooooh<X = Pffffffft> where X: Secrit {
|
||||
#[subsystem(Foo)]
|
||||
sub0: FooSubsystem,
|
||||
@@ -77,7 +77,7 @@ fn struct_parse_full() {
|
||||
|
||||
#[test]
|
||||
fn struct_parse_basic() {
|
||||
let item: OverseerGuts = parse_quote! {
|
||||
let item: OrchestraGuts = parse_quote! {
|
||||
pub struct Ooooh {
|
||||
#[subsystem(Foo)]
|
||||
sub0: FooSubsystem,
|
||||
@@ -88,11 +88,11 @@ fn struct_parse_basic() {
|
||||
|
||||
#[test]
|
||||
fn attr_full() {
|
||||
let attr: OverseerAttrArgs = parse_quote! {
|
||||
let attr: OrchestraAttrArgs = parse_quote! {
|
||||
gen=AllMessage, event=::some::why::ExternEvent, signal=SigSigSig, signal_capacity=111, message_capacity=222,
|
||||
error=OverseerError,
|
||||
error=OrchestraError,
|
||||
};
|
||||
assert_matches!(attr, OverseerAttrArgs {
|
||||
assert_matches!(attr, OrchestraAttrArgs {
|
||||
message_channel_capacity,
|
||||
signal_channel_capacity,
|
||||
..
|
||||
@@ -104,11 +104,11 @@ fn attr_full() {
|
||||
|
||||
#[test]
|
||||
fn attr_partial() {
|
||||
let attr: OverseerAttrArgs = parse_quote! {
|
||||
let attr: OrchestraAttrArgs = parse_quote! {
|
||||
gen=AllMessage, event=::some::why::ExternEvent, signal=::foo::SigSigSig,
|
||||
error=OverseerError,
|
||||
error=OrchestraError,
|
||||
};
|
||||
assert_matches!(attr, OverseerAttrArgs {
|
||||
assert_matches!(attr, OrchestraAttrArgs {
|
||||
message_channel_capacity: _,
|
||||
signal_channel_capacity: _,
|
||||
..
|
||||
+59
-39
@@ -14,29 +14,31 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! # Overseer
|
||||
//! # Orchestra
|
||||
//!
|
||||
//! `overseer` implements the Overseer architecture described in the
|
||||
//! [implementers-guide](https://w3f.github.io/parachain-implementers-guide/node/index.html).
|
||||
//! For the motivations behind implementing the overseer itself you should
|
||||
//! check out that guide, documentation in this crate will be mostly discussing
|
||||
//! technical stuff.
|
||||
//! `orchestra` provides a global information flow of what a token of information.
|
||||
//! The token is arbitrary, but is used to notify all `Subsystem`s of what is relevant
|
||||
//! and what is not.
|
||||
//!
|
||||
//! An `Overseer` is something that allows spawning/stopping and overseeing
|
||||
//! For the motivations behind implementing the orchestra itself you should
|
||||
//! check out that guide, documentation in this crate will focus and be of
|
||||
//! technical nature.
|
||||
//!
|
||||
//! An `Orchestra` is something that allows spawning/stopping and orchestrating
|
||||
//! asynchronous tasks as well as establishing a well-defined and easy to use
|
||||
//! protocol that the tasks can use to communicate with each other. It is desired
|
||||
//! that this protocol is the only way tasks communicate with each other, however
|
||||
//! at this moment there are no foolproof guards against other ways of communication.
|
||||
//!
|
||||
//! The `Overseer` is instantiated with a pre-defined set of `Subsystems` that
|
||||
//! share the same behavior from `Overseer`'s point of view.
|
||||
//! The `Orchestra` is instantiated with a pre-defined set of `Subsystems` that
|
||||
//! share the same behavior from `Orchestra`'s point of view.
|
||||
//!
|
||||
//! ```text
|
||||
//! +-----------------------------+
|
||||
//! | Overseer |
|
||||
//! | Orchesta |
|
||||
//! +-----------------------------+
|
||||
//!
|
||||
//! ................| Overseer "holds" these and uses |..............
|
||||
//! ................| Orchestra "holds" these and uses |.............
|
||||
//! . them to (re)start things .
|
||||
//! . .
|
||||
//! . +-------------------+ +---------------------+ .
|
||||
@@ -47,7 +49,7 @@
|
||||
//! | |
|
||||
//! start() start()
|
||||
//! V V
|
||||
//! ..................| Overseer "runs" these |.......................
|
||||
//! ..................| Orchestra "runs" these |.......................
|
||||
//! . +--------------------+ +---------------------+ .
|
||||
//! . | SubsystemInstance1 | <-- bidir --> | SubsystemInstance2 | .
|
||||
//! . +--------------------+ +---------------------+ .
|
||||
@@ -60,15 +62,12 @@
|
||||
#![deny(missing_docs)]
|
||||
#![deny(unused_crate_dependencies)]
|
||||
|
||||
pub use polkadot_overseer_gen_proc_macro::{contextbounds, overlord, subsystem};
|
||||
pub use orchestra_proc_macro::{contextbounds, orchestra, subsystem};
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use gum;
|
||||
#[doc(hidden)]
|
||||
pub use metered;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use polkadot_node_primitives::SpawnNamed;
|
||||
pub use tracing;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use async_trait::async_trait;
|
||||
@@ -95,19 +94,40 @@ pub use std::time::Duration;
|
||||
#[doc(hidden)]
|
||||
pub use futures_timer::Delay;
|
||||
|
||||
pub use polkadot_node_network_protocol::WrongVariant;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
/// A type of messages that are sent from a [`Subsystem`] to the declared overseer.
|
||||
/// A spawner
|
||||
#[dyn_clonable::clonable]
|
||||
pub trait Spawner: Clone + Send + Sync {
|
||||
/// Spawn the given blocking future.
|
||||
///
|
||||
/// The given `group` and `name` is used to identify the future in tracing.
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
name: &'static str,
|
||||
group: Option<&'static str>,
|
||||
future: futures::future::BoxFuture<'static, ()>,
|
||||
);
|
||||
/// Spawn the given non-blocking future.
|
||||
///
|
||||
/// The given `group` and `name` is used to identify the future in tracing.
|
||||
fn spawn(
|
||||
&self,
|
||||
name: &'static str,
|
||||
group: Option<&'static str>,
|
||||
future: futures::future::BoxFuture<'static, ()>,
|
||||
);
|
||||
}
|
||||
|
||||
/// A type of messages that are sent from a [`Subsystem`] to the declared orchestra.
|
||||
///
|
||||
/// Used to launch jobs.
|
||||
pub enum ToOverseer {
|
||||
pub enum ToOrchestra {
|
||||
/// A message that wraps something the `Subsystem` is desiring to
|
||||
/// spawn on the overseer and a `oneshot::Sender` to signal the result
|
||||
/// spawn on the orchestra and a `oneshot::Sender` to signal the result
|
||||
/// of the spawn.
|
||||
SpawnJob {
|
||||
/// Name of the task to spawn which be shown in jaeger and tracing logs.
|
||||
@@ -130,7 +150,7 @@ pub enum ToOverseer {
|
||||
},
|
||||
}
|
||||
|
||||
impl fmt::Debug for ToOverseer {
|
||||
impl fmt::Debug for ToOrchestra {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::SpawnJob { name, subsystem, .. } => {
|
||||
@@ -227,7 +247,7 @@ pub trait AnnotateErrorOrigin: 'static + Send + Sync + std::error::Error {
|
||||
/// In essence it's just a new type wrapping a `BoxFuture`.
|
||||
pub struct SpawnedSubsystem<E>
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static + From<self::OverseerError>,
|
||||
E: std::error::Error + Send + Sync + 'static + From<self::OrchestraError>,
|
||||
{
|
||||
/// Name of the subsystem being spawned.
|
||||
pub name: &'static str,
|
||||
@@ -244,7 +264,7 @@ where
|
||||
/// * etc.
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum OverseerError {
|
||||
pub enum OrchestraError {
|
||||
#[error(transparent)]
|
||||
NotifyCancellation(#[from] oneshot::Canceled),
|
||||
|
||||
@@ -274,8 +294,8 @@ pub enum OverseerError {
|
||||
},
|
||||
}
|
||||
|
||||
/// Alias for a result with error type `OverseerError`.
|
||||
pub type OverseerResult<T> = std::result::Result<T, self::OverseerError>;
|
||||
/// Alias for a result with error type `OrchestraError`.
|
||||
pub type OrchestraResult<T> = std::result::Result<T, self::OrchestraError>;
|
||||
|
||||
/// Collection of meters related to a subsystem.
|
||||
#[derive(Clone)]
|
||||
@@ -329,14 +349,14 @@ pub struct SubsystemInstance<Message, Signal> {
|
||||
pub name: &'static str,
|
||||
}
|
||||
|
||||
/// A message type that a subsystem receives from an overseer.
|
||||
/// It wraps signals from an overseer and messages that are circulating
|
||||
/// A message type that a subsystem receives from an orchestra.
|
||||
/// It wraps signals from an orchestra and messages that are circulating
|
||||
/// between subsystems.
|
||||
///
|
||||
/// It is generic over over the message type `M` that a particular `Subsystem` may use.
|
||||
#[derive(Debug)]
|
||||
pub enum FromOverseer<Message, Signal> {
|
||||
/// Signal from the `Overseer`.
|
||||
pub enum FromOrchestra<Message, Signal> {
|
||||
/// Signal from the `Orchestra`.
|
||||
Signal(Signal),
|
||||
|
||||
/// Some other `Subsystem`'s message.
|
||||
@@ -346,7 +366,7 @@ pub enum FromOverseer<Message, Signal> {
|
||||
},
|
||||
}
|
||||
|
||||
impl<Signal, Message> From<Signal> for FromOverseer<Message, Signal> {
|
||||
impl<Signal, Message> From<Signal> for FromOrchestra<Message, Signal> {
|
||||
fn from(signal: Signal) -> Self {
|
||||
Self::Signal(signal)
|
||||
}
|
||||
@@ -356,7 +376,7 @@ impl<Signal, Message> From<Signal> for FromOverseer<Message, Signal> {
|
||||
/// It can be used by [`Subsystem`] to communicate with other [`Subsystem`]s
|
||||
/// or spawn jobs.
|
||||
///
|
||||
/// [`Overseer`]: struct.Overseer.html
|
||||
/// [`Orchestra`]: struct.Orchestra.html
|
||||
/// [`SubsystemJob`]: trait.SubsystemJob.html
|
||||
#[async_trait::async_trait]
|
||||
pub trait SubsystemContext: Send + 'static {
|
||||
@@ -375,16 +395,16 @@ pub trait SubsystemContext: Send + 'static {
|
||||
/// The sender type as provided by `sender()` and underlying.
|
||||
type Sender: Clone + Send + 'static + SubsystemSender<Self::OutgoingMessages>;
|
||||
/// The error type.
|
||||
type Error: ::std::error::Error + ::std::convert::From<OverseerError> + Sync + Send + 'static;
|
||||
type Error: ::std::error::Error + ::std::convert::From<OrchestraError> + Sync + Send + 'static;
|
||||
|
||||
/// Try to asynchronously receive a message.
|
||||
///
|
||||
/// Has to be used with caution, if you loop over this without
|
||||
/// using `pending!()` macro you will end up with a busy loop!
|
||||
async fn try_recv(&mut self) -> Result<Option<FromOverseer<Self::Message, Self::Signal>>, ()>;
|
||||
async fn try_recv(&mut self) -> Result<Option<FromOrchestra<Self::Message, Self::Signal>>, ()>;
|
||||
|
||||
/// Receive a message.
|
||||
async fn recv(&mut self) -> Result<FromOverseer<Self::Message, Self::Signal>, Self::Error>;
|
||||
async fn recv(&mut self) -> Result<FromOrchestra<Self::Message, Self::Signal>, Self::Error>;
|
||||
|
||||
/// Spawn a child task on the executor.
|
||||
fn spawn(
|
||||
@@ -438,18 +458,18 @@ pub trait SubsystemContext: Send + 'static {
|
||||
fn sender(&mut self) -> &mut Self::Sender;
|
||||
}
|
||||
|
||||
/// A trait that describes the [`Subsystem`]s that can run on the [`Overseer`].
|
||||
/// A trait that describes the [`Subsystem`]s that can run on the [`Orchestra`].
|
||||
///
|
||||
/// It is generic over the message type circulating in the system.
|
||||
/// The idea that we want some type containing persistent state that
|
||||
/// can spawn actually running subsystems when asked.
|
||||
///
|
||||
/// [`Overseer`]: struct.Overseer.html
|
||||
/// [`Orchestra`]: struct.Orchestra.html
|
||||
/// [`Subsystem`]: trait.Subsystem.html
|
||||
pub trait Subsystem<Ctx, E>
|
||||
where
|
||||
Ctx: SubsystemContext,
|
||||
E: std::error::Error + Send + Sync + 'static + From<self::OverseerError>,
|
||||
E: std::error::Error + Send + Sync + 'static + From<self::OrchestraError>,
|
||||
{
|
||||
/// Start this `Subsystem` and return `SpawnedSubsystem`.
|
||||
fn start(self, ctx: Ctx) -> SpawnedSubsystem<E>;
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
@@ -16,8 +16,8 @@ struct Event;
|
||||
#[derive(Clone)]
|
||||
struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
|
||||
struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
|
||||
@@ -31,7 +31,7 @@ struct DummySpawner;
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let overseer = Overseer::<_,_>::builder()
|
||||
let orchestra = Orchestra::<_,_>::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.spawner(DummySpawner)
|
||||
.build(|| -> DummyCtx { DummyCtx } );
|
||||
@@ -0,0 +1,21 @@
|
||||
error[E0119]: conflicting implementations of trait `orchestra::SubsystemSender<MsgStrukt>` for type `OrchestraSubsystemSender`
|
||||
--> tests/ui/err-01-duplicate-consumer.rs:19:1
|
||||
|
|
||||
19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| first implementation here
|
||||
| conflicting implementation for `OrchestraSubsystemSender`
|
||||
|
|
||||
= note: this error originates in the attribute macro `orchestra` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `std::convert::From<MsgStrukt>` for type `AllMessages`
|
||||
--> tests/ui/err-01-duplicate-consumer.rs:19:1
|
||||
|
|
||||
19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| first implementation here
|
||||
| conflicting implementation for `AllMessages`
|
||||
|
|
||||
= note: this error originates in the attribute macro `orchestra` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
@@ -12,8 +12,8 @@ struct Event;
|
||||
#[derive(Clone, Debug)]
|
||||
struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
|
||||
enum Overseer {
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
enum Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
Sub0(AwesomeSubSys),
|
||||
}
|
||||
@@ -24,7 +24,7 @@ struct DummySpawner;
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let overseer = Overseer::<_,_>::builder()
|
||||
let orchestra = Orchestra::<_,_>::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
@@ -0,0 +1,11 @@
|
||||
error: expected `struct`
|
||||
--> $DIR/err-02-enum.rs:16:1
|
||||
|
|
||||
16 | enum Orchestra {
|
||||
| ^^^^
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared type `Orchestra`
|
||||
--> $DIR/err-02-enum.rs:27:17
|
||||
|
|
||||
27 | let orchestra = Orchestra::<_,_>::builder()
|
||||
| ^^^^^^^^ use of undeclared type `Orchestra`
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
@@ -16,8 +16,8 @@ struct MsgStrukt(u8);
|
||||
#[derive(Clone, Debug)]
|
||||
struct MsgStrukt2(f64);
|
||||
|
||||
#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
|
||||
struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
|
||||
@@ -31,7 +31,7 @@ struct DummySpawner;
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let overseer = Overseer::<_,_>::builder()
|
||||
let orchestra = Orchestra::<_,_>::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
+3
-3
@@ -10,8 +10,8 @@ error: previously defined here.
|
||||
22 | sub0: AwesomeSubSys,
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared type `Overseer`
|
||||
error[E0433]: failed to resolve: use of undeclared type `Orchestra`
|
||||
--> $DIR/err-03-subsys-twice.rs:34:17
|
||||
|
|
||||
34 | let overseer = Overseer::<_,_>::builder()
|
||||
| ^^^^^^^^ use of undeclared type `Overseer`
|
||||
34 | let orchestra = Orchestra::<_,_>::builder()
|
||||
| ^^^^^^^^ use of undeclared type `Orchestra`
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
@@ -13,8 +13,8 @@ struct Event;
|
||||
#[derive(Clone)]
|
||||
struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, event=Event, gen=AllMessages)]
|
||||
struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
|
||||
@@ -27,7 +27,7 @@ struct DummySpawner;
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Overseer::builder()
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
@@ -0,0 +1,13 @@
|
||||
error: Must declare the orchestra error type via `error=..`.
|
||||
--> $DIR/err-04-missing-error.rs:16:1
|
||||
|
|
||||
16 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the attribute macro `orchestra` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared type `Orchestra`
|
||||
--> $DIR/err-04-missing-error.rs:30:10
|
||||
|
|
||||
30 | let _ = Orchestra::builder()
|
||||
| ^^^^^^^^ use of undeclared type `Orchestra`
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgStrukt>, OverseerError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OverseerSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OverseerError> {
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ pub struct Event;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
@@ -29,7 +29,7 @@ struct Overseer {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl SpawnNamed for DummySpawner {
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
@@ -52,7 +52,7 @@ impl SpawnNamed for DummySpawner {
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Overseer::builder()
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
//.i_like_pie(std::f64::consts::PI) // The filed is not initialised
|
||||
.spawner(DummySpawner)
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
error[E0599]: no method named `build` found for struct `OverseerBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<f64>>` in the current scope
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<f64>>` in the current scope
|
||||
--> tests/ui/err-05-missing-field.rs:59:4
|
||||
|
|
||||
22 | #[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OverseerBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<f64>>`
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<f64>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OverseerBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgStrukt>, OverseerError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OverseerSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OverseerError> {
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ pub struct Event;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
@@ -29,7 +29,7 @@ struct Overseer {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl SpawnNamed for DummySpawner {
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
@@ -52,7 +52,7 @@ impl SpawnNamed for DummySpawner {
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Overseer::builder()
|
||||
let _ = Orchestra::builder()
|
||||
//.sub0(AwesomeSubSys::default()) // Subsystem is uninitialized
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
.spawner(DummySpawner)
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
error[E0599]: no method named `build` found for struct `OverseerBuilder<Init<DummySpawner>, Missing<_>, Init<f64>>` in the current scope
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Init<DummySpawner>, Missing<_>, Init<f64>>` in the current scope
|
||||
--> tests/ui/err-06-missing-subsystem.rs:59:4
|
||||
|
|
||||
22 | #[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OverseerBuilder<Init<DummySpawner>, Missing<_>, Init<f64>>`
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Init<DummySpawner>, Missing<_>, Init<f64>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OverseerBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgStrukt>, OverseerError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OverseerSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OverseerError> {
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ pub struct Event;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
@@ -29,7 +29,7 @@ struct Overseer {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl SpawnNamed for DummySpawner {
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
@@ -52,7 +52,7 @@ impl SpawnNamed for DummySpawner {
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Overseer::builder()
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
//.spawner(DummySpawner) // Spawner is missing
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
error[E0599]: no method named `build` found for struct `OverseerBuilder<Missing<_>, Init<AwesomeSubSys>, Init<f64>>` in the current scope
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Missing<_>, Init<AwesomeSubSys>, Init<f64>>` in the current scope
|
||||
--> tests/ui/err-07-missing-spawner.rs:59:4
|
||||
|
|
||||
22 | #[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OverseerBuilder<Missing<_>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Missing<_>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OverseerBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<f64>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgStrukt>, OverseerError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OverseerSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OverseerError> {
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ pub struct Event;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: f64,
|
||||
@@ -29,7 +29,7 @@ struct Overseer {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl SpawnNamed for DummySpawner {
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
@@ -52,7 +52,7 @@ impl SpawnNamed for DummySpawner {
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _ = Overseer::builder()
|
||||
let _ = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
.sub0(AwesomeSubSys::default()) // Duplicate subsystem
|
||||
.i_like_pie(std::f64::consts::PI)
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
error[E0599]: no method named `sub0` found for struct `OverseerBuilder<Missing<_>, Init<AwesomeSubSys>, Missing<f64>>` in the current scope
|
||||
error[E0599]: no method named `sub0` found for struct `OrchestraBuilder<Missing<_>, Init<AwesomeSubSys>, Missing<f64>>` in the current scope
|
||||
--> tests/ui/err-08-duplicate-subsystem.rs:57:4
|
||||
|
|
||||
22 | #[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `sub0` not found for this
|
||||
...
|
||||
57 | .sub0(AwesomeSubSys::default()) // Duplicate subsystem
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSys;
|
||||
|
||||
impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgStrukt>, OverseerError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OverseerSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OverseerError> {
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgStrukt>, OrchestraError> for AwesomeSubSys {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgStrukt>) -> SpawnedSubsystem<OrchestraError> {
|
||||
unimplemented!("starting yay!")
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ pub struct Event;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgStrukt(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
struct Overseer<T> {
|
||||
#[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
struct Orchestra<T> {
|
||||
#[subsystem(MsgStrukt)]
|
||||
sub0: AwesomeSubSys,
|
||||
i_like_pie: T,
|
||||
@@ -29,7 +29,7 @@ struct Overseer<T> {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl SpawnNamed for DummySpawner {
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
@@ -52,7 +52,7 @@ impl SpawnNamed for DummySpawner {
|
||||
struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let (_, _): (Overseer<_, f64>, _) = Overseer::builder()
|
||||
let (_, _): (Orchestra<_, f64>, _) = Orchestra::builder()
|
||||
.sub0(AwesomeSubSys::default())
|
||||
//.i_like_pie(std::f64::consts::PI) // The filed is not initialised
|
||||
.spawner(DummySpawner)
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
error[E0599]: no method named `build` found for struct `OverseerBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<_>>` in the current scope
|
||||
error[E0599]: no method named `build` found for struct `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<_>>` in the current scope
|
||||
--> tests/ui/err-09-uninit_generic_baggage.rs:59:4
|
||||
|
|
||||
22 | #[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
|
||||
22 | #[orchestra(signal=SigSigSig, error=OrchestraError, event=Event, gen=AllMessages)]
|
||||
| -------------------------------------------------------------------------------- method `build` not found for this
|
||||
...
|
||||
59 | .build()
|
||||
| ^^^^^ method not found in `OverseerBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<_>>`
|
||||
| ^^^^^ method not found in `OrchestraBuilder<Init<DummySpawner>, Init<AwesomeSubSys>, Missing<_>>`
|
||||
|
|
||||
= note: the method was found for
|
||||
- `OverseerBuilder<Init<S>, Init<AwesomeSubSys>, Init<T>>`
|
||||
- `OrchestraBuilder<Init<S>, Init<AwesomeSubSys>, Init<T>>`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `build`, perhaps you need to implement one of them:
|
||||
candidate #1: `frame_support::traits::hooks::GenesisBuild`
|
||||
+9
-9
@@ -1,18 +1,18 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use polkadot_overseer_gen::*;
|
||||
use orchestra::*;
|
||||
|
||||
#[derive(Default)]
|
||||
struct AwesomeSubSysA;
|
||||
|
||||
|
||||
impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgA>, OverseerError> for AwesomeSubSysA {
|
||||
fn start(self, _ctx: OverseerSubsystemContext<MsgA>) -> SpawnedSubsystem<OverseerError> {
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgA>, OrchestraError> for AwesomeSubSysA {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgA>) -> SpawnedSubsystem<OrchestraError> {
|
||||
SpawnedSubsystem { name: "sub A", future: Box::pin(async move { Ok(()) }) }
|
||||
}
|
||||
}
|
||||
impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgB>, OverseerError> for AwesomeSubSysB {
|
||||
fn start(self, _ctx: OverseerSubsystemContext<MsgB>) -> SpawnedSubsystem<OverseerError> {
|
||||
impl ::orchestra::Subsystem<OrchestraSubsystemContext<MsgB>, OrchestraError> for AwesomeSubSysB {
|
||||
fn start(self, _ctx: OrchestraSubsystemContext<MsgB>) -> SpawnedSubsystem<OrchestraError> {
|
||||
SpawnedSubsystem { name: "sub B", future: Box::pin(async move { Ok(()) }) }
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ impl ::polkadot_overseer_gen::Subsystem<OverseerSubsystemContext<MsgB>, Overseer
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DummySpawner;
|
||||
|
||||
impl SpawnNamed for DummySpawner {
|
||||
impl Spawner for DummySpawner {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
task_name: &'static str,
|
||||
@@ -54,8 +54,8 @@ pub struct MsgA(u8);
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MsgB(u8);
|
||||
|
||||
#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)]
|
||||
pub struct Overseer {
|
||||
#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)]
|
||||
pub struct Orchestra {
|
||||
#[subsystem(MsgA)]
|
||||
sub_a: AwesomeSubSysA,
|
||||
|
||||
@@ -66,7 +66,7 @@ pub struct Overseer {
|
||||
pub struct DummyCtx;
|
||||
|
||||
fn main() {
|
||||
let _overseer_builder = Overseer::builder()
|
||||
let _orchestra_builder = Orchestra::builder()
|
||||
.sub_a(AwesomeSubSysA::default())
|
||||
// b is tagged as `wip`
|
||||
// .sub_b(AwesomeSubSysB::default())
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user