mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 15:11:03 +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
@@ -27,12 +27,12 @@
|
||||
use polkadot_node_subsystem::{
|
||||
errors::{RuntimeApiError, SubsystemError},
|
||||
messages::{BoundToRelayParent, RuntimeApiMessage, RuntimeApiRequest, RuntimeApiSender},
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem,
|
||||
SubsystemContext, SubsystemSender,
|
||||
};
|
||||
|
||||
pub use overseer::{
|
||||
gen::{OverseerError, Timeout},
|
||||
gen::{OrchestraError as OverseerError, Timeout},
|
||||
Subsystem, TimeoutExt,
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ use polkadot_primitives::v2::{
|
||||
};
|
||||
pub use rand;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_core::{traits::SpawnNamed, ByteArray};
|
||||
use sp_core::ByteArray;
|
||||
use sp_keystore::{CryptoStore, Error as KeystoreError, SyncCryptoStorePtr};
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap},
|
||||
@@ -75,7 +75,7 @@ pub use determine_new_blocks::determine_new_blocks;
|
||||
|
||||
/// These reexports are required so that external crates can use the `delegated_subsystem` macro properly.
|
||||
pub mod reexports {
|
||||
pub use polkadot_overseer::gen::{SpawnNamed, SpawnedSubsystem, Subsystem, SubsystemContext};
|
||||
pub use polkadot_overseer::gen::{SpawnedSubsystem, Spawner, Subsystem, SubsystemContext};
|
||||
}
|
||||
|
||||
/// A rolling session window cache.
|
||||
@@ -548,7 +548,7 @@ struct Jobs<Spawner, ToJob> {
|
||||
|
||||
impl<Spawner, ToJob> Jobs<Spawner, ToJob>
|
||||
where
|
||||
Spawner: SpawnNamed,
|
||||
Spawner: overseer::gen::Spawner + Clone,
|
||||
ToJob: Send + 'static,
|
||||
{
|
||||
/// Create a new Jobs manager which handles spawning appropriate jobs.
|
||||
@@ -622,7 +622,7 @@ where
|
||||
|
||||
impl<Spawner, ToJob> Stream for Jobs<Spawner, ToJob>
|
||||
where
|
||||
Spawner: SpawnNamed,
|
||||
Spawner: overseer::gen::Spawner + Clone,
|
||||
{
|
||||
type Item = FromJobCommand;
|
||||
|
||||
@@ -637,7 +637,7 @@ where
|
||||
|
||||
impl<Spawner, ToJob> stream::FusedStream for Jobs<Spawner, ToJob>
|
||||
where
|
||||
Spawner: SpawnNamed,
|
||||
Spawner: overseer::gen::Spawner + Clone,
|
||||
{
|
||||
fn is_terminated(&self) -> bool {
|
||||
false
|
||||
@@ -680,7 +680,7 @@ impl<Job: JobTrait, Spawner> JobSubsystem<Job, Spawner> {
|
||||
/// Run the subsystem to completion.
|
||||
pub async fn run<Context>(self, mut ctx: Context)
|
||||
where
|
||||
Spawner: SpawnNamed + Send + Clone + Unpin + 'static,
|
||||
Spawner: overseer::gen::Spawner + Clone + Unpin + 'static,
|
||||
Context: SubsystemContext<
|
||||
Message = <Job as JobTrait>::ToJob,
|
||||
OutgoingMessages = <Job as JobTrait>::OutgoingMessages,
|
||||
@@ -701,7 +701,7 @@ impl<Job: JobTrait, Spawner> JobSubsystem<Job, Spawner> {
|
||||
select! {
|
||||
incoming = ctx.recv().fuse() => {
|
||||
match incoming {
|
||||
Ok(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated,
|
||||
deactivated,
|
||||
}))) => {
|
||||
@@ -719,12 +719,12 @@ impl<Job: JobTrait, Spawner> JobSubsystem<Job, Spawner> {
|
||||
jobs.stop_job(hash).await;
|
||||
}
|
||||
}
|
||||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => {
|
||||
jobs.running.clear();
|
||||
break;
|
||||
}
|
||||
Ok(FromOverseer::Signal(OverseerSignal::BlockFinalized(..))) => {}
|
||||
Ok(FromOverseer::Communication { msg }) => {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::BlockFinalized(..))) => {}
|
||||
Ok(FromOrchestra::Communication { msg }) => {
|
||||
if let Ok(to_job) = <<Context as SubsystemContext>::Message>::try_from(msg) {
|
||||
jobs.send_msg(to_job.relay_parent(), to_job).await;
|
||||
}
|
||||
@@ -760,7 +760,7 @@ impl<Job: JobTrait, Spawner> JobSubsystem<Job, Spawner> {
|
||||
|
||||
impl<Context, Job, Spawner> Subsystem<Context, SubsystemError> for JobSubsystem<Job, Spawner>
|
||||
where
|
||||
Spawner: SpawnNamed + Send + Clone + Unpin + 'static,
|
||||
Spawner: overseer::gen::Spawner + Clone + Unpin + 'static,
|
||||
Context: SubsystemContext<
|
||||
Message = Job::ToJob,
|
||||
Signal = OverseerSignal,
|
||||
|
||||
@@ -23,7 +23,7 @@ use futures::{channel::mpsc, executor, future, Future, FutureExt, SinkExt, Strea
|
||||
use polkadot_node_jaeger as jaeger;
|
||||
use polkadot_node_subsystem::{
|
||||
messages::{AllMessages, CollatorProtocolMessage},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal, SpawnedSubsystem,
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal, SpawnedSubsystem,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{self as test_helpers, make_subsystem_context};
|
||||
use polkadot_primitives::v2::Hash;
|
||||
@@ -143,7 +143,8 @@ fn test_harness<T: Future<Output = ()>>(run_args: bool, test: impl FnOnce(Overse
|
||||
let pool = sp_core::testing::TaskExecutor::new();
|
||||
let (context, overseer_handle) = make_subsystem_context(pool.clone());
|
||||
|
||||
let subsystem = FakeCollatorProtocolSubsystem::new(pool, run_args, ()).run(context);
|
||||
let subsystem =
|
||||
FakeCollatorProtocolSubsystem::new(overseer::SpawnGlue(pool), run_args, ()).run(context);
|
||||
let test_future = test(overseer_handle);
|
||||
|
||||
futures::pin_mut!(subsystem, test_future);
|
||||
@@ -162,7 +163,7 @@ fn starting_and_stopping_job_works() {
|
||||
|
||||
test_harness(true, |mut overseer_handle| async move {
|
||||
overseer_handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: relay_parent,
|
||||
number: 1,
|
||||
@@ -173,12 +174,12 @@ fn starting_and_stopping_job_works() {
|
||||
.await;
|
||||
assert_matches!(overseer_handle.recv().await, AllMessages::CollatorProtocol(_));
|
||||
overseer_handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::stop_work(relay_parent),
|
||||
)))
|
||||
.await;
|
||||
|
||||
overseer_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
overseer_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -188,7 +189,7 @@ fn sending_to_a_non_running_job_do_not_stop_the_subsystem() {
|
||||
|
||||
test_harness(true, |mut overseer_handle| async move {
|
||||
overseer_handle
|
||||
.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: relay_parent,
|
||||
number: 1,
|
||||
@@ -200,13 +201,13 @@ fn sending_to_a_non_running_job_do_not_stop_the_subsystem() {
|
||||
|
||||
// send to a non running job
|
||||
overseer_handle
|
||||
.send(FromOverseer::Communication { msg: Default::default() })
|
||||
.send(FromOrchestra::Communication { msg: Default::default() })
|
||||
.await;
|
||||
|
||||
// the subsystem is still alive
|
||||
assert_matches!(overseer_handle.recv().await, AllMessages::CollatorProtocol(_));
|
||||
|
||||
overseer_handle.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
|
||||
overseer_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ fn test_subsystem_impl_and_name_derivation() {
|
||||
let (context, _) = make_subsystem_context::<CollatorProtocolMessage, _>(pool.clone());
|
||||
|
||||
let SpawnedSubsystem { name, .. } =
|
||||
FakeCollatorProtocolSubsystem::new(pool, false, ()).start(context);
|
||||
FakeCollatorProtocolSubsystem::new(overseer::SpawnGlue(pool), false, ()).start(context);
|
||||
assert_eq!(name, "fake-collator-protocol");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user