From bc66bc5b3ed8bbf57e05254d5af23b23f4fd77e5 Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Mon, 16 May 2022 18:38:50 +0200 Subject: [PATCH 01/15] rename overseer-gen to orchestra Also drop `gum` and use `tracing`. --- Cargo.lock | 2 +- Cargo.toml | 4 +-- node/metered-channel/Cargo.toml | 3 +- node/overseer/Cargo.toml | 4 +-- .../{overseer-gen => orchestra}/Cargo.toml | 15 +++++----- .../{overseer-gen => orchestra}/README.md | 10 +++---- .../{overseer-gen => orchestra}/adr/01-adr.md | 4 +-- .../examples/duo.rs | 4 +-- .../examples/misc.rs | 12 ++++---- .../examples/solo.rs | 4 +-- .../proc-macro/Cargo.toml | 15 +++++----- .../proc-macro/build.rs | 0 .../proc-macro/src/impl_builder.rs | 12 ++++---- .../proc-macro/src/impl_channels_out.rs | 0 .../proc-macro/src/impl_message_wrapper.rs | 0 .../proc-macro/src/impl_orchestra.rs} | 2 +- .../src/impl_subsystem_ctx_sender.rs | 0 .../proc-macro/src/lib.rs | 6 ++-- .../proc-macro/src/overseer.rs | 6 ++-- .../proc-macro/src/parse/mod.rs | 0 .../src/parse/parse_overseer_attr.rs | 0 .../src/parse/parse_overseer_struct.rs | 2 +- .../src/parse/parse_subsystem_attr.rs | 0 .../proc-macro/src/parse/tests.rs | 0 .../proc-macro/src/subsystem.rs | 24 ++++++++-------- .../proc-macro/src/tests.rs | 2 +- .../{overseer-gen => orchestra}/src/lib.rs | 28 +++++++++++++++++-- .../{overseer-gen => orchestra}/src/tests.rs | 0 .../tests/ui/err-01-duplicate-consumer.rs | 2 +- .../tests/ui/err-01-duplicate-consumer.stderr | 8 +++--- .../tests/ui/err-02-enum.rs | 2 +- .../tests/ui/err-02-enum.stderr | 0 .../tests/ui/err-03-subsys-twice.rs | 2 +- .../tests/ui/err-03-subsys-twice.stderr | 0 .../tests/ui/err-04-missing-error.rs | 2 +- .../tests/ui/err-04-missing-error.stderr | 4 +-- .../tests/ui/err-05-missing-field.rs | 2 +- .../tests/ui/err-05-missing-field.stderr | 2 +- .../tests/ui/err-06-missing-subsystem.rs | 2 +- .../tests/ui/err-06-missing-subsystem.stderr | 2 +- .../tests/ui/err-07-missing-spawner.rs | 2 +- .../tests/ui/err-07-missing-spawner.stderr | 2 +- .../tests/ui/err-08-duplicate-subsystem.rs | 2 +- .../ui/err-08-duplicate-subsystem.stderr | 2 +- .../tests/ui/err-09-uninit_generic_baggage.rs | 2 +- .../ui/err-09-uninit_generic_baggage.stderr | 2 +- .../tests/ui/ok-01-wip.rs | 2 +- node/overseer/src/lib.rs | 4 +-- 48 files changed, 116 insertions(+), 89 deletions(-) rename node/overseer/{overseer-gen => orchestra}/Cargo.toml (65%) rename node/overseer/{overseer-gen => orchestra}/README.md (91%) rename node/overseer/{overseer-gen => orchestra}/adr/01-adr.md (94%) rename node/overseer/{overseer-gen => orchestra}/examples/duo.rs (93%) rename node/overseer/{overseer-gen => orchestra}/examples/misc.rs (77%) rename node/overseer/{overseer-gen => orchestra}/examples/solo.rs (88%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/Cargo.toml (59%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/build.rs (100%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/impl_builder.rs (97%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/impl_channels_out.rs (100%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/impl_message_wrapper.rs (100%) rename node/overseer/{overseer-gen/proc-macro/src/impl_overseer.rs => orchestra/proc-macro/src/impl_orchestra.rs} (99%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/impl_subsystem_ctx_sender.rs (100%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/lib.rs (96%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/overseer.rs (93%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/parse/mod.rs (100%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/parse/parse_overseer_attr.rs (100%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/parse/parse_overseer_struct.rs (99%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/parse/parse_subsystem_attr.rs (100%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/parse/tests.rs (100%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/subsystem.rs (91%) rename node/overseer/{overseer-gen => orchestra}/proc-macro/src/tests.rs (96%) rename node/overseer/{overseer-gen => orchestra}/src/lib.rs (96%) rename node/overseer/{overseer-gen => orchestra}/src/tests.rs (100%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-01-duplicate-consumer.rs (87%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-01-duplicate-consumer.stderr (62%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-02-enum.rs (85%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-02-enum.stderr (100%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-03-subsys-twice.rs (88%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-03-subsys-twice.stderr (100%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-04-missing-error.rs (89%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-04-missing-error.stderr (66%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-05-missing-field.rs (94%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-05-missing-field.stderr (91%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-06-missing-subsystem.rs (94%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-06-missing-subsystem.stderr (90%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-07-missing-spawner.rs (94%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-07-missing-spawner.stderr (90%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-08-duplicate-subsystem.rs (94%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-08-duplicate-subsystem.stderr (85%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-09-uninit_generic_baggage.rs (94%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/err-09-uninit_generic_baggage.stderr (91%) rename node/overseer/{overseer-gen => orchestra}/tests/ui/ok-01-wip.rs (95%) diff --git a/Cargo.lock b/Cargo.lock index 2f4d62410042..23b8b73c696d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6980,7 +6980,7 @@ dependencies = [ "polkadot-overseer-gen-proc-macro", "rustversion", "thiserror", - "tracing-gum", + "tracing", "trybuild", ] diff --git a/Cargo.toml b/Cargo.toml index b02f6ac1b500..70aa3f77c329 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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", diff --git a/node/metered-channel/Cargo.toml b/node/metered-channel/Cargo.toml index 8d9772573c60..a7d6b7ee3844 100644 --- a/node/metered-channel/Cargo.toml +++ b/node/metered-channel/Cargo.toml @@ -4,12 +4,13 @@ version = "0.9.22" authors = ["Parity Technologies "] 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"] } diff --git a/node/overseer/Cargo.toml b/node/overseer/Cargo.toml index e66fd2af3623..f39c89651d7e 100644 --- a/node/overseer/Cargo.toml +++ b/node/overseer/Cargo.toml @@ -15,7 +15,7 @@ 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 } @@ -30,4 +30,4 @@ test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../pri [features] default = [] -expand = ["polkadot-overseer-gen/expand"] +expand = ["orchestra/expand"] diff --git a/node/overseer/overseer-gen/Cargo.toml b/node/overseer/orchestra/Cargo.toml similarity index 65% rename from node/overseer/overseer-gen/Cargo.toml rename to node/overseer/orchestra/Cargo.toml index f22c36771934..c3db257263d6 100644 --- a/node/overseer/overseer-gen/Cargo.toml +++ b/node/overseer/orchestra/Cargo.toml @@ -1,20 +1,22 @@ [package] -name = "polkadot-overseer-gen" +name = "orchestra" version = "0.9.22" authors = ["Parity Technologies "] 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" } +orchestra-proc-macro = { path = "./proc-macro" } polkadot-node-network-protocol = { path = "../../network/protocol"} -# trait SpawnNamed +# FIXME TODO +# trait Spawner polkadot-node-primitives = { path = "../../primitives" } futures-timer = "3.0.2" pin-project = "1.0" @@ -24,7 +26,6 @@ trybuild = "1.0.61" rustversion = "1.0.6" - [[example]] name = "duo" crate-type = ["bin"] @@ -35,4 +36,4 @@ crate-type = ["bin"] [features] default = [] -expand = ["polkadot-overseer-gen-proc-macro/expand"] +expand = ["orchestra-proc-macro/expand"] diff --git a/node/overseer/overseer-gen/README.md b/node/overseer/orchestra/README.md similarity index 91% rename from node/overseer/overseer-gen/README.md rename to node/overseer/orchestra/README.md index ebce568ce9a5..2f6479c36b8f 100644 --- a/node/overseer/overseer-gen/README.md +++ b/node/overseer/orchestra/README.md @@ -9,7 +9,7 @@ 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)] + #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] pub struct Overseer { #[subsystem(MsgA, sends: [MsgB])] sub_a: AwesomeSubSysA, @@ -23,7 +23,7 @@ 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 `::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 `::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`. * `error=` tells the overseer 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` for all other error types `E` that are relevant to your application. @@ -64,7 +64,7 @@ To exclude subsystems from such a check, one can set `wip` attribute on some sub is not ready to be included in the Overseer: ```rust - #[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] + #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] pub struct Overseer { #[subsystem(MsgA, sends: MsgB)] sub_a: AwesomeSubSysA, @@ -78,13 +78,13 @@ 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_`. -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 +error messages. Enable with `--feature=orchestra/expand` or `--feature=polkadot-overseer/expand` from the root of the project or make `"expand"` part of the default feature set. diff --git a/node/overseer/overseer-gen/adr/01-adr.md b/node/overseer/orchestra/adr/01-adr.md similarity index 94% rename from node/overseer/overseer-gen/adr/01-adr.md rename to node/overseer/orchestra/adr/01-adr.md index 410f5a699b29..e9df45c9e194 100644 --- a/node/overseer/overseer-gen/adr/01-adr.md +++ b/node/overseer/orchestra/adr/01-adr.md @@ -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 `::Sender` bounds. ## Consequences -* A graph will be spawn for every compilation under the `OUT_DIR` of the crate where `#[overlord]` is specified. +* 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 overseer declaration. `${Subsystem}OutgoingMessages` is used throughout everywhere to constrain the outgoing messages (commonly referred to as `OutgoingMessage` generic bounded by `${Subsystem}OutgoingMessages: From` 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. * `Job`-based subsystems, being on their way out, are patched, but they now are generic over the `Sender` type, leaking that type. diff --git a/node/overseer/overseer-gen/examples/duo.rs b/node/overseer/orchestra/examples/duo.rs similarity index 93% rename from node/overseer/overseer-gen/examples/duo.rs rename to node/overseer/orchestra/examples/duo.rs index b63a7df603e1..84a016969509 100644 --- a/node/overseer/overseer-gen/examples/duo.rs +++ b/node/overseer/orchestra/examples/duo.rs @@ -2,7 +2,7 @@ //! A dummy to be used with cargo expand -use polkadot_overseer_gen::{self as overseer, SpawnNamed, *}; +use orchestra::{self as overseer, Spawner, *}; use std::collections::HashMap; mod misc; @@ -45,7 +45,7 @@ impl Fortified { } } -#[overlord(signal=SigSigSig, event=EvX, error=Yikes, gen=AllMessages)] +#[orchestra(signal=SigSigSig, event=EvX, error=Yikes, gen=AllMessages)] struct Duo { #[subsystem(consumes: MsgStrukt, sends: [Plinko])] sub0: Awesome, diff --git a/node/overseer/overseer-gen/examples/misc.rs b/node/overseer/orchestra/examples/misc.rs similarity index 77% rename from node/overseer/overseer-gen/examples/misc.rs rename to node/overseer/orchestra/examples/misc.rs index 87f674e14134..3e917ac7b728 100644 --- a/node/overseer/overseer-gen/examples/misc.rs +++ b/node/overseer/orchestra/examples/misc.rs @@ -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 for Yikes { - fn from(_: polkadot_overseer_gen::OverseerError) -> Yikes { +impl From for Yikes { + fn from(_: orchestra::OverseerError) -> Yikes { Yikes } } -impl From for Yikes { - fn from(_: polkadot_overseer_gen::mpsc::SendError) -> Yikes { +impl From for Yikes { + fn from(_: orchestra::mpsc::SendError) -> Yikes { Yikes } } diff --git a/node/overseer/overseer-gen/examples/solo.rs b/node/overseer/orchestra/examples/solo.rs similarity index 88% rename from node/overseer/overseer-gen/examples/solo.rs rename to node/overseer/orchestra/examples/solo.rs index 74ecdc9d16ba..1ffd7b16855e 100644 --- a/node/overseer/overseer-gen/examples/solo.rs +++ b/node/overseer/orchestra/examples/solo.rs @@ -2,12 +2,12 @@ //! A minimal demo to be used with cargo expand. -use polkadot_overseer_gen::{self as overseer, SpawnNamed, *}; +use orchestra::{self as overseer, 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 { #[subsystem(consumes: Plinko, sends: [MsgStrukt])] goblin_tower: GoblinTower, diff --git a/node/overseer/overseer-gen/proc-macro/Cargo.toml b/node/overseer/orchestra/proc-macro/Cargo.toml similarity index 59% rename from node/overseer/overseer-gen/proc-macro/Cargo.toml rename to node/overseer/orchestra/proc-macro/Cargo.toml index e2494a0e5552..fa5c44549e75 100644 --- a/node/overseer/overseer-gen/proc-macro/Cargo.toml +++ b/node/overseer/orchestra/proc-macro/Cargo.toml @@ -1,9 +1,10 @@ [package] -name = "polkadot-overseer-gen-proc-macro" +name = "orchestra-proc-macro" version = "0.9.22" authors = ["Parity Technologies "] 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 = [] diff --git a/node/overseer/overseer-gen/proc-macro/build.rs b/node/overseer/orchestra/proc-macro/build.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/build.rs rename to node/overseer/orchestra/proc-macro/build.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs b/node/overseer/orchestra/proc-macro/src/impl_builder.rs similarity index 97% rename from node/overseer/overseer-gen/proc-macro/src/impl_builder.rs rename to node/overseer/orchestra/proc-macro/src/impl_builder.rs index ceb9faf0ca39..1dcb38f0ba7d 100644 --- a/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_builder.rs @@ -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 + Send }; // Field names and real types @@ -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, signal_capacity: Option, @@ -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(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>); + fn launch_task(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(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) { + fn launch_task(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(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) { + fn launch_task(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) { spawner.spawn_blocking(task_name, Some(subsystem_name), future) } } @@ -708,7 +708,7 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream { futures: &mut #support_crate ::FuturesUnordered >>, ) -> ::std::result::Result, #error_ty > where - S: #support_crate ::SpawnNamed, + S: #support_crate ::Spawner, M: std::fmt::Debug + Send + 'static, TK: TaskKind, Ctx: #support_crate ::SubsystemContext, diff --git a/node/overseer/overseer-gen/proc-macro/src/impl_channels_out.rs b/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/src/impl_channels_out.rs rename to node/overseer/orchestra/proc-macro/src/impl_channels_out.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/impl_message_wrapper.rs b/node/overseer/orchestra/proc-macro/src/impl_message_wrapper.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/src/impl_message_wrapper.rs rename to node/overseer/orchestra/proc-macro/src/impl_message_wrapper.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/impl_overseer.rs b/node/overseer/orchestra/proc-macro/src/impl_orchestra.rs similarity index 99% rename from node/overseer/overseer-gen/proc-macro/src/impl_overseer.rs rename to node/overseer/orchestra/proc-macro/src/impl_orchestra.rs index b3bb74665687..ba679bcf3889 100644 --- a/node/overseer/overseer-gen/proc-macro/src/impl_overseer.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_orchestra.rs @@ -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 diff --git a/node/overseer/overseer-gen/proc-macro/src/impl_subsystem_ctx_sender.rs b/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/src/impl_subsystem_ctx_sender.rs rename to node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/lib.rs b/node/overseer/orchestra/proc-macro/src/lib.rs similarity index 96% rename from node/overseer/overseer-gen/proc-macro/src/lib.rs rename to node/overseer/orchestra/proc-macro/src/lib.rs index 7845917cfbab..5f7fe61b9b71 100644 --- a/node/overseer/overseer-gen/proc-macro/src/lib.rs +++ b/node/overseer/orchestra/proc-macro/src/lib.rs @@ -44,7 +44,7 @@ pub(crate) fn support_crate() -> Result { 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 { } #[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() } diff --git a/node/overseer/overseer-gen/proc-macro/src/overseer.rs b/node/overseer/orchestra/proc-macro/src/overseer.rs similarity index 93% rename from node/overseer/overseer-gen/proc-macro/src/overseer.rs rename to node/overseer/orchestra/proc-macro/src/overseer.rs index 127120337ae0..ecd382cfef9c 100644 --- a/node/overseer/overseer-gen/proc-macro/src/overseer.rs +++ b/node/overseer/orchestra/proc-macro/src/overseer.rs @@ -19,7 +19,7 @@ use syn::{parse2, Result}; use super::{parse::*, *}; -pub(crate) fn impl_overseer_gen( +pub(crate) fn impl_orchestra_gen( attr: TokenStream, orig: TokenStream, ) -> Result { @@ -52,8 +52,8 @@ pub(crate) fn impl_overseer_gen( 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 overseer code by `#[orchestra(..)]`".to_owned()) .dry(!cfg!(feature = "expand")) .verbose(true) // once all our needed format options are available on stable diff --git a/node/overseer/overseer-gen/proc-macro/src/parse/mod.rs b/node/overseer/orchestra/proc-macro/src/parse/mod.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/src/parse/mod.rs rename to node/overseer/orchestra/proc-macro/src/parse/mod.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/parse/parse_overseer_attr.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/src/parse/parse_overseer_attr.rs rename to node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/parse/parse_overseer_struct.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs similarity index 99% rename from node/overseer/overseer-gen/proc-macro/src/parse/parse_overseer_struct.rs rename to node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs index 179a4ada06eb..78cbdc2ad6c7 100644 --- a/node/overseer/overseer-gen/proc-macro/src/parse/parse_overseer_struct.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs @@ -262,7 +262,7 @@ pub(crate) struct BaggageField { #[derive(Clone, Debug)] pub(crate) struct OverseerInfo { - /// Where the support crate `::polkadot_overseer_gen` lives. + /// Where the support crate `::orchestra` lives. pub(crate) support_crate: Path, /// Fields annotated with `#[subsystem(..)]`. diff --git a/node/overseer/overseer-gen/proc-macro/src/parse/parse_subsystem_attr.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_subsystem_attr.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/src/parse/parse_subsystem_attr.rs rename to node/overseer/orchestra/proc-macro/src/parse/parse_subsystem_attr.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/parse/tests.rs b/node/overseer/orchestra/proc-macro/src/parse/tests.rs similarity index 100% rename from node/overseer/overseer-gen/proc-macro/src/parse/tests.rs rename to node/overseer/orchestra/proc-macro/src/parse/tests.rs diff --git a/node/overseer/overseer-gen/proc-macro/src/subsystem.rs b/node/overseer/orchestra/proc-macro/src/subsystem.rs similarity index 91% rename from node/overseer/overseer-gen/proc-macro/src/subsystem.rs rename to node/overseer/orchestra/proc-macro/src/subsystem.rs index 7b5523e4b5c8..5f1c9256055c 100644 --- a/node/overseer/overseer-gen/proc-macro/src/subsystem.rs +++ b/node/overseer/orchestra/proc-macro/src/subsystem.rs @@ -20,10 +20,10 @@ //! ## Implement `trait Subsystem` 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!")] @@ -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,10 +71,10 @@ //! 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!")] @@ -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") }) })?; diff --git a/node/overseer/overseer-gen/proc-macro/src/tests.rs b/node/overseer/orchestra/proc-macro/src/tests.rs similarity index 96% rename from node/overseer/overseer-gen/proc-macro/src/tests.rs rename to node/overseer/orchestra/proc-macro/src/tests.rs index 364e53f5b02a..399fcc0c07ea 100644 --- a/node/overseer/overseer-gen/proc-macro/src/tests.rs +++ b/node/overseer/orchestra/proc-macro/src/tests.rs @@ -48,7 +48,7 @@ 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); } diff --git a/node/overseer/overseer-gen/src/lib.rs b/node/overseer/orchestra/src/lib.rs similarity index 96% rename from node/overseer/overseer-gen/src/lib.rs rename to node/overseer/orchestra/src/lib.rs index e0ec74793501..9c45d815458c 100644 --- a/node/overseer/overseer-gen/src/lib.rs +++ b/node/overseer/orchestra/src/lib.rs @@ -60,7 +60,7 @@ #![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; @@ -68,7 +68,7 @@ pub use gum; pub use metered; #[doc(hidden)] -pub use polkadot_node_primitives::SpawnNamed; +pub use polkadot_node_primitives::Spawner; #[doc(hidden)] pub use async_trait::async_trait; @@ -102,6 +102,30 @@ use std::fmt; #[cfg(test)] mod tests; + + +/// A spawner +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 overseer. /// /// Used to launch jobs. diff --git a/node/overseer/overseer-gen/src/tests.rs b/node/overseer/orchestra/src/tests.rs similarity index 100% rename from node/overseer/overseer-gen/src/tests.rs rename to node/overseer/orchestra/src/tests.rs diff --git a/node/overseer/overseer-gen/tests/ui/err-01-duplicate-consumer.rs b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs similarity index 87% rename from node/overseer/overseer-gen/tests/ui/err-01-duplicate-consumer.rs rename to node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs index b81f10a7f0fa..625c171233a0 100644 --- a/node/overseer/overseer-gen/tests/ui/err-01-duplicate-consumer.rs +++ b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs @@ -16,7 +16,7 @@ struct Event; #[derive(Clone)] struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-01-duplicate-consumer.stderr b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.stderr similarity index 62% rename from node/overseer/overseer-gen/tests/ui/err-01-duplicate-consumer.stderr rename to node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.stderr index ea67ef7aad5b..d5e761288362 100644 --- a/node/overseer/overseer-gen/tests/ui/err-01-duplicate-consumer.stderr +++ b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.stderr @@ -1,21 +1,21 @@ error[E0119]: conflicting implementations of trait `polkadot_overseer_gen::SubsystemSender` for type `OverseerSubsystemSender` --> tests/ui/err-01-duplicate-consumer.rs:19:1 | -19 | #[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | first implementation here | conflicting implementation for `OverseerSubsystemSender` | - = note: this error originates in the attribute macro `overlord` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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` for type `AllMessages` --> tests/ui/err-01-duplicate-consumer.rs:19:1 | -19 | #[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | first implementation here | conflicting implementation for `AllMessages` | - = note: this error originates in the attribute macro `overlord` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `orchestra` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/node/overseer/overseer-gen/tests/ui/err-02-enum.rs b/node/overseer/orchestra/tests/ui/err-02-enum.rs similarity index 85% rename from node/overseer/overseer-gen/tests/ui/err-02-enum.rs rename to node/overseer/orchestra/tests/ui/err-02-enum.rs index c7e491bfba9a..202c37922f12 100644 --- a/node/overseer/overseer-gen/tests/ui/err-02-enum.rs +++ b/node/overseer/orchestra/tests/ui/err-02-enum.rs @@ -12,7 +12,7 @@ struct Event; #[derive(Clone, Debug)] struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] enum Overseer { #[subsystem(MsgStrukt)] Sub0(AwesomeSubSys), diff --git a/node/overseer/overseer-gen/tests/ui/err-02-enum.stderr b/node/overseer/orchestra/tests/ui/err-02-enum.stderr similarity index 100% rename from node/overseer/overseer-gen/tests/ui/err-02-enum.stderr rename to node/overseer/orchestra/tests/ui/err-02-enum.stderr diff --git a/node/overseer/overseer-gen/tests/ui/err-03-subsys-twice.rs b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs similarity index 88% rename from node/overseer/overseer-gen/tests/ui/err-03-subsys-twice.rs rename to node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs index 9a7ad951c8b7..f397cb6e7041 100644 --- a/node/overseer/overseer-gen/tests/ui/err-03-subsys-twice.rs +++ b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs @@ -16,7 +16,7 @@ struct MsgStrukt(u8); #[derive(Clone, Debug)] struct MsgStrukt2(f64); -#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-03-subsys-twice.stderr b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr similarity index 100% rename from node/overseer/overseer-gen/tests/ui/err-03-subsys-twice.stderr rename to node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr diff --git a/node/overseer/overseer-gen/tests/ui/err-04-missing-error.rs b/node/overseer/orchestra/tests/ui/err-04-missing-error.rs similarity index 89% rename from node/overseer/overseer-gen/tests/ui/err-04-missing-error.rs rename to node/overseer/orchestra/tests/ui/err-04-missing-error.rs index 3547eb36a5c5..fc91a958cfe0 100644 --- a/node/overseer/overseer-gen/tests/ui/err-04-missing-error.rs +++ b/node/overseer/orchestra/tests/ui/err-04-missing-error.rs @@ -13,7 +13,7 @@ struct Event; #[derive(Clone)] struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, event=Event, gen=AllMessages)] +#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-04-missing-error.stderr b/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr similarity index 66% rename from node/overseer/overseer-gen/tests/ui/err-04-missing-error.stderr rename to node/overseer/orchestra/tests/ui/err-04-missing-error.stderr index 7fa4d832253e..e0f0bf28f485 100644 --- a/node/overseer/overseer-gen/tests/ui/err-04-missing-error.stderr +++ b/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr @@ -1,10 +1,10 @@ error: Must declare the overseer error type via `error=..`. --> $DIR/err-04-missing-error.rs:16:1 | -16 | #[overlord(signal=SigSigSig, event=Event, gen=AllMessages)] +16 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in the attribute macro `overlord` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 `Overseer` --> $DIR/err-04-missing-error.rs:30:10 diff --git a/node/overseer/overseer-gen/tests/ui/err-05-missing-field.rs b/node/overseer/orchestra/tests/ui/err-05-missing-field.rs similarity index 94% rename from node/overseer/overseer-gen/tests/ui/err-05-missing-field.rs rename to node/overseer/orchestra/tests/ui/err-05-missing-field.rs index 22ead71ea180..fbb3d0688c87 100644 --- a/node/overseer/overseer-gen/tests/ui/err-05-missing-field.rs +++ b/node/overseer/orchestra/tests/ui/err-05-missing-field.rs @@ -19,7 +19,7 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] +#[orchestra(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-05-missing-field.stderr b/node/overseer/orchestra/tests/ui/err-05-missing-field.stderr similarity index 91% rename from node/overseer/overseer-gen/tests/ui/err-05-missing-field.stderr rename to node/overseer/orchestra/tests/ui/err-05-missing-field.stderr index dcd9fbaa019b..099a8f352939 100644 --- a/node/overseer/overseer-gen/tests/ui/err-05-missing-field.stderr +++ b/node/overseer/orchestra/tests/ui/err-05-missing-field.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `build` found for struct `OverseerBuilder, Init, Missing>` 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=OverseerError, event=Event, gen=AllMessages)] | -------------------------------------------------------------------------------- method `build` not found for this ... 59 | .build() diff --git a/node/overseer/overseer-gen/tests/ui/err-06-missing-subsystem.rs b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs similarity index 94% rename from node/overseer/overseer-gen/tests/ui/err-06-missing-subsystem.rs rename to node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs index bccc990d5e66..e0785293ffa7 100644 --- a/node/overseer/overseer-gen/tests/ui/err-06-missing-subsystem.rs +++ b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs @@ -19,7 +19,7 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] +#[orchestra(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-06-missing-subsystem.stderr b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.stderr similarity index 90% rename from node/overseer/overseer-gen/tests/ui/err-06-missing-subsystem.stderr rename to node/overseer/orchestra/tests/ui/err-06-missing-subsystem.stderr index 6d7a210fd9c3..b70761b1a539 100644 --- a/node/overseer/overseer-gen/tests/ui/err-06-missing-subsystem.stderr +++ b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `build` found for struct `OverseerBuilder, Missing<_>, Init>` 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=OverseerError, event=Event, gen=AllMessages)] | -------------------------------------------------------------------------------- method `build` not found for this ... 59 | .build() diff --git a/node/overseer/overseer-gen/tests/ui/err-07-missing-spawner.rs b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs similarity index 94% rename from node/overseer/overseer-gen/tests/ui/err-07-missing-spawner.rs rename to node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs index 4193d28ec879..07f121ba1cc8 100644 --- a/node/overseer/overseer-gen/tests/ui/err-07-missing-spawner.rs +++ b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs @@ -19,7 +19,7 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] +#[orchestra(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-07-missing-spawner.stderr b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.stderr similarity index 90% rename from node/overseer/overseer-gen/tests/ui/err-07-missing-spawner.stderr rename to node/overseer/orchestra/tests/ui/err-07-missing-spawner.stderr index d265f36f5fa7..3ef8a977dbd8 100644 --- a/node/overseer/overseer-gen/tests/ui/err-07-missing-spawner.stderr +++ b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `build` found for struct `OverseerBuilder, Init, Init>` 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=OverseerError, event=Event, gen=AllMessages)] | -------------------------------------------------------------------------------- method `build` not found for this ... 59 | .build() diff --git a/node/overseer/overseer-gen/tests/ui/err-08-duplicate-subsystem.rs b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs similarity index 94% rename from node/overseer/overseer-gen/tests/ui/err-08-duplicate-subsystem.rs rename to node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs index 8895723abbc1..e689e9844972 100644 --- a/node/overseer/overseer-gen/tests/ui/err-08-duplicate-subsystem.rs +++ b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs @@ -19,7 +19,7 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] +#[orchestra(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-08-duplicate-subsystem.stderr b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.stderr similarity index 85% rename from node/overseer/overseer-gen/tests/ui/err-08-duplicate-subsystem.stderr rename to node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.stderr index a0fcee914fd4..e7d638014df6 100644 --- a/node/overseer/overseer-gen/tests/ui/err-08-duplicate-subsystem.stderr +++ b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `sub0` found for struct `OverseerBuilder, Init, Missing>` 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=OverseerError, event=Event, gen=AllMessages)] | -------------------------------------------------------------------------------- method `sub0` not found for this ... 57 | .sub0(AwesomeSubSys::default()) // Duplicate subsystem diff --git a/node/overseer/overseer-gen/tests/ui/err-09-uninit_generic_baggage.rs b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs similarity index 94% rename from node/overseer/overseer-gen/tests/ui/err-09-uninit_generic_baggage.rs rename to node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs index 64a2f6c4bffc..b15464c38716 100644 --- a/node/overseer/overseer-gen/tests/ui/err-09-uninit_generic_baggage.rs +++ b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs @@ -19,7 +19,7 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] +#[orchestra(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)] struct Overseer { #[subsystem(MsgStrukt)] sub0: AwesomeSubSys, diff --git a/node/overseer/overseer-gen/tests/ui/err-09-uninit_generic_baggage.stderr b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.stderr similarity index 91% rename from node/overseer/overseer-gen/tests/ui/err-09-uninit_generic_baggage.stderr rename to node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.stderr index 26998c4e418b..cbb10c15c520 100644 --- a/node/overseer/overseer-gen/tests/ui/err-09-uninit_generic_baggage.stderr +++ b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `build` found for struct `OverseerBuilder, Init, 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=OverseerError, event=Event, gen=AllMessages)] | -------------------------------------------------------------------------------- method `build` not found for this ... 59 | .build() diff --git a/node/overseer/overseer-gen/tests/ui/ok-01-wip.rs b/node/overseer/orchestra/tests/ui/ok-01-wip.rs similarity index 95% rename from node/overseer/overseer-gen/tests/ui/ok-01-wip.rs rename to node/overseer/orchestra/tests/ui/ok-01-wip.rs index b07855f67a1d..89e36ff89a3a 100644 --- a/node/overseer/overseer-gen/tests/ui/ok-01-wip.rs +++ b/node/overseer/orchestra/tests/ui/ok-01-wip.rs @@ -54,7 +54,7 @@ pub struct MsgA(u8); #[derive(Clone, Debug)] pub struct MsgB(u8); -#[overlord(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +#[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] pub struct Overseer { #[subsystem(MsgA)] sub_a: AwesomeSubSysA, diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index bcf486d2a0db..91126c236a52 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -107,7 +107,7 @@ use parity_util_mem::MemoryAllocationTracker; pub use polkadot_overseer_gen as gen; pub use polkadot_overseer_gen::{ - contextbounds, overlord, subsystem, FromOverseer, MapSubsystem, MessagePacket, SignalsReceived, + contextbounds, orchestra, subsystem, FromOverseer, MapSubsystem, MessagePacket, SignalsReceived, SpawnNamed, Subsystem, SubsystemContext, SubsystemIncomingMessages, SubsystemInstance, SubsystemMeterReadouts, SubsystemMeters, SubsystemSender, TimeoutExt, ToOverseer, }; @@ -408,7 +408,7 @@ pub async fn forward_events>(client: Arc

, mut hand /// # }); /// # } /// ``` -#[overlord( +#[orchestra( gen=AllMessages, event=Event, signal=OverseerSignal, From 1c1f518441a74498146fb12fe34668d9ffb64e8f Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Tue, 17 May 2022 16:03:53 +0200 Subject: [PATCH 02/15] make orchestra compile as standalone --- Cargo.lock | 71 +++++++++---------- node/metered-channel/src/oneshot.rs | 2 +- node/overseer/orchestra/Cargo.toml | 4 -- node/overseer/orchestra/README.md | 12 ++-- node/overseer/orchestra/examples/misc.rs | 4 +- .../orchestra/proc-macro/src/impl_builder.rs | 32 ++++----- .../proc-macro/src/impl_channels_out.rs | 10 +-- .../proc-macro/src/impl_message_wrapper.rs | 2 +- .../proc-macro/src/impl_orchestra.rs | 26 +++---- .../src/impl_subsystem_ctx_sender.rs | 42 +++++------ node/overseer/orchestra/proc-macro/src/lib.rs | 8 +-- .../src/{overseer.rs => orchestra.rs} | 10 +-- .../src/parse/parse_overseer_attr.rs | 42 +++++------ .../src/parse/parse_overseer_struct.rs | 10 +-- .../orchestra/proc-macro/src/parse/tests.rs | 18 ++--- .../orchestra/proc-macro/src/subsystem.rs | 8 +-- .../orchestra/proc-macro/src/tests.rs | 18 ++--- node/overseer/orchestra/src/lib.rs | 65 ++++++++--------- .../tests/ui/err-01-duplicate-consumer.rs | 8 +-- .../tests/ui/err-01-duplicate-consumer.stderr | 8 +-- .../orchestra/tests/ui/err-02-enum.rs | 8 +-- .../orchestra/tests/ui/err-02-enum.stderr | 8 +-- .../orchestra/tests/ui/err-03-subsys-twice.rs | 8 +-- .../tests/ui/err-03-subsys-twice.stderr | 6 +- .../tests/ui/err-04-missing-error.rs | 6 +- .../tests/ui/err-04-missing-error.stderr | 6 +- .../tests/ui/err-05-missing-field.rs | 12 ++-- .../tests/ui/err-05-missing-field.stderr | 8 +-- .../tests/ui/err-06-missing-subsystem.rs | 12 ++-- .../tests/ui/err-06-missing-subsystem.stderr | 8 +-- .../tests/ui/err-07-missing-spawner.rs | 12 ++-- .../tests/ui/err-07-missing-spawner.stderr | 8 +-- .../tests/ui/err-08-duplicate-subsystem.rs | 12 ++-- .../ui/err-08-duplicate-subsystem.stderr | 4 +- .../tests/ui/err-09-uninit_generic_baggage.rs | 12 ++-- .../ui/err-09-uninit_generic_baggage.stderr | 8 +-- node/overseer/orchestra/tests/ui/ok-01-wip.rs | 16 ++--- 37 files changed, 272 insertions(+), 282 deletions(-) rename node/overseer/orchestra/proc-macro/src/{overseer.rs => orchestra.rs} (90%) diff --git a/Cargo.lock b/Cargo.lock index 23b8b73c696d..926af5d02566 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4341,7 +4341,6 @@ dependencies = [ "nanorand", "thiserror", "tracing", - "tracing-gum", ] [[package]] @@ -4828,6 +4827,38 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "orchestra" +version = "0.9.22" +dependencies = [ + "async-trait", + "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" @@ -6889,10 +6920,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", @@ -6951,13 +6982,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", @@ -6966,40 +6997,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", - "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" diff --git a/node/metered-channel/src/oneshot.rs b/node/metered-channel/src/oneshot.rs index 520531beabd4..23cb548747b2 100644 --- a/node/metered-channel/src/oneshot.rs +++ b/node/metered-channel/src/oneshot.rs @@ -225,7 +225,7 @@ impl Future for MeteredReceiver { .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(); diff --git a/node/overseer/orchestra/Cargo.toml b/node/overseer/orchestra/Cargo.toml index c3db257263d6..323b069c845f 100644 --- a/node/overseer/orchestra/Cargo.toml +++ b/node/overseer/orchestra/Cargo.toml @@ -14,10 +14,6 @@ async-trait = "0.1" thiserror = "1" metered = { package = "metered-channel", path = "../../metered-channel" } orchestra-proc-macro = { path = "./proc-macro" } -polkadot-node-network-protocol = { path = "../../network/protocol"} -# FIXME TODO -# trait Spawner -polkadot-node-primitives = { path = "../../primitives" } futures-timer = "3.0.2" pin-project = "1.0" diff --git a/node/overseer/orchestra/README.md b/node/overseer/orchestra/README.md index 2f6479c36b8f..b41692a50290 100644 --- a/node/overseer/orchestra/README.md +++ b/node/overseer/orchestra/README.md @@ -9,8 +9,8 @@ where at it's core it creates and spawns a set of subsystems, which are purely declarative. ```rust - #[orchestra(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, sends: [MsgB])] sub_a: AwesomeSubSysA, @@ -40,7 +40,7 @@ into the overseer, without participating in the subsystem pattern. pub struct DummySpawner; fn main() { - let _overseer = Overseer::builder() + let _overseer = Orchestra::builder() .sub_a(AwesomeSubSysA::default()) .sub_b(AwesomeSubSysB::default()) .spawner(DummySpawner) @@ -61,11 +61,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 - #[orchestra(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, sends: MsgB)] sub_a: AwesomeSubSysA, diff --git a/node/overseer/orchestra/examples/misc.rs b/node/overseer/orchestra/examples/misc.rs index 3e917ac7b728..39a755c5d0fc 100644 --- a/node/overseer/orchestra/examples/misc.rs +++ b/node/overseer/orchestra/examples/misc.rs @@ -50,8 +50,8 @@ impl std::fmt::Display for Yikes { impl std::error::Error for Yikes {} -impl From for Yikes { - fn from(_: orchestra::OverseerError) -> Yikes { +impl From for Yikes { + fn from(_: orchestra::OrchestraError) -> Yikes { Yikes } } diff --git a/node/overseer/orchestra/proc-macro/src/impl_builder.rs b/node/overseer/orchestra/proc-macro/src/impl_builder.rs index 1dcb38f0ba7d..fa6963dbe78b 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_builder.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_builder.rs @@ -26,11 +26,11 @@ fn recollect_without_idx(x: &[T], idx: usize) -> Vec { v } -/// Implement a builder pattern for the `Overseer`-type, +/// Implement a builder pattern for the `Orchestra`-type, /// which acts as the gateway to constructing the overseer. /// /// Elements tagged with `wip` are not covered here. -pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { +pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { let overseer_name = info.overseer_name.clone(); let builder = format_ident!("{}Builder", overseer_name); let handle = format_ident!("{}Handle", overseer_name); @@ -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, )* }; @@ -352,10 +352,10 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { pub struct Missing(::core::marker::PhantomData); /// Trait used to mark fields status in a builder - trait OverseerFieldState {} + trait OrchestraFieldState {} - impl OverseerFieldState for Init {} - impl OverseerFieldState for Missing {} + impl OrchestraFieldState for Init {} + impl OrchestraFieldState for Missing {} impl ::std::default::Default for Missing { fn default() -> Self { @@ -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() 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 >(); @@ -560,7 +560,7 @@ 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 + ToOrchestra >(); #( @@ -622,7 +622,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { #subsystem_name_str_literal ); - let #subsystem_name: OverseenSubsystem< #consumes > = + let #subsystem_name: OrchestratedSubsystem< #consumes > = spawn::<_,_, #blocking, _, _, _>( &mut spawner, #channel_name_tx, @@ -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(); @@ -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 >>, - ) -> ::std::result::Result, #error_ty > + ) -> ::std::result::Result, #error_ty > where S: #support_crate ::Spawner, M: std::fmt::Debug + Send + 'static, TK: TaskKind, Ctx: #support_crate ::SubsystemContext, - E: std::error::Error + Send + Sync + 'static + From<#support_crate ::OverseerError>, + E: std::error::Error + Send + Sync + 'static + From<#support_crate ::OrchestraError>, SubSys: #support_crate ::Subsystem, { let #support_crate ::SpawnedSubsystem:: { 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"); + 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, }) } diff --git a/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs b/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs index a337a69d46a9..799174dedd45 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs @@ -20,7 +20,7 @@ use syn::Result; use super::*; /// Implement the helper type `ChannelsOut` and `MessagePacket`. -pub(crate) fn impl_channels_out_struct(info: &OverseerInfo) -> Result { +pub(crate) fn impl_channels_out_struct(info: &OrchestraInfo) -> Result { let message_wrapper = info.message_wrapper.clone(); let channel_name = &info.channel_names_without_wip(""); @@ -84,13 +84,13 @@ pub(crate) fn impl_channels_out_struct(info: &OverseerInfo) -> Result { - #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 { - #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 diff --git a/node/overseer/orchestra/proc-macro/src/impl_message_wrapper.rs b/node/overseer/orchestra/proc-macro/src/impl_message_wrapper.rs index 7d29ddd458ab..19d57a69cf10 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_message_wrapper.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_message_wrapper.rs @@ -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 { +pub(crate) fn impl_message_wrapper_enum(info: &OrchestraInfo) -> Result { let consumes = info.any_message(); let consumes_variant = info.variant_names(); diff --git a/node/overseer/orchestra/proc-macro/src/impl_orchestra.rs b/node/overseer/orchestra/proc-macro/src/impl_orchestra.rs index ba679bcf3889..b621a357c084 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_orchestra.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_orchestra.rs @@ -18,7 +18,7 @@ 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 subsystem_name = &info.subsystem_names_without_wip(); @@ -71,7 +71,7 @@ pub(crate) fn impl_overseer_struct(info: &OverseerInfo) -> proc_macro2::TokenStr #( /// A subsystem instance. - #subsystem_name: OverseenSubsystem< #consumes >, + #subsystem_name: OrchestratedSubsystem< #consumes >, )* #( @@ -89,7 +89,7 @@ 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 > + #support_crate ::metered::UnboundedMeteredReceiver< #support_crate ::ToOrchestra > >, /// Events that are sent to the overseer from the outside world. @@ -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 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 { + pub struct OrchestratedSubsystem { /// The instance. pub instance: std::option::Option< #support_crate ::SubsystemInstance >, } - impl OverseenSubsystem { + impl OrchestratedSubsystem { /// 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) => { diff --git a/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs b/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs index 9bb051a38703..e34dbdd41b80 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs @@ -52,7 +52,7 @@ fn graphviz( } /// Generates all subsystem types and related accumulation traits. -pub(crate) fn impl_subsystem_types_all(info: &OverseerInfo) -> Result { +pub(crate) fn impl_subsystem_types_all(info: &OrchestraInfo) -> Result { let mut ts = TokenStream::new(); let overseer_name = &info.overseer_name; @@ -125,7 +125,7 @@ pub(crate) fn impl_subsystem_types_all(info: &OverseerInfo) -> Result { - #support_crate :: gum :: warn!("Nothing consumes {:?}", unused_msg); + #support_crate :: tracing :: warn!("Nothing consumes {:?}", unused_msg); #all_messages_wrapper :: Empty } } @@ -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>, ()> { + async fn try_recv(&mut self) -> ::std::result::Result>, ()> { 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, #error_ty> { + async fn recv(&mut self) -> ::std::result::Result, #error_ty> { loop { // If we have a message pending an overseer 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)) } } @@ -474,16 +474,16 @@ pub(crate) fn impl_subsystem_context_trait_for( let from_overseer = #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,12 +494,12 @@ 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_overseer { self.signals_received.inc(); } @@ -514,22 +514,22 @@ pub(crate) fn impl_subsystem_context_trait_for( fn spawn(&mut self, name: &'static str, s: Pin + Send>>) -> ::std::result::Result<(), #error_ty> { - self.to_overseer.unbounded_send(#support_crate ::ToOverseer::SpawnJob { + self.to_overseer.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 + Send>>) -> ::std::result::Result<(), #error_ty> { - self.to_overseer.unbounded_send(#support_crate ::ToOverseer::SpawnBlockingJob { + self.to_overseer.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)] @@ -667,7 +667,7 @@ pub(crate) fn impl_subsystem_context( messages: SubsystemIncomingMessages< M >, to_subsystems: #subsystem_sender_name < ::OutgoingMessages >, to_overseer: #support_crate ::metered::UnboundedMeteredSender< - #support_crate ::ToOverseer + #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_overseer: #support_crate ::metered::UnboundedMeteredSender<#support_crate:: ToOrchestra>, name: &'static str ) -> Self { let signals_received = SignalsReceived::default(); diff --git a/node/overseer/orchestra/proc-macro/src/lib.rs b/node/overseer/orchestra/proc-macro/src/lib.rs index 5f7fe61b9b71..cd0dcf3a4225 100644 --- a/node/overseer/orchestra/proc-macro/src/lib.rs +++ b/node/overseer/orchestra/proc-macro/src/lib.rs @@ -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 { diff --git a/node/overseer/orchestra/proc-macro/src/overseer.rs b/node/overseer/orchestra/proc-macro/src/orchestra.rs similarity index 90% rename from node/overseer/orchestra/proc-macro/src/overseer.rs rename to node/overseer/orchestra/proc-macro/src/orchestra.rs index ecd382cfef9c..f258c58508b9 100644 --- a/node/overseer/orchestra/proc-macro/src/overseer.rs +++ b/node/overseer/orchestra/proc-macro/src/orchestra.rs @@ -23,13 +23,13 @@ pub(crate) fn impl_orchestra_gen( attr: TokenStream, orig: TokenStream, ) -> Result { - 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, @@ -43,10 +43,10 @@ pub(crate) fn impl_orchestra_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)?); diff --git a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs index e5cb30dd7513..25406901328a 100644 --- a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs @@ -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 { let lookahead = input.lookahead1(); if lookahead.peek(kw::event) { - Ok(OverseerAttrItem::ExternEventType { + Ok(OrchestraAttrItem::ExternEventType { tag: input.parse::()?, eq_token: input.parse()?, value: input.parse()?, }) } else if lookahead.peek(kw::signal) { - Ok(OverseerAttrItem::ExternOverseerSignalType { + Ok(OrchestraAttrItem::ExternOrchestraSignalType { tag: input.parse::()?, eq_token: input.parse()?, value: input.parse()?, }) } else if lookahead.peek(kw::error) { - Ok(OverseerAttrItem::ExternErrorType { + Ok(OrchestraAttrItem::ExternErrorType { tag: input.parse::()?, eq_token: input.parse()?, value: input.parse()?, }) } else if lookahead.peek(kw::outgoing) { - Ok(OverseerAttrItem::OutgoingType { + Ok(OrchestraAttrItem::OutgoingType { tag: input.parse::()?, eq_token: input.parse()?, value: input.parse()?, }) } else if lookahead.peek(kw::gen) { - Ok(OverseerAttrItem::MessageWrapperName { + Ok(OrchestraAttrItem::MessageWrapperName { tag: input.parse::()?, eq_token: input.parse()?, value: input.parse()?, }) } else if lookahead.peek(kw::signal_capacity) { - Ok(OverseerAttrItem::SignalChannelCapacity { + Ok(OrchestraAttrItem::SignalChannelCapacity { tag: input.parse::()?, eq_token: input.parse()?, value: input.parse::()?.base10_parse::()?, }) } else if lookahead.peek(kw::message_capacity) { - Ok(OverseerAttrItem::MessageChannelCapacity { + Ok(OrchestraAttrItem::MessageChannelCapacity { tag: input.parse::()?, eq_token: input.parse()?, value: input.parse::()?.base10_parse::()?, @@ -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,14 +146,14 @@ macro_rules! extract_variant { }; } -impl Parse for OverseerAttrArgs { +impl Parse for OrchestraAttrArgs { fn parse(input: &ParseBuffer) -> Result { - let items: Punctuated = - input.parse_terminated(OverseerAttrItem::parse)?; + let items: Punctuated = + input.parse_terminated(OrchestraAttrItem::parse)?; let mut unique = HashMap::< - std::mem::Discriminant, - OverseerAttrItem, + std::mem::Discriminant, + OrchestraAttrItem, RandomState, >::default(); for item in items { @@ -174,11 +174,11 @@ impl Parse for OverseerAttrArgs { 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 signal = extract_variant!(unique, ExternOrchestraSignalType; 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 outgoing = extract_variant!(unique, OutgoingType); - Ok(OverseerAttrArgs { + Ok(OrchestraAttrArgs { signal_channel_capacity, message_channel_capacity, extern_event_ty: event, diff --git a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs index 78cbdc2ad6c7..15a3fdf09a4b 100644 --- a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs @@ -261,7 +261,7 @@ pub(crate) struct BaggageField { } #[derive(Clone, Debug)] -pub(crate) struct OverseerInfo { +pub(crate) struct OrchestraInfo { /// Where the support crate `::orchestra` lives. pub(crate) support_crate: Path, @@ -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 } @@ -391,13 +391,13 @@ impl OverseerInfo { /// Internals of the overseer. #[derive(Debug, Clone)] -pub(crate) struct OverseerGuts { +pub(crate) struct OrchestraGuts { pub(crate) name: Ident, pub(crate) subsystems: Vec, pub(crate) baggage: Vec, } -impl OverseerGuts { +impl OrchestraGuts { pub(crate) fn parse_fields( name: Ident, baggage_generics: HashSet, @@ -497,7 +497,7 @@ impl OverseerGuts { } } -impl Parse for OverseerGuts { +impl Parse for OrchestraGuts { fn parse(input: ParseStream) -> Result { let ds: ItemStruct = input.parse()?; match ds.fields { diff --git a/node/overseer/orchestra/proc-macro/src/parse/tests.rs b/node/overseer/orchestra/proc-macro/src/parse/tests.rs index 990b5d6872c0..cff53727564f 100644 --- a/node/overseer/orchestra/proc-macro/src/parse/tests.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/tests.rs @@ -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 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 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, diff --git a/node/overseer/orchestra/proc-macro/src/subsystem.rs b/node/overseer/orchestra/proc-macro/src/subsystem.rs index 5f1c9256055c..c1e79b6f3d42 100644 --- a/node/overseer/orchestra/proc-macro/src/subsystem.rs +++ b/node/overseer/orchestra/proc-macro/src/subsystem.rs @@ -28,8 +28,8 @@ //! # #[derive(Debug, thiserror::Error)] //! # #[error("Yikes!")] //! # pub struct Yikes; -//! # impl From for Yikes { -//! # fn from(_: OverseerError) -> Yikes { Yikes } +//! # impl From for Yikes { +//! # fn from(_: OrchestraError) -> Yikes { Yikes } //! # } //! # impl From for Yikes { //! # fn from(_: mpsc::SendError) -> Yikes { Yikes } @@ -79,8 +79,8 @@ //! # #[derive(Debug, thiserror::Error)] //! # #[error("Yikes!")] //! # pub struct Yikes; -//! # impl From for Yikes { -//! # fn from(_: OverseerError) -> Yikes { Yikes } +//! # impl From for Yikes { +//! # fn from(_: OrchestraError) -> Yikes { Yikes } //! # } //! # impl From for Yikes { //! # fn from(_: mpsc::SendError) -> Yikes { Yikes } diff --git a/node/overseer/orchestra/proc-macro/src/tests.rs b/node/overseer/orchestra/proc-macro/src/tests.rs index 399fcc0c07ea..51bae46ca4de 100644 --- a/node/overseer/orchestra/proc-macro/src/tests.rs +++ b/node/overseer/orchestra/proc-macro/src/tests.rs @@ -27,7 +27,7 @@ fn print() { signal=SigSigSig, signal_capacity=111, message_capacity=222, - error=OverseerError, + error=OrchestraError, }; let item = quote! { @@ -55,7 +55,7 @@ fn print() { #[test] fn struct_parse_full() { - let item: OverseerGuts = parse_quote! { + let item: OrchestraGuts = parse_quote! { pub struct Ooooh 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: _, .. diff --git a/node/overseer/orchestra/src/lib.rs b/node/overseer/orchestra/src/lib.rs index 9c45d815458c..21f69c8da1d0 100644 --- a/node/overseer/orchestra/src/lib.rs +++ b/node/overseer/orchestra/src/lib.rs @@ -14,29 +14,31 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! # 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 | . //! . +--------------------+ +---------------------+ . @@ -63,13 +65,10 @@ pub use orchestra_proc_macro::{contextbounds, orchestra, subsystem}; #[doc(hidden)] -pub use gum; +pub use tracing; #[doc(hidden)] pub use metered; -#[doc(hidden)] -pub use polkadot_node_primitives::Spawner; - #[doc(hidden)] pub use async_trait::async_trait; #[doc(hidden)] @@ -95,8 +94,6 @@ pub use std::time::Duration; #[doc(hidden)] pub use futures_timer::Delay; -pub use polkadot_node_network_protocol::WrongVariant; - use std::fmt; #[cfg(test)] @@ -129,7 +126,7 @@ pub trait Spawner: Clone + Send + Sync { /// A type of messages that are sent from a [`Subsystem`] to the declared overseer. /// /// 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 /// of the spawn. @@ -154,7 +151,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, .. } => { @@ -251,7 +248,7 @@ pub trait AnnotateErrorOrigin: 'static + Send + Sync + std::error::Error { /// In essence it's just a new type wrapping a `BoxFuture`. pub struct SpawnedSubsystem where - E: std::error::Error + Send + Sync + 'static + From, + E: std::error::Error + Send + Sync + 'static + From, { /// Name of the subsystem being spawned. pub name: &'static str, @@ -268,7 +265,7 @@ where /// * etc. #[derive(thiserror::Error, Debug)] #[allow(missing_docs)] -pub enum OverseerError { +pub enum OrchestraError { #[error(transparent)] NotifyCancellation(#[from] oneshot::Canceled), @@ -298,8 +295,8 @@ pub enum OverseerError { }, } -/// Alias for a result with error type `OverseerError`. -pub type OverseerResult = std::result::Result; +/// Alias for a result with error type `OrchestraError`. +pub type OrchestraResult = std::result::Result; /// Collection of meters related to a subsystem. #[derive(Clone)] @@ -359,8 +356,8 @@ pub struct SubsystemInstance { /// /// It is generic over over the message type `M` that a particular `Subsystem` may use. #[derive(Debug)] -pub enum FromOverseer { - /// Signal from the `Overseer`. +pub enum FromOrchestra { + /// Signal from the `Orchestra`. Signal(Signal), /// Some other `Subsystem`'s message. @@ -370,7 +367,7 @@ pub enum FromOverseer { }, } -impl From for FromOverseer { +impl From for FromOrchestra { fn from(signal: Signal) -> Self { Self::Signal(signal) } @@ -380,7 +377,7 @@ impl From for FromOverseer { /// 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 { @@ -399,16 +396,16 @@ pub trait SubsystemContext: Send + 'static { /// The sender type as provided by `sender()` and underlying. type Sender: Clone + Send + 'static + SubsystemSender; /// The error type. - type Error: ::std::error::Error + ::std::convert::From + Sync + Send + 'static; + type Error: ::std::error::Error + ::std::convert::From + 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>, ()>; + async fn try_recv(&mut self) -> Result>, ()>; /// Receive a message. - async fn recv(&mut self) -> Result, Self::Error>; + async fn recv(&mut self) -> Result, Self::Error>; /// Spawn a child task on the executor. fn spawn( @@ -462,18 +459,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 where Ctx: SubsystemContext, - E: std::error::Error + Send + Sync + 'static + From, + E: std::error::Error + Send + Sync + 'static + From, { /// Start this `Subsystem` and return `SpawnedSubsystem`. fn start(self, ctx: Ctx) -> SpawnedSubsystem; diff --git a/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs index 625c171233a0..d43ca412ca68 100644 --- a/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs +++ b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs @@ -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); -#[orchestra(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 overseer = Orchestra::<_,_>::builder() .sub0(AwesomeSubSys::default()) .spawner(DummySpawner) .build(|| -> DummyCtx { DummyCtx } ); diff --git a/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.stderr b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.stderr index d5e761288362..cd117ebd7285 100644 --- a/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.stderr +++ b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.stderr @@ -1,18 +1,18 @@ -error[E0119]: conflicting implementations of trait `polkadot_overseer_gen::SubsystemSender` for type `OverseerSubsystemSender` +error[E0119]: conflicting implementations of trait `orchestra::SubsystemSender` for type `OrchestraSubsystemSender` --> tests/ui/err-01-duplicate-consumer.rs:19:1 | -19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | first implementation here - | conflicting implementation for `OverseerSubsystemSender` + | 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` for type `AllMessages` --> tests/ui/err-01-duplicate-consumer.rs:19:1 | -19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OverseerError)] +19 | #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | first implementation here diff --git a/node/overseer/orchestra/tests/ui/err-02-enum.rs b/node/overseer/orchestra/tests/ui/err-02-enum.rs index 202c37922f12..3ba4bb190305 100644 --- a/node/overseer/orchestra/tests/ui/err-02-enum.rs +++ b/node/overseer/orchestra/tests/ui/err-02-enum.rs @@ -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); -#[orchestra(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 overseer = Orchestra::<_,_>::builder() .sub0(AwesomeSubSys::default()) .i_like_pie(std::f64::consts::PI) .spawner(DummySpawner) diff --git a/node/overseer/orchestra/tests/ui/err-02-enum.stderr b/node/overseer/orchestra/tests/ui/err-02-enum.stderr index 7ed414a6ecb3..19fc5e34cc40 100644 --- a/node/overseer/orchestra/tests/ui/err-02-enum.stderr +++ b/node/overseer/orchestra/tests/ui/err-02-enum.stderr @@ -1,11 +1,11 @@ error: expected `struct` --> $DIR/err-02-enum.rs:16:1 | -16 | enum Overseer { +16 | enum Orchestra { | ^^^^ -error[E0433]: failed to resolve: use of undeclared type `Overseer` +error[E0433]: failed to resolve: use of undeclared type `Orchestra` --> $DIR/err-02-enum.rs:27:17 | -27 | let overseer = Overseer::<_,_>::builder() - | ^^^^^^^^ use of undeclared type `Overseer` +27 | let overseer = Orchestra::<_,_>::builder() + | ^^^^^^^^ use of undeclared type `Orchestra` diff --git a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs index f397cb6e7041..cca300d113cf 100644 --- a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs +++ b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs @@ -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); -#[orchestra(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 overseer = Orchestra::<_,_>::builder() .sub0(AwesomeSubSys::default()) .i_like_pie(std::f64::consts::PI) .spawner(DummySpawner) diff --git a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr index cba46366daed..25e9505442a9 100644 --- a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr +++ b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr @@ -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 overseer = Orchestra::<_,_>::builder() + | ^^^^^^^^ use of undeclared type `Orchestra` diff --git a/node/overseer/orchestra/tests/ui/err-04-missing-error.rs b/node/overseer/orchestra/tests/ui/err-04-missing-error.rs index fc91a958cfe0..74672a4549a4 100644 --- a/node/overseer/orchestra/tests/ui/err-04-missing-error.rs +++ b/node/overseer/orchestra/tests/ui/err-04-missing-error.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use polkadot_overseer_gen::*; +use orchestra::*; #[derive(Default)] struct AwesomeSubSys; @@ -14,7 +14,7 @@ struct Event; struct MsgStrukt(u8); #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages)] -struct Overseer { +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) diff --git a/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr b/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr index e0f0bf28f485..58bc388bb033 100644 --- a/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr +++ b/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr @@ -6,8 +6,8 @@ error: Must declare the overseer error type via `error=..`. | = 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 `Overseer` +error[E0433]: failed to resolve: use of undeclared type `Orchestra` --> $DIR/err-04-missing-error.rs:30:10 | -30 | let _ = Overseer::builder() - | ^^^^^^^^ use of undeclared type `Overseer` +30 | let _ = Orchestra::builder() + | ^^^^^^^^ use of undeclared type `Orchestra` diff --git a/node/overseer/orchestra/tests/ui/err-05-missing-field.rs b/node/overseer/orchestra/tests/ui/err-05-missing-field.rs index fbb3d0688c87..6fa194a5e327 100644 --- a/node/overseer/orchestra/tests/ui/err-05-missing-field.rs +++ b/node/overseer/orchestra/tests/ui/err-05-missing-field.rs @@ -1,12 +1,12 @@ #![allow(dead_code)] -use polkadot_overseer_gen::*; +use orchestra::*; #[derive(Default)] struct AwesomeSubSys; -impl ::polkadot_overseer_gen::Subsystem, OverseerError> for AwesomeSubSys { - fn start(self, _ctx: OverseerSubsystemContext) -> SpawnedSubsystem { +impl ::orchestra::Subsystem, OrchestraError> for AwesomeSubSys { + fn start(self, _ctx: OrchestraSubsystemContext) -> SpawnedSubsystem { unimplemented!("starting yay!") } } @@ -19,8 +19,8 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[orchestra(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, @@ -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) diff --git a/node/overseer/orchestra/tests/ui/err-05-missing-field.stderr b/node/overseer/orchestra/tests/ui/err-05-missing-field.stderr index 099a8f352939..76f4f1107f46 100644 --- a/node/overseer/orchestra/tests/ui/err-05-missing-field.stderr +++ b/node/overseer/orchestra/tests/ui/err-05-missing-field.stderr @@ -1,14 +1,14 @@ -error[E0599]: no method named `build` found for struct `OverseerBuilder, Init, Missing>` in the current scope +error[E0599]: no method named `build` found for struct `OrchestraBuilder, Init, Missing>` in the current scope --> tests/ui/err-05-missing-field.rs:59:4 | -22 | #[orchestra(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, Missing>` + | ^^^^^ method not found in `OrchestraBuilder, Init, Missing>` | = note: the method was found for - - `OverseerBuilder, Init, Init>` + - `OrchestraBuilder, Init, Init>` = 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` diff --git a/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs index e0785293ffa7..6f017df91273 100644 --- a/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs +++ b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs @@ -1,12 +1,12 @@ #![allow(dead_code)] -use polkadot_overseer_gen::*; +use orchestra::*; #[derive(Default)] struct AwesomeSubSys; -impl ::polkadot_overseer_gen::Subsystem, OverseerError> for AwesomeSubSys { - fn start(self, _ctx: OverseerSubsystemContext) -> SpawnedSubsystem { +impl ::orchestra::Subsystem, OrchestraError> for AwesomeSubSys { + fn start(self, _ctx: OrchestraSubsystemContext) -> SpawnedSubsystem { unimplemented!("starting yay!") } } @@ -19,8 +19,8 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[orchestra(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, @@ -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) diff --git a/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.stderr b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.stderr index b70761b1a539..3052464e0c38 100644 --- a/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.stderr +++ b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.stderr @@ -1,14 +1,14 @@ -error[E0599]: no method named `build` found for struct `OverseerBuilder, Missing<_>, Init>` in the current scope +error[E0599]: no method named `build` found for struct `OrchestraBuilder, Missing<_>, Init>` in the current scope --> tests/ui/err-06-missing-subsystem.rs:59:4 | -22 | #[orchestra(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>` + | ^^^^^ method not found in `OrchestraBuilder, Missing<_>, Init>` | = note: the method was found for - - `OverseerBuilder, Init, Init>` + - `OrchestraBuilder, Init, Init>` = 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` diff --git a/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs index 07f121ba1cc8..ae4c94851e60 100644 --- a/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs +++ b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs @@ -1,12 +1,12 @@ #![allow(dead_code)] -use polkadot_overseer_gen::*; +use orchestra::*; #[derive(Default)] struct AwesomeSubSys; -impl ::polkadot_overseer_gen::Subsystem, OverseerError> for AwesomeSubSys { - fn start(self, _ctx: OverseerSubsystemContext) -> SpawnedSubsystem { +impl ::orchestra::Subsystem, OrchestraError> for AwesomeSubSys { + fn start(self, _ctx: OrchestraSubsystemContext) -> SpawnedSubsystem { unimplemented!("starting yay!") } } @@ -19,8 +19,8 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[orchestra(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, @@ -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 diff --git a/node/overseer/orchestra/tests/ui/err-07-missing-spawner.stderr b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.stderr index 3ef8a977dbd8..932e6fa776bd 100644 --- a/node/overseer/orchestra/tests/ui/err-07-missing-spawner.stderr +++ b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.stderr @@ -1,14 +1,14 @@ -error[E0599]: no method named `build` found for struct `OverseerBuilder, Init, Init>` in the current scope +error[E0599]: no method named `build` found for struct `OrchestraBuilder, Init, Init>` in the current scope --> tests/ui/err-07-missing-spawner.rs:59:4 | -22 | #[orchestra(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, Init>` + | ^^^^^ method not found in `OrchestraBuilder, Init, Init>` | = note: the method was found for - - `OverseerBuilder, Init, Init>` + - `OrchestraBuilder, Init, Init>` = 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` diff --git a/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs index e689e9844972..1051cf10151b 100644 --- a/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs +++ b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs @@ -1,12 +1,12 @@ #![allow(dead_code)] -use polkadot_overseer_gen::*; +use orchestra::*; #[derive(Default)] struct AwesomeSubSys; -impl ::polkadot_overseer_gen::Subsystem, OverseerError> for AwesomeSubSys { - fn start(self, _ctx: OverseerSubsystemContext) -> SpawnedSubsystem { +impl ::orchestra::Subsystem, OrchestraError> for AwesomeSubSys { + fn start(self, _ctx: OrchestraSubsystemContext) -> SpawnedSubsystem { unimplemented!("starting yay!") } } @@ -19,8 +19,8 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[orchestra(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, @@ -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) diff --git a/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.stderr b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.stderr index e7d638014df6..9053c1e814a1 100644 --- a/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.stderr +++ b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.stderr @@ -1,7 +1,7 @@ -error[E0599]: no method named `sub0` found for struct `OverseerBuilder, Init, Missing>` in the current scope +error[E0599]: no method named `sub0` found for struct `OrchestraBuilder, Init, Missing>` in the current scope --> tests/ui/err-08-duplicate-subsystem.rs:57:4 | -22 | #[orchestra(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 diff --git a/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs index b15464c38716..0ca1bf94efbd 100644 --- a/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs +++ b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs @@ -1,12 +1,12 @@ #![allow(dead_code)] -use polkadot_overseer_gen::*; +use orchestra::*; #[derive(Default)] struct AwesomeSubSys; -impl ::polkadot_overseer_gen::Subsystem, OverseerError> for AwesomeSubSys { - fn start(self, _ctx: OverseerSubsystemContext) -> SpawnedSubsystem { +impl ::orchestra::Subsystem, OrchestraError> for AwesomeSubSys { + fn start(self, _ctx: OrchestraSubsystemContext) -> SpawnedSubsystem { unimplemented!("starting yay!") } } @@ -19,8 +19,8 @@ pub struct Event; #[derive(Clone, Debug)] pub struct MsgStrukt(u8); -#[orchestra(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: T, @@ -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) diff --git a/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.stderr b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.stderr index cbb10c15c520..f4b7137ad688 100644 --- a/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.stderr +++ b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.stderr @@ -1,14 +1,14 @@ -error[E0599]: no method named `build` found for struct `OverseerBuilder, Init, Missing<_>>` in the current scope +error[E0599]: no method named `build` found for struct `OrchestraBuilder, Init, Missing<_>>` in the current scope --> tests/ui/err-09-uninit_generic_baggage.rs:59:4 | -22 | #[orchestra(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, Missing<_>>` + | ^^^^^ method not found in `OrchestraBuilder, Init, Missing<_>>` | = note: the method was found for - - `OverseerBuilder, Init, Init>` + - `OrchestraBuilder, Init, Init>` = 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` diff --git a/node/overseer/orchestra/tests/ui/ok-01-wip.rs b/node/overseer/orchestra/tests/ui/ok-01-wip.rs index 89e36ff89a3a..2cedd41d9bea 100644 --- a/node/overseer/orchestra/tests/ui/ok-01-wip.rs +++ b/node/overseer/orchestra/tests/ui/ok-01-wip.rs @@ -1,18 +1,18 @@ #![allow(dead_code)] -use polkadot_overseer_gen::*; +use orchestra::*; #[derive(Default)] struct AwesomeSubSysA; -impl ::polkadot_overseer_gen::Subsystem, OverseerError> for AwesomeSubSysA { - fn start(self, _ctx: OverseerSubsystemContext) -> SpawnedSubsystem { +impl ::orchestra::Subsystem, OrchestraError> for AwesomeSubSysA { + fn start(self, _ctx: OrchestraSubsystemContext) -> SpawnedSubsystem { SpawnedSubsystem { name: "sub A", future: Box::pin(async move { Ok(()) }) } } } -impl ::polkadot_overseer_gen::Subsystem, OverseerError> for AwesomeSubSysB { - fn start(self, _ctx: OverseerSubsystemContext) -> SpawnedSubsystem { +impl ::orchestra::Subsystem, OrchestraError> for AwesomeSubSysB { + fn start(self, _ctx: OrchestraSubsystemContext) -> SpawnedSubsystem { SpawnedSubsystem { name: "sub B", future: Box::pin(async move { Ok(()) }) } } } @@ -54,8 +54,8 @@ pub struct MsgA(u8); #[derive(Clone, Debug)] pub struct MsgB(u8); -#[orchestra(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 _overseer_builder = Orchestra::builder() .sub_a(AwesomeSubSysA::default()) // b is tagged as `wip` // .sub_b(AwesomeSubSysB::default()) From a8a81a5decee9e135763d1f2e89048ce90eddb44 Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Wed, 18 May 2022 22:49:14 +0200 Subject: [PATCH 03/15] introduce Spawner trait to split from sp_core Finalizes the independence of orchestra from polkadot-overseer --- Cargo.lock | 1 + doc/testing.md | 2 +- node/collation-generation/src/lib.rs | 14 +- node/core/approval-voting/src/lib.rs | 12 +- node/core/approval-voting/src/tests.rs | 18 +- node/core/av-store/src/lib.rs | 10 +- node/core/av-store/src/tests.rs | 30 +-- node/core/backing/src/lib.rs | 10 +- node/core/backing/src/tests.rs | 68 +++---- node/core/candidate-validation/src/lib.rs | 10 +- node/core/chain-api/src/lib.rs | 10 +- node/core/chain-api/src/tests.rs | 32 ++-- node/core/chain-selection/src/lib.rs | 10 +- node/core/chain-selection/src/tests.rs | 12 +- .../dispute-coordinator/src/initialized.rs | 12 +- node/core/dispute-coordinator/src/lib.rs | 10 +- .../src/participation/tests.rs | 8 +- .../dispute-coordinator/src/scraping/tests.rs | 4 +- node/core/dispute-coordinator/src/tests.rs | 180 +++++++++--------- node/core/pvf-checker/src/lib.rs | 12 +- node/core/pvf-checker/src/tests.rs | 6 +- node/core/runtime-api/Cargo.toml | 1 - node/core/runtime-api/src/lib.rs | 17 +- node/core/runtime-api/src/tests.rs | 159 +++++++++------- node/malus/src/interceptor.rs | 14 +- node/malus/src/shared.rs | 2 +- node/malus/src/tests.rs | 10 +- .../src/variants/back_garbage_candidate.rs | 8 +- node/malus/src/variants/common.rs | 27 +-- .../src/variants/dispute_valid_candidates.rs | 8 +- .../src/variants/suggest_garbage_candidate.rs | 28 +-- node/network/approval-distribution/src/lib.rs | 10 +- .../approval-distribution/src/tests.rs | 6 +- .../availability-distribution/src/lib.rs | 10 +- .../src/requester/tests.rs | 4 +- .../src/tests/state.rs | 10 +- node/network/availability-recovery/src/lib.rs | 6 +- .../availability-recovery/src/tests.rs | 4 +- node/network/bitfield-distribution/src/lib.rs | 12 +- node/network/bridge/src/lib.rs | 12 +- node/network/bridge/src/tests.rs | 34 ++-- .../src/collator_side/mod.rs | 10 +- .../src/collator_side/tests.rs | 4 +- .../src/validator_side/mod.rs | 8 +- .../src/validator_side/tests.rs | 4 +- node/network/dispute-distribution/src/lib.rs | 12 +- .../dispute-distribution/src/tests/mod.rs | 12 +- node/network/gossip-support/src/lib.rs | 10 +- node/network/gossip-support/src/tests.rs | 4 +- .../network/statement-distribution/src/lib.rs | 14 +- .../statement-distribution/src/tests.rs | 98 +++++----- node/overseer/Cargo.toml | 1 + node/overseer/examples/minimal-example.rs | 4 +- node/overseer/orchestra/Cargo.toml | 1 + .../orchestra/proc-macro/src/impl_builder.rs | 4 +- node/overseer/orchestra/src/lib.rs | 7 +- .../tests/ui/err-05-missing-field.rs | 2 +- .../tests/ui/err-06-missing-subsystem.rs | 2 +- .../tests/ui/err-07-missing-spawner.rs | 2 +- .../tests/ui/err-08-duplicate-subsystem.rs | 2 +- .../tests/ui/err-09-uninit_generic_baggage.rs | 2 +- node/overseer/orchestra/tests/ui/ok-01-wip.rs | 2 +- node/overseer/src/dummy.rs | 17 +- node/overseer/src/lib.rs | 61 ++++-- node/overseer/src/tests.rs | 28 +-- node/primitives/src/lib.rs | 8 +- node/service/src/lib.rs | 2 +- node/service/src/overseer.rs | 18 +- node/subsystem-test-helpers/src/lib.rs | 28 +-- node/subsystem-types/Cargo.toml | 2 +- node/subsystem-types/src/errors.rs | 3 +- node/subsystem-util/src/lib.rs | 26 +-- node/subsystem-util/src/tests.rs | 19 +- node/subsystem/src/lib.rs | 2 +- .../undying/collator/src/lib.rs | 5 +- .../src/types/overseer-protocol.md | 2 +- 76 files changed, 676 insertions(+), 603 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 926af5d02566..9439e28cc860 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4832,6 +4832,7 @@ name = "orchestra" version = "0.9.22" dependencies = [ "async-trait", + "dyn-clonable", "futures 0.3.21", "futures-timer", "metered-channel", diff --git a/doc/testing.md b/doc/testing.md index 363085ab4694..fa7e3915861d 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -190,7 +190,7 @@ impl OverseerGen for BehaveMaleficient { where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, - Spawner: 'static + SpawnNamed + Clone + Unpin, + Spawner: 'static + overseer::gen::Spawner + Clone + Unpin, { let spawner = args.spawner.clone(); let leaves = args.leaves.clone(); diff --git a/node/collation-generation/src/lib.rs b/node/collation-generation/src/lib.rs index b68a46335cb3..500b500636ba 100644 --- a/node/collation-generation/src/lib.rs +++ b/node/collation-generation/src/lib.rs @@ -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( &mut self, - incoming: SubsystemResult::Message>>, + incoming: SubsystemResult::Message>>, ctx: &mut Context, sender: &mpsc::Sender, ) -> 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, diff --git a/node/core/approval-voting/src/lib.rs b/node/core/approval-voting/src/lib.rs index c53c04c690a5..5f3a71cb9db9 100644 --- a/node/core/approval-voting/src/lib.rs +++ b/node/core/approval-voting/src/lib.rs @@ -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( state: &mut State, db: &mut OverlayedBackend<'_, impl Backend>, metrics: &Metrics, - x: FromOverseer, + x: FromOrchestra, last_finalized_height: &mut Option, wakeups: &mut Wakeups, ) -> SubsystemResult> { 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( 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( 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)?; diff --git a/node/core/approval-voting/src/tests.rs b/node/core/approval-voting/src/tests.rs index cc488646540b..25dcfcdb4e81 100644 --- a/node/core/approval-voting/src/tests.rs +++ b/node/core/approval-voting/src/tests.rs @@ -514,7 +514,7 @@ fn test_harness>( .unwrap(); } -async fn overseer_send(overseer: &mut VirtualOverseer, msg: FromOverseer) { +async fn overseer_send(overseer: &mut VirtualOverseer, msg: FromOrchestra) { 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), }, ) diff --git a/node/core/av-store/src/lib.rs b/node/core/av-store/src/lib.rs index 086ce0255cf9..cd1685e32ea8 100644 --- a/node/core/av-store/src/lib.rs +++ b/node/core/av-store/src/lib.rs @@ -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( 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( 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( number, ).await?; } - FromOverseer::Communication { msg } => { + FromOrchestra::Communication { msg } => { let _timer = subsystem.metrics.time_process_message(); process_message(subsystem, msg)?; } diff --git a/node/core/av-store/src/tests.rs b/node/core/av-store/src/tests.rs index 9ef9666d619a..0a855bb88057 100644 --- a/node/core/av-store/src/tests.rs +++ b/node/core/av-store/src/tests.rs @@ -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() } diff --git a/node/core/backing/src/lib.rs b/node/core/backing/src/lib.rs index c6c1a76cee61..a189b5955c89 100644 --- a/node/core/backing/src/lib.rs +++ b/node/core/backing/src/lib.rs @@ -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( } 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( &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?, } } ) diff --git a/node/core/backing/src/tests.rs b/node/core/backing/src/tests.rs index e7fbdf6a4e13..0243c68c7c4c 100644 --- a/node/core/backing/src/tests.rs +++ b/node/core/backing/src/tests.rs @@ -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>( 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; diff --git a/node/core/candidate-validation/src/lib.rs b/node/core/candidate-validation/src/lib.rs index 2fdcc976219b..1f51c1ec7701 100644 --- a/node/core/candidate-validation/src/lib.rs +++ b/node/core/candidate-validation/src/lib.rs @@ -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( 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, diff --git a/node/core/chain-api/src/lib.rs b/node/core/chain-api/src/lib.rs index 3543183654f0..7205527982c1 100644 --- a/node/core/chain-api/src/lib.rs +++ b/node/core/chain-api/src/lib.rs @@ -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()); diff --git a/node/core/chain-api/src/tests.rs b/node/core/chain-api/src/tests.rs index 54bd2c50df14..aa24b3621200 100644 --- a/node/core/chain-api/src/tests.rs +++ b/node/core/chain-api/src/tests.rs @@ -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() }) diff --git a/node/core/chain-selection/src/lib.rs b/node/core/chain-selection/src/lib.rs index 464edf69f13b..a8646d874d8f 100644 --- a/node/core/chain-selection/src/lib.rs +++ b/node/core/chain-selection/src/lib.rs @@ -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)? } diff --git a/node/core/chain-selection/src/tests.rs b/node/core/chain-selection/src/tests.rs index 217a5a74e029..0b8947a200cf 100644 --- a/node/core/chain-selection/src/tests.rs +++ b/node/core/chain-selection/src/tests.rs @@ -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 { 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. diff --git a/node/core/dispute-coordinator/src/initialized.rs b/node/core/dispute-coordinator/src/initialized.rs index 00817a136334..84ffd45fcf9d 100644 --- a/node/core/dispute-coordinator/src/initialized.rs +++ b/node/core/dispute-coordinator/src/initialized.rs @@ -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), + Subsystem(FromOrchestra), /// Messages from participation workers. Participation(participation::WorkerMessage), } diff --git a/node/core/dispute-coordinator/src/lib.rs b/node/core/dispute-coordinator/src/lib.rs index 1a7f1540b8b2..a4cff2f1385c 100644 --- a/node/core/dispute-coordinator/src/lib.rs +++ b/node/core/dispute-coordinator/src/lib.rs @@ -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( async fn wait_for_first_leaf(ctx: &mut Context) -> Result> { 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 diff --git a/node/core/dispute-coordinator/src/participation/tests.rs b/node/core/dispute-coordinator/src/participation/tests.rs index 37400f365fb1..3ccb652fecc1 100644 --- a/node/core/dispute-coordinator/src/participation/tests.rs +++ b/node/core/dispute-coordinator/src/participation/tests.rs @@ -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; pub fn make_our_subsystem_context( - spawn: S, + spawner: S, ) -> ( - TestSubsystemContext, + TestSubsystemContext>, TestSubsystemContextHandle, ) { - make_subsystem_context(spawn) + make_subsystem_context(spawner) } #[overseer::contextbounds(DisputeCoordinator, prefix = self::overseer)] diff --git a/node/core/dispute-coordinator/src/scraping/tests.rs b/node/core/dispute-coordinator/src/scraping/tests.rs index ba7767260376..b6b5a1f633bf 100644 --- a/node/core/dispute-coordinator/src/scraping/tests.rs +++ b/node/core/dispute-coordinator/src/scraping/tests.rs @@ -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, scraper: ChainScraper, - ctx: TestSubsystemContext, + ctx: TestSubsystemContext>, } impl TestState { diff --git a/node/core/dispute-coordinator/src/tests.rs b/node/core/dispute-coordinator/src/tests.rs index d74a1e0e46c0..e8c983ddb977 100644 --- a/node/core/dispute-coordinator/src/tests.rs +++ b/node/core/dispute-coordinator/src/tests.rs @@ -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 diff --git a/node/core/pvf-checker/src/lib.rs b/node/core/pvf-checker/src/lib.rs index e5ace4c8f7ef..f31f3f728aa6 100644 --- a/node/core/pvf-checker/src/lib.rs +++ b/node/core/pvf-checker/src/lib.rs @@ -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, + from_overseer: FromOrchestra, ) -> Option { 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. }, } diff --git a/node/core/pvf-checker/src/tests.rs b/node/core/pvf-checker/src/tests.rs index 36ca35b187e7..f47e642ae98d 100644 --- a/node/core/pvf-checker/src/tests.rs +++ b/node/core/pvf-checker/src/tests.rs @@ -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(), }))) diff --git a/node/core/runtime-api/Cargo.toml b/node/core/runtime-api/Cargo.toml index 3c20bb60924c..322dc8f1d269 100644 --- a/node/core/runtime-api/Cargo.toml +++ b/node/core/runtime-api/Cargo.toml @@ -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" } diff --git a/node/core/runtime-api/src/lib.rs b/node/core/runtime-api/src/lib.rs index 1e8908ebe544..691ca9e655d9 100644 --- a/node/core/runtime-api/src/lib.rs +++ b/node/core/runtime-api/src/lib.rs @@ -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: Arc, metrics: Metrics, - spawn_handle: Box, + spawn_handle: Box, /// All the active runtime API requests that are currently being executed. active_requests: FuturesUnordered>>, /// Requests results cache @@ -74,12 +73,12 @@ impl RuntimeApiSubsystem { pub fn new( client: Arc, 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); }, diff --git a/node/core/runtime-api/src/tests.rs b/node/core/runtime-api/src/tests.rs index 4e75df100504..539dc6c8aa98 100644 --- a/node/core/runtime-api/src/tests.rs +++ b/node/core/runtime-api/src/tests.rs @@ -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; @@ -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)); diff --git a/node/malus/src/interceptor.rs b/node/malus/src/interceptor.rs index 19889b42e32a..a41712e469f1 100644 --- a/node/malus/src/interceptor.rs +++ b/node/malus/src/interceptor.rs @@ -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, - ) -> Option> { + msg: FromOrchestra, + ) -> Option> { Some(msg) } @@ -174,7 +174,7 @@ where type OutgoingMessages = <::Message as overseer::AssociateOutgoing>::OutgoingMessages; type Signal = OverseerSignal; - async fn try_recv(&mut self) -> Result>, ()> { + async fn try_recv(&mut self) -> Result>, ()> { loop { match self.inner.try_recv().await? { None => return Ok(None), @@ -188,7 +188,7 @@ where } } - async fn recv(&mut self) -> SubsystemResult> { + async fn recv(&mut self) -> SubsystemResult> { 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 ::Sender, Message = ::Message, >, - // ::Sender: - // overseer::SubsystemSender< - // ::Sender>>::Message, - // >, ::Message: overseer::AssociateOutgoing, ::Sender: diff --git a/node/malus/src/shared.rs b/node/malus/src/shared.rs index 123497340ec5..11d81aded11e 100644 --- a/node/malus/src/shared.rs +++ b/node/malus/src/shared.rs @@ -15,7 +15,7 @@ // along with Polkadot. If not, see . use futures::prelude::*; -use polkadot_node_primitives::SpawnNamed; +use sp_core::traits::SpawnNamed; pub const MALUS: &str = "MALUS"; diff --git a/node/malus/src/tests.rs b/node/malus/src/tests.rs index 6ce65fd9fc3b..39cfe19634dd 100644 --- a/node/malus/src/tests.rs +++ b/node/malus/src/tests.rs @@ -37,10 +37,10 @@ where fn intercept_incoming( &self, _sender: &mut Sender, - msg: FromOverseer, - ) -> Option> { + msg: FromOrchestra, + ) -> Option> { match msg { - FromOverseer::Communication { msg: _msg } => None, + FromOrchestra::Communication { msg: _msg } => None, // to conclude the test cleanly sig => Some(sig), } @@ -60,7 +60,7 @@ where } async fn overseer_send>(overseer: &mut TestSubsystemContextHandle, msg: T) { - overseer.send(FromOverseer::Communication { msg }).await; + overseer.send(FromOrchestra::Communication { msg }).await; } fn launch_harness(test_gen: G) @@ -84,7 +84,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, )) diff --git a/node/malus/src/variants/back_garbage_candidate.rs b/node/malus/src/variants/back_garbage_candidate.rs index 5ece8cd4bd7b..cf72776b5f28 100644 --- a/node/malus/src/variants/back_garbage_candidate.rs +++ b/node/malus/src/variants/back_garbage_candidate.rs @@ -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>, OverseerHandle), Error> + ) -> Result<(Overseer, Arc>, OverseerHandle), Error> where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, @@ -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)? diff --git a/node/malus/src/variants/common.rs b/node/malus/src/variants/common.rs index 138a91b759ab..e112aa49f83e 100644 --- a/node/malus/src/variants/common.rs +++ b/node/malus/src/variants/common.rs @@ -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 { impl ReplaceValidationResult where - Spawner: SpawnNamed, + Spawner: overseer::gen::Spawner, { pub fn new( fake_validation: FakeCandidateValidation, @@ -197,7 +198,7 @@ fn create_validation_response( impl MessageInterceptor for ReplaceValidationResult 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, - ) -> Option> { + msg: FromOrchestra, + ) -> Option> { 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, diff --git a/node/malus/src/variants/dispute_valid_candidates.rs b/node/malus/src/variants/dispute_valid_candidates.rs index 63a99e7df441..17ac070e619b 100644 --- a/node/malus/src/variants/dispute_valid_candidates.rs +++ b/node/malus/src/variants/dispute_valid_candidates.rs @@ -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>, OverseerHandle), Error> + ) -> Result<(Overseer, Arc>, OverseerHandle), Error> where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, @@ -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)? diff --git a/node/malus/src/variants/suggest_garbage_candidate.rs b/node/malus/src/variants/suggest_garbage_candidate.rs index ef987278decb..b8aaaa18c10d 100644 --- a/node/malus/src/variants/suggest_garbage_candidate.rs +++ b/node/malus/src/variants/suggest_garbage_candidate.rs @@ -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 { impl MessageInterceptor for NoteCandidate 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, - ) -> Option> { + msg: FromOrchestra, + ) -> Option> { 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>, OverseerHandle), Error> + ) -> Result<(Overseer, Arc>, OverseerHandle), Error> where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, @@ -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)? diff --git a/node/network/approval-distribution/src/lib.rs b/node/network/approval-distribution/src/lib.rs index 39a5c75420ce..900fd5339dcb 100644 --- a/node/network/approval-distribution/src/lib.rs +++ b/node/network/approval-distribution/src/lib.rs @@ -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, } } } diff --git a/node/network/approval-distribution/src/tests.rs b/node/network/approval-distribution/src/tests.rs index 2693cbd8bc66..8a46d565bd17 100644 --- a/node/network/approval-distribution/src/tests.rs +++ b/node/network/approval-distribution/src/tests.rs @@ -63,7 +63,7 @@ fn test_harness>( 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"); diff --git a/node/network/availability-distribution/src/lib.rs b/node/network/availability-distribution/src/lib.rs index 392b3a8dfd3b..3faaa80ce835 100644 --- a/node/network/availability-distribution/src/lib.rs +++ b/node/network/availability-distribution/src/lib.rs @@ -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, diff --git a/node/network/availability-distribution/src/requester/tests.rs b/node/network/availability-distribution/src/requester/tests.rs index 64e695530b68..94ceed607428 100644 --- a/node/network/availability-distribution/src/requester/tests.rs +++ b/node/network/availability-distribution/src/requester/tests.rs @@ -19,7 +19,7 @@ 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, @@ -30,7 +30,7 @@ use polkadot_node_subsystem::{ AllMessages, AvailabilityDistributionMessage, AvailabilityStoreMessage, ChainApiMessage, NetworkBridgeMessage, RuntimeApiMessage, RuntimeApiRequest, }, - ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, + overseer, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, }; use polkadot_node_subsystem_test_helpers::{ make_subsystem_context, mock::make_ferdie_keystore, TestSubsystemContext, diff --git a/node/network/availability-distribution/src/tests/state.rs b/node/network/availability-distribution/src/tests/state.rs index 2659eafcbb13..31b1d81311f6 100644 --- a/node/network/availability-distribution/src/tests/state.rs +++ b/node/network/availability-distribution/src/tests/state.rs @@ -31,7 +31,7 @@ use futures_timer::Delay; use sc_network as network; use sc_network::{config as netconfig, config::RequestResponseConfig, IfDisconnected}; -use sp_core::{testing::TaskExecutor, traits::SpawnNamed}; +use sp_core::testing::TaskExecutor; use sp_keystore::SyncCryptoStorePtr; use polkadot_node_network_protocol::{ @@ -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>, + mut tx: SingleItemSink>, msg: impl Into, ) { 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 { diff --git a/node/network/availability-recovery/src/lib.rs b/node/network/availability-recovery/src/lib.rs index c23397975b55..1d50dcfef5cb 100644 --- a/node/network/availability-recovery/src/lib.rs +++ b/node/network/availability-recovery/src/lib.rs @@ -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, diff --git a/node/network/availability-recovery/src/tests.rs b/node/network/availability-recovery/src/tests.rs index 2aa5723a6900..3a19c07e1082 100644 --- a/node/network/availability-recovery/src/tests.rs +++ b/node/network/availability-recovery/src/tests.rs @@ -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."); diff --git a/node/network/bitfield-distribution/src/lib.rs b/node/network/bitfield-distribution/src/lib.rs index feba3344467d..06bad64911b1 100644 --- a/node/network/bitfield-distribution/src/lib.rs +++ b/node/network/bitfield-distribution/src/lib.rs @@ -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 }, diff --git a/node/network/bridge/src/lib.rs b/node/network/bridge/src/lib.rs index e11d3500487a..f10f7fa5b67a 100644 --- a/node/network/bridge/src/lib.rs +++ b/node/network/bridge/src/lib.rs @@ -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!( diff --git a/node/network/bridge/src/tests.rs b/node/network/bridge/src/tests.rs index 09c7f270c11f..80929580d165 100644 --- a/node/network/bridge/src/tests.rs +++ b/node/network/bridge/src/tests.rs @@ -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>( 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 _, diff --git a/node/network/collator-protocol/src/collator_side/mod.rs b/node/network/collator-protocol/src/collator_side/mod.rs index 767d05aba357..66b404551c52 100644 --- a/node/network/collator-protocol/src/collator_side/mod.rs +++ b/node/network/collator-protocol/src/collator_side/mod.rs @@ -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( 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) { diff --git a/node/network/collator-protocol/src/collator_side/tests.rs b/node/network/collator-protocol/src/collator_side/tests.rs index f2c4c37a7f2d..41cabb39a600 100644 --- a/node/network/collator-protocol/src/collator_side/tests.rs +++ b/node/network/collator-protocol/src/collator_side/tests.rs @@ -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)); diff --git a/node/network/collator-protocol/src/validator_side/mod.rs b/node/network/collator-protocol/src/validator_side/mod.rs index 3ebc253edb78..592feaf9124a 100644 --- a/node/network/collator-protocol/src/validator_side/mod.rs +++ b/node/network/collator-protocol/src/validator_side/mod.rs @@ -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( 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( &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() => { diff --git a/node/network/collator-protocol/src/validator_side/tests.rs b/node/network/collator-protocol/src/validator_side/tests.rs index 6227b30551a4..77c209361422 100644 --- a/node/network/collator-protocol/src/validator_side/tests.rs +++ b/node/network/collator-protocol/src/validator_side/tests.rs @@ -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)); diff --git a/node/network/dispute-distribution/src/lib.rs b/node/network/dispute-distribution/src/lib.rs index 3b195aa7b3e7..aefd66e0ae79 100644 --- a/node/network/dispute-distribution/src/lib.rs +++ b/node/network/dispute-distribution/src/lib.rs @@ -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>), + Subsystem(FatalResult>), /// Messages from spawned sender background tasks. Sender(Option), } diff --git a/node/network/dispute-distribution/src/tests/mod.rs b/node/network/dispute-distribution/src/tests/mod.rs index 3a294e1a34ef..dd9cd1da9420 100644 --- a/node/network/dispute-distribution/src/tests/mod.rs +++ b/node/network/dispute-distribution/src/tests/mod.rs @@ -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 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, } } } diff --git a/node/network/gossip-support/src/tests.rs b/node/network/gossip-support/src/tests.rs index 72c1dff85ad6..dbe44ea835d0 100644 --- a/node/network/gossip-support/src/tests.rs +++ b/node/network/gossip-support/src/tests.rs @@ -179,7 +179,7 @@ fn test_harness, 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) diff --git a/node/network/statement-distribution/src/lib.rs b/node/network/statement-distribution/src/lib.rs index 00759fd9e95d..2abb765f392b 100644 --- a/node/network/statement-distribution/src/lib.rs +++ b/node/network/statement-distribution/src/lib.rs @@ -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>), + Subsystem(FatalResult>), /// Messages from spawned requester background tasks. Requester(Option), /// Messages from spawned responder background task. @@ -1978,12 +1978,12 @@ impl StatementDistributionSubsystem { active_heads: &mut HashMap, recent_outdated_heads: &mut RecentOutdatedHeads, req_sender: &mpsc::Sender, - message: FromOverseer, + message: FromOrchestra, ) -> Result { let metrics = &self.metrics; match message { - FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { + FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, deactivated, })) => { @@ -2025,11 +2025,11 @@ impl StatementDistributionSubsystem { )); } }, - 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(); diff --git a/node/network/statement-distribution/src/tests.rs b/node/network/statement-distribution/src/tests.rs index a7405d329971..9f5b4f6de326 100644 --- a/node/network/statement-distribution/src/tests.rs +++ b/node/network/statement-distribution/src/tests.rs @@ -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); diff --git a/node/overseer/Cargo.toml b/node/overseer/Cargo.toml index f39c89651d7e..7f51f8a3772c 100644 --- a/node/overseer/Cargo.toml +++ b/node/overseer/Cargo.toml @@ -19,6 +19,7 @@ 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" } diff --git a/node/overseer/examples/minimal-example.rs b/node/overseer/examples/minimal-example.rs index c3cbbd3b289a..6033815ddd50 100644 --- a/node/overseer/examples/minimal-example.rs +++ b/node/overseer/examples/minimal-example.rs @@ -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 diff --git a/node/overseer/orchestra/Cargo.toml b/node/overseer/orchestra/Cargo.toml index 323b069c845f..4af9be0c3658 100644 --- a/node/overseer/orchestra/Cargo.toml +++ b/node/overseer/orchestra/Cargo.toml @@ -16,6 +16,7 @@ metered = { package = "metered-channel", path = "../../metered-channel" } 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" diff --git a/node/overseer/orchestra/proc-macro/src/impl_builder.rs b/node/overseer/orchestra/proc-macro/src/impl_builder.rs index fa6963dbe78b..b4d37d6fcd53 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_builder.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_builder.rs @@ -83,7 +83,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { // Helpers to use within quote! macros let spawner_where_clause: syn::TypeParam = parse_quote! { - S: #support_crate ::Spawner + Send + S: #support_crate ::Spawner }; // Field names and real types @@ -732,7 +732,7 @@ pub(crate) fn impl_task_kind(info: &OrchestraInfo) -> proc_macro2::TokenStream { futures.push(Box::pin( rx.map(|e| { - tracing::warn!(err = ?e, "dropping error"); + #support_crate ::tracing::warn!(err = ?e, "dropping error"); Ok(()) }) )); diff --git a/node/overseer/orchestra/src/lib.rs b/node/overseer/orchestra/src/lib.rs index 21f69c8da1d0..84b24711107f 100644 --- a/node/overseer/orchestra/src/lib.rs +++ b/node/overseer/orchestra/src/lib.rs @@ -64,10 +64,10 @@ pub use orchestra_proc_macro::{contextbounds, orchestra, subsystem}; -#[doc(hidden)] -pub use tracing; #[doc(hidden)] pub use metered; +#[doc(hidden)] +pub use tracing; #[doc(hidden)] pub use async_trait::async_trait; @@ -99,9 +99,8 @@ use std::fmt; #[cfg(test)] mod tests; - - /// A spawner +#[dyn_clonable::clonable] pub trait Spawner: Clone + Send + Sync { /// Spawn the given blocking future. /// diff --git a/node/overseer/orchestra/tests/ui/err-05-missing-field.rs b/node/overseer/orchestra/tests/ui/err-05-missing-field.rs index 6fa194a5e327..f351724072b6 100644 --- a/node/overseer/orchestra/tests/ui/err-05-missing-field.rs +++ b/node/overseer/orchestra/tests/ui/err-05-missing-field.rs @@ -29,7 +29,7 @@ struct Orchestra { #[derive(Debug, Clone)] pub struct DummySpawner; -impl SpawnNamed for DummySpawner { +impl Spawner for DummySpawner { fn spawn_blocking( &self, task_name: &'static str, diff --git a/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs index 6f017df91273..85b1b2f618fe 100644 --- a/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs +++ b/node/overseer/orchestra/tests/ui/err-06-missing-subsystem.rs @@ -29,7 +29,7 @@ struct Orchestra { #[derive(Debug, Clone)] pub struct DummySpawner; -impl SpawnNamed for DummySpawner { +impl Spawner for DummySpawner { fn spawn_blocking( &self, task_name: &'static str, diff --git a/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs index ae4c94851e60..45f0af1c6e50 100644 --- a/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs +++ b/node/overseer/orchestra/tests/ui/err-07-missing-spawner.rs @@ -29,7 +29,7 @@ struct Orchestra { #[derive(Debug, Clone)] pub struct DummySpawner; -impl SpawnNamed for DummySpawner { +impl Spawner for DummySpawner { fn spawn_blocking( &self, task_name: &'static str, diff --git a/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs index 1051cf10151b..8a3eab1ee726 100644 --- a/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs +++ b/node/overseer/orchestra/tests/ui/err-08-duplicate-subsystem.rs @@ -29,7 +29,7 @@ struct Orchestra { #[derive(Debug, Clone)] pub struct DummySpawner; -impl SpawnNamed for DummySpawner { +impl Spawner for DummySpawner { fn spawn_blocking( &self, task_name: &'static str, diff --git a/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs index 0ca1bf94efbd..c90979c4e4e8 100644 --- a/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs +++ b/node/overseer/orchestra/tests/ui/err-09-uninit_generic_baggage.rs @@ -29,7 +29,7 @@ struct Orchestra { #[derive(Debug, Clone)] pub struct DummySpawner; -impl SpawnNamed for DummySpawner { +impl Spawner for DummySpawner { fn spawn_blocking( &self, task_name: &'static str, diff --git a/node/overseer/orchestra/tests/ui/ok-01-wip.rs b/node/overseer/orchestra/tests/ui/ok-01-wip.rs index 2cedd41d9bea..79686ecbe579 100644 --- a/node/overseer/orchestra/tests/ui/ok-01-wip.rs +++ b/node/overseer/orchestra/tests/ui/ok-01-wip.rs @@ -20,7 +20,7 @@ impl ::orchestra::Subsystem, OrchestraError> for #[derive(Debug, Clone)] pub struct DummySpawner; -impl SpawnNamed for DummySpawner { +impl Spawner for DummySpawner { fn spawn_blocking( &self, task_name: &'static str, diff --git a/node/overseer/src/dummy.rs b/node/overseer/src/dummy.rs index b4a97c3e6321..0b34339dfe7d 100644 --- a/node/overseer/src/dummy.rs +++ b/node/overseer/src/dummy.rs @@ -16,13 +16,12 @@ use crate::{ prometheus::Registry, HeadSupportsParachains, InitializedOverseerBuilder, MetricsTrait, - Overseer, OverseerMetrics, OverseerSignal, OverseerSubsystemContext, SpawnNamed, + Overseer, OverseerMetrics, OverseerSignal, OverseerSubsystemContext, SpawnGlue, KNOWN_LEAVES_CACHE_SIZE, }; use lru::LruCache; +use orchestra::{FromOrchestra, SpawnedSubsystem, Subsystem, SubsystemContext}; use polkadot_node_subsystem_types::{errors::SubsystemError, messages::*}; -use polkadot_overseer_gen::{FromOverseer, SpawnedSubsystem, Subsystem, SubsystemContext}; - /// A dummy subsystem that implements [`Subsystem`] for all /// types of messages. Used for tests or as a placeholder. #[derive(Clone, Copy, Debug)] @@ -37,7 +36,7 @@ where loop { match ctx.recv().await { Err(_) => return Ok(()), - Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), + Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => return Ok(()), Ok(overseer_msg) => { gum::debug!( target: "dummy-subsystem", @@ -63,7 +62,7 @@ pub fn dummy_overseer_builder<'a, Spawner, SupportsParachains>( registry: Option<&'a Registry>, ) -> Result< InitializedOverseerBuilder< - Spawner, + SpawnGlue, SupportsParachains, DummySubsystem, DummySubsystem, @@ -90,7 +89,7 @@ pub fn dummy_overseer_builder<'a, Spawner, SupportsParachains>( SubsystemError, > where - Spawner: SpawnNamed + Send + Sync + 'static, + SpawnGlue: orchestra::Spawner + 'static, SupportsParachains: HeadSupportsParachains, { one_for_all_overseer_builder(spawner, supports_parachains, DummySubsystem, registry) @@ -104,7 +103,7 @@ pub fn one_for_all_overseer_builder<'a, Spawner, SupportsParachains, Sub>( registry: Option<&'a Registry>, ) -> Result< InitializedOverseerBuilder< - Spawner, + SpawnGlue, SupportsParachains, Sub, Sub, @@ -131,7 +130,7 @@ pub fn one_for_all_overseer_builder<'a, Spawner, SupportsParachains, Sub>( SubsystemError, > where - Spawner: SpawnNamed + Send + Sync + 'static, + SpawnGlue: orchestra::Spawner + 'static, SupportsParachains: HeadSupportsParachains, Sub: Clone + Subsystem, SubsystemError> @@ -185,7 +184,7 @@ where .active_leaves(Default::default()) .known_leaves(LruCache::new(KNOWN_LEAVES_CACHE_SIZE)) .leaves(Default::default()) - .spawner(spawner) + .spawner(SpawnGlue(spawner)) .metrics(metrics) .supports_parachains(supports_parachains); Ok(builder) diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index 91126c236a52..829d7db87d52 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -105,11 +105,12 @@ pub use polkadot_node_metrics::{ use parity_util_mem::MemoryAllocationTracker; -pub use polkadot_overseer_gen as gen; -pub use polkadot_overseer_gen::{ - contextbounds, orchestra, subsystem, FromOverseer, MapSubsystem, MessagePacket, SignalsReceived, - SpawnNamed, Subsystem, SubsystemContext, SubsystemIncomingMessages, SubsystemInstance, - SubsystemMeterReadouts, SubsystemMeters, SubsystemSender, TimeoutExt, ToOverseer, +pub use orchestra as gen; +pub use orchestra::{ + contextbounds, orchestra, subsystem, FromOrchestra, MapSubsystem, MessagePacket, + SignalsReceived, Spawner, Subsystem, SubsystemContext, SubsystemIncomingMessages, + SubsystemInstance, SubsystemMeterReadouts, SubsystemMeters, SubsystemSender, TimeoutExt, + ToOrchestra, }; /// Store 2 days worth of blocks, not accounting for forks, @@ -119,6 +120,42 @@ pub const KNOWN_LEAVES_CACHE_SIZE: usize = 2 * 24 * 3600 / 6; #[cfg(test)] mod tests; +use sp_core::traits::SpawnNamed; + +/// Glue to connect `trait orchestra::Spawner` and `SpawnNamed` from `substrate`. +pub struct SpawnGlue(pub S); + +impl AsRef for SpawnGlue { + fn as_ref(&self) -> &S { + &self.0 + } +} + +impl Clone for SpawnGlue { + fn clone(&self) -> Self { + Self(self.0.clone()) + } +} + +impl crate::gen::Spawner for SpawnGlue { + fn spawn_blocking( + &self, + name: &'static str, + group: Option<&'static str>, + future: futures::future::BoxFuture<'static, ()>, + ) { + SpawnNamed::spawn_blocking(&self.0, name, group, future) + } + fn spawn( + &self, + name: &'static str, + group: Option<&'static str>, + future: futures::future::BoxFuture<'static, ()>, + ) { + SpawnNamed::spawn(&self.0, name, group, future) + } +} + /// Whether a header supports parachain consensus or not. pub trait HeadSupportsParachains { /// Return true if the given header supports parachain consensus. Otherwise, false. @@ -346,7 +383,7 @@ pub async fn forward_events>(client: Arc

, mut hand /// # SubsystemError, /// # gen::{ /// # SubsystemContext, -/// # FromOverseer, +/// # FromOrchestra, /// # SpawnedSubsystem, /// # }, /// # }; @@ -594,15 +631,15 @@ pub fn spawn_metronome_metrics( metronome_metrics: OverseerMetrics, ) -> Result<(), SubsystemError> where - S: SpawnNamed, + S: Spawner, SupportsParachains: HeadSupportsParachains, { struct ExtractNameAndMeters; - impl<'a, T: 'a> MapSubsystem<&'a OverseenSubsystem> for ExtractNameAndMeters { + impl<'a, T: 'a> MapSubsystem<&'a OrchestratedSubsystem> for ExtractNameAndMeters { type Output = Option<(&'static str, SubsystemMeters)>; - fn map_subsystem(&self, subsystem: &'a OverseenSubsystem) -> Self::Output { + fn map_subsystem(&self, subsystem: &'a OrchestratedSubsystem) -> Self::Output { subsystem .instance .as_ref() @@ -662,7 +699,7 @@ where impl Overseer where SupportsParachains: HeadSupportsParachains, - S: SpawnNamed, + S: Spawner, { /// Stop the `Overseer`. async fn stop(mut self) { @@ -709,10 +746,10 @@ where }, msg = self.to_overseer_rx.select_next_some() => { match msg { - ToOverseer::SpawnJob { name, subsystem, s } => { + ToOrchestra::SpawnJob { name, subsystem, s } => { self.spawn_job(name, subsystem, s); } - ToOverseer::SpawnBlockingJob { name, subsystem, s } => { + ToOrchestra::SpawnBlockingJob { name, subsystem, s } => { self.spawn_blocking_job(name, subsystem, s); } } diff --git a/node/overseer/src/tests.rs b/node/overseer/src/tests.rs index 9fb030140191..2a7a430bcea5 100644 --- a/node/overseer/src/tests.rs +++ b/node/overseer/src/tests.rs @@ -70,12 +70,12 @@ where let mut i = 0; loop { match ctx.recv().await { - Ok(FromOverseer::Communication { .. }) => { + Ok(FromOrchestra::Communication { .. }) => { let _ = sender.send(i).await; i += 1; continue }, - Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), + Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => return Ok(()), Err(_) => return Ok(()), _ => (), } @@ -121,7 +121,7 @@ where continue } match ctx.try_recv().await { - Ok(Some(FromOverseer::Signal(OverseerSignal::Conclude))) => break, + Ok(Some(FromOrchestra::Signal(OverseerSignal::Conclude))) => break, Ok(Some(_)) => continue, Err(_) => return Ok(()), _ => (), @@ -318,8 +318,8 @@ where future: Box::pin(async move { loop { match ctx.try_recv().await { - Ok(Some(FromOverseer::Signal(OverseerSignal::Conclude))) => break, - Ok(Some(FromOverseer::Signal(s))) => { + Ok(Some(FromOrchestra::Signal(OverseerSignal::Conclude))) => break, + Ok(Some(FromOrchestra::Signal(s))) => { sender.send(s).await.unwrap(); continue }, @@ -350,8 +350,8 @@ where future: Box::pin(async move { loop { match ctx.try_recv().await { - Ok(Some(FromOverseer::Signal(OverseerSignal::Conclude))) => break, - Ok(Some(FromOverseer::Signal(s))) => { + Ok(Some(FromOrchestra::Signal(OverseerSignal::Conclude))) => break, + Ok(Some(FromOrchestra::Signal(s))) => { sender.send(s).await.unwrap(); continue }, @@ -754,15 +754,15 @@ where future: Box::pin(async move { loop { match ctx.try_recv().await { - Ok(Some(FromOverseer::Signal(OverseerSignal::Conclude))) => { + Ok(Some(FromOrchestra::Signal(OverseerSignal::Conclude))) => { self.stop_signals_received.fetch_add(1, atomic::Ordering::SeqCst); break }, - Ok(Some(FromOverseer::Signal(_))) => { + Ok(Some(FromOrchestra::Signal(_))) => { self.signals_received.fetch_add(1, atomic::Ordering::SeqCst); continue }, - Ok(Some(FromOverseer::Communication { .. })) => { + Ok(Some(FromOrchestra::Communication { .. })) => { self.msgs_received.fetch_add(1, atomic::Ordering::SeqCst); continue }, @@ -1139,7 +1139,7 @@ fn context_holds_onto_message_until_enough_signals_received() { let test_fut = async move { signal_tx.send(OverseerSignal::Conclude).await.unwrap(); - assert_matches!(ctx.recv().await.unwrap(), FromOverseer::Signal(OverseerSignal::Conclude)); + assert_matches!(ctx.recv().await.unwrap(), FromOrchestra::Signal(OverseerSignal::Conclude)); assert_eq!(ctx.signals_received.load(), 1); bounded_tx @@ -1158,9 +1158,9 @@ fn context_holds_onto_message_until_enough_signals_received() { assert!(ctx.pending_incoming.is_some()); signal_tx.send(OverseerSignal::Conclude).await.unwrap(); - assert_matches!(ctx.recv().await.unwrap(), FromOverseer::Signal(OverseerSignal::Conclude)); - assert_matches!(ctx.recv().await.unwrap(), FromOverseer::Communication { msg: () }); - assert_matches!(ctx.recv().await.unwrap(), FromOverseer::Communication { msg: () }); + assert_matches!(ctx.recv().await.unwrap(), FromOrchestra::Signal(OverseerSignal::Conclude)); + assert_matches!(ctx.recv().await.unwrap(), FromOrchestra::Communication { msg: () }); + assert_matches!(ctx.recv().await.unwrap(), FromOrchestra::Communication { msg: () }); assert!(ctx.pending_incoming.is_none()); }; diff --git a/node/primitives/src/lib.rs b/node/primitives/src/lib.rs index c203e560647d..882b75a0e81f 100644 --- a/node/primitives/src/lib.rs +++ b/node/primitives/src/lib.rs @@ -29,17 +29,15 @@ use futures::Future; use parity_scale_codec::{Decode, Encode, Error as CodecError, Input}; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; -pub use sp_consensus_babe::{ - AllowedSlots as BabeAllowedSlots, BabeEpochConfiguration, Epoch as BabeEpoch, -}; -pub use sp_core::traits::SpawnNamed; - use polkadot_primitives::v2::{ BlakeTwo256, CandidateCommitments, CandidateHash, CollatorPair, CommittedCandidateReceipt, CompactStatement, EncodeAs, Hash, HashT, HeadData, Id as ParaId, OutboundHrmpMessage, PersistedValidationData, SessionIndex, Signed, UncheckedSigned, UpwardMessage, ValidationCode, ValidatorIndex, MAX_CODE_SIZE, MAX_POV_SIZE, }; +pub use sp_consensus_babe::{ + AllowedSlots as BabeAllowedSlots, BabeEpochConfiguration, Epoch as BabeEpoch, +}; pub use polkadot_parachain::primitives::BlockData; diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 687ea0269515..6e996fd7eaa2 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -49,12 +49,12 @@ use { polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig, polkadot_overseer::BlockInfo, sc_client_api::{BlockBackend, ExecutorProvider}, + sp_core::traits::SpawnNamed, sp_trie::PrefixedMemoryDB, }; use polkadot_node_subsystem_util::database::Database; -pub use sp_core::traits::SpawnNamed; #[cfg(feature = "full-node")] pub use { polkadot_overseer::{Handle, Overseer, OverseerConnector, OverseerHandle}, diff --git a/node/service/src/overseer.rs b/node/service/src/overseer.rs index bb3d9e840f1c..2001076aa1db 100644 --- a/node/service/src/overseer.rs +++ b/node/service/src/overseer.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use super::{AuthorityDiscoveryApi, Block, Error, Hash, IsCollator, Registry, SpawnNamed}; +use super::{AuthorityDiscoveryApi, Block, Error, Hash, IsCollator, Registry}; +use sp_core::traits::SpawnNamed; + use lru::LruCache; use polkadot_availability_distribution::IncomingRequestReceivers; use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig; @@ -33,7 +35,7 @@ pub use polkadot_overseer::{ use polkadot_overseer::{ gen::SubsystemContext, metrics::Metrics as OverseerMetrics, BlockInfo, InitializedOverseerBuilder, MetricsTrait, Overseer, OverseerConnector, OverseerHandle, - OverseerSubsystemContext, + OverseerSubsystemContext, SpawnGlue, }; use polkadot_primitives::runtime_api::ParachainHost; @@ -146,7 +148,7 @@ pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>( }: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result< InitializedOverseerBuilder< - Spawner, + SpawnGlue, Arc, CandidateValidationSubsystem, PvfCheckerSubsystem, @@ -155,12 +157,12 @@ pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>( AvailabilityDistributionSubsystem, AvailabilityRecoverySubsystem, BitfieldSigningSubsystem< - Spawner, + SpawnGlue, as SubsystemContext>::Sender, >, BitfieldDistributionSubsystem, ProvisionerSubsystem< - Spawner, + SpawnGlue, as SubsystemContext>::Sender, >, RuntimeApiSubsystem, @@ -190,6 +192,8 @@ where let metrics = ::register(registry)?; + let spawner = SpawnGlue(spawner); + let builder = Overseer::builder() .availability_distribution(AvailabilityDistributionSubsystem::new( keystore.clone(), @@ -321,7 +325,7 @@ pub trait OverseerGen { &self, connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, - ) -> Result<(Overseer>, OverseerHandle), Error> + ) -> Result<(Overseer, Arc>, OverseerHandle), Error> where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, @@ -345,7 +349,7 @@ impl OverseerGen for RealOverseerGen { &self, connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, - ) -> Result<(Overseer>, OverseerHandle), Error> + ) -> Result<(Overseer, Arc>, OverseerHandle), Error> where RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, diff --git a/node/subsystem-test-helpers/src/lib.rs b/node/subsystem-test-helpers/src/lib.rs index b36c180a57b7..1af715852038 100644 --- a/node/subsystem-test-helpers/src/lib.rs +++ b/node/subsystem-test-helpers/src/lib.rs @@ -19,14 +19,14 @@ #![warn(missing_docs)] use polkadot_node_subsystem::{ - messages::AllMessages, overseer, FromOverseer, OverseerSignal, SpawnedSubsystem, + messages::AllMessages, overseer, FromOrchestra, OverseerSignal, SpawnGlue, SpawnedSubsystem, SubsystemError, SubsystemResult, }; use polkadot_node_subsystem_util::TimeoutExt; use futures::{channel::mpsc, poll, prelude::*}; use parking_lot::Mutex; -use sp_core::{testing::TaskExecutor, traits::SpawnNamed}; +use sp_core::testing::TaskExecutor; use std::{ convert::Infallible, @@ -176,7 +176,7 @@ where /// A test subsystem context. pub struct TestSubsystemContext { tx: TestSubsystemSender, - rx: SingleItemStream>, + rx: SingleItemStream>, spawn: S, } @@ -186,7 +186,7 @@ where M: overseer::AssociateOutgoing + std::fmt::Debug + Send + 'static, AllMessages: From<::OutgoingMessages>, AllMessages: From, - Spawner: SpawnNamed + Send + 'static, + Spawner: overseer::gen::Spawner + Send + 'static, { type Message = M; type Sender = TestSubsystemSender; @@ -194,7 +194,7 @@ where type OutgoingMessages = ::OutgoingMessages; type Error = SubsystemError; - async fn try_recv(&mut self) -> Result>, ()> { + async fn try_recv(&mut self) -> Result>, ()> { match poll!(self.rx.next()) { Poll::Ready(Some(msg)) => Ok(Some(msg)), Poll::Ready(None) => Err(()), @@ -202,7 +202,7 @@ where } } - async fn recv(&mut self) -> SubsystemResult> { + async fn recv(&mut self) -> SubsystemResult> { self.rx .next() .await @@ -238,7 +238,7 @@ pub struct TestSubsystemContextHandle { /// /// Useful for shared ownership situations (one can have multiple senders, but only one /// receiver. - pub tx: SingleItemSink>, + pub tx: SingleItemSink>, /// Direct access to the receiver. pub rx: mpsc::UnboundedReceiver, @@ -247,7 +247,7 @@ pub struct TestSubsystemContextHandle { impl TestSubsystemContextHandle { /// Send a message or signal to the subsystem. This resolves at the point in time when the /// subsystem has _read_ the message. - pub async fn send(&mut self, from_overseer: FromOverseer) { + pub async fn send(&mut self, from_overseer: FromOrchestra) { self.tx.send(from_overseer).await.expect("Test subsystem no longer live"); } @@ -264,8 +264,8 @@ impl TestSubsystemContextHandle { /// Make a test subsystem context. pub fn make_subsystem_context( - spawn: S, -) -> (TestSubsystemContext, TestSubsystemContextHandle) { + spawner: S, +) -> (TestSubsystemContext>, TestSubsystemContextHandle) { let (overseer_tx, overseer_rx) = single_item_sink(); let (all_messages_tx, all_messages_rx) = mpsc::unbounded(); @@ -273,7 +273,7 @@ pub fn make_subsystem_context( TestSubsystemContext { tx: TestSubsystemSender { tx: all_messages_tx }, rx: overseer_rx, - spawn, + spawn: SpawnGlue(spawner), }, TestSubsystemContextHandle { tx: overseer_tx, rx: all_messages_rx }, ) @@ -290,7 +290,7 @@ pub fn subsystem_test_harness( ) where OverseerFactory: FnOnce(TestSubsystemContextHandle) -> Overseer, Overseer: Future, - TestFactory: FnOnce(TestSubsystemContext) -> Test, + TestFactory: FnOnce(TestSubsystemContext>) -> Test, Test: Future, { let pool = TaskExecutor::new(); @@ -330,8 +330,8 @@ where let future = Box::pin(async move { loop { match ctx.recv().await { - Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), - Ok(FromOverseer::Communication { msg }) => { + Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => return Ok(()), + Ok(FromOrchestra::Communication { msg }) => { let _ = self.0.send(msg).await; }, Err(_) => return Ok(()), diff --git a/node/subsystem-types/Cargo.toml b/node/subsystem-types/Cargo.toml index 8f94a6ac510c..48639e58b274 100644 --- a/node/subsystem-types/Cargo.toml +++ b/node/subsystem-types/Cargo.toml @@ -13,7 +13,7 @@ polkadot-node-primitives = { path = "../primitives" } polkadot-node-network-protocol = { path = "../network/protocol" } polkadot-statement-table = { path = "../../statement-table" } polkadot-node-jaeger = { path = "../jaeger" } -polkadot-overseer-gen = { path = "../overseer/overseer-gen" } +orchestra = { path = "../overseer/orchestra" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } smallvec = "1.8.0" substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/node/subsystem-types/src/errors.rs b/node/subsystem-types/src/errors.rs index 306b326e053e..27c4fcdf8d37 100644 --- a/node/subsystem-types/src/errors.rs +++ b/node/subsystem-types/src/errors.rs @@ -17,6 +17,7 @@ //! Error types for the subsystem requests. use crate::JaegerError; +use ::orchestra::OrchestraError as OverseerError; /// A description of an error causing the runtime API request to be unservable. #[derive(thiserror::Error, Debug, Clone)] @@ -120,7 +121,7 @@ pub enum SubsystemError { /// Generated by the `#[overseer(..)]` proc-macro #[error(transparent)] - Generated(#[from] ::polkadot_overseer_gen::OverseerError), + Generated(#[from] OverseerError), /// Per origin (or subsystem) annotations to wrap an error. #[error("Error originated in {origin}")] diff --git a/node/subsystem-util/src/lib.rs b/node/subsystem-util/src/lib.rs index dcc7c5615431..5fba22bc139e 100644 --- a/node/subsystem-util/src/lib.rs +++ b/node/subsystem-util/src/lib.rs @@ -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 { impl Jobs 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 Stream for Jobs where - Spawner: SpawnNamed, + Spawner: overseer::gen::Spawner + Clone, { type Item = FromJobCommand; @@ -637,7 +637,7 @@ where impl stream::FusedStream for Jobs where - Spawner: SpawnNamed, + Spawner: overseer::gen::Spawner + Clone, { fn is_terminated(&self) -> bool { false @@ -680,7 +680,7 @@ impl JobSubsystem { /// Run the subsystem to completion. pub async fn run(self, mut ctx: Context) where - Spawner: SpawnNamed + Send + Clone + Unpin + 'static, + Spawner: overseer::gen::Spawner + Clone + Unpin + 'static, Context: SubsystemContext< Message = ::ToJob, OutgoingMessages = ::OutgoingMessages, @@ -701,7 +701,7 @@ impl JobSubsystem { 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 JobSubsystem { 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) = <::Message>::try_from(msg) { jobs.send_msg(to_job.relay_parent(), to_job).await; } @@ -760,7 +760,7 @@ impl JobSubsystem { impl Subsystem for JobSubsystem where - Spawner: SpawnNamed + Send + Clone + Unpin + 'static, + Spawner: overseer::gen::Spawner + Clone + Unpin + 'static, Context: SubsystemContext< Message = Job::ToJob, Signal = OverseerSignal, diff --git a/node/subsystem-util/src/tests.rs b/node/subsystem-util/src/tests.rs index 2a1a95a88458..fde6d375d6fa 100644 --- a/node/subsystem-util/src/tests.rs +++ b/node/subsystem-util/src/tests.rs @@ -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>(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::(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"); } diff --git a/node/subsystem/src/lib.rs b/node/subsystem/src/lib.rs index 2ffd4871f4f8..ce5fef2c8b51 100644 --- a/node/subsystem/src/lib.rs +++ b/node/subsystem/src/lib.rs @@ -46,7 +46,7 @@ pub type SubsystemResult = Result; // subsystems at once. /// Specialized message type originating from the overseer. -pub type FromOverseer = polkadot_overseer::gen::FromOverseer; +pub type FromOrchestra = polkadot_overseer::gen::FromOrchestra; /// Specialized subsystem instance type of subsystems consuming a particular message type. pub type SubsystemInstance = diff --git a/parachain/test-parachains/undying/collator/src/lib.rs b/parachain/test-parachains/undying/collator/src/lib.rs index 8ca8e9409958..5d1a53f60cb3 100644 --- a/parachain/test-parachains/undying/collator/src/lib.rs +++ b/parachain/test-parachains/undying/collator/src/lib.rs @@ -24,7 +24,7 @@ use polkadot_node_primitives::{ MaybeCompressedPoV, PoV, Statement, }; use polkadot_primitives::v2::{CollatorId, CollatorPair, Hash}; -use sp_core::{traits::SpawnNamed, Pair}; +use sp_core::Pair; use std::{ collections::HashMap, sync::{ @@ -323,10 +323,11 @@ impl Collator { } } +use sp_core::traits::SpawnNamed; + #[cfg(test)] mod tests { use super::*; - use futures::executor::block_on; use polkadot_parachain::primitives::{ValidationParams, ValidationResult}; use polkadot_primitives::v2::{Hash, PersistedValidationData}; diff --git a/roadmap/implementers-guide/src/types/overseer-protocol.md b/roadmap/implementers-guide/src/types/overseer-protocol.md index f10537fcf666..b2559c4cfda7 100644 --- a/roadmap/implementers-guide/src/types/overseer-protocol.md +++ b/roadmap/implementers-guide/src/types/overseer-protocol.md @@ -19,7 +19,7 @@ enum OverseerSignal { All subsystems have their own message types; all of them need to be able to listen for overseer signals as well. There are currently two proposals for how to handle that with unified communication channels: -1. Retaining the `OverseerSignal` definition above, add `enum FromOverseer {Signal(OverseerSignal), Message(T)}`. +1. Retaining the `OverseerSignal` definition above, add `enum FromOrchestra {Signal(OverseerSignal), Message(T)}`. 1. Add a generic varint to `OverseerSignal`: `Message(T)`. Either way, there will be some top-level type encapsulating messages from the overseer to each subsystem. From 00f766d9eb63cc99c09106d4651a7e49ca7ac80c Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 19 May 2022 08:59:50 +0200 Subject: [PATCH 04/15] slip of the pen --- node/core/runtime-api/src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/core/runtime-api/src/tests.rs b/node/core/runtime-api/src/tests.rs index 539dc6c8aa98..fdcd66ecf2a7 100644 --- a/node/core/runtime-api/src/tests.rs +++ b/node/core/runtime-api/src/tests.rs @@ -881,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; From e5a59253dad698ee01fb25deeed038a794d248eb Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 19 May 2022 09:25:15 +0200 Subject: [PATCH 05/15] other fixins --- node/malus/src/tests.rs | 6 ++++-- .../availability-distribution/src/requester/tests.rs | 12 ++++++++---- .../availability-distribution/src/tests/state.rs | 2 +- node/subsystem-test-helpers/src/lib.rs | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/node/malus/src/tests.rs b/node/malus/src/tests.rs index 39cfe19634dd..706e8b931993 100644 --- a/node/malus/src/tests.rs +++ b/node/malus/src/tests.rs @@ -63,15 +63,17 @@ async fn overseer_send>(overseer: &mut TestSubsystemContext overseer.send(FromOrchestra::Communication { msg }).await; } +use sp_core::testing::TaskExecutor; + fn launch_harness(test_gen: G) where F: Future> + Send, M: AssociateOutgoing + std::fmt::Debug + Send + 'static, // ::OutgoingMessages: From, - Sub: Subsystem, SubsystemError>, + Sub: Subsystem>, SubsystemError>, G: Fn(TestSubsystemContextHandle) -> (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); diff --git a/node/network/availability-distribution/src/requester/tests.rs b/node/network/availability-distribution/src/requester/tests.rs index 94ceed607428..34524a9b150b 100644 --- a/node/network/availability-distribution/src/requester/tests.rs +++ b/node/network/availability-distribution/src/requester/tests.rs @@ -22,15 +22,17 @@ use polkadot_node_network_protocol::jaeger; 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, }, - overseer, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, + overseer, 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>( test_state: TestState, - test_fx: impl FnOnce(TestSubsystemContext) -> T, + test_fx: impl FnOnce( + TestSubsystemContext>, + ) -> T, ) { let pool = TaskExecutor::new(); let (ctx, ctx_handle) = make_subsystem_context(pool.clone()); diff --git a/node/network/availability-distribution/src/tests/state.rs b/node/network/availability-distribution/src/tests/state.rs index 31b1d81311f6..140713b9c4aa 100644 --- a/node/network/availability-distribution/src/tests/state.rs +++ b/node/network/availability-distribution/src/tests/state.rs @@ -31,7 +31,7 @@ use futures_timer::Delay; use sc_network as network; use sc_network::{config as netconfig, config::RequestResponseConfig, IfDisconnected}; -use sp_core::testing::TaskExecutor; +use sp_core::{testing::TaskExecutor, traits::SpawnNamed}; use sp_keystore::SyncCryptoStorePtr; use polkadot_node_network_protocol::{ diff --git a/node/subsystem-test-helpers/src/lib.rs b/node/subsystem-test-helpers/src/lib.rs index 1af715852038..6ea0caabaddc 100644 --- a/node/subsystem-test-helpers/src/lib.rs +++ b/node/subsystem-test-helpers/src/lib.rs @@ -381,6 +381,7 @@ mod tests { use polkadot_node_subsystem::messages::CollatorProtocolMessage; use polkadot_overseer::{dummy::dummy_overseer_builder, Handle, HeadSupportsParachains}; use polkadot_primitives::v2::Hash; + use sp_core::traits::SpawnNamed; struct AlwaysSupportsParachains; impl HeadSupportsParachains for AlwaysSupportsParachains { From f81777f1c4ddbb347b6111195e029e2ec7518273 Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 19 May 2022 09:56:30 +0200 Subject: [PATCH 06/15] remove unused import --- node/network/availability-distribution/src/requester/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/network/availability-distribution/src/requester/tests.rs b/node/network/availability-distribution/src/requester/tests.rs index 34524a9b150b..9fd738a04388 100644 --- a/node/network/availability-distribution/src/requester/tests.rs +++ b/node/network/availability-distribution/src/requester/tests.rs @@ -32,7 +32,7 @@ use polkadot_node_subsystem::{ AllMessages, AvailabilityDistributionMessage, AvailabilityStoreMessage, ChainApiMessage, NetworkBridgeMessage, RuntimeApiMessage, RuntimeApiRequest, }, - overseer, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SpawnGlue, + ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SpawnGlue, }; use polkadot_node_subsystem_test_helpers::{ make_subsystem_context, mock::make_ferdie_keystore, TestSubsystemContext, From 1f7e7c1b9636f6fda5b1aacf123596c4ef76daae Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 19 May 2022 10:32:00 +0200 Subject: [PATCH 07/15] Update node/overseer/orchestra/proc-macro/src/impl_builder.rs Co-authored-by: Vsevolod Stakhov --- node/overseer/orchestra/proc-macro/src/impl_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/overseer/orchestra/proc-macro/src/impl_builder.rs b/node/overseer/orchestra/proc-macro/src/impl_builder.rs index b4d37d6fcd53..a4d948bf3924 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_builder.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_builder.rs @@ -712,7 +712,7 @@ pub(crate) fn impl_task_kind(info: &OrchestraInfo) -> proc_macro2::TokenStream { M: std::fmt::Debug + Send + 'static, TK: TaskKind, Ctx: #support_crate ::SubsystemContext, - E: std::error::Error + Send + Sync + 'static + From<#support_crate ::OrchestraError>, + E: ::std::error::Error + Send + Sync + 'static + ::std::convert::From<#support_crate ::OrchestraError>, SubSys: #support_crate ::Subsystem, { let #support_crate ::SpawnedSubsystem:: { future, name } = s.start(ctx); From f297e54c4f8b088699ce1705c86705809b39106f Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 19 May 2022 10:32:14 +0200 Subject: [PATCH 08/15] Update node/overseer/orchestra/proc-macro/src/impl_builder.rs Co-authored-by: Vsevolod Stakhov --- node/overseer/orchestra/proc-macro/src/impl_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/overseer/orchestra/proc-macro/src/impl_builder.rs b/node/overseer/orchestra/proc-macro/src/impl_builder.rs index a4d948bf3924..6691c5e2980f 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_builder.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_builder.rs @@ -455,7 +455,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { // explicitly assure the required traits are implemented fn trait_from_must_be_implemented() where - E: std::error::Error + Send + Sync + 'static + From<#support_crate ::OrchestraError> + E: ::std::error::Error + Send + Sync + 'static + From<#support_crate ::OrchestraError> {} trait_from_must_be_implemented::< #error_ty >(); From d6cf5b93cfb364bf752a1b04a51fde62650134e0 Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 19 May 2022 12:56:11 +0200 Subject: [PATCH 09/15] orchestra everywhere --- node/overseer/orchestra/README.md | 28 +++++------ node/overseer/orchestra/adr/01-adr.md | 4 +- node/overseer/orchestra/examples/duo.rs | 22 ++++---- node/overseer/orchestra/examples/solo.rs | 14 +++--- .../orchestra/proc-macro/src/impl_builder.rs | 50 +++++++++---------- .../proc-macro/src/impl_channels_out.rs | 2 +- .../proc-macro/src/impl_orchestra.rs | 18 +++---- .../src/impl_subsystem_ctx_sender.rs | 30 +++++------ .../orchestra/proc-macro/src/orchestra.rs | 4 +- .../orchestra/proc-macro/src/parse/mod.rs | 6 +-- ...erseer_attr.rs => parse_orchestra_attr.rs} | 10 ++-- ...er_struct.rs => parse_orchestra_struct.rs} | 6 +-- .../src/parse/parse_subsystem_attr.rs | 8 +-- .../orchestra/proc-macro/src/subsystem.rs | 2 +- node/overseer/orchestra/src/lib.rs | 8 +-- .../tests/ui/err-01-duplicate-consumer.rs | 2 +- .../orchestra/tests/ui/err-02-enum.rs | 2 +- .../orchestra/tests/ui/err-02-enum.stderr | 2 +- .../orchestra/tests/ui/err-03-subsys-twice.rs | 2 +- .../tests/ui/err-03-subsys-twice.stderr | 2 +- .../tests/ui/err-04-missing-error.stderr | 2 +- node/overseer/orchestra/tests/ui/ok-01-wip.rs | 2 +- 22 files changed, 113 insertions(+), 113 deletions(-) rename node/overseer/orchestra/proc-macro/src/parse/{parse_overseer_attr.rs => parse_orchestra_attr.rs} (94%) rename node/overseer/orchestra/proc-macro/src/parse/{parse_overseer_struct.rs => parse_orchestra_struct.rs} (99%) diff --git a/node/overseer/orchestra/README.md b/node/overseer/orchestra/README.md index b41692a50290..46106d40f82a 100644 --- a/node/overseer/orchestra/README.md +++ b/node/overseer/orchestra/README.md @@ -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 @@ -10,7 +11,7 @@ declarative. ```rust #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)] - pub struct Orchestra { + pub struct Opera { #[subsystem(MsgA, sends: [MsgB])] sub_a: AwesomeSubSysA, @@ -25,22 +26,23 @@ 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 `::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`. -* `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` 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 = Orchestra::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 @@ -65,7 +67,7 @@ is not ready to be included in the Orchestra: ```rust #[orchestra(signal=SigSigSig, event=Event, gen=AllMessages, error=OrchestraError)] - pub struct Orchestra { + pub struct Opera { #[subsystem(MsgA, sends: MsgB)] sub_a: AwesomeSubSysA, @@ -85,6 +87,4 @@ A task spawner and subsystem context are required to be defined with `Spawner` a 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=orchestra/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`. diff --git a/node/overseer/orchestra/adr/01-adr.md b/node/overseer/orchestra/adr/01-adr.md index e9df45c9e194..3b1cb57eb322 100644 --- a/node/overseer/orchestra/adr/01-adr.md +++ b/node/overseer/orchestra/adr/01-adr.md @@ -16,6 +16,6 @@ with an aditional set of outgoing messages and enforce this via more fine graine ## Consequences * 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 overseer declaration. `${Subsystem}OutgoingMessages` is used throughout everywhere to constrain the outgoing messages (commonly referred to as `OutgoingMessage` generic bounded by `${Subsystem}OutgoingMessages: From` 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. +* 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` 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. diff --git a/node/overseer/orchestra/examples/duo.rs b/node/overseer/orchestra/examples/duo.rs index 84a016969509..7e5cc32cd8ac 100644 --- a/node/overseer/orchestra/examples/duo.rs +++ b/node/overseer/orchestra/examples/duo.rs @@ -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 orchestra::{self as overseer, Spawner, *}; +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 AwesomeSubSys { fn start(self, mut ctx: Context) -> SpawnedSubsystem { let mut sender = ctx.sender().clone(); @@ -30,7 +30,7 @@ impl AwesomeSubSys { #[derive(Default)] pub struct Fortified; -#[overseer::subsystem(GoblinTower, error=Yikes)] +#[orchestra::subsystem(GoblinTower, error=Yikes)] impl Fortified { fn start(self, mut ctx: Context) -> SpawnedSubsystem { let mut sender = ctx.sender().clone(); @@ -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 }); } diff --git a/node/overseer/orchestra/examples/solo.rs b/node/overseer/orchestra/examples/solo.rs index 1ffd7b16855e..2ca53cb64868 100644 --- a/node/overseer/orchestra/examples/solo.rs +++ b/node/overseer/orchestra/examples/solo.rs @@ -1,8 +1,8 @@ -#![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 orchestra::{self as overseer, Spawner, *}; +use orchestra::{self as orchestra, Spawner, *}; mod misc; pub use self::misc::*; @@ -16,7 +16,7 @@ struct Solo { #[derive(Default)] pub struct Fortified; -#[overseer::subsystem(GoblinTower, error=Yikes)] +#[orchestra::subsystem(GoblinTower, error=Yikes)] impl Fortified { fn start(self, mut ctx: Context) -> SpawnedSubsystem { 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 }); } diff --git a/node/overseer/orchestra/proc-macro/src/impl_builder.rs b/node/overseer/orchestra/proc-macro/src/impl_builder.rs index 6691c5e2980f..89515e0d1048 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_builder.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_builder.rs @@ -27,15 +27,15 @@ fn recollect_without_idx(x: &[T], idx: usize) -> Vec { } /// Implement a builder pattern for the `Orchestra`-type, -/// which acts as the gateway to constructing the overseer. +/// which acts as the gateway to constructing the orchestra. /// /// Elements tagged with `wip` are not covered here. pub(crate) fn impl_builder(info: &OrchestraInfo) -> 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); + 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(); @@ -336,7 +336,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { /// Convenience alias. type SubsystemInitFn = Box ::std::result::Result >; - /// Type for the initialized field of the overseer builder + /// Type for the initialized field of the orchestra builder pub enum Init { /// Defer initialization to a point where the `handle` is available. Fn(SubsystemInitFn), @@ -344,7 +344,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> 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()` @@ -363,11 +363,11 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { } } - impl #overseer_name + impl #orchestra_name 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< #field_type > )* > where @@ -379,7 +379,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> 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: &OrchestraInfo) -> 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 } @@ -530,7 +530,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { .collect::>(); 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<#field_type>, )*>; // A builder specialization where all fields are set @@ -539,18 +539,18 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> 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, #handle), #error_ty> { + -> ::std::result::Result<(#orchestra_name, #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, #handle), #error_ty> + -> ::std::result::Result<(#orchestra_name, #handle), #error_ty> { let #connector { handle: events_tx, @@ -559,7 +559,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { let handle = events_tx.clone(); - let (to_overseer_tx, to_overseer_rx) = #support_crate ::metered::unbounded::< + let (to_orchestra_tx, to_orchestra_rx) = #support_crate ::metered::unbounded::< ToOrchestra >(); @@ -618,7 +618,7 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> proc_macro2::TokenStream { signal_rx, message_rx, channels_out.clone(), - to_overseer_tx.clone(), + to_orchestra_tx.clone(), #subsystem_name_str_literal ); @@ -637,8 +637,8 @@ pub(crate) fn impl_builder(info: &OrchestraInfo) -> 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: &OrchestraInfo) -> proc_macro2::TokenStream { spawner, running_subsystems, events_rx, - to_overseer_rx, + to_orchestra_rx, }; - Ok((overseer, handle)) + Ok((orchestra, handle)) } } }); diff --git a/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs b/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs index 799174dedd45..d697ff34da97 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_channels_out.rs @@ -36,7 +36,7 @@ pub(crate) fn impl_channels_out_struct(info: &OrchestraInfo) -> Result 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(); @@ -53,21 +53,21 @@ pub(crate) fn impl_orchestra_struct(info: &OrchestraInfo) -> proc_macro2::TokenS 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. @@ -88,15 +88,15 @@ pub(crate) fn impl_orchestra_struct(info: &OrchestraInfo) -> proc_macro2::TokenS >, /// Gather running subsystems' outbound streams into one. - to_overseer_rx: #support_crate ::stream::Fuse< + 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. /// diff --git a/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs b/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs index e34dbdd41b80..7987a60ba1ec 100644 --- a/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs +++ b/node/overseer/orchestra/proc-macro/src/impl_subsystem_ctx_sender.rs @@ -55,8 +55,8 @@ fn graphviz( pub(crate) fn impl_subsystem_types_all(info: &OrchestraInfo) -> Result { 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; @@ -137,7 +137,7 @@ pub(crate) fn impl_subsystem_types_all(info: &OrchestraInfo) -> Result Result ::std::result::Result, #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() { @@ -471,7 +471,7 @@ 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 ::OrchestraError::Context( @@ -499,11 +499,11 @@ pub(crate) fn impl_subsystem_context_trait_for( } }; - if let #support_crate ::FromOrchestra::Signal(_) = from_overseer { + if let #support_crate ::FromOrchestra::Signal(_) = from_orchestra { self.signals_received.inc(); } - return Ok(from_overseer); + return Ok(from_orchestra); } } @@ -514,7 +514,7 @@ pub(crate) fn impl_subsystem_context_trait_for( fn spawn(&mut self, name: &'static str, s: Pin + Send>>) -> ::std::result::Result<(), #error_ty> { - self.to_overseer.unbounded_send(#support_crate ::ToOrchestra::SpawnJob { + self.to_orchestra.unbounded_send(#support_crate ::ToOrchestra::SpawnJob { name, subsystem: Some(self.name()), s, @@ -525,7 +525,7 @@ pub(crate) fn impl_subsystem_context_trait_for( fn spawn_blocking(&mut self, name: &'static str, s: Pin + Send>>) -> ::std::result::Result<(), #error_ty> { - self.to_overseer.unbounded_send(#support_crate ::ToOrchestra::SpawnBlockingJob { + self.to_orchestra.unbounded_send(#support_crate ::ToOrchestra::SpawnBlockingJob { name, subsystem: Some(self.name()), s, @@ -666,7 +666,7 @@ pub(crate) fn impl_subsystem_context( signals: #support_crate ::metered::MeteredReceiver< #signal_ty >, messages: SubsystemIncomingMessages< M >, to_subsystems: #subsystem_sender_name < ::OutgoingMessages >, - to_overseer: #support_crate ::metered::UnboundedMeteredSender< + to_orchestra: #support_crate ::metered::UnboundedMeteredSender< #support_crate ::ToOrchestra >, signals_received: SignalsReceived, @@ -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:: ToOrchestra>, + 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 diff --git a/node/overseer/orchestra/proc-macro/src/orchestra.rs b/node/overseer/orchestra/proc-macro/src/orchestra.rs index f258c58508b9..5f906eed694e 100644 --- a/node/overseer/orchestra/proc-macro/src/orchestra.rs +++ b/node/overseer/orchestra/proc-macro/src/orchestra.rs @@ -33,7 +33,7 @@ pub(crate) fn impl_orchestra_gen( 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, @@ -53,7 +53,7 @@ pub(crate) fn impl_orchestra_gen( additive.extend(impl_message_wrapper_enum(&info)?); let ts = expander::Expander::new("orchestra-expansion") - .add_comment("Generated overseer code by `#[orchestra(..)]`".to_owned()) + .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 diff --git a/node/overseer/orchestra/proc-macro/src/parse/mod.rs b/node/overseer/orchestra/proc-macro/src/parse/mod.rs index f1d82ff93451..3d6a6c7043ac 100644 --- a/node/overseer/orchestra/proc-macro/src/parse/mod.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/mod.rs @@ -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::*; diff --git a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_orchestra_attr.rs similarity index 94% rename from node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs rename to node/overseer/orchestra/proc-macro/src/parse/parse_orchestra_attr.rs index 25406901328a..f5bba725af09 100644 --- a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_attr.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/parse_orchestra_attr.rs @@ -160,7 +160,7 @@ impl Parse for OrchestraAttrArgs { 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,10 +172,10 @@ impl Parse for OrchestraAttrArgs { 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, ExternOrchestraSignalType; 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(OrchestraAttrArgs { diff --git a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_orchestra_struct.rs similarity index 99% rename from node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs rename to node/overseer/orchestra/proc-macro/src/parse/parse_orchestra_struct.rs index 15a3fdf09a4b..9482429c5667 100644 --- a/node/overseer/orchestra/proc-macro/src/parse/parse_overseer_struct.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/parse_orchestra_struct.rs @@ -272,9 +272,9 @@ pub(crate) struct OrchestraInfo { pub(crate) baggage: Vec, /// 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, @@ -389,7 +389,7 @@ impl OrchestraInfo { } } -/// Internals of the overseer. +/// Internals of the orchestra. #[derive(Debug, Clone)] pub(crate) struct OrchestraGuts { pub(crate) name: Ident, diff --git a/node/overseer/orchestra/proc-macro/src/parse/parse_subsystem_attr.rs b/node/overseer/orchestra/proc-macro/src/parse/parse_subsystem_attr.rs index ec308a6b804f..e27031349e63 100644 --- a/node/overseer/orchestra/proc-macro/src/parse/parse_subsystem_attr.rs +++ b/node/overseer/orchestra/proc-macro/src/parse/parse_subsystem_attr.rs @@ -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, eq_token: Option, 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 }) } diff --git a/node/overseer/orchestra/proc-macro/src/subsystem.rs b/node/overseer/orchestra/proc-macro/src/subsystem.rs index c1e79b6f3d42..c12c742e0eb3 100644 --- a/node/overseer/orchestra/proc-macro/src/subsystem.rs +++ b/node/overseer/orchestra/proc-macro/src/subsystem.rs @@ -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. diff --git a/node/overseer/orchestra/src/lib.rs b/node/overseer/orchestra/src/lib.rs index 84b24711107f..8f872cf3a668 100644 --- a/node/overseer/orchestra/src/lib.rs +++ b/node/overseer/orchestra/src/lib.rs @@ -122,12 +122,12 @@ pub trait Spawner: Clone + Send + Sync { ); } -/// A type of messages that are sent from a [`Subsystem`] to the declared overseer. +/// A type of messages that are sent from a [`Subsystem`] to the declared orchestra. /// /// Used to launch jobs. 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. @@ -349,8 +349,8 @@ pub struct SubsystemInstance { 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. diff --git a/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs index d43ca412ca68..589bcede9963 100644 --- a/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs +++ b/node/overseer/orchestra/tests/ui/err-01-duplicate-consumer.rs @@ -31,7 +31,7 @@ struct DummySpawner; struct DummyCtx; fn main() { - let overseer = Orchestra::<_,_>::builder() + let orchestra = Orchestra::<_,_>::builder() .sub0(AwesomeSubSys::default()) .spawner(DummySpawner) .build(|| -> DummyCtx { DummyCtx } ); diff --git a/node/overseer/orchestra/tests/ui/err-02-enum.rs b/node/overseer/orchestra/tests/ui/err-02-enum.rs index 3ba4bb190305..8d1ddeac6dda 100644 --- a/node/overseer/orchestra/tests/ui/err-02-enum.rs +++ b/node/overseer/orchestra/tests/ui/err-02-enum.rs @@ -24,7 +24,7 @@ struct DummySpawner; struct DummyCtx; fn main() { - let overseer = Orchestra::<_,_>::builder() + let orchestra = Orchestra::<_,_>::builder() .sub0(AwesomeSubSys::default()) .i_like_pie(std::f64::consts::PI) .spawner(DummySpawner) diff --git a/node/overseer/orchestra/tests/ui/err-02-enum.stderr b/node/overseer/orchestra/tests/ui/err-02-enum.stderr index 19fc5e34cc40..d83aab2ea23b 100644 --- a/node/overseer/orchestra/tests/ui/err-02-enum.stderr +++ b/node/overseer/orchestra/tests/ui/err-02-enum.stderr @@ -7,5 +7,5 @@ error: expected `struct` error[E0433]: failed to resolve: use of undeclared type `Orchestra` --> $DIR/err-02-enum.rs:27:17 | -27 | let overseer = Orchestra::<_,_>::builder() +27 | let orchestra = Orchestra::<_,_>::builder() | ^^^^^^^^ use of undeclared type `Orchestra` diff --git a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs index cca300d113cf..187d9e1e7a5b 100644 --- a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs +++ b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.rs @@ -31,7 +31,7 @@ struct DummySpawner; struct DummyCtx; fn main() { - let overseer = Orchestra::<_,_>::builder() + let orchestra = Orchestra::<_,_>::builder() .sub0(AwesomeSubSys::default()) .i_like_pie(std::f64::consts::PI) .spawner(DummySpawner) diff --git a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr index 25e9505442a9..3fb97a88d7ab 100644 --- a/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr +++ b/node/overseer/orchestra/tests/ui/err-03-subsys-twice.stderr @@ -13,5 +13,5 @@ error: previously defined here. error[E0433]: failed to resolve: use of undeclared type `Orchestra` --> $DIR/err-03-subsys-twice.rs:34:17 | -34 | let overseer = Orchestra::<_,_>::builder() +34 | let orchestra = Orchestra::<_,_>::builder() | ^^^^^^^^ use of undeclared type `Orchestra` diff --git a/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr b/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr index 58bc388bb033..7b7dc015eade 100644 --- a/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr +++ b/node/overseer/orchestra/tests/ui/err-04-missing-error.stderr @@ -1,4 +1,4 @@ -error: Must declare the overseer error type via `error=..`. +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)] diff --git a/node/overseer/orchestra/tests/ui/ok-01-wip.rs b/node/overseer/orchestra/tests/ui/ok-01-wip.rs index 79686ecbe579..4efe75f29a46 100644 --- a/node/overseer/orchestra/tests/ui/ok-01-wip.rs +++ b/node/overseer/orchestra/tests/ui/ok-01-wip.rs @@ -66,7 +66,7 @@ pub struct Orchestra { pub struct DummyCtx; fn main() { - let _overseer_builder = Orchestra::builder() + let _orchestra_builder = Orchestra::builder() .sub_a(AwesomeSubSysA::default()) // b is tagged as `wip` // .sub_b(AwesomeSubSysB::default()) From 8f0bc87fd6d52504deceffc9e5f7dafc5754fbf9 Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Thu, 19 May 2022 13:16:27 +0200 Subject: [PATCH 10/15] leaky data --- node/overseer/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index 829d7db87d52..8c38f8a8299f 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -744,7 +744,7 @@ where } } }, - msg = self.to_overseer_rx.select_next_some() => { + msg = self.to_orchestra_rx.select_next_some() => { match msg { ToOrchestra::SpawnJob { name, subsystem, s } => { self.spawn_job(name, subsystem, s); From 8e1c8e54b4e9e1ae078538f1ac227acb8127026f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 10:51:25 +0200 Subject: [PATCH 11/15] 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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 10 +++++----- core-primitives/Cargo.toml | 2 +- parachain/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- runtime/common/Cargo.toml | 2 +- runtime/kusama/Cargo.toml | 2 +- runtime/parachains/Cargo.toml | 2 +- runtime/polkadot/Cargo.toml | 2 +- runtime/rococo/Cargo.toml | 2 +- runtime/test-runtime/Cargo.toml | 2 +- runtime/westend/Cargo.toml | 2 +- xcm/Cargo.toml | 2 +- xcm/pallet-xcm-benchmarks/Cargo.toml | 2 +- xcm/pallet-xcm/Cargo.toml | 2 +- xcm/xcm-builder/Cargo.toml | 2 +- xcm/xcm-simulator/example/Cargo.toml | 2 +- xcm/xcm-simulator/fuzzer/Cargo.toml | 2 +- 17 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9439e28cc860..c81128118230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9594,9 +9594,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8980cafbe98a7ee7a9cc16b32ebce542c77883f512d83fbf2ddc8f6a85ea74c9" +checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -9608,9 +9608,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4260c630e8a8a33429d1688eff2f163f24c65a4e1b1578ef6b565061336e4b6f" +checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11829,7 +11829,7 @@ version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ee73e6e4924fe940354b8d4d98cad5231175d615cd855b758adc658c0aac6a0" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "digest 0.10.3", "rand 0.8.5", "static_assertions", diff --git a/core-primitives/Cargo.toml b/core-primitives/Cargo.toml index 735a41e38256..cc8bd9744ef4 100644 --- a/core-primitives/Cargo.toml +++ b/core-primitives/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = [ "derive" ] } parity-util-mem = { version = "0.11.0", default-features = false, optional = true } diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 7aba0b221800..d6ca70dac8bc 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" # various unnecessary Substrate-specific endpoints. parity-scale-codec = { version = "3.1.2", default-features = false, features = [ "derive" ] } parity-util-mem = { version = "0.11.0", default-features = false, optional = true } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index c45a96dcb91e..f980bfe6d695 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] serde = { version = "1.0.137", optional = true, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["bit-vec", "derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["bit-vec", "derive"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = ["bit-vec", "derive"] } primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 215655ab6a1f..b2f97938a467 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -10,7 +10,7 @@ bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } rustc-hex = { version = "2.1.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.137", default-features = false } serde_derive = { version = "1.0.117", optional = true } static_assertions = "1.1.0" diff --git a/runtime/kusama/Cargo.toml b/runtime/kusama/Cargo.toml index 3064fa9292ea..60d22fc2db0f 100644 --- a/runtime/kusama/Cargo.toml +++ b/runtime/kusama/Cargo.toml @@ -8,7 +8,7 @@ build = "build.rs" [dependencies] bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } rustc-hex = { version = "2.1.0", default-features = false } serde = { version = "1.0.137", default-features = false } diff --git a/runtime/parachains/Cargo.toml b/runtime/parachains/Cargo.toml index 71eea7d8d7f1..8a45553e5a6d 100644 --- a/runtime/parachains/Cargo.toml +++ b/runtime/parachains/Cargo.toml @@ -9,7 +9,7 @@ bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } rustc-hex = { version = "2.1.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.137", features = [ "derive" ], optional = true } derive_more = "0.99.17" bitflags = "1.3.2" diff --git a/runtime/polkadot/Cargo.toml b/runtime/polkadot/Cargo.toml index 72137430cfad..1c41bc5db6a3 100644 --- a/runtime/polkadot/Cargo.toml +++ b/runtime/polkadot/Cargo.toml @@ -8,7 +8,7 @@ build = "build.rs" [dependencies] bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } rustc-hex = { version = "2.1.0", default-features = false } serde = { version = "1.0.137", default-features = false } diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index c74f97653ee0..c8b1d16a75a1 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -7,7 +7,7 @@ build = "build.rs" [dependencies] parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.137", default-features = false } serde_derive = { version = "1.0.117", optional = true } smallvec = "1.8.0" diff --git a/runtime/test-runtime/Cargo.toml b/runtime/test-runtime/Cargo.toml index 0961b7084816..27b1f7f1512f 100644 --- a/runtime/test-runtime/Cargo.toml +++ b/runtime/test-runtime/Cargo.toml @@ -10,7 +10,7 @@ bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } rustc-hex = { version = "2.1.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.137", default-features = false } serde_derive = { version = "1.0.117", optional = true } smallvec = "1.8.0" diff --git a/runtime/westend/Cargo.toml b/runtime/westend/Cargo.toml index 693027e01ed5..9e443f856b4a 100644 --- a/runtime/westend/Cargo.toml +++ b/runtime/westend/Cargo.toml @@ -8,7 +8,7 @@ build = "build.rs" [dependencies] bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } rustc-hex = { version = "2.1.0", default-features = false } serde = { version = "1.0.137", default-features = false } diff --git a/xcm/Cargo.toml b/xcm/Cargo.toml index ac7839cdcb29..391dc56e008c 100644 --- a/xcm/Cargo.toml +++ b/xcm/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] impl-trait-for-tuples = "0.2.2" parity-scale-codec = { version = "3.1.2", default-features = false, features = [ "derive" ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } derivative = {version = "2.2.0", default-features = false, features = [ "use_core" ] } log = { version = "0.4.17", default-features = false } xcm-procedural = { path = "procedural" } diff --git a/xcm/pallet-xcm-benchmarks/Cargo.toml b/xcm/pallet-xcm-benchmarks/Cargo.toml index 03f483e4a570..08a29de8b762 100644 --- a/xcm/pallet-xcm-benchmarks/Cargo.toml +++ b/xcm/pallet-xcm-benchmarks/Cargo.toml @@ -9,7 +9,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } frame-support = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" } frame-system = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" } sp-runtime = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" } diff --git a/xcm/pallet-xcm/Cargo.toml b/xcm/pallet-xcm/Cargo.toml index a8f0d98403a5..01fc74b09e82 100644 --- a/xcm/pallet-xcm/Cargo.toml +++ b/xcm/pallet-xcm/Cargo.toml @@ -6,7 +6,7 @@ version = "0.9.22" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.137", optional = true, features = ["derive"] } log = { version = "0.4.17", default-features = false } diff --git a/xcm/xcm-builder/Cargo.toml b/xcm/xcm-builder/Cargo.toml index 69779a3430dd..4e785383e285 100644 --- a/xcm/xcm-builder/Cargo.toml +++ b/xcm/xcm-builder/Cargo.toml @@ -7,7 +7,7 @@ version = "0.9.22" [dependencies] parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } xcm = { path = "..", default-features = false } xcm-executor = { path = "../xcm-executor", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } diff --git a/xcm/xcm-simulator/example/Cargo.toml b/xcm/xcm-simulator/example/Cargo.toml index 4f7696a68213..7538afe43b6e 100644 --- a/xcm/xcm-simulator/example/Cargo.toml +++ b/xcm/xcm-simulator/example/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0" } -scale-info = { version = "2.1.1", features = ["derive"] } +scale-info = { version = "2.1.2", features = ["derive"] } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/xcm/xcm-simulator/fuzzer/Cargo.toml b/xcm/xcm-simulator/fuzzer/Cargo.toml index 52955bfc8995..966fd51c0fd6 100644 --- a/xcm/xcm-simulator/fuzzer/Cargo.toml +++ b/xcm/xcm-simulator/fuzzer/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0" } honggfuzz = "0.5.54" -scale-info = { version = "2.1.1", features = ["derive"] } +scale-info = { version = "2.1.2", features = ["derive"] } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } From 0183579c32537cc8c7560a69baa7b89801924afe Mon Sep 17 00:00:00 2001 From: Malte Kliemann Date: Thu, 19 May 2022 11:09:49 +0200 Subject: [PATCH 12/15] Add missing markdown code block delimiter (#5555) --- runtime/common/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index d9dac14a0f5e..0a6ca7b6e9c8 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -226,6 +226,7 @@ impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig { /// pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD"); /// pub const VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES); /// } +/// ``` #[macro_export] macro_rules! prod_or_fast { ($prod:expr, $test:expr) => { From 380356ec0208692f93bfd0cefe77aceddb2d2b6b Mon Sep 17 00:00:00 2001 From: Chris Sosnin <48099298+slumber@users.noreply.github.com> Date: Thu, 19 May 2022 14:01:22 +0300 Subject: [PATCH 13/15] bitfield-signing: remove util::jobs usage (#5523) --- node/core/bitfield-signing/src/lib.rs | 271 ++++++++++++++---------- node/core/bitfield-signing/src/tests.rs | 2 +- node/service/src/overseer.rs | 8 +- 3 files changed, 158 insertions(+), 123 deletions(-) diff --git a/node/core/bitfield-signing/src/lib.rs b/node/core/bitfield-signing/src/lib.rs index 3b082de92109..ad9f93f3d598 100644 --- a/node/core/bitfield-signing/src/lib.rs +++ b/node/core/bitfield-signing/src/lib.rs @@ -24,22 +24,21 @@ use futures::{ channel::{mpsc, oneshot}, future, lock::Mutex, - prelude::*, - Future, + FutureExt, }; use polkadot_node_subsystem::{ errors::RuntimeApiError, jaeger, messages::{ - AvailabilityStoreMessage, BitfieldDistributionMessage, BitfieldSigningMessage, - RuntimeApiMessage, RuntimeApiRequest, + AvailabilityStoreMessage, BitfieldDistributionMessage, RuntimeApiMessage, RuntimeApiRequest, }, - overseer, ActivatedLeaf, LeafStatus, PerLeafSpan, SubsystemSender, + overseer, ActivatedLeaf, FromOverseer, LeafStatus, OverseerSignal, PerLeafSpan, + SpawnedSubsystem, SubsystemError, SubsystemResult, SubsystemSender, }; -use polkadot_node_subsystem_util::{self as util, JobSender, JobSubsystem, JobTrait, Validator}; +use polkadot_node_subsystem_util::{self as util, Validator}; use polkadot_primitives::v2::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex}; use sp_keystore::{Error as KeystoreError, SyncCryptoStorePtr}; -use std::{iter::FromIterator, pin::Pin, time::Duration}; +use std::{collections::HashMap, iter::FromIterator, time::Duration}; use wasm_timer::{Delay, Instant}; mod metrics; @@ -49,12 +48,10 @@ use self::metrics::Metrics; mod tests; /// Delay between starting a bitfield signing job and its attempting to create a bitfield. -const JOB_DELAY: Duration = Duration::from_millis(1500); +const SPAWNED_TASK_DELAY: Duration = Duration::from_millis(1500); const LOG_TARGET: &str = "parachain::bitfield-signing"; -/// Each `BitfieldSigningJob` prepares a signed bitfield for a single relay parent. -pub struct BitfieldSigningJob(std::marker::PhantomData); - +// TODO: use `fatality` (https://github.com/paritytech/polkadot/issues/5540). /// Errors we may encounter in the course of executing the `BitfieldSigningSubsystem`. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] @@ -182,114 +179,156 @@ async fn construct_availability_bitfield( Ok(AvailabilityBitfield(core_bits)) } -impl JobTrait for BitfieldSigningJob +/// The bitfield signing subsystem. +pub struct BitfieldSigningSubsystem { + keystore: SyncCryptoStorePtr, + metrics: Metrics, +} + +impl BitfieldSigningSubsystem { + /// Create a new instance of the `BitfieldSigningSubsystem`. + pub fn new(keystore: SyncCryptoStorePtr, metrics: Metrics) -> Self { + Self { keystore, metrics } + } +} + +#[overseer::subsystem(BitfieldSigning, error=SubsystemError, prefix=self::overseer)] +impl BitfieldSigningSubsystem { + fn start(self, ctx: Context) -> SpawnedSubsystem { + let future = async move { + run(ctx, self.keystore, self.metrics) + .await + .map_err(|e| SubsystemError::with_origin("bitfield-signing", e)) + } + .boxed(); + + SpawnedSubsystem { name: "bitfield-signing-subsystem", future } + } +} + +#[overseer::contextbounds(BitfieldSigning, prefix = self::overseer)] +async fn run( + mut ctx: Context, + keystore: SyncCryptoStorePtr, + metrics: Metrics, +) -> SubsystemResult<()> { + // Track spawned jobs per active leaf. + let mut running = HashMap::::new(); + + loop { + match ctx.recv().await? { + FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => { + // Abort jobs for deactivated leaves. + for leaf in &update.deactivated { + if let Some(handle) = running.remove(leaf) { + handle.abort(); + } + } + + for leaf in update.activated { + let sender = ctx.sender().clone(); + let leaf_hash = leaf.hash; + + let (fut, handle) = future::abortable(handle_active_leaves_update( + sender, + leaf, + keystore.clone(), + metrics.clone(), + )); + + running.insert(leaf_hash, handle); + + ctx.spawn("bitfield-signing-job", fut.map(drop).boxed())?; + } + }, + FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {}, + FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()), + FromOverseer::Communication { .. } => {}, + } + } +} + +async fn handle_active_leaves_update( + mut sender: Sender, + leaf: ActivatedLeaf, + keystore: SyncCryptoStorePtr, + metrics: Metrics, +) -> Result<(), Error> where - Sender: overseer::BitfieldSigningSenderTrait + Unpin, + Sender: overseer::BitfieldSigningSenderTrait, { - type ToJob = BitfieldSigningMessage; - type OutgoingMessages = overseer::BitfieldSigningOutgoingMessages; - type Sender = Sender; - type Error = Error; - type RunArgs = SyncCryptoStorePtr; - type Metrics = Metrics; - - const NAME: &'static str = "bitfield-signing-job"; - - /// Run a job for the parent block indicated - fn run( - leaf: ActivatedLeaf, - keystore: Self::RunArgs, - metrics: Self::Metrics, - _receiver: mpsc::Receiver, - mut sender: JobSender, - ) -> Pin> + Send>> { - let metrics = metrics.clone(); - async move { - if let LeafStatus::Stale = leaf.status { - gum::debug!( + if let LeafStatus::Stale = leaf.status { + gum::debug!( + target: LOG_TARGET, + relay_parent = ?leaf.hash, + block_number = ?leaf.number, + "Skip bitfield signing for stale leaf" + ); + return Ok(()) + } + + let span = PerLeafSpan::new(leaf.span, "bitfield-signing"); + let span_delay = span.child("delay"); + let wait_until = Instant::now() + SPAWNED_TASK_DELAY; + + // now do all the work we can before we need to wait for the availability store + // if we're not a validator, we can just succeed effortlessly + let validator = match Validator::new(leaf.hash, keystore.clone(), &mut sender).await { + Ok(validator) => validator, + Err(util::Error::NotAValidator) => return Ok(()), + Err(err) => return Err(Error::Util(err)), + }; + + // wait a bit before doing anything else + Delay::new_at(wait_until).await?; + + // this timer does not appear at the head of the function because we don't want to include + // SPAWNED_TASK_DELAY each time. + let _timer = metrics.time_run(); + + drop(span_delay); + let span_availability = span.child("availability"); + + let bitfield = match construct_availability_bitfield( + leaf.hash, + &span_availability, + validator.index(), + &mut sender, + ) + .await + { + Err(Error::Runtime(runtime_err)) => { + // Don't take down the node on runtime API errors. + gum::warn!(target: LOG_TARGET, err = ?runtime_err, "Encountered a runtime API error"); + return Ok(()) + }, + Err(err) => return Err(err), + Ok(bitfield) => bitfield, + }; + + drop(span_availability); + let span_signing = span.child("signing"); + + let signed_bitfield = + match validator.sign(keystore, bitfield).await.map_err(|e| Error::Keystore(e))? { + Some(b) => b, + None => { + gum::error!( target: LOG_TARGET, - hash = ?leaf.hash, - block_number = ?leaf.number, - "Stale leaf - don't sign bitfields." + "Key was found at construction, but while signing it could not be found.", ); return Ok(()) - } - - let span = PerLeafSpan::new(leaf.span, "bitfield-signing"); - let _span = span.child("delay"); - let wait_until = Instant::now() + JOB_DELAY; - - // now do all the work we can before we need to wait for the availability store - // if we're not a validator, we can just succeed effortlessly - let validator = match Validator::new(leaf.hash, keystore.clone(), &mut sender).await { - Ok(validator) => validator, - Err(util::Error::NotAValidator) => return Ok(()), - Err(err) => return Err(Error::Util(err)), - }; - - // wait a bit before doing anything else - Delay::new_at(wait_until).await?; - - // this timer does not appear at the head of the function because we don't want to include - // JOB_DELAY each time. - let _timer = metrics.time_run(); - - drop(_span); - let span_availability = span.child("availability"); - - let bitfield = match construct_availability_bitfield( - leaf.hash, - &span_availability, - validator.index(), - sender.subsystem_sender(), - ) - .await - { - Err(Error::Runtime(runtime_err)) => { - // Don't take down the node on runtime API errors. - gum::warn!(target: LOG_TARGET, err = ?runtime_err, "Encountered a runtime API error"); - return Ok(()) - }, - Err(err) => return Err(err), - Ok(bitfield) => bitfield, - }; - - drop(span_availability); - let _span = span.child("signing"); - - let signed_bitfield = match validator - .sign(keystore.clone(), bitfield) - .await - .map_err(|e| Error::Keystore(e))? - { - Some(b) => b, - None => { - gum::error!( - target: LOG_TARGET, - "Key was found at construction, but while signing it could not be found.", - ); - return Ok(()) - }, - }; - - metrics.on_bitfield_signed(); - - drop(_span); - let _span = span.child("gossip"); - - sender - .send_message(BitfieldDistributionMessage::DistributeBitfield( - leaf.hash, - signed_bitfield, - )) - .await; - - Ok(()) - } - .boxed() - } -} + }, + }; + + metrics.on_bitfield_signed(); -/// `BitfieldSigningSubsystem` manages a number of bitfield signing jobs. -pub type BitfieldSigningSubsystem = - JobSubsystem, Spawner>; + drop(span_signing); + let _span_gossip = span.child("gossip"); + + sender + .send_message(BitfieldDistributionMessage::DistributeBitfield(leaf.hash, signed_bitfield)) + .await; + + Ok(()) +} diff --git a/node/core/bitfield-signing/src/tests.rs b/node/core/bitfield-signing/src/tests.rs index b2c0c4e174d9..19777c29157f 100644 --- a/node/core/bitfield-signing/src/tests.rs +++ b/node/core/bitfield-signing/src/tests.rs @@ -15,7 +15,7 @@ // along with Polkadot. If not, see . use super::*; -use futures::{executor::block_on, pin_mut}; +use futures::{executor::block_on, pin_mut, StreamExt}; use polkadot_node_subsystem::messages::AllMessages; use polkadot_primitives::v2::{CandidateHash, OccupiedCore}; use test_helpers::dummy_candidate_descriptor; diff --git a/node/service/src/overseer.rs b/node/service/src/overseer.rs index 2001076aa1db..06d47d7de0c5 100644 --- a/node/service/src/overseer.rs +++ b/node/service/src/overseer.rs @@ -26,7 +26,7 @@ use polkadot_node_core_chain_selection::Config as ChainSelectionConfig; use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig; use polkadot_node_core_provisioner::ProvisionerConfig; use polkadot_node_network_protocol::request_response::{v1 as request_v1, IncomingRequestReceiver}; -use polkadot_node_subsystem_types::messages::{BitfieldSigningMessage, ProvisionerMessage}; +use polkadot_node_subsystem_types::messages::ProvisionerMessage; #[cfg(any(feature = "malus", test))] pub use polkadot_overseer::{ dummy::{dummy_overseer_builder, DummySubsystem}, @@ -156,10 +156,7 @@ pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>( StatementDistributionSubsystem, AvailabilityDistributionSubsystem, AvailabilityRecoverySubsystem, - BitfieldSigningSubsystem< - SpawnGlue, - as SubsystemContext>::Sender, - >, + BitfieldSigningSubsystem, BitfieldDistributionSubsystem, ProvisionerSubsystem< SpawnGlue, @@ -211,7 +208,6 @@ where )) .bitfield_distribution(BitfieldDistributionSubsystem::new(Metrics::register(registry)?)) .bitfield_signing(BitfieldSigningSubsystem::new( - spawner.clone(), keystore.clone(), Metrics::register(registry)?, )) From 47ccca9d13a5ee55cadf000dc3ef5c1a5182e168 Mon Sep 17 00:00:00 2001 From: Koute Date: Thu, 19 May 2022 20:06:34 +0900 Subject: [PATCH 14/15] 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 <> --- Cargo.lock | 461 ++++++++++++---------------- node/core/pvf/Cargo.toml | 1 + node/core/pvf/src/artifacts.rs | 3 - node/core/pvf/src/execute/worker.rs | 21 +- node/core/pvf/src/executor_intf.rs | 31 +- node/core/pvf/src/prepare/worker.rs | 4 +- node/core/pvf/src/testing.rs | 9 +- node/test/service/src/lib.rs | 9 +- 8 files changed, 241 insertions(+), 298 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c81128118230..648562d6ad33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -433,7 +433,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "beefy-primitives", "fnv", @@ -467,7 +467,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -487,12 +487,12 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -1401,15 +1401,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ct-logs" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" -dependencies = [ - "sct 0.6.1", -] - [[package]] name = "ctor" version = "0.1.21" @@ -1936,9 +1927,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.5.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] @@ -2096,7 +2087,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", ] @@ -2114,7 +2105,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -2136,7 +2127,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "Inflector", "chrono", @@ -2186,7 +2177,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2197,7 +2188,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2213,7 +2204,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -2241,7 +2232,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "bitflags", "frame-metadata", @@ -2271,7 +2262,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -2283,7 +2274,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2295,7 +2286,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro2", "quote", @@ -2305,7 +2296,7 @@ dependencies = [ [[package]] name = "frame-support-test" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-support-test-pallet", @@ -2328,7 +2319,7 @@ dependencies = [ [[package]] name = "frame-support-test-pallet" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -2339,7 +2330,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "log", @@ -2356,7 +2347,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -2371,7 +2362,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "sp-api", @@ -2380,7 +2371,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "sp-api", @@ -2516,8 +2507,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01fe9932a224b72b45336d96040aa86386d674a31d0af27d800ea7bc8ca97fe" dependencies = [ "futures-io", - "rustls 0.20.2", - "webpki 0.22.0", + "rustls", + "webpki", ] [[package]] @@ -2559,7 +2550,7 @@ dependencies = [ [[package]] name = "generate-bags" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "chrono", "frame-election-provider-support", @@ -2927,19 +2918,17 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" dependencies = [ - "ct-logs", - "futures-util", + "http", "hyper", "log", - "rustls 0.19.1", - "rustls-native-certs 0.5.0", + "rustls", + "rustls-native-certs", "tokio", - "tokio-rustls 0.22.0", - "webpki 0.21.4", + "tokio-rustls", ] [[package]] @@ -3159,11 +3148,11 @@ dependencies = [ "jsonrpsee-core", "jsonrpsee-types", "pin-project 1.0.10", - "rustls-native-certs 0.6.1", + "rustls-native-certs", "soketto", "thiserror", "tokio", - "tokio-rustls 0.23.2", + "tokio-rustls", "tokio-util 0.7.1", "tracing", "webpki-roots", @@ -4251,6 +4240,15 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +[[package]] +name = "memfd" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6627dc657574b49d6ad27105ed671822be56e0d2547d413bfbf3e8d8fa92e7a" +dependencies = [ + "libc", +] + [[package]] name = "memmap" version = "0.7.0" @@ -4902,7 +4900,7 @@ checksum = "20448fd678ec04e6ea15bbe0476874af65e98a01515d667aa49f1434dc44ebf4" [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -4916,7 +4914,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -4932,7 +4930,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -4947,7 +4945,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -4971,7 +4969,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4991,7 +4989,7 @@ dependencies = [ [[package]] name = "pallet-bags-list-remote-tests" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-election-provider-support", "frame-support", @@ -5010,7 +5008,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5025,7 +5023,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "beefy-primitives", "frame-support", @@ -5041,7 +5039,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -5064,7 +5062,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5146,7 +5144,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5165,7 +5163,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5182,7 +5180,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5198,7 +5196,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5221,7 +5219,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5234,7 +5232,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5252,7 +5250,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5267,7 +5265,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5290,7 +5288,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5306,7 +5304,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5326,7 +5324,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5343,7 +5341,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5360,7 +5358,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -5378,7 +5376,7 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -5393,7 +5391,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5408,7 +5406,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -5422,7 +5420,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -5438,7 +5436,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5457,7 +5455,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -5474,7 +5472,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5497,7 +5495,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5513,7 +5511,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5528,7 +5526,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5543,7 +5541,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5559,7 +5557,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -5580,7 +5578,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5596,7 +5594,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -5610,7 +5608,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5633,7 +5631,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5644,7 +5642,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "sp-arithmetic", @@ -5653,7 +5651,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -5667,7 +5665,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5685,7 +5683,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5704,7 +5702,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-support", "frame-system", @@ -5721,7 +5719,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5736,7 +5734,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5747,7 +5745,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5764,7 +5762,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5780,7 +5778,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-benchmarking", "frame-support", @@ -8247,7 +8245,7 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "env_logger 0.9.0", "jsonrpsee", @@ -8511,19 +8509,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rustls" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" -dependencies = [ - "base64", - "log", - "ring", - "sct 0.6.1", - "webpki 0.21.4", -] - [[package]] name = "rustls" version = "0.20.2" @@ -8532,20 +8517,8 @@ checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" dependencies = [ "log", "ring", - "sct 0.7.0", - "webpki 0.22.0", -] - -[[package]] -name = "rustls-native-certs" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" -dependencies = [ - "openssl-probe", - "rustls 0.19.1", - "schannel", - "security-framework", + "sct", + "webpki", ] [[package]] @@ -8613,7 +8586,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "sp-core", @@ -8624,7 +8597,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "futures 0.3.21", @@ -8651,7 +8624,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "futures-timer", @@ -8674,7 +8647,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -8690,7 +8663,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "impl-trait-for-tuples", "memmap2 0.5.0", @@ -8707,7 +8680,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8718,7 +8691,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "chrono", "clap", @@ -8757,7 +8730,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "fnv", "futures 0.3.21", @@ -8785,7 +8758,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "hash-db", "kvdb", @@ -8810,7 +8783,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "futures 0.3.21", @@ -8834,7 +8807,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "fork-tree", @@ -8877,7 +8850,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "jsonrpsee", @@ -8899,7 +8872,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "fork-tree", "parity-scale-codec", @@ -8912,7 +8885,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "futures 0.3.21", @@ -8937,7 +8910,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "sc-client-api", "sp-authorship", @@ -8948,7 +8921,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "lazy_static", "lru 0.7.5", @@ -8975,7 +8948,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "environmental", "parity-scale-codec", @@ -8992,7 +8965,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "parity-scale-codec", @@ -9007,7 +8980,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "cfg-if 1.0.0", "libc", @@ -9025,7 +8998,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "ahash", "async-trait", @@ -9065,7 +9038,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "finality-grandpa", "futures 0.3.21", @@ -9086,7 +9059,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "ansi_term", "futures 0.3.21", @@ -9103,7 +9076,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "hex", @@ -9118,7 +9091,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "asynchronous-codec", @@ -9170,7 +9143,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "libp2p", @@ -9183,7 +9156,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "ahash", "futures 0.3.21", @@ -9200,7 +9173,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "libp2p", @@ -9220,7 +9193,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "bitflags", "either", @@ -9249,7 +9222,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "bytes", "fnv", @@ -9277,7 +9250,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "libp2p", @@ -9290,7 +9263,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -9299,7 +9272,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "hash-db", @@ -9329,7 +9302,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "jsonrpsee", @@ -9352,7 +9325,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "jsonrpsee", @@ -9365,7 +9338,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "directories", @@ -9430,7 +9403,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "parity-scale-codec", @@ -9444,7 +9417,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -9463,7 +9436,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "libc", @@ -9482,7 +9455,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "chrono", "futures 0.3.21", @@ -9500,7 +9473,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "ansi_term", "atty", @@ -9531,7 +9504,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9542,7 +9515,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "futures-timer", @@ -9569,7 +9542,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "log", @@ -9582,7 +9555,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "futures-timer", @@ -9652,16 +9625,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "sct" version = "0.7.0" @@ -10059,7 +10022,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "hash-db", "log", @@ -10076,7 +10039,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "blake2", "proc-macro-crate", @@ -10088,7 +10051,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -10101,7 +10064,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "integer-sqrt", "num-traits", @@ -10116,7 +10079,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -10129,7 +10092,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "parity-scale-codec", @@ -10141,7 +10104,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "sp-api", @@ -10153,7 +10116,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "log", @@ -10171,7 +10134,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "futures 0.3.21", @@ -10190,7 +10153,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "merlin", @@ -10213,7 +10176,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -10227,7 +10190,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -10240,7 +10203,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "base58", "bitflags", @@ -10286,7 +10249,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "blake2", "byteorder", @@ -10300,7 +10263,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro2", "quote", @@ -10311,7 +10274,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "kvdb", "parking_lot 0.12.0", @@ -10320,7 +10283,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro2", "quote", @@ -10330,7 +10293,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "environmental", "parity-scale-codec", @@ -10341,7 +10304,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "finality-grandpa", "log", @@ -10359,7 +10322,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -10373,7 +10336,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "hash-db", @@ -10398,7 +10361,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "lazy_static", "sp-core", @@ -10409,7 +10372,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "futures 0.3.21", @@ -10426,7 +10389,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "thiserror", "zstd", @@ -10435,7 +10398,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "parity-scale-codec", @@ -10450,7 +10413,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -10464,7 +10427,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "sp-api", "sp-core", @@ -10474,7 +10437,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "backtrace", "lazy_static", @@ -10484,7 +10447,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "rustc-hash", "serde", @@ -10494,7 +10457,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "either", "hash256-std-hasher", @@ -10516,7 +10479,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -10533,7 +10496,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "Inflector", "proc-macro-crate", @@ -10545,7 +10508,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "parity-scale-codec", @@ -10559,7 +10522,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "serde", "serde_json", @@ -10568,7 +10531,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -10582,7 +10545,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "scale-info", @@ -10593,7 +10556,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "hash-db", "log", @@ -10615,12 +10578,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10633,7 +10596,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "log", "sp-core", @@ -10646,7 +10609,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "futures-timer", @@ -10662,7 +10625,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "sp-std", @@ -10674,7 +10637,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "sp-api", "sp-runtime", @@ -10683,7 +10646,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "log", @@ -10699,7 +10662,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "hash-db", "memory-db", @@ -10715,7 +10678,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10732,7 +10695,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -10743,7 +10706,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "impl-trait-for-tuples", "log", @@ -10935,7 +10898,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "platforms", ] @@ -10943,7 +10906,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.21", @@ -10964,7 +10927,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures-util", "hyper", @@ -10977,7 +10940,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "jsonrpsee", "log", @@ -10998,7 +10961,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "async-trait", "futures 0.3.21", @@ -11024,7 +10987,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "futures 0.3.21", "substrate-test-utils-derive", @@ -11034,7 +10997,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11045,7 +11008,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "ansi_term", "build-helper", @@ -11154,13 +11117,13 @@ checksum = "d9bffcddbc2458fa3e6058414599e3c838a022abae82e5c67b4f7f80298d5bff" [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if 1.0.0", + "fastrand", "libc", - "rand 0.8.5", "redox_syscall", "remove_dir_all", "winapi", @@ -11479,26 +11442,15 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls 0.19.1", - "tokio", - "webpki 0.21.4", -] - [[package]] name = "tokio-rustls" version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b" dependencies = [ - "rustls 0.20.2", + "rustls", "tokio", - "webpki 0.22.0", + "webpki", ] [[package]] @@ -11760,7 +11712,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#19b44f087b30e7730cf037518ec921c336fcbb0f" +source = "git+https://github.com/paritytech/substrate?branch=master#2916ebbc0cad448874dc4b446ee7709d7b33776b" dependencies = [ "clap", "jsonrpsee", @@ -12329,6 +12281,7 @@ dependencies = [ "libc", "log", "mach", + "memfd", "memoffset", "more-asserts", "rand 0.8.5", @@ -12362,16 +12315,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki" version = "0.22.0" @@ -12388,7 +12331,7 @@ version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449" dependencies = [ - "webpki 0.22.0", + "webpki", ] [[package]] diff --git a/node/core/pvf/Cargo.toml b/node/core/pvf/Cargo.toml index 0e58c6bd058c..d64ccc1a3360 100644 --- a/node/core/pvf/Cargo.toml +++ b/node/core/pvf/Cargo.toml @@ -19,6 +19,7 @@ slotmap = "1.0" gum = { package = "tracing-gum", path = "../../gum" } pin-project = "1.0.9" rand = "0.8.5" +tempfile = "3.3.0" parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] } polkadot-parachain = { path = "../../../parachain" } polkadot-core-primitives = { path = "../../../core-primitives" } diff --git a/node/core/pvf/src/artifacts.rs b/node/core/pvf/src/artifacts.rs index af579863cd61..49d1be75fed4 100644 --- a/node/core/pvf/src/artifacts.rs +++ b/node/core/pvf/src/artifacts.rs @@ -17,15 +17,12 @@ use crate::{error::PrepareError, host::PrepareResultSender}; use always_assert::always; use async_std::path::{Path, PathBuf}; -use parity_scale_codec::{Decode, Encode}; use polkadot_parachain::primitives::ValidationCodeHash; use std::{ collections::HashMap, time::{Duration, SystemTime}, }; -/// A wrapper for the compiled PVF code. -#[derive(Encode, Decode)] pub struct CompiledArtifact(Vec); impl CompiledArtifact { diff --git a/node/core/pvf/src/execute/worker.rs b/node/core/pvf/src/execute/worker.rs index 1140758e6aee..01bc59cb1a84 100644 --- a/node/core/pvf/src/execute/worker.rs +++ b/node/core/pvf/src/execute/worker.rs @@ -15,7 +15,7 @@ // along with Polkadot. If not, see . use crate::{ - artifacts::{ArtifactPathId, CompiledArtifact}, + artifacts::ArtifactPathId, executor_intf::TaskExecutor, worker_common::{ bytes_to_path, framed_recv, framed_send, path_to_bytes, spawn_with_program_path, @@ -206,29 +206,12 @@ async fn validate_using_artifact( params: &[u8], spawner: &TaskExecutor, ) -> Response { - let artifact_bytes = match async_std::fs::read(artifact_path).await { - Err(e) => - return Response::InternalError(format!( - "failed to read the artifact at {}: {:?}", - artifact_path.display(), - e, - )), - Ok(b) => b, - }; - - let artifact = match CompiledArtifact::decode(&mut artifact_bytes.as_slice()) { - Err(e) => return Response::InternalError(format!("artifact deserialization: {:?}", e)), - Ok(a) => a, - }; - - let compiled_artifact = artifact.as_ref(); - let validation_started_at = Instant::now(); let descriptor_bytes = match unsafe { // SAFETY: this should be safe since the compiled artifact passed here comes from the // file created by the prepare workers. These files are obtained by calling // [`executor_intf::prepare`]. - crate::executor_intf::execute(compiled_artifact, params, spawner.clone()) + crate::executor_intf::execute(artifact_path.as_ref(), params, spawner.clone()) } { Err(err) => return Response::format_invalid("execute", &err.to_string()), Ok(d) => d, diff --git a/node/core/pvf/src/executor_intf.rs b/node/core/pvf/src/executor_intf.rs index b4064e13ecc0..ec2caa88434c 100644 --- a/node/core/pvf/src/executor_intf.rs +++ b/node/core/pvf/src/executor_intf.rs @@ -22,7 +22,10 @@ use sc_executor_common::{ }; use sc_executor_wasmtime::{Config, DeterministicStackLimit, Semantics}; use sp_core::storage::{ChildInfo, TrackedStorageKey}; -use std::any::{Any, TypeId}; +use std::{ + any::{Any, TypeId}, + path::Path, +}; // Memory configuration // @@ -40,15 +43,17 @@ const DEFAULT_HEAP_PAGES_ESTIMATE: u64 = 32; const EXTRA_HEAP_PAGES: u64 = 2048; const CONFIG: Config = Config { - // NOTE: This is specified in bytes, so we multiply by WASM page size. - max_memory_size: Some(((DEFAULT_HEAP_PAGES_ESTIMATE + EXTRA_HEAP_PAGES) * 65536) as usize), - allow_missing_func_imports: true, cache_path: None, semantics: Semantics { extra_heap_pages: EXTRA_HEAP_PAGES, - fast_instance_reuse: false, + // NOTE: This is specified in bytes, so we multiply by WASM page size. + max_memory_size: Some(((DEFAULT_HEAP_PAGES_ESTIMATE + EXTRA_HEAP_PAGES) * 65536) as usize), + + instantiation_strategy: + sc_executor_wasmtime::InstantiationStrategy::RecreateInstanceCopyOnWrite, + // Enable deterministic stack limit to pin down the exact number of items the wasmtime stack // can contain before it traps with stack overflow. // @@ -87,7 +92,7 @@ pub fn prevalidate(code: &[u8]) -> Result Result, sc_executor_common::error::WasmError> { sc_executor_wasmtime::prepare_runtime_artifact(blob, &CONFIG.semantics) } @@ -97,10 +102,16 @@ pub fn prepare(blob: RuntimeBlob) -> Result, sc_executor_common::error:: /// /// # Safety /// -/// The compiled artifact must be produced with [`prepare`]. Not following this guidance can lead -/// to arbitrary code execution. +/// The caller must ensure that the compiled artifact passed here was: +/// 1) produced by [`prepare`], +/// 2) written to the disk as a file, +/// 3) was not modified, +/// 4) will not be modified while any runtime using this artifact is alive, or is being +/// instantiated. +/// +/// Failure to adhere to these requirements might lead to crashes and arbitrary code execution. pub unsafe fn execute( - compiled_artifact: &[u8], + compiled_artifact_path: &Path, params: &[u8], spawner: impl sp_core::traits::SpawnNamed + 'static, ) -> Result, sc_executor_common::error::Error> { @@ -113,7 +124,7 @@ pub unsafe fn execute( sc_executor::with_externalities_safe(&mut ext, || { let runtime = sc_executor_wasmtime::create_runtime_from_artifact::( - compiled_artifact, + compiled_artifact_path, CONFIG, )?; runtime.new_instance()?.call(InvokeMethod::Export("validate_block"), params) diff --git a/node/core/pvf/src/prepare/worker.rs b/node/core/pvf/src/prepare/worker.rs index d83346946f62..ca90285ca7b3 100644 --- a/node/core/pvf/src/prepare/worker.rs +++ b/node/core/pvf/src/prepare/worker.rs @@ -265,15 +265,13 @@ pub fn worker_entrypoint(socket_path: &str) { // worker is only required to send an empty `Ok` to the pool // to indicate the success. - let artifact_bytes = compiled_artifact.encode(); - gum::debug!( target: LOG_TARGET, worker_pid = %std::process::id(), "worker: writing artifact to {}", dest.display(), ); - async_std::fs::write(&dest, &artifact_bytes).await?; + async_std::fs::write(&dest, &compiled_artifact).await?; Ok(()) }, diff --git a/node/core/pvf/src/testing.rs b/node/core/pvf/src/testing.rs index 20cf85151f81..ba407e0b87cb 100644 --- a/node/core/pvf/src/testing.rs +++ b/node/core/pvf/src/testing.rs @@ -36,10 +36,15 @@ pub fn validate_candidate( let blob = prevalidate(&*code)?; let artifact = prepare(blob)?; + let tmpdir = tempfile::tempdir()?; + let artifact_path = tmpdir.path().join("blob"); + std::fs::write(&artifact_path, &artifact)?; + let executor = TaskExecutor::new()?; let result = unsafe { - // SAFETY: This is trivially safe since the artifact is obtained by calling `prepare`. - execute(&artifact, params, executor)? + // SAFETY: This is trivially safe since the artifact is obtained by calling `prepare` + // and is written into a temporary directory in an unmodified state. + execute(&artifact_path, params, executor)? }; Ok(result) diff --git a/node/test/service/src/lib.rs b/node/test/service/src/lib.rs index e268e375dce6..90e311b910da 100644 --- a/node/test/service/src/lib.rs +++ b/node/test/service/src/lib.rs @@ -42,7 +42,10 @@ use sc_network::{ multiaddr, }; use sc_service::{ - config::{DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod}, + config::{ + DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod, + WasmtimeInstantiationStrategy, + }, BasePath, Configuration, KeepBlocks, Role, RpcHandlers, TaskManager, }; use sp_arithmetic::traits::SaturatedConversion; @@ -176,7 +179,9 @@ pub fn node_config( state_pruning: Default::default(), keep_blocks: KeepBlocks::All, chain_spec: Box::new(spec), - wasm_method: WasmExecutionMethod::Compiled, + wasm_method: WasmExecutionMethod::Compiled { + instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, + }, wasm_runtime_overrides: Default::default(), // NOTE: we enforce the use of the native runtime to make the errors more debuggable execution_strategies: ExecutionStrategies { From 409946398e6e5bedfa6a670181a7da30c2fe8a1b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 19 May 2022 12:23:22 +0100 Subject: [PATCH 15/15] Fix build --- node/core/bitfield-signing/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/node/core/bitfield-signing/src/lib.rs b/node/core/bitfield-signing/src/lib.rs index ad9f93f3d598..13a3dd28705f 100644 --- a/node/core/bitfield-signing/src/lib.rs +++ b/node/core/bitfield-signing/src/lib.rs @@ -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( 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( 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 { .. } => {}, } } }