From 7bc352628e65ec99f3393503a28c8a0c8e4202bd Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Fri, 17 Sep 2021 21:39:33 +0200 Subject: [PATCH 1/8] remove connected disconnected state only (#3868) * remove connected disconnected state from overseer * foo * split new partial * fix * refactor init code to not require a `OverseerHandle` when we don't have an overseer * intermediate * fixins * X * fixup * foo * fixup * docs * conditional * Update node/service/src/lib.rs * review by ladi --- Cargo.lock | 1 + doc/testing.md | 3 +- node/malus/src/variant-a.rs | 5 +- node/overseer/examples/minimal-example.rs | 14 +- .../proc-macro/src/impl_builder.rs | 2 +- node/overseer/src/dummy.rs | 54 ++++ node/overseer/src/lib.rs | 87 ++---- node/overseer/src/metrics.rs | 4 +- node/overseer/src/subsystems.rs | 42 +-- node/overseer/src/tests.rs | 74 +++-- node/service/Cargo.toml | 1 + node/service/src/lib.rs | 276 +++++++++++------- node/service/src/overseer.rs | 196 ++++++++++++- node/service/src/relay_chain_selection.rs | 79 +++-- node/service/src/tests.rs | 2 +- node/subsystem-test-helpers/src/lib.rs | 7 +- node/subsystem/src/lib.rs | 4 +- 17 files changed, 548 insertions(+), 303 deletions(-) create mode 100644 node/overseer/src/dummy.rs diff --git a/Cargo.lock b/Cargo.lock index 8d6986a73574..631c36009309 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6841,6 +6841,7 @@ dependencies = [ "kvdb", "kvdb-rocksdb", "log", + "lru", "pallet-babe", "pallet-im-online", "pallet-mmr-primitives", diff --git a/doc/testing.md b/doc/testing.md index 8230ea352c0f..6709d1b9bdeb 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -185,6 +185,7 @@ struct BehaveMaleficient; impl OverseerGen for BehaveMaleficient { fn generate<'a, Spawner, RuntimeClient>( &self, + connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandler), Error> where @@ -213,7 +214,7 @@ impl OverseerGen for BehaveMaleficient { ), ); - Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner) + Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner, connector) .map_err(|e| e.into()) // A builder pattern will simplify this further diff --git a/node/malus/src/variant-a.rs b/node/malus/src/variant-a.rs index a545bd360faf..8abdf75198b3 100644 --- a/node/malus/src/variant-a.rs +++ b/node/malus/src/variant-a.rs @@ -37,7 +37,7 @@ use polkadot_cli::{ use polkadot_node_core_candidate_validation::CandidateValidationSubsystem; use polkadot_node_subsystem::{ messages::{AllMessages, CandidateValidationMessage}, - overseer::{self, OverseerHandle}, + overseer::{self, OverseerConnector, OverseerHandle}, FromOverseer, }; @@ -86,6 +86,7 @@ struct BehaveMaleficient; impl OverseerGen for BehaveMaleficient { fn generate<'a, Spawner, RuntimeClient>( &self, + connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandle), Error> where @@ -113,7 +114,7 @@ impl OverseerGen for BehaveMaleficient { }, ); - Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner) + Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner, connector) .map_err(|e| e.into()) } } diff --git a/node/overseer/examples/minimal-example.rs b/node/overseer/examples/minimal-example.rs index 6970054a3013..0c4a3bdc6ae6 100644 --- a/node/overseer/examples/minimal-example.rs +++ b/node/overseer/examples/minimal-example.rs @@ -29,7 +29,8 @@ use polkadot_node_subsystem_types::messages::{ use polkadot_overseer::{ self as overseer, gen::{FromOverseer, SpawnedSubsystem}, - AllMessages, AllSubsystems, HeadSupportsParachains, Overseer, OverseerSignal, SubsystemError, + AllMessages, AllSubsystems, HeadSupportsParachains, Overseer, OverseerConnector, + OverseerSignal, SubsystemError, }; use polkadot_primitives::v1::Hash; @@ -173,8 +174,15 @@ fn main() { .replace_candidate_validation(|_| Subsystem2) .replace_candidate_backing(|orig| orig); - let (overseer, _handle) = - Overseer::new(vec![], all_subsystems, None, AlwaysSupportsParachains, spawner).unwrap(); + let (overseer, _handle) = Overseer::new( + vec![], + all_subsystems, + None, + AlwaysSupportsParachains, + spawner, + OverseerConnector::default(), + ) + .unwrap(); let overseer_fut = overseer.run().fuse(); let timer_stream = timer_stream; diff --git a/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs b/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs index 832e193fd4d1..b736de97d463 100644 --- a/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs +++ b/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs @@ -130,7 +130,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { &mut self.handle } /// Obtain access to the overseer handle. - pub fn as_handle(&mut self) -> &#handle { + pub fn as_handle(&self) -> &#handle { &self.handle } } diff --git a/node/overseer/src/dummy.rs b/node/overseer/src/dummy.rs new file mode 100644 index 000000000000..c3d3d4fcf3c8 --- /dev/null +++ b/node/overseer/src/dummy.rs @@ -0,0 +1,54 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use crate::{AllMessages, OverseerSignal}; +use polkadot_node_subsystem_types::errors::SubsystemError; +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)] +pub struct DummySubsystem; + +impl Subsystem for DummySubsystem +where + Context: SubsystemContext< + Signal = OverseerSignal, + Error = SubsystemError, + AllMessages = AllMessages, + >, +{ + fn start(self, mut ctx: Context) -> SpawnedSubsystem { + let future = Box::pin(async move { + loop { + match ctx.recv().await { + Err(_) => return Ok(()), + Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), + Ok(overseer_msg) => { + tracing::debug!( + target: "dummy-subsystem", + "Discarding a message sent from overseer {:?}", + overseer_msg + ); + continue + }, + } + } + }); + + SpawnedSubsystem { name: "dummy-subsystem", future } + } +} diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index 935cf6ebbef8..9b1e591b44c2 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -70,7 +70,6 @@ use std::{ use futures::{channel::oneshot, future::BoxFuture, select, Future, FutureExt, StreamExt}; use lru::LruCache; -use parking_lot::RwLock; use client::{BlockImportNotification, BlockchainEvents, FinalityNotification}; use polkadot_primitives::v1::{Block, BlockId, BlockNumber, Hash, ParachainHost}; @@ -91,12 +90,17 @@ pub use polkadot_node_subsystem_types::{ jaeger, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, OverseerSignal, }; +/// Test helper supplements. +pub mod dummy; +pub use self::dummy::DummySubsystem; + // TODO legacy, to be deleted, left for easier integration // TODO https://github.com/paritytech/polkadot/issues/3427 mod subsystems; -pub use self::subsystems::{AllSubsystems, DummySubsystem}; +pub use self::subsystems::AllSubsystems; -mod metrics; +/// Metrics re-exports of `polkadot-metrics`. +pub mod metrics; use self::metrics::Metrics; use polkadot_node_metrics::{ @@ -116,7 +120,7 @@ pub use polkadot_overseer_gen::{ /// Store 2 days worth of blocks, not accounting for forks, /// in the LRU cache. Assumes a 6-second block time. -const KNOWN_LEAVES_CACHE_SIZE: usize = 2 * 24 * 3600 / 6; +pub const KNOWN_LEAVES_CACHE_SIZE: usize = 2 * 24 * 3600 / 6; #[cfg(test)] mod tests; @@ -142,18 +146,12 @@ where /// /// [`Overseer`]: struct.Overseer.html #[derive(Clone)] -pub enum Handle { - /// Used only at initialization to break the cyclic dependency. - // TODO: refactor in https://github.com/paritytech/polkadot/issues/3427 - Disconnected(Arc>>), - /// A handle to the overseer. - Connected(OverseerHandle), -} +pub struct Handle(pub OverseerHandle); impl Handle { - /// Create a new disconnected [`Handle`]. - pub fn new_disconnected() -> Self { - Self::Disconnected(Arc::new(RwLock::new(None))) + /// Create a new [`Handle`]. + pub fn new(raw: OverseerHandle) -> Self { + Self(raw) } /// Inform the `Overseer` that that some block was imported. @@ -202,58 +200,8 @@ impl Handle { /// Most basic operation, to stop a server. async fn send_and_log_error(&mut self, event: Event) { - self.try_connect(); - if let Self::Connected(ref mut handle) = self { - if handle.send(event).await.is_err() { - tracing::info!(target: LOG_TARGET, "Failed to send an event to Overseer"); - } - } else { - tracing::warn!(target: LOG_TARGET, "Using a disconnected Handle to send to Overseer"); - } - } - - /// Whether the handle is disconnected. - pub fn is_disconnected(&self) -> bool { - match self { - Self::Disconnected(ref x) => x.read().is_none(), - _ => false, - } - } - - /// Connect this handle and all disconnected clones of it to the overseer. - pub fn connect_to_overseer(&mut self, handle: OverseerHandle) { - match self { - Self::Disconnected(ref mut x) => { - let mut maybe_handle = x.write(); - if maybe_handle.is_none() { - tracing::info!(target: LOG_TARGET, "🖇️ Connecting all Handles to Overseer"); - *maybe_handle = Some(handle); - } else { - tracing::warn!( - target: LOG_TARGET, - "Attempting to connect a clone of a connected Handle", - ); - } - }, - _ => { - tracing::warn!( - target: LOG_TARGET, - "Attempting to connect an already connected Handle", - ); - }, - } - } - - /// Try upgrading from `Self::Disconnected` to `Self::Connected` state - /// after calling `connect_to_overseer` on `self` or a clone of `self`. - fn try_connect(&mut self) { - if let Self::Disconnected(ref mut x) = self { - let guard = x.write(); - if let Some(ref h) = *guard { - let handle = h.clone(); - drop(guard); - *self = Self::Connected(handle); - } + if self.0.send(event).await.is_err() { + tracing::info!(target: LOG_TARGET, "Failed to send an event to Overseer"); } } } @@ -491,12 +439,13 @@ where /// # use polkadot_primitives::v1::Hash; /// # use polkadot_overseer::{ /// # self as overseer, + /// # Overseer, /// # OverseerSignal, + /// # OverseerConnector, /// # SubsystemSender as _, /// # AllMessages, /// # AllSubsystems, /// # HeadSupportsParachains, - /// # Overseer, /// # SubsystemError, /// # gen::{ /// # SubsystemContext, @@ -550,6 +499,7 @@ where /// None, /// AlwaysSupportsParachains, /// spawner, + /// OverseerConnector::default(), /// ).unwrap(); /// /// let timer = Delay::new(Duration::from_millis(50)).fuse(); @@ -616,6 +566,7 @@ where prometheus_registry: Option<&prometheus::Registry>, supports_parachains: SupportsParachains, s: S, + connector: OverseerConnector, ) -> SubsystemResult<(Self, OverseerHandle)> where CV: Subsystem, SubsystemError> + Send, @@ -680,7 +631,7 @@ where .supports_parachains(supports_parachains) .metrics(metrics.clone()) .spawner(s) - .build()?; + .build_with_connector(connector)?; // spawn the metrics metronome task { diff --git a/node/overseer/src/metrics.rs b/node/overseer/src/metrics.rs index e6a1ec4f4086..5b57f3336131 100644 --- a/node/overseer/src/metrics.rs +++ b/node/overseer/src/metrics.rs @@ -17,7 +17,7 @@ //! Prometheus metrics related to the overseer and its channels. use super::*; -use polkadot_node_metrics::metrics::{self, prometheus}; +pub use polkadot_node_metrics::metrics::{self, prometheus, Metrics as MetricsTrait}; #[cfg(feature = "memory-stats")] use polkadot_node_metrics::MemoryAllocationSnapshot; @@ -117,7 +117,7 @@ impl Metrics { } } -impl metrics::Metrics for Metrics { +impl MetricsTrait for Metrics { fn try_register(registry: &prometheus::Registry) -> Result { let metrics = MetricsInner { activated_heads_total: prometheus::register( diff --git a/node/overseer/src/subsystems.rs b/node/overseer/src/subsystems.rs index 648528730d67..695d368dc16c 100644 --- a/node/overseer/src/subsystems.rs +++ b/node/overseer/src/subsystems.rs @@ -19,47 +19,9 @@ //! In the future, everything should be set up using the generated //! overseer builder pattern instead. -use crate::{AllMessages, OverseerSignal}; -use polkadot_node_subsystem_types::errors::SubsystemError; +use crate::dummy::DummySubsystem; use polkadot_overseer_all_subsystems_gen::AllSubsystemsGen; -use polkadot_overseer_gen::{ - FromOverseer, MapSubsystem, 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)] -pub struct DummySubsystem; - -impl Subsystem for DummySubsystem -where - Context: SubsystemContext< - Signal = OverseerSignal, - Error = SubsystemError, - AllMessages = AllMessages, - >, -{ - fn start(self, mut ctx: Context) -> SpawnedSubsystem { - let future = Box::pin(async move { - loop { - match ctx.recv().await { - Err(_) => return Ok(()), - Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), - Ok(overseer_msg) => { - tracing::debug!( - target: "dummy-subsystem", - "Discarding a message sent from overseer {:?}", - overseer_msg - ); - continue - }, - } - } - }); - - SpawnedSubsystem { name: "dummy-subsystem", future } - } -} +use polkadot_overseer_gen::MapSubsystem; /// This struct is passed as an argument to create a new instance of an [`Overseer`]. /// diff --git a/node/overseer/src/tests.rs b/node/overseer/src/tests.rs index 7564116e7141..349b04d34be3 100644 --- a/node/overseer/src/tests.rs +++ b/node/overseer/src/tests.rs @@ -32,7 +32,7 @@ use polkadot_primitives::v1::{ ValidatorIndex, }; -use crate::{self as overseer, gen::Delay, HeadSupportsParachains, Overseer}; +use crate::{self as overseer, gen::Delay, HeadSupportsParachains, Overseer, OverseerConnector}; use metered_channel as metered; use assert_matches::assert_matches; @@ -164,9 +164,16 @@ fn overseer_works() { .replace_candidate_validation(move |_| TestSubsystem1(s1_tx)) .replace_candidate_backing(move |_| TestSubsystem2(s2_tx)); - let (overseer, handle) = - Overseer::new(vec![], all_subsystems, None, MockSupportsParachains, spawner).unwrap(); - let mut handle = Handle::Connected(handle); + let (overseer, handle) = Overseer::new( + vec![], + all_subsystems, + None, + MockSupportsParachains, + spawner, + OverseerConnector::default(), + ) + .unwrap(); + let mut handle = Handle(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -227,9 +234,10 @@ fn overseer_metrics_work() { Some(®istry), MockSupportsParachains, spawner, + OverseerConnector::default(), ) .unwrap(); - let mut handle = Handle::Connected(handle); + let mut handle = Handle(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -280,8 +288,15 @@ fn overseer_ends_on_subsystem_exit() { executor::block_on(async move { let all_subsystems = AllSubsystems::<()>::dummy().replace_candidate_backing(|_| ReturnOnStart); - let (overseer, _handle) = - Overseer::new(vec![], all_subsystems, None, MockSupportsParachains, spawner).unwrap(); + let (overseer, _handle) = Overseer::new( + vec![], + all_subsystems, + None, + MockSupportsParachains, + spawner, + OverseerConnector::default(), + ) + .unwrap(); overseer.run().await.unwrap(); }) @@ -382,10 +397,16 @@ fn overseer_start_stop_works() { let all_subsystems = AllSubsystems::<()>::dummy() .replace_candidate_validation(move |_| TestSubsystem5(tx_5)) .replace_candidate_backing(move |_| TestSubsystem6(tx_6)); - let (overseer, handle) = - Overseer::new(vec![first_block], all_subsystems, None, MockSupportsParachains, spawner) - .unwrap(); - let mut handle = Handle::Connected(handle); + let (overseer, handle) = Overseer::new( + vec![first_block], + all_subsystems, + None, + MockSupportsParachains, + spawner, + OverseerConnector::default(), + ) + .unwrap(); + let mut handle = Handle(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -486,9 +507,10 @@ fn overseer_finalize_works() { None, MockSupportsParachains, spawner, + OverseerConnector::default(), ) .unwrap(); - let mut handle = Handle::Connected(handle); + let mut handle = Handle(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -573,10 +595,16 @@ fn do_not_send_empty_leaves_update_on_block_finalization() { let all_subsystems = AllSubsystems::<()>::dummy().replace_candidate_backing(move |_| TestSubsystem6(tx_5)); - let (overseer, handle) = - Overseer::new(Vec::new(), all_subsystems, None, MockSupportsParachains, spawner) - .unwrap(); - let mut handle = Handle::Connected(handle); + let (overseer, handle) = Overseer::new( + Vec::new(), + all_subsystems, + None, + MockSupportsParachains, + spawner, + OverseerConnector::default(), + ) + .unwrap(); + let mut handle = Handle(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -849,9 +877,17 @@ fn overseer_all_subsystems_receive_signals_and_messages() { dispute_distribution: subsystem.clone(), chain_selection: subsystem.clone(), }; - let (overseer, handle) = - Overseer::new(vec![], all_subsystems, None, MockSupportsParachains, spawner).unwrap(); - let mut handle = Handle::Connected(handle); + + let (overseer, handle) = Overseer::new( + vec![], + all_subsystems, + None, + MockSupportsParachains, + spawner, + OverseerConnector::default(), + ) + .unwrap(); + let mut handle = Handle(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 213afe4edb1a..66c936e9a6c3 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -26,6 +26,7 @@ sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" } service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } telemetry = { package = "sc-telemetry", git = "https://github.com/paritytech/substrate", branch = "master" } +lru = "0.6" # Substrate Primitives sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index bcb181fa04b8..ab9f732ec44f 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -54,7 +54,7 @@ use { pub use sp_core::traits::SpawnNamed; #[cfg(feature = "full-node")] pub use { - polkadot_overseer::{Handle, Overseer, OverseerHandle}, + polkadot_overseer::{Handle, Overseer, OverseerConnector, OverseerHandle}, polkadot_primitives::v1::ParachainHost, sc_client_api::AuxStore, sp_authority_discovery::AuthorityDiscoveryApi, @@ -68,6 +68,8 @@ use polkadot_subsystem::jaeger; use std::{sync::Arc, time::Duration}; use prometheus_endpoint::Registry; +#[cfg(feature = "full-node")] +use service::KeystoreContainer; use service::RpcHandlers; use telemetry::TelemetryWorker; #[cfg(feature = "full-node")] @@ -302,14 +304,15 @@ fn jaeger_launch_collector_with_agent( } #[cfg(feature = "full-node")] -type FullSelectChain = relay_chain_selection::SelectRelayChainWithFallback; +type FullSelectChain = relay_chain_selection::SelectRelayChain; #[cfg(feature = "full-node")] -type FullGrandpaBlockImport = grandpa::GrandpaBlockImport< - FullBackend, - Block, - FullClient, - FullSelectChain, ->; +type FullGrandpaBlockImport = + grandpa::GrandpaBlockImport< + FullBackend, + Block, + FullClient, + ChainSelection, + >; #[cfg(feature = "light-node")] type LightBackend = service::TLightBackendWithHash; @@ -319,36 +322,29 @@ type LightClient = service::TLightClientWithBackend; #[cfg(feature = "full-node")] -fn new_partial( +struct Basics +where + RuntimeApi: ConstructRuntimeApi> + + Send + + Sync + + 'static, + RuntimeApi::RuntimeApi: + RuntimeApiCollection>, + ExecutorDispatch: NativeExecutionDispatch + 'static, +{ + task_manager: TaskManager, + client: Arc>, + backend: Arc, + keystore_container: KeystoreContainer, + telemetry: Option, +} + +#[cfg(feature = "full-node")] +fn new_partial_basics( config: &mut Configuration, jaeger_agent: Option, telemetry_worker_handle: Option, -) -> Result< - service::PartialComponents< - FullClient, - FullBackend, - FullSelectChain, - sc_consensus::DefaultImportQueue>, - sc_transaction_pool::FullPool>, - ( - impl service::RpcExtensionBuilder, - ( - babe::BabeBlockImport< - Block, - FullClient, - FullGrandpaBlockImport, - >, - grandpa::LinkHalf, FullSelectChain>, - babe::BabeLink, - beefy_gadget::notification::BeefySignedCommitmentSender, - ), - grandpa::SharedVoterState, - std::time::Duration, // slot-duration - Option, - ), - >, - Error, -> +) -> Result, Error> where RuntimeApi: ConstructRuntimeApi> + Send @@ -391,21 +387,62 @@ where )?; let client = Arc::new(client); - let telemetry = telemetry.map(|(worker, telemetry)| { + jaeger_launch_collector_with_agent(task_manager.spawn_handle(), &*config, jaeger_agent)?; + + let telemetry: Option<_> = telemetry.map(|(worker, telemetry)| { if let Some(worker) = worker { task_manager.spawn_handle().spawn("telemetry", worker.run()); } telemetry }); - jaeger_launch_collector_with_agent(task_manager.spawn_handle(), &*config, jaeger_agent)?; - - let select_chain = relay_chain_selection::SelectRelayChainWithFallback::new( - backend.clone(), - Handle::new_disconnected(), - polkadot_node_subsystem_util::metrics::Metrics::register(config.prometheus_registry())?, - ); + Ok(Basics { task_manager, client, backend, keystore_container, telemetry }) +} +#[cfg(feature = "full-node")] +fn new_partial( + config: &mut Configuration, + Basics { task_manager, backend, client, keystore_container, telemetry }: Basics< + RuntimeApi, + ExecutorDispatch, + >, + select_chain: ChainSelection, +) -> Result< + service::PartialComponents< + FullClient, + FullBackend, + ChainSelection, + sc_consensus::DefaultImportQueue>, + sc_transaction_pool::FullPool>, + ( + impl service::RpcExtensionBuilder, + ( + babe::BabeBlockImport< + Block, + FullClient, + FullGrandpaBlockImport, + >, + grandpa::LinkHalf, ChainSelection>, + babe::BabeLink, + beefy_gadget::notification::BeefySignedCommitmentSender, + ), + grandpa::SharedVoterState, + std::time::Duration, // slot-duration + Option, + ), + >, + Error, +> +where + RuntimeApi: ConstructRuntimeApi> + + Send + + Sync + + 'static, + RuntimeApi::RuntimeApi: + RuntimeApiCollection>, + ExecutorDispatch: NativeExecutionDispatch + 'static, + ChainSelection: 'static + SelectChain, +{ let transaction_pool = sc_transaction_pool::BasicPool::new_full( config.transaction_pool.clone(), config.role.is_authority().into(), @@ -674,23 +711,50 @@ where let disable_grandpa = config.disable_grandpa; let name = config.network.node_name.clone(); - let service::PartialComponents { + let overseer_connector = OverseerConnector::default(); + + let handle = Handle(overseer_connector.as_handle().clone()); + + let basics = new_partial_basics::( + &mut config, + jaeger_agent, + telemetry_worker_handle, + )?; + + // we should remove this check before we deploy parachains on polkadot + // TODO: https://github.com/paritytech/polkadot/issues/3326 + let chain_spec = &config.chain_spec as &dyn IdentifyVariant; + + let is_relay_chain = chain_spec.is_kusama() || + chain_spec.is_westend() || + chain_spec.is_rococo() || + chain_spec.is_wococo(); + + let prometheus_registry = config.prometheus_registry().cloned(); + + use relay_chain_selection::SelectRelayChain; + + let select_chain = SelectRelayChain::new( + basics.backend.clone(), + is_relay_chain, + handle.clone(), + polkadot_node_subsystem_util::metrics::Metrics::register(prometheus_registry.as_ref())?, + ); + let service::PartialComponents::<_, _, SelectRelayChain<_>, _, _, _> { client, backend, mut task_manager, keystore_container, - mut select_chain, + select_chain, import_queue, transaction_pool, other: (rpc_extensions_builder, import_setup, rpc_setup, slot_duration, mut telemetry), - } = new_partial::( + } = new_partial::>( &mut config, - jaeger_agent, - telemetry_worker_handle, + basics, + select_chain, )?; - let prometheus_registry = config.prometheus_registry().cloned(); - let shared_voter_state = rpc_setup; let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht; @@ -850,8 +914,10 @@ where local_keystore.and_then(move |k| authority_discovery_service.map(|a| (a, k))); let overseer_handle = if let Some((authority_discovery_service, keystore)) = maybe_params { - let (overseer, overseer_handle) = overseer_gen + // already have access to the handle + let (overseer, _handle) = overseer_gen .generate::>( + overseer_connector, OverseerGenArgs { leaves: active_leaves, keystore, @@ -875,40 +941,29 @@ where dispute_coordinator_config, }, )?; - let handle = Handle::Connected(overseer_handle.clone()); - let handle_clone = handle.clone(); - task_manager.spawn_essential_handle().spawn_blocking( - "overseer", - Box::pin(async move { - use futures::{pin_mut, select, FutureExt}; + { + let handle = handle.clone(); + task_manager.spawn_essential_handle().spawn_blocking( + "overseer", + Box::pin(async move { + use futures::{pin_mut, select, FutureExt}; - let forward = polkadot_overseer::forward_events(overseer_client, handle_clone); + let forward = polkadot_overseer::forward_events(overseer_client, handle); - let forward = forward.fuse(); - let overseer_fut = overseer.run().fuse(); + let forward = forward.fuse(); + let overseer_fut = overseer.run().fuse(); - pin_mut!(overseer_fut); - pin_mut!(forward); + pin_mut!(overseer_fut); + pin_mut!(forward); - select! { - _ = forward => (), - _ = overseer_fut => (), - complete => (), - } - }), - ); - // we should remove this check before we deploy parachains on polkadot - // TODO: https://github.com/paritytech/polkadot/issues/3326 - let should_connect_overseer = chain_spec.is_kusama() || - chain_spec.is_westend() || - chain_spec.is_rococo() || - chain_spec.is_wococo(); - - if should_connect_overseer { - select_chain.connect_to_overseer(overseer_handle.clone()); - } else { - tracing::info!("Overseer is running in the disconnected state"); + select! { + _ = forward => (), + _ = overseer_fut => (), + complete => (), + } + }), + ); } Some(handle) } else { @@ -1228,6 +1283,31 @@ where Ok((task_manager, rpc_handlers)) } +macro_rules! chain_ops { + ($config:expr, $jaeger_agent:expr, $telemetry_worker_handle:expr; $scope:ident, $executor:ident, $variant:ident) => {{ + let telemetry_worker_handle = $telemetry_worker_handle; + let jaeger_agent = $jaeger_agent; + let mut config = $config; + let basics = new_partial_basics::<$scope::RuntimeApi, $executor>( + config, + jaeger_agent, + telemetry_worker_handle, + )?; + + use ::sc_consensus::LongestChain; + // use the longest chain selection, since there is no overseer available + let chain_selection = LongestChain::new(basics.backend.clone()); + + let service::PartialComponents { client, backend, import_queue, task_manager, .. } = + new_partial::<$scope::RuntimeApi, $executor, LongestChain<_, Block>>( + &mut config, + basics, + chain_selection, + )?; + Ok((Arc::new(Client::$variant(client)), backend, import_queue, task_manager)) + }}; +} + /// Builds a new object suitable for chain operations. #[cfg(feature = "full-node")] pub fn new_chain_ops( @@ -1244,50 +1324,28 @@ pub fn new_chain_ops( > { config.keystore = service::config::KeystoreConfig::InMemory; + let telemetry_worker_handle = None; + #[cfg(feature = "rococo-native")] if config.chain_spec.is_rococo() || config.chain_spec.is_wococo() { - let service::PartialComponents { client, backend, import_queue, task_manager, .. } = - new_partial::( - config, - jaeger_agent, - None, - )?; - return Ok((Arc::new(Client::Rococo(client)), backend, import_queue, task_manager)) + return chain_ops!(config, jaeger_agent, telemetry_worker_handle; rococo_runtime, RococoExecutorDispatch, Rococo) } #[cfg(feature = "kusama-native")] if config.chain_spec.is_kusama() { - let service::PartialComponents { client, backend, import_queue, task_manager, .. } = - new_partial::( - config, - jaeger_agent, - None, - )?; - return Ok((Arc::new(Client::Kusama(client)), backend, import_queue, task_manager)) + return chain_ops!(config, jaeger_agent, telemetry_worker_handle; kusama_runtime, KusamaExecutorDispatch, Kusama) } #[cfg(feature = "westend-native")] if config.chain_spec.is_westend() { - let service::PartialComponents { client, backend, import_queue, task_manager, .. } = - new_partial::( - config, - jaeger_agent, - None, - )?; - return Ok((Arc::new(Client::Westend(client)), backend, import_queue, task_manager)) + return chain_ops!(config, jaeger_agent, telemetry_worker_handle; westend_runtime, WestendExecutorDispatch, Westend) } #[cfg(feature = "polkadot-native")] { - let service::PartialComponents { client, backend, import_queue, task_manager, .. } = - new_partial::( - config, - jaeger_agent, - None, - )?; - return Ok((Arc::new(Client::Polkadot(client)), backend, import_queue, task_manager)) + chain_ops!(config, jaeger_agent, telemetry_worker_handle; polkadot_runtime, PolkadotExecutorDispatch, Polkadot) } - + #[cfg(not(feature = "polkadot-native"))] Err(Error::NoRuntime) } diff --git a/node/service/src/overseer.rs b/node/service/src/overseer.rs index 66156fd18298..385bab190266 100644 --- a/node/service/src/overseer.rs +++ b/node/service/src/overseer.rs @@ -15,6 +15,7 @@ // along with Polkadot. If not, see . use super::{AuthorityDiscoveryApi, Block, Error, Hash, IsCollator, Registry, SpawnNamed}; +use lru::LruCache; use polkadot_availability_distribution::IncomingRequestReceivers; use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig; use polkadot_node_core_av_store::Config as AvailabilityConfig; @@ -22,7 +23,14 @@ use polkadot_node_core_candidate_validation::Config as CandidateValidationConfig use polkadot_node_core_chain_selection::Config as ChainSelectionConfig; use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig; use polkadot_node_network_protocol::request_response::{v1 as request_v1, IncomingRequestReceiver}; -use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandle}; +#[cfg(any(feature = "malus", test))] +pub use polkadot_overseer::dummy::DummySubsystem; +pub use polkadot_overseer::{ + metrics::{Metrics, MetricsTrait}, + AllSubsystems, BlockInfo, HeadSupportsParachains, Overseer, OverseerBuilder, OverseerConnector, + OverseerHandle, +}; + use polkadot_primitives::v1::ParachainHost; use sc_authority_discovery::Service as AuthorityDiscoveryService; use sc_client_api::AuxStore; @@ -255,6 +263,176 @@ where Ok(all_subsystems) } +/// Obtain a prepared `OverseerBuilder`, that is initialized +/// with all default values. +pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>( + OverseerGenArgs { + leaves, + keystore, + runtime_client, + parachains_db, + network_service, + authority_discovery_service, + pov_req_receiver, + chunk_req_receiver, + collation_req_receiver, + available_data_req_receiver, + statement_req_receiver, + dispute_req_receiver, + registry, + spawner, + is_collator, + approval_voting_config, + availability_config, + candidate_validation_config, + chain_selection_config, + dispute_coordinator_config, + }: OverseerGenArgs<'a, Spawner, RuntimeClient>, +) -> Result< + OverseerBuilder< + Spawner, + Arc, + CandidateValidationSubsystem, + CandidateBackingSubsystem, + StatementDistributionSubsystem, + AvailabilityDistributionSubsystem, + AvailabilityRecoverySubsystem, + BitfieldSigningSubsystem, + BitfieldDistributionSubsystem, + ProvisionerSubsystem, + RuntimeApiSubsystem, + AvailabilityStoreSubsystem, + NetworkBridgeSubsystem< + Arc>, + AuthorityDiscoveryService, + >, + ChainApiSubsystem, + CollationGenerationSubsystem, + CollatorProtocolSubsystem, + ApprovalDistributionSubsystem, + ApprovalVotingSubsystem, + GossipSupportSubsystem, + DisputeCoordinatorSubsystem, + DisputeParticipationSubsystem, + DisputeDistributionSubsystem, + ChainSelectionSubsystem, + >, + Error, +> +where + RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, + RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, + Spawner: 'static + SpawnNamed + Clone + Unpin, +{ + use polkadot_node_subsystem_util::metrics::Metrics; + use std::iter::FromIterator; + + let metrics = ::register(registry)?; + + let builder = Overseer::builder() + .availability_distribution(AvailabilityDistributionSubsystem::new( + keystore.clone(), + IncomingRequestReceivers { pov_req_receiver, chunk_req_receiver }, + Metrics::register(registry)?, + )) + .availability_recovery(AvailabilityRecoverySubsystem::with_chunks_only( + available_data_req_receiver, + Metrics::register(registry)?, + )) + .availability_store(AvailabilityStoreSubsystem::new( + parachains_db.clone(), + availability_config, + Metrics::register(registry)?, + )) + .bitfield_distribution(BitfieldDistributionSubsystem::new(Metrics::register(registry)?)) + .bitfield_signing(BitfieldSigningSubsystem::new( + spawner.clone(), + keystore.clone(), + Metrics::register(registry)?, + )) + .candidate_backing(CandidateBackingSubsystem::new( + spawner.clone(), + keystore.clone(), + Metrics::register(registry)?, + )) + .candidate_validation(CandidateValidationSubsystem::with_config( + candidate_validation_config, + Metrics::register(registry)?, // candidate-validation metrics + Metrics::register(registry)?, // validation host metrics + )) + .chain_api(ChainApiSubsystem::new(runtime_client.clone(), Metrics::register(registry)?)) + .collation_generation(CollationGenerationSubsystem::new(Metrics::register(registry)?)) + .collator_protocol({ + let side = match is_collator { + IsCollator::Yes(collator_pair) => ProtocolSide::Collator( + network_service.local_peer_id().clone(), + collator_pair, + collation_req_receiver, + Metrics::register(registry)?, + ), + IsCollator::No => ProtocolSide::Validator { + keystore: keystore.clone(), + eviction_policy: Default::default(), + metrics: Metrics::register(registry)?, + }, + }; + CollatorProtocolSubsystem::new(side) + }) + .network_bridge(NetworkBridgeSubsystem::new( + network_service.clone(), + authority_discovery_service.clone(), + Box::new(network_service.clone()), + Metrics::register(registry)?, + )) + .provisioner(ProvisionerSubsystem::new(spawner.clone(), (), Metrics::register(registry)?)) + .runtime_api(RuntimeApiSubsystem::new( + runtime_client.clone(), + Metrics::register(registry)?, + spawner.clone(), + )) + .statement_distribution(StatementDistributionSubsystem::new( + keystore.clone(), + statement_req_receiver, + Metrics::register(registry)?, + )) + .approval_distribution(ApprovalDistributionSubsystem::new(Metrics::register(registry)?)) + .approval_voting(ApprovalVotingSubsystem::with_config( + approval_voting_config, + parachains_db.clone(), + keystore.clone(), + Box::new(network_service.clone()), + Metrics::register(registry)?, + )) + .gossip_support(GossipSupportSubsystem::new(keystore.clone())) + .dispute_coordinator(DisputeCoordinatorSubsystem::new( + parachains_db.clone(), + dispute_coordinator_config, + keystore.clone(), + Metrics::register(registry)?, + )) + .dispute_participation(DisputeParticipationSubsystem::new()) + .dispute_distribution(DisputeDistributionSubsystem::new( + keystore.clone(), + dispute_req_receiver, + authority_discovery_service.clone(), + Metrics::register(registry)?, + )) + .chain_selection(ChainSelectionSubsystem::new(chain_selection_config, parachains_db)) + .leaves(Vec::from_iter( + leaves + .into_iter() + .map(|BlockInfo { hash, parent_hash: _, number }| (hash, number)), + )) + .activation_external_listeners(Default::default()) + .span_per_active_leaf(Default::default()) + .active_leaves(Default::default()) + .supports_parachains(runtime_client) + .known_leaves(LruCache::new(KNOWN_LEAVES_CACHE_SIZE)) + .metrics(metrics) + .spawner(spawner); + Ok(builder) +} + /// Trait for the `fn` generating the overseer. /// /// Default behavior is to create an unmodified overseer, as `RealOverseerGen` @@ -263,6 +441,7 @@ pub trait OverseerGen { /// Overwrite the full generation of the overseer, including the subsystems. fn generate<'a, Spawner, RuntimeClient>( &self, + connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandle), Error> where @@ -271,19 +450,22 @@ pub trait OverseerGen { Spawner: 'static + SpawnNamed + Clone + Unpin, { let gen = RealOverseerGen; - RealOverseerGen::generate::(&gen, args) + RealOverseerGen::generate::(&gen, connector, args) } // It would be nice to make `create_subsystems` part of this trait, // but the amount of generic arguments that would be required as // as consequence make this rather annoying to implement and use. } +use polkadot_overseer::KNOWN_LEAVES_CACHE_SIZE; + /// The regular set of subsystems. pub struct RealOverseerGen; impl OverseerGen for RealOverseerGen { fn generate<'a, Spawner, RuntimeClient>( &self, + connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandle), Error> where @@ -291,14 +473,8 @@ impl OverseerGen for RealOverseerGen { RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, Spawner: 'static + SpawnNamed + Clone + Unpin, { - let spawner = args.spawner.clone(); - let leaves = args.leaves.clone(); - let runtime_client = args.runtime_client.clone(); - let registry = args.registry.clone(); - - let all_subsystems = create_default_subsystems::(args)?; - - Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner) + prepared_overseer_builder(args)? + .build_with_connector(connector) .map_err(|e| e.into()) } } diff --git a/node/service/src/relay_chain_selection.rs b/node/service/src/relay_chain_selection.rs index 184d526eac47..cece25d3e547 100644 --- a/node/service/src/relay_chain_selection.rs +++ b/node/service/src/relay_chain_selection.rs @@ -39,7 +39,7 @@ use super::{HeaderProvider, HeaderProviderProvider}; use consensus_common::{Error as ConsensusError, SelectChain}; use futures::channel::oneshot; use polkadot_node_subsystem_util::metrics::{self, prometheus}; -use polkadot_overseer::{AllMessages, Handle, OverseerHandle}; +use polkadot_overseer::{AllMessages, Handle}; use polkadot_primitives::v1::{ Block as PolkadotBlock, BlockNumber, Hash, Header as PolkadotHeader, }; @@ -109,66 +109,57 @@ impl Metrics { } /// A chain-selection implementation which provides safety for relay chains. -pub struct SelectRelayChainWithFallback> { - // A fallback to use in case the overseer is disconnected. - // - // This is used on relay chains which have not yet enabled - // parachains as well as situations where the node is offline. - fallback: sc_consensus::LongestChain, - selection: SelectRelayChain, +pub struct SelectRelayChain> { + is_relay_chain: bool, + longest_chain: sc_consensus::LongestChain, + selection: SelectRelayChainInner, } -impl Clone for SelectRelayChainWithFallback +impl Clone for SelectRelayChain where B: sc_client_api::Backend, - SelectRelayChain: Clone, + SelectRelayChainInner: Clone, { fn clone(&self) -> Self { - Self { fallback: self.fallback.clone(), selection: self.selection.clone() } + Self { + is_relay_chain: self.is_relay_chain, + longest_chain: self.longest_chain.clone(), + selection: self.selection.clone(), + } } } -impl SelectRelayChainWithFallback +impl SelectRelayChain where B: sc_client_api::Backend + 'static, { - /// Create a new [`SelectRelayChainWithFallback`] wrapping the given chain backend + /// Create a new [`SelectRelayChain`] wrapping the given chain backend /// and a handle to the overseer. - pub fn new(backend: Arc, overseer: Handle, metrics: Metrics) -> Self { - SelectRelayChainWithFallback { - fallback: sc_consensus::LongestChain::new(backend.clone()), - selection: SelectRelayChain::new(backend, overseer, metrics), + pub fn new(backend: Arc, is_relay_chain: bool, overseer: Handle, metrics: Metrics) -> Self { + SelectRelayChain { + is_relay_chain, + longest_chain: sc_consensus::LongestChain::new(backend.clone()), + selection: SelectRelayChainInner::new(backend, overseer, metrics), } } } -impl SelectRelayChainWithFallback -where - B: sc_client_api::Backend + 'static, -{ - /// Given an overseer handle, this connects the [`SelectRelayChainWithFallback`]'s - /// internal handle and its clones to the same overseer. - pub fn connect_to_overseer(&mut self, handle: OverseerHandle) { - self.selection.overseer.connect_to_overseer(handle); - } -} - #[async_trait::async_trait] -impl SelectChain for SelectRelayChainWithFallback +impl SelectChain for SelectRelayChain where B: sc_client_api::Backend + 'static, { async fn leaves(&self) -> Result, ConsensusError> { - if self.selection.overseer.is_disconnected() { - return self.fallback.leaves().await + if !self.is_relay_chain { + return self.longest_chain.leaves().await } self.selection.leaves().await } async fn best_chain(&self) -> Result { - if self.selection.overseer.is_disconnected() { - return self.fallback.best_chain().await + if !self.is_relay_chain { + return self.longest_chain.best_chain().await } self.selection.best_chain().await } @@ -179,34 +170,34 @@ where maybe_max_number: Option, ) -> Result, ConsensusError> { let longest_chain_best = - self.fallback.finality_target(target_hash, maybe_max_number).await?; + self.longest_chain.finality_target(target_hash, maybe_max_number).await?; - if self.selection.overseer.is_disconnected() { + if !self.is_relay_chain { return Ok(longest_chain_best) } self.selection - .finality_target_with_fallback(target_hash, longest_chain_best, maybe_max_number) + .finality_target_with_longest_chain(target_hash, longest_chain_best, maybe_max_number) .await } } /// A chain-selection implementation which provides safety for relay chains /// but does not handle situations where the overseer is not yet connected. -pub struct SelectRelayChain { +pub struct SelectRelayChainInner { backend: Arc, overseer: OH, metrics: Metrics, } -impl SelectRelayChain +impl SelectRelayChainInner where B: HeaderProviderProvider, OH: OverseerHandleT, { - /// Create a new [`SelectRelayChain`] wrapping the given chain backend + /// Create a new [`SelectRelayChainInner`] wrapping the given chain backend /// and a handle to the overseer. pub fn new(backend: Arc, overseer: OH, metrics: Metrics) -> Self { - SelectRelayChain { backend, overseer, metrics } + SelectRelayChainInner { backend, overseer, metrics } } fn block_header(&self, hash: Hash) -> Result { @@ -234,13 +225,13 @@ where } } -impl Clone for SelectRelayChain +impl Clone for SelectRelayChainInner where B: HeaderProviderProvider + Send + Sync, OH: OverseerHandleT, { fn clone(&self) -> Self { - SelectRelayChain { + SelectRelayChainInner { backend: self.backend.clone(), overseer: self.overseer.clone(), metrics: self.metrics.clone(), @@ -273,7 +264,7 @@ impl OverseerHandleT for Handle { } } -impl SelectRelayChain +impl SelectRelayChainInner where B: HeaderProviderProvider, OH: OverseerHandleT, @@ -317,7 +308,7 @@ where /// /// It will also constrain the chain to only chains which are fully /// approved, and chains which contain no disputes. - pub(crate) async fn finality_target_with_fallback( + pub(crate) async fn finality_target_with_longest_chain( &self, target_hash: Hash, best_leaf: Option, diff --git a/node/service/src/tests.rs b/node/service/src/tests.rs index 34ac69d78cc7..7dc5fe19ecbd 100644 --- a/node/service/src/tests.rs +++ b/node/service/src/tests.rs @@ -79,7 +79,7 @@ fn test_harness>( let (finality_target_tx, finality_target_rx) = oneshot::channel::>(); - let select_relay_chain = SelectRelayChain::::new( + let select_relay_chain = SelectRelayChainInner::::new( Arc::new(case_vars.chain.clone()), context.sender().clone(), Default::default(), diff --git a/node/subsystem-test-helpers/src/lib.rs b/node/subsystem-test-helpers/src/lib.rs index 80dae08825b0..c180c1d0ea88 100644 --- a/node/subsystem-test-helpers/src/lib.rs +++ b/node/subsystem-test-helpers/src/lib.rs @@ -372,7 +372,9 @@ mod tests { use super::*; use futures::executor::block_on; use polkadot_node_subsystem::messages::CollatorProtocolMessage; - use polkadot_overseer::{AllSubsystems, Handle, HeadSupportsParachains, Overseer}; + use polkadot_overseer::{ + AllSubsystems, Handle, HeadSupportsParachains, Overseer, OverseerConnector, + }; use polkadot_primitives::v1::Hash; struct AlwaysSupportsParachains; @@ -394,9 +396,10 @@ mod tests { None, AlwaysSupportsParachains, spawner.clone(), + OverseerConnector::default(), ) .unwrap(); - let mut handle = Handle::Connected(handle); + let mut handle = Handle(handle); spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed()); diff --git a/node/subsystem/src/lib.rs b/node/subsystem/src/lib.rs index f0918ab1dc02..429120709a07 100644 --- a/node/subsystem/src/lib.rs +++ b/node/subsystem/src/lib.rs @@ -24,7 +24,9 @@ pub use jaeger::*; pub use polkadot_node_jaeger as jaeger; -pub use polkadot_overseer::{self as overseer, ActiveLeavesUpdate, DummySubsystem, OverseerSignal}; +pub use polkadot_overseer::{ + self as overseer, dummy::DummySubsystem, ActiveLeavesUpdate, OverseerConnector, OverseerSignal, +}; pub use polkadot_node_subsystem_types::{ errors::{self, *}, From e106953744e88abaaa16a7e109e6eb9596076460 Mon Sep 17 00:00:00 2001 From: Zeke Mostov <32168567+emostov@users.noreply.github.com> Date: Fri, 17 Sep 2021 15:41:12 -0700 Subject: [PATCH 2/8] Run fmt (#3887) --- node/service/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index ab9f732ec44f..66047854f3c2 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -1345,7 +1345,7 @@ pub fn new_chain_ops( { chain_ops!(config, jaeger_agent, telemetry_worker_handle; polkadot_runtime, PolkadotExecutorDispatch, Polkadot) } - + #[cfg(not(feature = "polkadot-native"))] Err(Error::NoRuntime) } From 4c547668ed38abee7b831e9f1cfd4af507418e1e Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Sat, 18 Sep 2021 02:57:50 -0700 Subject: [PATCH 3/8] Add benchmarking for parachain runtime configuration pallet (#3862) * Add benchmarking for parachain runtime configuration pallet * cargo fmt * Add WeightInfo trait * Specify missing WeightInfo associated type in mocks * Fix typo * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_configuration.rs * Fix compilation errors * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_configuration.rs * Condense the number of WeightInfo methods * Fixes * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_configuration.rs * Make use of weights generated from kusama benchmarking * Use a better dispatch function for weighing set_config_with_block_number * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_configuration.rs * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_configuration.rs Co-authored-by: Parity Bot --- runtime/common/src/integration_tests.rs | 4 +- runtime/common/src/paras_registrar.rs | 14 +-- runtime/kusama/src/lib.rs | 6 +- runtime/kusama/src/weights/mod.rs | 1 + .../runtime_parachains_configuration.rs | 91 ++++++++++++++++ runtime/parachains/Cargo.toml | 4 +- runtime/parachains/src/configuration.rs | 100 ++++++++++-------- .../src/configuration/benchmarking.rs | 44 ++++++++ .../parachains/src/configuration/weights.rs | 82 ++++++++++++++ runtime/parachains/src/lib.rs | 1 + runtime/parachains/src/mock.rs | 4 +- runtime/rococo/src/lib.rs | 4 +- runtime/test-runtime/src/lib.rs | 4 +- runtime/westend/src/lib.rs | 6 +- runtime/westend/src/weights/mod.rs | 1 + .../runtime_parachains_configuration.rs | 91 ++++++++++++++++ xcm/xcm-builder/tests/mock/mod.rs | 4 +- xcm/xcm-simulator/example/src/relay_chain.rs | 4 +- 18 files changed, 407 insertions(+), 58 deletions(-) create mode 100644 runtime/kusama/src/weights/runtime_parachains_configuration.rs create mode 100644 runtime/parachains/src/configuration/benchmarking.rs create mode 100644 runtime/parachains/src/configuration/weights.rs create mode 100644 runtime/westend/src/weights/runtime_parachains_configuration.rs diff --git a/runtime/common/src/integration_tests.rs b/runtime/common/src/integration_tests.rs index 50a1e9efaaac..c0e1615599e7 100644 --- a/runtime/common/src/integration_tests.rs +++ b/runtime/common/src/integration_tests.rs @@ -156,7 +156,9 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = [u8; 8]; } -impl configuration::Config for Test {} +impl configuration::Config for Test { + type WeightInfo = configuration::weights::WeightInfo; +} impl shared::Config for Test {} diff --git a/runtime/common/src/paras_registrar.rs b/runtime/common/src/paras_registrar.rs index 5f444bcffc0f..ee595cd0df05 100644 --- a/runtime/common/src/paras_registrar.rs +++ b/runtime/common/src/paras_registrar.rs @@ -213,7 +213,7 @@ pub mod pallet { /// /// ## Events /// The `Registered` event is emitted in case of success. - #[pallet::weight(T::WeightInfo::register())] + #[pallet::weight(::WeightInfo::register())] pub fn register( origin: OriginFor, id: ParaId, @@ -231,7 +231,7 @@ pub mod pallet { /// /// The deposit taken can be specified for this registration. Any `ParaId` /// can be registered, including sub-1000 IDs which are System Parachains. - #[pallet::weight(T::WeightInfo::force_register())] + #[pallet::weight(::WeightInfo::force_register())] pub fn force_register( origin: OriginFor, who: T::AccountId, @@ -247,7 +247,7 @@ pub mod pallet { /// Deregister a Para Id, freeing all data and returning any deposit. /// /// The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread. - #[pallet::weight(T::WeightInfo::deregister())] + #[pallet::weight(::WeightInfo::deregister())] pub fn deregister(origin: OriginFor, id: ParaId) -> DispatchResult { Self::ensure_root_para_or_owner(origin, id)?; Self::do_deregister(id) @@ -264,7 +264,7 @@ pub mod pallet { /// `ParaId` to be a long-term identifier of a notional "parachain". However, their /// scheduling info (i.e. whether they're a parathread or parachain), auction information /// and the auction deposit are switched. - #[pallet::weight(T::WeightInfo::swap())] + #[pallet::weight(::WeightInfo::swap())] pub fn swap(origin: OriginFor, id: ParaId, other: ParaId) -> DispatchResult { Self::ensure_root_para_or_owner(origin, id)?; @@ -325,7 +325,7 @@ pub mod pallet { /// /// ## Events /// The `Reserved` event is emitted in case of success, which provides the ID reserved for use. - #[pallet::weight(T::WeightInfo::reserve())] + #[pallet::weight(::WeightInfo::reserve())] pub fn reserve(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; let id = NextFreeParaId::::get().max(LOWEST_PUBLIC_ID); @@ -659,7 +659,9 @@ mod tests { type Event = Event; } - impl configuration::Config for Test {} + impl configuration::Config for Test { + type WeightInfo = configuration::weights::WeightInfo; + } parameter_types! { pub const ParaDeposit: Balance = 10; diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index cd6f3fc2e277..78e910f01f01 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1126,7 +1126,9 @@ impl pallet_proxy::Config for Runtime { impl parachains_origin::Config for Runtime {} -impl parachains_configuration::Config for Runtime {} +impl parachains_configuration::Config for Runtime { + type WeightInfo = weights::runtime_parachains_configuration::WeightInfo; +} impl parachains_shared::Config for Runtime {} @@ -2000,6 +2002,7 @@ sp_api::impl_runtime_apis! { list_benchmark!(list, extra, runtime_common::claims, Claims); list_benchmark!(list, extra, runtime_common::slots, Slots); list_benchmark!(list, extra, runtime_common::paras_registrar, Registrar); + list_benchmark!(list, extra, runtime_parachains::configuration, Configuration); // Substrate list_benchmark!(list, extra, pallet_bags_list, BagsList); list_benchmark!(list, extra, pallet_balances, Balances); @@ -2074,6 +2077,7 @@ sp_api::impl_runtime_apis! { add_benchmark!(params, batches, runtime_common::claims, Claims); add_benchmark!(params, batches, runtime_common::slots, Slots); add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar); + add_benchmark!(params, batches, runtime_parachains::configuration, Configuration); // Substrate add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_bags_list, BagsList); diff --git a/runtime/kusama/src/weights/mod.rs b/runtime/kusama/src/weights/mod.rs index 35273e1c98a0..adb103ad4eee 100644 --- a/runtime/kusama/src/weights/mod.rs +++ b/runtime/kusama/src/weights/mod.rs @@ -44,3 +44,4 @@ pub mod runtime_common_claims; pub mod runtime_common_crowdloan; pub mod runtime_common_paras_registrar; pub mod runtime_common_slots; +pub mod runtime_parachains_configuration; diff --git a/runtime/kusama/src/weights/runtime_parachains_configuration.rs b/runtime/kusama/src/weights/runtime_parachains_configuration.rs new file mode 100644 index 000000000000..ae840f37752d --- /dev/null +++ b/runtime/kusama/src/weights/runtime_parachains_configuration.rs @@ -0,0 +1,91 @@ +// Copyright 2017-2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `runtime_parachains::configuration` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128 + +// Executed Command: +// target/release/polkadot +// benchmark +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=runtime_parachains::configuration +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/kusama/src/weights/runtime_parachains_configuration.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `runtime_parachains::configuration`. +pub struct WeightInfo(PhantomData); +impl runtime_parachains::configuration::WeightInfo for WeightInfo { + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_block_number() -> Weight { + (12_378_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_u32() -> Weight { + (12_384_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_option_u32() -> Weight { + (12_746_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_weight() -> Weight { + (12_563_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Benchmark Override (r:0 w:0) + fn set_hrmp_open_request_ttl() -> Weight { + (2_000_000_000_000 as Weight) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_balance() -> Weight { + (12_644_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/runtime/parachains/Cargo.toml b/runtime/parachains/Cargo.toml index 8e3b41d95e6b..3b75b95619fe 100644 --- a/runtime/parachains/Cargo.toml +++ b/runtime/parachains/Cargo.toml @@ -28,12 +28,12 @@ pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } xcm = { package = "xcm", path = "../../xcm", default-features = false } xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false } diff --git a/runtime/parachains/src/configuration.rs b/runtime/parachains/src/configuration.rs index 64aaac6b3487..bcfc05e1a6c5 100644 --- a/runtime/parachains/src/configuration.rs +++ b/runtime/parachains/src/configuration.rs @@ -26,6 +26,10 @@ use primitives::v1::{Balance, SessionIndex, MAX_CODE_SIZE, MAX_POV_SIZE}; use sp_runtime::traits::Zero; use sp_std::prelude::*; +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; +pub mod weights; + pub use pallet::*; pub mod migration; @@ -258,6 +262,15 @@ impl HostConfiguration { } } +pub trait WeightInfo { + fn set_config_with_block_number() -> Weight; + fn set_config_with_u32() -> Weight; + fn set_config_with_option_u32() -> Weight; + fn set_config_with_weight() -> Weight; + fn set_config_with_balance() -> Weight; + fn set_hrmp_open_request_ttl() -> Weight; +} + #[frame_support::pallet] pub mod pallet { use super::*; @@ -268,7 +281,10 @@ pub mod pallet { pub struct Pallet(_); #[pallet::config] - pub trait Config: frame_system::Config + shared::Config {} + pub trait Config: frame_system::Config + shared::Config { + /// Weight information for extrinsics in this pallet. + type WeightInfo: WeightInfo; + } #[pallet::error] pub enum Error { @@ -310,7 +326,7 @@ pub mod pallet { #[pallet::call] impl Pallet { /// Set the validation upgrade frequency. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_validation_upgrade_frequency( origin: OriginFor, new: T::BlockNumber, @@ -323,7 +339,7 @@ pub mod pallet { } /// Set the validation upgrade delay. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_validation_upgrade_delay( origin: OriginFor, new: T::BlockNumber, @@ -336,7 +352,7 @@ pub mod pallet { } /// Set the acceptance period for an included candidate. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_code_retention_period( origin: OriginFor, new: T::BlockNumber, @@ -349,7 +365,7 @@ pub mod pallet { } /// Set the max validation code size for incoming upgrades. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_code_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; ensure!(new <= MAX_CODE_SIZE, Error::::InvalidNewValue); @@ -360,7 +376,7 @@ pub mod pallet { } /// Set the max POV block size for incoming upgrades. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_pov_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; ensure!(new <= MAX_POV_SIZE, Error::::InvalidNewValue); @@ -371,7 +387,7 @@ pub mod pallet { } /// Set the max head data size for paras. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_head_data_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -381,7 +397,7 @@ pub mod pallet { } /// Set the number of parathread execution cores. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_parathread_cores(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -391,7 +407,7 @@ pub mod pallet { } /// Set the number of retries for a particular parathread. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_parathread_retries(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -401,7 +417,7 @@ pub mod pallet { } /// Set the parachain validator-group rotation frequency - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_group_rotation_frequency( origin: OriginFor, new: T::BlockNumber, @@ -417,7 +433,7 @@ pub mod pallet { } /// Set the availability period for parachains. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_chain_availability_period( origin: OriginFor, new: T::BlockNumber, @@ -433,7 +449,7 @@ pub mod pallet { } /// Set the availability period for parathreads. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_thread_availability_period( origin: OriginFor, new: T::BlockNumber, @@ -449,7 +465,7 @@ pub mod pallet { } /// Set the scheduling lookahead, in expected number of blocks at peak throughput. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_scheduling_lookahead(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -459,7 +475,7 @@ pub mod pallet { } /// Set the maximum number of validators to assign to any core. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_option_u32())] pub fn set_max_validators_per_core( origin: OriginFor, new: Option, @@ -472,7 +488,7 @@ pub mod pallet { } /// Set the maximum number of validators to use in parachain consensus. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_option_u32())] pub fn set_max_validators(origin: OriginFor, new: Option) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -482,7 +498,7 @@ pub mod pallet { } /// Set the dispute period, in number of sessions to keep for disputes. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_dispute_period(origin: OriginFor, new: SessionIndex) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -492,7 +508,7 @@ pub mod pallet { } /// Set the dispute post conclusion acceptance period. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_dispute_post_conclusion_acceptance_period( origin: OriginFor, new: T::BlockNumber, @@ -506,7 +522,7 @@ pub mod pallet { } /// Set the maximum number of dispute spam slots. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_dispute_max_spam_slots(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -516,7 +532,7 @@ pub mod pallet { } /// Set the dispute conclusion by time out period. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_block_number())] pub fn set_dispute_conclusion_by_time_out_period( origin: OriginFor, new: T::BlockNumber, @@ -530,7 +546,7 @@ pub mod pallet { /// Set the no show slots, in number of number of consensus slots. /// Must be at least 1. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_no_show_slots(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; @@ -543,7 +559,7 @@ pub mod pallet { } /// Set the total number of delay tranches. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_n_delay_tranches(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -553,7 +569,7 @@ pub mod pallet { } /// Set the zeroth delay tranche width. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_zeroth_delay_tranche_width(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -563,7 +579,7 @@ pub mod pallet { } /// Set the number of validators needed to approve a block. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_needed_approvals(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -573,7 +589,7 @@ pub mod pallet { } /// Set the number of samples to do of the `RelayVRFModulo` approval assignment criterion. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_relay_vrf_modulo_samples(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -583,7 +599,7 @@ pub mod pallet { } /// Sets the maximum items that can present in a upward dispatch queue at once. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_upward_queue_count(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -593,7 +609,7 @@ pub mod pallet { } /// Sets the maximum total size of items that can present in a upward dispatch queue at once. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_upward_queue_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -603,7 +619,7 @@ pub mod pallet { } /// Set the critical downward message size. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_downward_message_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -613,7 +629,7 @@ pub mod pallet { } /// Sets the soft limit for the phase of dispatching dispatchable upward messages. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_weight())] pub fn set_ump_service_total_weight(origin: OriginFor, new: Weight) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -623,7 +639,7 @@ pub mod pallet { } /// Sets the maximum size of an upward message that can be sent by a candidate. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_upward_message_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -633,7 +649,7 @@ pub mod pallet { } /// Sets the maximum number of messages that a candidate can contain. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_max_upward_message_num_per_candidate( origin: OriginFor, new: u32, @@ -646,7 +662,7 @@ pub mod pallet { } /// Sets the number of sessions after which an HRMP open channel request expires. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_hrmp_open_request_ttl())] // Deprecated, but is not marked as such, because that would trigger warnings coming from // the macro. pub fn set_hrmp_open_request_ttl(_origin: OriginFor, _new: u32) -> DispatchResult { @@ -654,7 +670,7 @@ pub mod pallet { } /// Sets the amount of funds that the sender should provide for opening an HRMP channel. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_balance())] pub fn set_hrmp_sender_deposit(origin: OriginFor, new: Balance) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -665,7 +681,7 @@ pub mod pallet { /// Sets the amount of funds that the recipient should provide for accepting opening an HRMP /// channel. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_balance())] pub fn set_hrmp_recipient_deposit(origin: OriginFor, new: Balance) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -675,7 +691,7 @@ pub mod pallet { } /// Sets the maximum number of messages allowed in an HRMP channel at once. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_channel_max_capacity(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -685,7 +701,7 @@ pub mod pallet { } /// Sets the maximum total size of messages in bytes allowed in an HRMP channel at once. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_channel_max_total_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -695,7 +711,7 @@ pub mod pallet { } /// Sets the maximum number of inbound HRMP channels a parachain is allowed to accept. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_max_parachain_inbound_channels( origin: OriginFor, new: u32, @@ -708,7 +724,7 @@ pub mod pallet { } /// Sets the maximum number of inbound HRMP channels a parathread is allowed to accept. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_max_parathread_inbound_channels( origin: OriginFor, new: u32, @@ -721,7 +737,7 @@ pub mod pallet { } /// Sets the maximum size of a message that could ever be put into an HRMP channel. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_channel_max_message_size(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { @@ -731,7 +747,7 @@ pub mod pallet { } /// Sets the maximum number of outbound HRMP channels a parachain is allowed to open. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_max_parachain_outbound_channels( origin: OriginFor, new: u32, @@ -744,7 +760,7 @@ pub mod pallet { } /// Sets the maximum number of outbound HRMP channels a parathread is allowed to open. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_max_parathread_outbound_channels( origin: OriginFor, new: u32, @@ -757,7 +773,7 @@ pub mod pallet { } /// Sets the maximum number of outbound HRMP messages can be sent by a candidate. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_u32())] pub fn set_hrmp_max_message_num_per_candidate( origin: OriginFor, new: u32, @@ -770,7 +786,7 @@ pub mod pallet { } /// Sets the maximum amount of weight any individual upward message may consume. - #[pallet::weight((1_000, DispatchClass::Operational))] + #[pallet::weight(T::WeightInfo::set_config_with_weight())] pub fn set_ump_max_individual_weight(origin: OriginFor, new: Weight) -> DispatchResult { ensure_root(origin)?; Self::update_config_member(|config| { diff --git a/runtime/parachains/src/configuration/benchmarking.rs b/runtime/parachains/src/configuration/benchmarking.rs new file mode 100644 index 000000000000..8b319cb8fabb --- /dev/null +++ b/runtime/parachains/src/configuration/benchmarking.rs @@ -0,0 +1,44 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use crate::configuration::*; +use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, BenchmarkError, BenchmarkResult}; +use frame_system::RawOrigin; +use sp_runtime::traits::One; + +benchmarks! { + set_config_with_block_number {}: set_code_retention_period(RawOrigin::Root, One::one()) + + set_config_with_u32 {}: set_max_code_size(RawOrigin::Root, 100) + + set_config_with_option_u32 {}: set_max_validators(RawOrigin::Root, Some(10)) + + set_config_with_weight {}: set_ump_service_total_weight(RawOrigin::Root, 3_000_000) + + set_hrmp_open_request_ttl {}: { + Err(BenchmarkError::Override( + BenchmarkResult::from_weight(T::BlockWeights::get().max_block) + ))?; + } + + set_config_with_balance {}: set_hrmp_sender_deposit(RawOrigin::Root, 100_000_000_000) +} + +impl_benchmark_test_suite!( + Pallet, + crate::mock::new_test_ext(Default::default()), + crate::mock::Test +); diff --git a/runtime/parachains/src/configuration/weights.rs b/runtime/parachains/src/configuration/weights.rs new file mode 100644 index 000000000000..da70d6cb29d1 --- /dev/null +++ b/runtime/parachains/src/configuration/weights.rs @@ -0,0 +1,82 @@ + +//! Autogenerated weights for `runtime_parachains::configuration` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128 + +// Executed Command: +// ./target/release/polkadot +// benchmark +// --chain +// westend-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// runtime_parachains::configuration +// --steps +// 50 +// --repeat +// 20 +// --raw +// --extrinsic +// * +// --output +// runtime/parachains/src/configuration/weights.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `runtime_parachains::configuration`. +pub struct WeightInfo(PhantomData); +impl super::WeightInfo for WeightInfo { + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_block_number() -> Weight { + (16_730_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_u32() -> Weight { + (16_592_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_option_u32() -> Weight { + (16_419_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_weight() -> Weight { + (16_732_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Benchmark Override (r:0 w:0) + fn set_hrmp_open_request_ttl() -> Weight { + (2_000_000_000_000 as Weight) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_balance() -> Weight { + (16_752_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/runtime/parachains/src/lib.rs b/runtime/parachains/src/lib.rs index 1ea90bb84e63..ab48d693d601 100644 --- a/runtime/parachains/src/lib.rs +++ b/runtime/parachains/src/lib.rs @@ -20,6 +20,7 @@ //! particular the `Initializer` module, as it is responsible for initializing the state //! of the other modules. +#![cfg_attr(feature = "runtime-benchmarks", recursion_limit = "256")] #![cfg_attr(not(feature = "std"), no_std)] pub mod configuration; diff --git a/runtime/parachains/src/mock.rs b/runtime/parachains/src/mock.rs index 5cf8d6237485..c4da0991de18 100644 --- a/runtime/parachains/src/mock.rs +++ b/runtime/parachains/src/mock.rs @@ -114,7 +114,9 @@ impl crate::initializer::Config for Test { type ForceOrigin = frame_system::EnsureRoot; } -impl crate::configuration::Config for Test {} +impl crate::configuration::Config for Test { + type WeightInfo = crate::configuration::weights::WeightInfo; +} impl crate::shared::Config for Test {} diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index cbedecf056ee..182c8f953cc0 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -560,7 +560,9 @@ impl pallet_authorship::Config for Runtime { impl parachains_origin::Config for Runtime {} -impl parachains_configuration::Config for Runtime {} +impl parachains_configuration::Config for Runtime { + type WeightInfo = parachains_configuration::weights::WeightInfo; +} impl parachains_shared::Config for Runtime {} diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index a1fe03cb37f6..58ccea45c249 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -454,7 +454,9 @@ impl pallet_sudo::Config for Runtime { type Call = Call; } -impl parachains_configuration::Config for Runtime {} +impl parachains_configuration::Config for Runtime { + type WeightInfo = parachains_configuration::weights::WeightInfo; +} impl parachains_shared::Config for Runtime {} diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 09baa14a691b..e7587856ecda 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -795,7 +795,9 @@ impl pallet_proxy::Config for Runtime { impl parachains_origin::Config for Runtime {} -impl parachains_configuration::Config for Runtime {} +impl parachains_configuration::Config for Runtime { + type WeightInfo = parachains_configuration::weights::WeightInfo; +} impl parachains_shared::Config for Runtime {} @@ -1462,6 +1464,7 @@ sp_api::impl_runtime_apis! { list_benchmark!(list, extra, runtime_common::crowdloan, Crowdloan); list_benchmark!(list, extra, runtime_common::paras_registrar, Registrar); list_benchmark!(list, extra, runtime_common::slots, Slots); + list_benchmark!(list, extra, runtime_parachains::configuration, Configuration); // Substrate list_benchmark!(list, extra, pallet_bags_list, BagsList); list_benchmark!(list, extra, pallet_balances, Balances); @@ -1527,6 +1530,7 @@ sp_api::impl_runtime_apis! { add_benchmark!(params, batches, runtime_common::crowdloan, Crowdloan); add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar); add_benchmark!(params, batches, runtime_common::slots, Slots); + add_benchmark!(params, batches, runtime_parachains::configuration, Configuration); // Substrate add_benchmark!(params, batches, pallet_bags_list, BagsList); add_benchmark!(params, batches, pallet_balances, Balances); diff --git a/runtime/westend/src/weights/mod.rs b/runtime/westend/src/weights/mod.rs index 05fefbef7d71..76e23ae5fb49 100644 --- a/runtime/westend/src/weights/mod.rs +++ b/runtime/westend/src/weights/mod.rs @@ -34,3 +34,4 @@ pub mod runtime_common_auctions; pub mod runtime_common_crowdloan; pub mod runtime_common_paras_registrar; pub mod runtime_common_slots; +pub mod runtime_parachains_configuration; diff --git a/runtime/westend/src/weights/runtime_parachains_configuration.rs b/runtime/westend/src/weights/runtime_parachains_configuration.rs new file mode 100644 index 000000000000..6c1753e7c3b3 --- /dev/null +++ b/runtime/westend/src/weights/runtime_parachains_configuration.rs @@ -0,0 +1,91 @@ +// Copyright 2017-2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `runtime_parachains::configuration` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128 + +// Executed Command: +// target/release/polkadot +// benchmark +// --chain=westend-dev +// --steps=50 +// --repeat=20 +// --pallet=runtime_parachains::configuration +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/westend/src/weights/runtime_parachains_configuration.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `runtime_parachains::configuration`. +pub struct WeightInfo(PhantomData); +impl runtime_parachains::configuration::WeightInfo for WeightInfo { + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_block_number() -> Weight { + (12_795_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_u32() -> Weight { + (12_758_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_option_u32() -> Weight { + (12_861_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_weight() -> Weight { + (12_854_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Benchmark Override (r:0 w:0) + fn set_hrmp_open_request_ttl() -> Weight { + (2_000_000_000_000 as Weight) + } + // Storage: ParasShared CurrentSessionIndex (r:1 w:0) + // Storage: Configuration PendingConfig (r:1 w:1) + // Storage: Configuration ActiveConfig (r:1 w:0) + fn set_config_with_balance() -> Weight { + (12_838_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/xcm/xcm-builder/tests/mock/mod.rs b/xcm/xcm-builder/tests/mock/mod.rs index ee5c77afe587..bcdac942a30a 100644 --- a/xcm/xcm-builder/tests/mock/mod.rs +++ b/xcm/xcm-builder/tests/mock/mod.rs @@ -107,7 +107,9 @@ impl pallet_balances::Config for Runtime { impl shared::Config for Runtime {} -impl configuration::Config for Runtime {} +impl configuration::Config for Runtime { + type WeightInfo = configuration::weights::WeightInfo; +} // aims to closely emulate the Kusama XcmConfig parameter_types! { diff --git a/xcm/xcm-simulator/example/src/relay_chain.rs b/xcm/xcm-simulator/example/src/relay_chain.rs index a6f6f1989174..cc50aec90d18 100644 --- a/xcm/xcm-simulator/example/src/relay_chain.rs +++ b/xcm/xcm-simulator/example/src/relay_chain.rs @@ -88,7 +88,9 @@ impl pallet_balances::Config for Runtime { impl shared::Config for Runtime {} -impl configuration::Config for Runtime {} +impl configuration::Config for Runtime { + type WeightInfo = configuration::weights::WeightInfo; +} parameter_types! { pub const KsmLocation: MultiLocation = Here.into(); From 07d183078b93a2309f80a80c52d8784acd410bd3 Mon Sep 17 00:00:00 2001 From: Andronik Ordian Date: Sat, 18 Sep 2021 12:02:30 +0200 Subject: [PATCH 4/8] ci: cache seed in fuzzer job (#3885) * ci: cache seed in fuzzer job * change id based on binary --- .github/workflows/honggfuzz.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/honggfuzz.yml b/.github/workflows/honggfuzz.yml index af0de3eb5017..ab1cdf0d2ef2 100644 --- a/.github/workflows/honggfuzz.yml +++ b/.github/workflows/honggfuzz.yml @@ -13,6 +13,13 @@ jobs: with: fetch-depth: 1 + - name: Cache Seed + id: cache-seed-round-trip + uses: actions/cache@v2 + with: + path: erasure-coding/fuzzer/hfuzz_workspace + key: ${{ runner.os }}-erasure-coding + - name: Install minimal stable Rust uses: actions-rs/toolchain@v1 with: @@ -52,6 +59,13 @@ jobs: with: fetch-depth: 1 + - name: Cache Seed + id: cache-seed-reconstruct + uses: actions/cache@v2 + with: + path: erasure-coding/fuzzer/hfuzz_workspace + key: ${{ runner.os }}-erasure-coding + - name: Install minimal stable Rust uses: actions-rs/toolchain@v1 with: From 9663d395884a9d94c5a563098ff7be0d1b6c9b41 Mon Sep 17 00:00:00 2001 From: Koute Date: Mon, 20 Sep 2021 17:51:34 +0900 Subject: [PATCH 5/8] Gather memory usage statistics through `parity-util-mem` (#3893) * Gather memory usage statistics through `parity-util-mem` * Update `Cargo.lock` --- Cargo.lock | 7 ++-- cli/Cargo.toml | 7 ---- node/metrics/Cargo.toml | 3 -- node/metrics/src/lib.rs | 7 ---- node/metrics/src/memory_stats.rs | 66 -------------------------------- node/overseer/Cargo.toml | 2 +- node/overseer/src/lib.rs | 48 ++++++++++++++--------- node/overseer/src/metrics.rs | 16 ++------ node/service/Cargo.toml | 1 - 9 files changed, 37 insertions(+), 120 deletions(-) delete mode 100644 node/metrics/src/memory_stats.rs diff --git a/Cargo.lock b/Cargo.lock index 631c36009309..eaa0d1a1fc66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5480,14 +5480,15 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ad6f1acec69b95caf435bbd158d486e5a0a44fcf51531e84922c59ff09e8457" +checksum = "9f7adaf50e545c285006d384d50588e98c405c49b55c0aa05660aca081f6ee5e" dependencies = [ "cfg-if 1.0.0", "ethereum-types", "hashbrown", "impl-trait-for-tuples", + "jemalloc-ctl", "jemallocator", "lru", "parity-util-mem-derive", @@ -6395,7 +6396,6 @@ version = "0.9.9" dependencies = [ "futures 0.3.17", "futures-timer 3.0.2", - "jemalloc-ctl", "metered-channel", "substrate-prometheus-endpoint", ] @@ -6524,6 +6524,7 @@ dependencies = [ "futures-timer 3.0.2", "lru", "metered-channel", + "parity-util-mem", "parking_lot 0.11.1", "polkadot-node-metrics", "polkadot-node-network-protocol", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 7d56222f313e..371c8b285dde 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -46,13 +46,6 @@ cli = [ "frame-benchmarking-cli", "try-runtime-cli", "polkadot-node-core-pvf", -# memory stats require jemalloc, which we know is enabled for Linux -# but not present on wasm or windows -# https://github.com/paritytech/parity-common/blob/master/parity-util-mem/src/allocators.rs#L9-L34 -# Once -# https://github.com/rust-lang/cargo/issues/1197 -# is resolved. - "service/memory-stats", ] runtime-benchmarks = [ "service/runtime-benchmarks" ] trie-memory-tracker = [ "sp-trie/memory-tracker" ] diff --git a/node/metrics/Cargo.toml b/node/metrics/Cargo.toml index 72cf2f2f7491..2146b6525c0d 100644 --- a/node/metrics/Cargo.toml +++ b/node/metrics/Cargo.toml @@ -13,8 +13,5 @@ metered-channel = { path = "../metered-channel" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } -jemalloc-ctl = { version = "0.3.3", optional = true } - [features] default = [] -memory-stats = ["jemalloc-ctl"] diff --git a/node/metrics/src/lib.rs b/node/metrics/src/lib.rs index 50ee6827bf4b..af635f621d73 100644 --- a/node/metrics/src/lib.rs +++ b/node/metrics/src/lib.rs @@ -26,13 +26,6 @@ pub use metered_channel as metered; -/// Memory allocation stats tracking. -#[cfg(feature = "memory-stats")] -pub mod memory_stats; - -#[cfg(feature = "memory-stats")] -pub use self::memory_stats::{MemoryAllocationSnapshot, MemoryAllocationTracker}; - /// Cyclic metric collection support. pub mod metronome; pub use self::metronome::Metronome; diff --git a/node/metrics/src/memory_stats.rs b/node/metrics/src/memory_stats.rs deleted file mode 100644 index cc1a7213c787..000000000000 --- a/node/metrics/src/memory_stats.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Polkadot is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Polkadot. If not, see . - -//! Memory tracking statistics. -//! -//! Many subsystems have common interests such as canceling a bunch of spawned jobs, -//! or determining what their validator ID is. These common interests are factored into -//! this module. -//! -//! This crate also reexports Prometheus metric types which are expected to be implemented by subsystems. - -// #[cfg(not(feature = "memory-stats"))] -// use std::convert::Infallible; - -use jemalloc_ctl::{epoch, stats, Result}; - -/// Accessor to the allocator internals. -#[derive(Clone)] -pub struct MemoryAllocationTracker { - epoch: jemalloc_ctl::epoch_mib, - allocated: stats::allocated_mib, - resident: stats::resident_mib, -} - -impl MemoryAllocationTracker { - /// Create an instance of an allocation tracker. - pub fn new() -> Result { - Ok(Self { - epoch: epoch::mib()?, - allocated: stats::allocated::mib()?, - resident: stats::resident::mib()?, - }) - } - - /// Create an allocation snapshot. - pub fn snapshot(&self) -> Result { - // update stats by advancing the allocation epoch - self.epoch.advance()?; - - let allocated: u64 = self.allocated.read()? as _; - let resident: u64 = self.resident.read()? as _; - Ok(MemoryAllocationSnapshot { allocated, resident }) - } -} - -/// Snapshot of collected memory metrics. -#[derive(Debug, Clone)] -pub struct MemoryAllocationSnapshot { - /// Total resident memory, in bytes. - pub resident: u64, - /// Total allocated memory, in bytes. - pub allocated: u64, -} diff --git a/node/overseer/Cargo.toml b/node/overseer/Cargo.toml index b22d57975aa1..bef2d141415e 100644 --- a/node/overseer/Cargo.toml +++ b/node/overseer/Cargo.toml @@ -19,6 +19,7 @@ polkadot-overseer-gen = { path = "./overseer-gen" } polkadot-overseer-all-subsystems-gen = { path = "./all-subsystems-gen" } tracing = "0.1.27" lru = "0.6" +parity-util-mem = { version = ">= 0.10.1", default-features = false } [dev-dependencies] metered-channel = { path = "../metered-channel" } @@ -29,4 +30,3 @@ assert_matches = "1.4.0" [features] default = [] -memory-stats = ["polkadot-node-metrics/memory-stats"] diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index 9b1e591b44c2..c226f2dfa0c1 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -108,8 +108,7 @@ use polkadot_node_metrics::{ Metronome, }; -#[cfg(feature = "memory-stats")] -use polkadot_node_metrics::memory_stats::MemoryAllocationTracker; +use parity_util_mem::MemoryAllocationTracker; pub use polkadot_overseer_gen as gen; pub use polkadot_overseer_gen::{ @@ -649,28 +648,39 @@ where } let subsystem_meters = overseer.map_subsystems(ExtractNameAndMeters); - #[cfg(feature = "memory-stats")] - let memory_stats = MemoryAllocationTracker::new().expect("Jemalloc is the default allocator. qed"); + let memory_stats = match MemoryAllocationTracker::new() { + Ok(memory_stats) => Some(memory_stats), + Err(error) => { + tracing::debug!( + target: LOG_TARGET, + "Failed to initialize memory allocation tracker: {:?}", + error + ); + + None + }, + }; let metronome_metrics = metrics.clone(); let metronome = Metronome::new(std::time::Duration::from_millis(950)).for_each(move |_| { - #[cfg(feature = "memory-stats")] - match memory_stats.snapshot() { - Ok(memory_stats_snapshot) => { - tracing::trace!( + if let Some(ref memory_stats) = memory_stats { + match memory_stats.snapshot() { + Ok(memory_stats_snapshot) => { + tracing::trace!( + target: LOG_TARGET, + "memory_stats: {:?}", + &memory_stats_snapshot + ); + metronome_metrics.memory_stats_snapshot(memory_stats_snapshot); + }, + + Err(e) => tracing::debug!( target: LOG_TARGET, - "memory_stats: {:?}", - &memory_stats_snapshot - ); - metronome_metrics.memory_stats_snapshot(memory_stats_snapshot); - }, - - Err(e) => tracing::debug!( - target: LOG_TARGET, - "Failed to obtain memory stats: {:?}", - e - ), + "Failed to obtain memory stats: {:?}", + e + ), + } } // We combine the amount of messages from subsystems to the overseer diff --git a/node/overseer/src/metrics.rs b/node/overseer/src/metrics.rs index 5b57f3336131..fa883857e9be 100644 --- a/node/overseer/src/metrics.rs +++ b/node/overseer/src/metrics.rs @@ -19,8 +19,7 @@ use super::*; pub use polkadot_node_metrics::metrics::{self, prometheus, Metrics as MetricsTrait}; -#[cfg(feature = "memory-stats")] -use polkadot_node_metrics::MemoryAllocationSnapshot; +use parity_util_mem::MemoryAllocationSnapshot; /// Overseer Prometheus metrics. #[derive(Clone)] @@ -35,10 +34,7 @@ struct MetricsInner { signals_sent: prometheus::GaugeVec, signals_received: prometheus::GaugeVec, - #[cfg(feature = "memory-stats")] memory_stats_resident: prometheus::Gauge, - - #[cfg(feature = "memory-stats")] memory_stats_allocated: prometheus::Gauge, } @@ -65,13 +61,10 @@ impl Metrics { } } - #[cfg(feature = "memory-stats")] pub(crate) fn memory_stats_snapshot(&self, memory_stats: MemoryAllocationSnapshot) { if let Some(metrics) = &self.0 { - let MemoryAllocationSnapshot { resident, allocated } = memory_stats; - - metrics.memory_stats_allocated.set(allocated); - metrics.memory_stats_resident.set(resident); + metrics.memory_stats_allocated.set(memory_stats.allocated); + metrics.memory_stats_resident.set(memory_stats.resident); } } @@ -202,7 +195,6 @@ impl MetricsTrait for Metrics { registry, )?, - #[cfg(feature = "memory-stats")] memory_stats_allocated: prometheus::register( prometheus::Gauge::::new( "memory_allocated", @@ -210,8 +202,6 @@ impl MetricsTrait for Metrics { )?, registry, )?, - - #[cfg(feature = "memory-stats")] memory_stats_resident: prometheus::register( prometheus::Gauge::::new( "memory_resident", diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 66c936e9a6c3..632c83c94980 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -175,5 +175,4 @@ try-runtime = [ "rococo-runtime/try-runtime", ] malus = ["full-node"] -memory-stats = ["polkadot-overseer/memory-stats"] disputes = ["polkadot-node-core-dispute-coordinator/disputes"] From 3e92a342ba738d366aee5d44476e885daef73382 Mon Sep 17 00:00:00 2001 From: Georges Date: Mon, 20 Sep 2021 12:58:09 +0100 Subject: [PATCH 6/8] Companion for Generate storage info for pallet im_online #9654 (#3744) * Adding `MaxKeys` `MaxPeerInHeartbeats` and `MaxPeerDataEncodingSize` to paller `im_online` after substrate changes * update Substrate Co-authored-by: parity-processbot <> --- Cargo.lock | 308 ++++++++++++++++++------------------ runtime/kusama/src/lib.rs | 6 + runtime/polkadot/src/lib.rs | 6 + runtime/rococo/src/lib.rs | 6 + runtime/westend/src/lib.rs | 6 + 5 files changed, 178 insertions(+), 154 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eaa0d1a1fc66..e70b8e44a447 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1928,7 +1928,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", ] @@ -1946,7 +1946,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -1966,7 +1966,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "Inflector", "chrono", @@ -1992,7 +1992,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -2006,7 +2006,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -2034,7 +2034,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "bitflags", "frame-metadata", @@ -2061,7 +2061,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -2073,7 +2073,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.0.0", @@ -2085,7 +2085,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "proc-macro2", "quote", @@ -2095,7 +2095,7 @@ dependencies = [ [[package]] name = "frame-support-test" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-support-test-pallet", @@ -2118,7 +2118,7 @@ dependencies = [ [[package]] name = "frame-support-test-pallet" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -2129,7 +2129,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "log", @@ -2146,7 +2146,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -2161,7 +2161,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "sp-api", @@ -2170,7 +2170,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "sp-api", @@ -2383,7 +2383,7 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "generate-bags" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "chrono", "frame-election-provider-support", @@ -4595,7 +4595,7 @@ checksum = "13370dae44474229701bb69b90b4f4dca6404cb0357a2d50d635f1171dc3aa7b" [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -4611,7 +4611,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -4626,7 +4626,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4650,7 +4650,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4670,7 +4670,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4726,7 +4726,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4808,7 +4808,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4825,7 +4825,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4841,7 +4841,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4865,7 +4865,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4883,7 +4883,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4898,7 +4898,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4921,7 +4921,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4937,7 +4937,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4957,7 +4957,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4974,7 +4974,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -4991,7 +4991,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -5009,7 +5009,7 @@ dependencies = [ [[package]] name = "pallet-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5025,7 +5025,7 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -5042,7 +5042,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5057,7 +5057,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5071,7 +5071,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5088,7 +5088,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5111,7 +5111,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5126,7 +5126,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5140,7 +5140,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5156,7 +5156,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5177,7 +5177,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5193,7 +5193,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5207,7 +5207,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5230,7 +5230,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -5241,7 +5241,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "log", "sp-arithmetic", @@ -5250,7 +5250,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5264,7 +5264,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5282,7 +5282,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5301,7 +5301,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-support", "frame-system", @@ -5318,7 +5318,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -5335,7 +5335,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5346,7 +5346,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5363,7 +5363,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -5379,7 +5379,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-benchmarking", "frame-support", @@ -7775,7 +7775,7 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "env_logger 0.9.0", "jsonrpsee-proc-macros", @@ -8035,7 +8035,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "log", "sp-core", @@ -8046,7 +8046,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "derive_more", @@ -8073,7 +8073,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "futures-timer 3.0.2", @@ -8096,7 +8096,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -8112,7 +8112,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8128,7 +8128,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -8139,7 +8139,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "chrono", "fdlimit", @@ -8177,7 +8177,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "fnv", "futures 0.3.17", @@ -8205,7 +8205,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "hash-db", "kvdb", @@ -8230,7 +8230,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "futures 0.3.17", @@ -8254,7 +8254,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "derive_more", @@ -8297,7 +8297,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "derive_more", "futures 0.3.17", @@ -8321,7 +8321,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "fork-tree", "parity-scale-codec", @@ -8334,7 +8334,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "assert_matches", "async-trait", @@ -8368,7 +8368,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "futures 0.3.17", @@ -8394,7 +8394,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "sc-client-api", "sp-authorship", @@ -8405,7 +8405,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "lazy_static", "libsecp256k1 0.6.0", @@ -8431,7 +8431,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "derive_more", "environmental", @@ -8449,7 +8449,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "log", "parity-scale-codec", @@ -8465,7 +8465,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "cfg-if 1.0.0", "libc", @@ -8484,7 +8484,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "derive_more", @@ -8521,7 +8521,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "derive_more", "finality-grandpa", @@ -8545,7 +8545,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "ansi_term 0.12.1", "futures 0.3.17", @@ -8562,7 +8562,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "derive_more", @@ -8577,7 +8577,7 @@ dependencies = [ [[package]] name = "sc-light" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "hash-db", "parity-scale-codec", @@ -8595,7 +8595,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-std", "async-trait", @@ -8646,7 +8646,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "futures-timer 3.0.2", @@ -8662,7 +8662,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "bytes 1.0.1", "fnv", @@ -8689,7 +8689,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "libp2p", @@ -8702,7 +8702,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -8711,7 +8711,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "hash-db", @@ -8742,7 +8742,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "jsonrpc-core", @@ -8767,7 +8767,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "jsonrpc-core", @@ -8784,7 +8784,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "directories", @@ -8849,7 +8849,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "log", "parity-scale-codec", @@ -8863,7 +8863,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -8885,7 +8885,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "chrono", "futures 0.3.17", @@ -8903,7 +8903,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "ansi_term 0.12.1", "atty", @@ -8932,7 +8932,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -8943,7 +8943,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "intervalier", @@ -8970,7 +8970,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "derive_more", "futures 0.3.17", @@ -8984,7 +8984,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "futures-timer 3.0.2", @@ -9416,7 +9416,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "hash-db", "log", @@ -9433,7 +9433,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "blake2-rfc", "proc-macro-crate 1.0.0", @@ -9445,7 +9445,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "scale-info", @@ -9458,7 +9458,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "integer-sqrt", "num-traits", @@ -9473,7 +9473,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "scale-info", @@ -9486,7 +9486,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "parity-scale-codec", @@ -9498,7 +9498,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "sp-api", @@ -9510,7 +9510,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "log", @@ -9528,7 +9528,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "futures 0.3.17", @@ -9547,7 +9547,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "merlin", @@ -9570,7 +9570,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "scale-info", @@ -9581,7 +9581,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -9593,7 +9593,7 @@ dependencies = [ [[package]] name = "sp-core" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "base58", "blake2-rfc", @@ -9638,7 +9638,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "kvdb", "parking_lot 0.11.1", @@ -9647,7 +9647,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "proc-macro2", "quote", @@ -9657,7 +9657,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "environmental", "parity-scale-codec", @@ -9668,7 +9668,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "finality-grandpa", "log", @@ -9686,7 +9686,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -9700,7 +9700,7 @@ dependencies = [ [[package]] name = "sp-io" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "hash-db", @@ -9725,7 +9725,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "lazy_static", "sp-core", @@ -9736,7 +9736,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "derive_more", @@ -9753,7 +9753,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "zstd", ] @@ -9761,7 +9761,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "scale-info", @@ -9776,7 +9776,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -9787,7 +9787,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "sp-api", "sp-core", @@ -9797,7 +9797,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "backtrace", ] @@ -9805,7 +9805,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "rustc-hash", "serde", @@ -9815,7 +9815,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "either", "hash256-std-hasher", @@ -9837,7 +9837,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -9854,7 +9854,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "Inflector", "proc-macro-crate 1.0.0", @@ -9866,7 +9866,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "serde", "serde_json", @@ -9875,7 +9875,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "scale-info", @@ -9889,7 +9889,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "scale-info", @@ -9900,7 +9900,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "hash-db", "log", @@ -9923,12 +9923,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" [[package]] name = "sp-storage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "impl-serde", "parity-scale-codec", @@ -9941,7 +9941,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "log", "sp-core", @@ -9954,7 +9954,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "futures-timer 3.0.2", @@ -9970,7 +9970,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "erased-serde", "log", @@ -9988,7 +9988,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "sp-api", "sp-runtime", @@ -9997,7 +9997,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "log", @@ -10013,7 +10013,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "hash-db", "memory-db", @@ -10028,7 +10028,7 @@ dependencies = [ [[package]] name = "sp-version" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10044,7 +10044,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -10055,7 +10055,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -10251,7 +10251,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "platforms", ] @@ -10259,7 +10259,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.17", @@ -10281,7 +10281,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-std", "derive_more", @@ -10295,7 +10295,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "async-trait", "futures 0.3.17", @@ -10322,7 +10322,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "futures 0.3.17", "substrate-test-utils-derive", @@ -10332,7 +10332,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -10343,7 +10343,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "ansi_term 0.12.1", "build-helper", @@ -10496,7 +10496,7 @@ dependencies = [ [[package]] name = "test-runner" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "frame-system", "futures 0.3.17", @@ -10903,7 +10903,7 @@ checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#c000780dba99a611fadbf83873073e024be1be0b" +source = "git+https://github.com/paritytech/substrate?branch=master#e30db04a7ec3b259e66d7b0334e42e538ed69b96" dependencies = [ "log", "parity-scale-codec", diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 78e910f01f01..39a532b47512 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -702,6 +702,9 @@ parameter_types! { pub const BountyValueMinimum: Balance = 200 * CENTS; pub const MaxApprovals: u32 = 100; pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; } type ApproveOrigin = EnsureOneOf< @@ -774,6 +777,9 @@ impl pallet_im_online::Config for Runtime { type ReportUnresponsiveness = Offences; type UnsignedPriority = ImOnlineUnsignedPriority; type WeightInfo = weights::pallet_im_online::WeightInfo; + type MaxKeys = MaxKeys; + type MaxPeerInHeartbeats = MaxPeerInHeartbeats; + type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } impl pallet_grandpa::Config for Runtime { diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 8b0230dffab9..72a5c7488409 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -688,6 +688,9 @@ parameter_types! { pub const BountyValueMinimum: Balance = 10 * DOLLARS; pub const MaxApprovals: u32 = 100; pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; } type ApproveOrigin = EnsureOneOf< @@ -760,6 +763,9 @@ impl pallet_im_online::Config for Runtime { type ReportUnresponsiveness = Offences; type UnsignedPriority = ImOnlineUnsignedPriority; type WeightInfo = weights::pallet_im_online::WeightInfo; + type MaxKeys = MaxKeys; + type MaxPeerInHeartbeats = MaxPeerInHeartbeats; + type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } impl pallet_grandpa::Config for Runtime { diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 182c8f953cc0..b86314c50b9f 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -377,6 +377,9 @@ parameter_types! { parameter_types! { pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; } impl pallet_im_online::Config for Runtime { @@ -387,6 +390,9 @@ impl pallet_im_online::Config for Runtime { type ReportUnresponsiveness = Offences; type UnsignedPriority = ImOnlineUnsignedPriority; type WeightInfo = (); + type MaxKeys = MaxKeys; + type MaxPeerInHeartbeats = MaxPeerInHeartbeats; + type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } parameter_types! { diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index e7587856ecda..3ce1ef1defc0 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -483,6 +483,9 @@ impl pallet_authority_discovery::Config for Runtime { parameter_types! { pub const NposSolutionPriority: TransactionPriority = TransactionPriority::max_value() / 2; pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; } impl pallet_im_online::Config for Runtime { @@ -493,6 +496,9 @@ impl pallet_im_online::Config for Runtime { type ReportUnresponsiveness = Offences; type UnsignedPriority = ImOnlineUnsignedPriority; type WeightInfo = weights::pallet_im_online::WeightInfo; + type MaxKeys = MaxKeys; + type MaxPeerInHeartbeats = MaxPeerInHeartbeats; + type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } impl pallet_grandpa::Config for Runtime { From eeb6cc61e15ce9c1edfe916b2152d7cccd19f8bc Mon Sep 17 00:00:00 2001 From: Bernhard Schuster Date: Mon, 20 Sep 2021 15:02:36 +0200 Subject: [PATCH 7/8] Revert "remove connected disconnected state only (#3868)" (#3896) This reverts commit 7bc352628e65ec99f3393503a28c8a0c8e4202bd. --- Cargo.lock | 1 - doc/testing.md | 3 +- node/malus/src/variant-a.rs | 5 +- node/overseer/examples/minimal-example.rs | 14 +- .../proc-macro/src/impl_builder.rs | 2 +- node/overseer/src/dummy.rs | 54 ---- node/overseer/src/lib.rs | 87 ++++-- node/overseer/src/metrics.rs | 4 +- node/overseer/src/subsystems.rs | 42 ++- node/overseer/src/tests.rs | 74 ++--- node/service/Cargo.toml | 1 - node/service/src/lib.rs | 274 +++++++----------- node/service/src/overseer.rs | 196 +------------ node/service/src/relay_chain_selection.rs | 79 ++--- node/service/src/tests.rs | 2 +- node/subsystem-test-helpers/src/lib.rs | 7 +- node/subsystem/src/lib.rs | 4 +- 17 files changed, 302 insertions(+), 547 deletions(-) delete mode 100644 node/overseer/src/dummy.rs diff --git a/Cargo.lock b/Cargo.lock index e70b8e44a447..c46974710b2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6842,7 +6842,6 @@ dependencies = [ "kvdb", "kvdb-rocksdb", "log", - "lru", "pallet-babe", "pallet-im-online", "pallet-mmr-primitives", diff --git a/doc/testing.md b/doc/testing.md index 6709d1b9bdeb..8230ea352c0f 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -185,7 +185,6 @@ struct BehaveMaleficient; impl OverseerGen for BehaveMaleficient { fn generate<'a, Spawner, RuntimeClient>( &self, - connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandler), Error> where @@ -214,7 +213,7 @@ impl OverseerGen for BehaveMaleficient { ), ); - Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner, connector) + Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner) .map_err(|e| e.into()) // A builder pattern will simplify this further diff --git a/node/malus/src/variant-a.rs b/node/malus/src/variant-a.rs index 8abdf75198b3..a545bd360faf 100644 --- a/node/malus/src/variant-a.rs +++ b/node/malus/src/variant-a.rs @@ -37,7 +37,7 @@ use polkadot_cli::{ use polkadot_node_core_candidate_validation::CandidateValidationSubsystem; use polkadot_node_subsystem::{ messages::{AllMessages, CandidateValidationMessage}, - overseer::{self, OverseerConnector, OverseerHandle}, + overseer::{self, OverseerHandle}, FromOverseer, }; @@ -86,7 +86,6 @@ struct BehaveMaleficient; impl OverseerGen for BehaveMaleficient { fn generate<'a, Spawner, RuntimeClient>( &self, - connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandle), Error> where @@ -114,7 +113,7 @@ impl OverseerGen for BehaveMaleficient { }, ); - Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner, connector) + Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner) .map_err(|e| e.into()) } } diff --git a/node/overseer/examples/minimal-example.rs b/node/overseer/examples/minimal-example.rs index 0c4a3bdc6ae6..6970054a3013 100644 --- a/node/overseer/examples/minimal-example.rs +++ b/node/overseer/examples/minimal-example.rs @@ -29,8 +29,7 @@ use polkadot_node_subsystem_types::messages::{ use polkadot_overseer::{ self as overseer, gen::{FromOverseer, SpawnedSubsystem}, - AllMessages, AllSubsystems, HeadSupportsParachains, Overseer, OverseerConnector, - OverseerSignal, SubsystemError, + AllMessages, AllSubsystems, HeadSupportsParachains, Overseer, OverseerSignal, SubsystemError, }; use polkadot_primitives::v1::Hash; @@ -174,15 +173,8 @@ fn main() { .replace_candidate_validation(|_| Subsystem2) .replace_candidate_backing(|orig| orig); - let (overseer, _handle) = Overseer::new( - vec![], - all_subsystems, - None, - AlwaysSupportsParachains, - spawner, - OverseerConnector::default(), - ) - .unwrap(); + let (overseer, _handle) = + Overseer::new(vec![], all_subsystems, None, AlwaysSupportsParachains, spawner).unwrap(); let overseer_fut = overseer.run().fuse(); let timer_stream = timer_stream; diff --git a/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs b/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs index b736de97d463..832e193fd4d1 100644 --- a/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs +++ b/node/overseer/overseer-gen/proc-macro/src/impl_builder.rs @@ -130,7 +130,7 @@ pub(crate) fn impl_builder(info: &OverseerInfo) -> proc_macro2::TokenStream { &mut self.handle } /// Obtain access to the overseer handle. - pub fn as_handle(&self) -> &#handle { + pub fn as_handle(&mut self) -> &#handle { &self.handle } } diff --git a/node/overseer/src/dummy.rs b/node/overseer/src/dummy.rs deleted file mode 100644 index c3d3d4fcf3c8..000000000000 --- a/node/overseer/src/dummy.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2020 Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Polkadot is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Polkadot. If not, see . - -use crate::{AllMessages, OverseerSignal}; -use polkadot_node_subsystem_types::errors::SubsystemError; -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)] -pub struct DummySubsystem; - -impl Subsystem for DummySubsystem -where - Context: SubsystemContext< - Signal = OverseerSignal, - Error = SubsystemError, - AllMessages = AllMessages, - >, -{ - fn start(self, mut ctx: Context) -> SpawnedSubsystem { - let future = Box::pin(async move { - loop { - match ctx.recv().await { - Err(_) => return Ok(()), - Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), - Ok(overseer_msg) => { - tracing::debug!( - target: "dummy-subsystem", - "Discarding a message sent from overseer {:?}", - overseer_msg - ); - continue - }, - } - } - }); - - SpawnedSubsystem { name: "dummy-subsystem", future } - } -} diff --git a/node/overseer/src/lib.rs b/node/overseer/src/lib.rs index c226f2dfa0c1..2fb9ffd359b2 100644 --- a/node/overseer/src/lib.rs +++ b/node/overseer/src/lib.rs @@ -70,6 +70,7 @@ use std::{ use futures::{channel::oneshot, future::BoxFuture, select, Future, FutureExt, StreamExt}; use lru::LruCache; +use parking_lot::RwLock; use client::{BlockImportNotification, BlockchainEvents, FinalityNotification}; use polkadot_primitives::v1::{Block, BlockId, BlockNumber, Hash, ParachainHost}; @@ -90,17 +91,12 @@ pub use polkadot_node_subsystem_types::{ jaeger, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, OverseerSignal, }; -/// Test helper supplements. -pub mod dummy; -pub use self::dummy::DummySubsystem; - // TODO legacy, to be deleted, left for easier integration // TODO https://github.com/paritytech/polkadot/issues/3427 mod subsystems; -pub use self::subsystems::AllSubsystems; +pub use self::subsystems::{AllSubsystems, DummySubsystem}; -/// Metrics re-exports of `polkadot-metrics`. -pub mod metrics; +mod metrics; use self::metrics::Metrics; use polkadot_node_metrics::{ @@ -119,7 +115,7 @@ pub use polkadot_overseer_gen::{ /// Store 2 days worth of blocks, not accounting for forks, /// in the LRU cache. Assumes a 6-second block time. -pub const KNOWN_LEAVES_CACHE_SIZE: usize = 2 * 24 * 3600 / 6; +const KNOWN_LEAVES_CACHE_SIZE: usize = 2 * 24 * 3600 / 6; #[cfg(test)] mod tests; @@ -145,12 +141,18 @@ where /// /// [`Overseer`]: struct.Overseer.html #[derive(Clone)] -pub struct Handle(pub OverseerHandle); +pub enum Handle { + /// Used only at initialization to break the cyclic dependency. + // TODO: refactor in https://github.com/paritytech/polkadot/issues/3427 + Disconnected(Arc>>), + /// A handle to the overseer. + Connected(OverseerHandle), +} impl Handle { - /// Create a new [`Handle`]. - pub fn new(raw: OverseerHandle) -> Self { - Self(raw) + /// Create a new disconnected [`Handle`]. + pub fn new_disconnected() -> Self { + Self::Disconnected(Arc::new(RwLock::new(None))) } /// Inform the `Overseer` that that some block was imported. @@ -199,8 +201,58 @@ impl Handle { /// Most basic operation, to stop a server. async fn send_and_log_error(&mut self, event: Event) { - if self.0.send(event).await.is_err() { - tracing::info!(target: LOG_TARGET, "Failed to send an event to Overseer"); + self.try_connect(); + if let Self::Connected(ref mut handle) = self { + if handle.send(event).await.is_err() { + tracing::info!(target: LOG_TARGET, "Failed to send an event to Overseer"); + } + } else { + tracing::warn!(target: LOG_TARGET, "Using a disconnected Handle to send to Overseer"); + } + } + + /// Whether the handle is disconnected. + pub fn is_disconnected(&self) -> bool { + match self { + Self::Disconnected(ref x) => x.read().is_none(), + _ => false, + } + } + + /// Connect this handle and all disconnected clones of it to the overseer. + pub fn connect_to_overseer(&mut self, handle: OverseerHandle) { + match self { + Self::Disconnected(ref mut x) => { + let mut maybe_handle = x.write(); + if maybe_handle.is_none() { + tracing::info!(target: LOG_TARGET, "🖇️ Connecting all Handles to Overseer"); + *maybe_handle = Some(handle); + } else { + tracing::warn!( + target: LOG_TARGET, + "Attempting to connect a clone of a connected Handle", + ); + } + }, + _ => { + tracing::warn!( + target: LOG_TARGET, + "Attempting to connect an already connected Handle", + ); + }, + } + } + + /// Try upgrading from `Self::Disconnected` to `Self::Connected` state + /// after calling `connect_to_overseer` on `self` or a clone of `self`. + fn try_connect(&mut self) { + if let Self::Disconnected(ref mut x) = self { + let guard = x.write(); + if let Some(ref h) = *guard { + let handle = h.clone(); + drop(guard); + *self = Self::Connected(handle); + } } } } @@ -438,13 +490,12 @@ where /// # use polkadot_primitives::v1::Hash; /// # use polkadot_overseer::{ /// # self as overseer, - /// # Overseer, /// # OverseerSignal, - /// # OverseerConnector, /// # SubsystemSender as _, /// # AllMessages, /// # AllSubsystems, /// # HeadSupportsParachains, + /// # Overseer, /// # SubsystemError, /// # gen::{ /// # SubsystemContext, @@ -498,7 +549,6 @@ where /// None, /// AlwaysSupportsParachains, /// spawner, - /// OverseerConnector::default(), /// ).unwrap(); /// /// let timer = Delay::new(Duration::from_millis(50)).fuse(); @@ -565,7 +615,6 @@ where prometheus_registry: Option<&prometheus::Registry>, supports_parachains: SupportsParachains, s: S, - connector: OverseerConnector, ) -> SubsystemResult<(Self, OverseerHandle)> where CV: Subsystem, SubsystemError> + Send, @@ -630,7 +679,7 @@ where .supports_parachains(supports_parachains) .metrics(metrics.clone()) .spawner(s) - .build_with_connector(connector)?; + .build()?; // spawn the metrics metronome task { diff --git a/node/overseer/src/metrics.rs b/node/overseer/src/metrics.rs index fa883857e9be..ab3b2a3bc14b 100644 --- a/node/overseer/src/metrics.rs +++ b/node/overseer/src/metrics.rs @@ -17,7 +17,7 @@ //! Prometheus metrics related to the overseer and its channels. use super::*; -pub use polkadot_node_metrics::metrics::{self, prometheus, Metrics as MetricsTrait}; +use polkadot_node_metrics::metrics::{self, prometheus}; use parity_util_mem::MemoryAllocationSnapshot; @@ -110,7 +110,7 @@ impl Metrics { } } -impl MetricsTrait for Metrics { +impl metrics::Metrics for Metrics { fn try_register(registry: &prometheus::Registry) -> Result { let metrics = MetricsInner { activated_heads_total: prometheus::register( diff --git a/node/overseer/src/subsystems.rs b/node/overseer/src/subsystems.rs index 695d368dc16c..648528730d67 100644 --- a/node/overseer/src/subsystems.rs +++ b/node/overseer/src/subsystems.rs @@ -19,9 +19,47 @@ //! In the future, everything should be set up using the generated //! overseer builder pattern instead. -use crate::dummy::DummySubsystem; +use crate::{AllMessages, OverseerSignal}; +use polkadot_node_subsystem_types::errors::SubsystemError; use polkadot_overseer_all_subsystems_gen::AllSubsystemsGen; -use polkadot_overseer_gen::MapSubsystem; +use polkadot_overseer_gen::{ + FromOverseer, MapSubsystem, 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)] +pub struct DummySubsystem; + +impl Subsystem for DummySubsystem +where + Context: SubsystemContext< + Signal = OverseerSignal, + Error = SubsystemError, + AllMessages = AllMessages, + >, +{ + fn start(self, mut ctx: Context) -> SpawnedSubsystem { + let future = Box::pin(async move { + loop { + match ctx.recv().await { + Err(_) => return Ok(()), + Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), + Ok(overseer_msg) => { + tracing::debug!( + target: "dummy-subsystem", + "Discarding a message sent from overseer {:?}", + overseer_msg + ); + continue + }, + } + } + }); + + SpawnedSubsystem { name: "dummy-subsystem", future } + } +} /// This struct is passed as an argument to create a new instance of an [`Overseer`]. /// diff --git a/node/overseer/src/tests.rs b/node/overseer/src/tests.rs index 349b04d34be3..7564116e7141 100644 --- a/node/overseer/src/tests.rs +++ b/node/overseer/src/tests.rs @@ -32,7 +32,7 @@ use polkadot_primitives::v1::{ ValidatorIndex, }; -use crate::{self as overseer, gen::Delay, HeadSupportsParachains, Overseer, OverseerConnector}; +use crate::{self as overseer, gen::Delay, HeadSupportsParachains, Overseer}; use metered_channel as metered; use assert_matches::assert_matches; @@ -164,16 +164,9 @@ fn overseer_works() { .replace_candidate_validation(move |_| TestSubsystem1(s1_tx)) .replace_candidate_backing(move |_| TestSubsystem2(s2_tx)); - let (overseer, handle) = Overseer::new( - vec![], - all_subsystems, - None, - MockSupportsParachains, - spawner, - OverseerConnector::default(), - ) - .unwrap(); - let mut handle = Handle(handle); + let (overseer, handle) = + Overseer::new(vec![], all_subsystems, None, MockSupportsParachains, spawner).unwrap(); + let mut handle = Handle::Connected(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -234,10 +227,9 @@ fn overseer_metrics_work() { Some(®istry), MockSupportsParachains, spawner, - OverseerConnector::default(), ) .unwrap(); - let mut handle = Handle(handle); + let mut handle = Handle::Connected(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -288,15 +280,8 @@ fn overseer_ends_on_subsystem_exit() { executor::block_on(async move { let all_subsystems = AllSubsystems::<()>::dummy().replace_candidate_backing(|_| ReturnOnStart); - let (overseer, _handle) = Overseer::new( - vec![], - all_subsystems, - None, - MockSupportsParachains, - spawner, - OverseerConnector::default(), - ) - .unwrap(); + let (overseer, _handle) = + Overseer::new(vec![], all_subsystems, None, MockSupportsParachains, spawner).unwrap(); overseer.run().await.unwrap(); }) @@ -397,16 +382,10 @@ fn overseer_start_stop_works() { let all_subsystems = AllSubsystems::<()>::dummy() .replace_candidate_validation(move |_| TestSubsystem5(tx_5)) .replace_candidate_backing(move |_| TestSubsystem6(tx_6)); - let (overseer, handle) = Overseer::new( - vec![first_block], - all_subsystems, - None, - MockSupportsParachains, - spawner, - OverseerConnector::default(), - ) - .unwrap(); - let mut handle = Handle(handle); + let (overseer, handle) = + Overseer::new(vec![first_block], all_subsystems, None, MockSupportsParachains, spawner) + .unwrap(); + let mut handle = Handle::Connected(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -507,10 +486,9 @@ fn overseer_finalize_works() { None, MockSupportsParachains, spawner, - OverseerConnector::default(), ) .unwrap(); - let mut handle = Handle(handle); + let mut handle = Handle::Connected(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -595,16 +573,10 @@ fn do_not_send_empty_leaves_update_on_block_finalization() { let all_subsystems = AllSubsystems::<()>::dummy().replace_candidate_backing(move |_| TestSubsystem6(tx_5)); - let (overseer, handle) = Overseer::new( - Vec::new(), - all_subsystems, - None, - MockSupportsParachains, - spawner, - OverseerConnector::default(), - ) - .unwrap(); - let mut handle = Handle(handle); + let (overseer, handle) = + Overseer::new(Vec::new(), all_subsystems, None, MockSupportsParachains, spawner) + .unwrap(); + let mut handle = Handle::Connected(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); @@ -877,17 +849,9 @@ fn overseer_all_subsystems_receive_signals_and_messages() { dispute_distribution: subsystem.clone(), chain_selection: subsystem.clone(), }; - - let (overseer, handle) = Overseer::new( - vec![], - all_subsystems, - None, - MockSupportsParachains, - spawner, - OverseerConnector::default(), - ) - .unwrap(); - let mut handle = Handle(handle); + let (overseer, handle) = + Overseer::new(vec![], all_subsystems, None, MockSupportsParachains, spawner).unwrap(); + let mut handle = Handle::Connected(handle); let overseer_fut = overseer.run().fuse(); pin_mut!(overseer_fut); diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 632c83c94980..affd8b25b33b 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -26,7 +26,6 @@ sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" } service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } telemetry = { package = "sc-telemetry", git = "https://github.com/paritytech/substrate", branch = "master" } -lru = "0.6" # Substrate Primitives sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 66047854f3c2..bcb181fa04b8 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -54,7 +54,7 @@ use { pub use sp_core::traits::SpawnNamed; #[cfg(feature = "full-node")] pub use { - polkadot_overseer::{Handle, Overseer, OverseerConnector, OverseerHandle}, + polkadot_overseer::{Handle, Overseer, OverseerHandle}, polkadot_primitives::v1::ParachainHost, sc_client_api::AuxStore, sp_authority_discovery::AuthorityDiscoveryApi, @@ -68,8 +68,6 @@ use polkadot_subsystem::jaeger; use std::{sync::Arc, time::Duration}; use prometheus_endpoint::Registry; -#[cfg(feature = "full-node")] -use service::KeystoreContainer; use service::RpcHandlers; use telemetry::TelemetryWorker; #[cfg(feature = "full-node")] @@ -304,15 +302,14 @@ fn jaeger_launch_collector_with_agent( } #[cfg(feature = "full-node")] -type FullSelectChain = relay_chain_selection::SelectRelayChain; +type FullSelectChain = relay_chain_selection::SelectRelayChainWithFallback; #[cfg(feature = "full-node")] -type FullGrandpaBlockImport = - grandpa::GrandpaBlockImport< - FullBackend, - Block, - FullClient, - ChainSelection, - >; +type FullGrandpaBlockImport = grandpa::GrandpaBlockImport< + FullBackend, + Block, + FullClient, + FullSelectChain, +>; #[cfg(feature = "light-node")] type LightBackend = service::TLightBackendWithHash; @@ -322,29 +319,36 @@ type LightClient = service::TLightClientWithBackend; #[cfg(feature = "full-node")] -struct Basics -where - RuntimeApi: ConstructRuntimeApi> - + Send - + Sync - + 'static, - RuntimeApi::RuntimeApi: - RuntimeApiCollection>, - ExecutorDispatch: NativeExecutionDispatch + 'static, -{ - task_manager: TaskManager, - client: Arc>, - backend: Arc, - keystore_container: KeystoreContainer, - telemetry: Option, -} - -#[cfg(feature = "full-node")] -fn new_partial_basics( +fn new_partial( config: &mut Configuration, jaeger_agent: Option, telemetry_worker_handle: Option, -) -> Result, Error> +) -> Result< + service::PartialComponents< + FullClient, + FullBackend, + FullSelectChain, + sc_consensus::DefaultImportQueue>, + sc_transaction_pool::FullPool>, + ( + impl service::RpcExtensionBuilder, + ( + babe::BabeBlockImport< + Block, + FullClient, + FullGrandpaBlockImport, + >, + grandpa::LinkHalf, FullSelectChain>, + babe::BabeLink, + beefy_gadget::notification::BeefySignedCommitmentSender, + ), + grandpa::SharedVoterState, + std::time::Duration, // slot-duration + Option, + ), + >, + Error, +> where RuntimeApi: ConstructRuntimeApi> + Send @@ -387,62 +391,21 @@ where )?; let client = Arc::new(client); - jaeger_launch_collector_with_agent(task_manager.spawn_handle(), &*config, jaeger_agent)?; - - let telemetry: Option<_> = telemetry.map(|(worker, telemetry)| { + let telemetry = telemetry.map(|(worker, telemetry)| { if let Some(worker) = worker { task_manager.spawn_handle().spawn("telemetry", worker.run()); } telemetry }); - Ok(Basics { task_manager, client, backend, keystore_container, telemetry }) -} + jaeger_launch_collector_with_agent(task_manager.spawn_handle(), &*config, jaeger_agent)?; + + let select_chain = relay_chain_selection::SelectRelayChainWithFallback::new( + backend.clone(), + Handle::new_disconnected(), + polkadot_node_subsystem_util::metrics::Metrics::register(config.prometheus_registry())?, + ); -#[cfg(feature = "full-node")] -fn new_partial( - config: &mut Configuration, - Basics { task_manager, backend, client, keystore_container, telemetry }: Basics< - RuntimeApi, - ExecutorDispatch, - >, - select_chain: ChainSelection, -) -> Result< - service::PartialComponents< - FullClient, - FullBackend, - ChainSelection, - sc_consensus::DefaultImportQueue>, - sc_transaction_pool::FullPool>, - ( - impl service::RpcExtensionBuilder, - ( - babe::BabeBlockImport< - Block, - FullClient, - FullGrandpaBlockImport, - >, - grandpa::LinkHalf, ChainSelection>, - babe::BabeLink, - beefy_gadget::notification::BeefySignedCommitmentSender, - ), - grandpa::SharedVoterState, - std::time::Duration, // slot-duration - Option, - ), - >, - Error, -> -where - RuntimeApi: ConstructRuntimeApi> - + Send - + Sync - + 'static, - RuntimeApi::RuntimeApi: - RuntimeApiCollection>, - ExecutorDispatch: NativeExecutionDispatch + 'static, - ChainSelection: 'static + SelectChain, -{ let transaction_pool = sc_transaction_pool::BasicPool::new_full( config.transaction_pool.clone(), config.role.is_authority().into(), @@ -711,50 +674,23 @@ where let disable_grandpa = config.disable_grandpa; let name = config.network.node_name.clone(); - let overseer_connector = OverseerConnector::default(); - - let handle = Handle(overseer_connector.as_handle().clone()); - - let basics = new_partial_basics::( - &mut config, - jaeger_agent, - telemetry_worker_handle, - )?; - - // we should remove this check before we deploy parachains on polkadot - // TODO: https://github.com/paritytech/polkadot/issues/3326 - let chain_spec = &config.chain_spec as &dyn IdentifyVariant; - - let is_relay_chain = chain_spec.is_kusama() || - chain_spec.is_westend() || - chain_spec.is_rococo() || - chain_spec.is_wococo(); - - let prometheus_registry = config.prometheus_registry().cloned(); - - use relay_chain_selection::SelectRelayChain; - - let select_chain = SelectRelayChain::new( - basics.backend.clone(), - is_relay_chain, - handle.clone(), - polkadot_node_subsystem_util::metrics::Metrics::register(prometheus_registry.as_ref())?, - ); - let service::PartialComponents::<_, _, SelectRelayChain<_>, _, _, _> { + let service::PartialComponents { client, backend, mut task_manager, keystore_container, - select_chain, + mut select_chain, import_queue, transaction_pool, other: (rpc_extensions_builder, import_setup, rpc_setup, slot_duration, mut telemetry), - } = new_partial::>( + } = new_partial::( &mut config, - basics, - select_chain, + jaeger_agent, + telemetry_worker_handle, )?; + let prometheus_registry = config.prometheus_registry().cloned(); + let shared_voter_state = rpc_setup; let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht; @@ -914,10 +850,8 @@ where local_keystore.and_then(move |k| authority_discovery_service.map(|a| (a, k))); let overseer_handle = if let Some((authority_discovery_service, keystore)) = maybe_params { - // already have access to the handle - let (overseer, _handle) = overseer_gen + let (overseer, overseer_handle) = overseer_gen .generate::>( - overseer_connector, OverseerGenArgs { leaves: active_leaves, keystore, @@ -941,29 +875,40 @@ where dispute_coordinator_config, }, )?; + let handle = Handle::Connected(overseer_handle.clone()); + let handle_clone = handle.clone(); - { - let handle = handle.clone(); - task_manager.spawn_essential_handle().spawn_blocking( - "overseer", - Box::pin(async move { - use futures::{pin_mut, select, FutureExt}; + task_manager.spawn_essential_handle().spawn_blocking( + "overseer", + Box::pin(async move { + use futures::{pin_mut, select, FutureExt}; - let forward = polkadot_overseer::forward_events(overseer_client, handle); + let forward = polkadot_overseer::forward_events(overseer_client, handle_clone); - let forward = forward.fuse(); - let overseer_fut = overseer.run().fuse(); + let forward = forward.fuse(); + let overseer_fut = overseer.run().fuse(); - pin_mut!(overseer_fut); - pin_mut!(forward); + pin_mut!(overseer_fut); + pin_mut!(forward); - select! { - _ = forward => (), - _ = overseer_fut => (), - complete => (), - } - }), - ); + select! { + _ = forward => (), + _ = overseer_fut => (), + complete => (), + } + }), + ); + // we should remove this check before we deploy parachains on polkadot + // TODO: https://github.com/paritytech/polkadot/issues/3326 + let should_connect_overseer = chain_spec.is_kusama() || + chain_spec.is_westend() || + chain_spec.is_rococo() || + chain_spec.is_wococo(); + + if should_connect_overseer { + select_chain.connect_to_overseer(overseer_handle.clone()); + } else { + tracing::info!("Overseer is running in the disconnected state"); } Some(handle) } else { @@ -1283,31 +1228,6 @@ where Ok((task_manager, rpc_handlers)) } -macro_rules! chain_ops { - ($config:expr, $jaeger_agent:expr, $telemetry_worker_handle:expr; $scope:ident, $executor:ident, $variant:ident) => {{ - let telemetry_worker_handle = $telemetry_worker_handle; - let jaeger_agent = $jaeger_agent; - let mut config = $config; - let basics = new_partial_basics::<$scope::RuntimeApi, $executor>( - config, - jaeger_agent, - telemetry_worker_handle, - )?; - - use ::sc_consensus::LongestChain; - // use the longest chain selection, since there is no overseer available - let chain_selection = LongestChain::new(basics.backend.clone()); - - let service::PartialComponents { client, backend, import_queue, task_manager, .. } = - new_partial::<$scope::RuntimeApi, $executor, LongestChain<_, Block>>( - &mut config, - basics, - chain_selection, - )?; - Ok((Arc::new(Client::$variant(client)), backend, import_queue, task_manager)) - }}; -} - /// Builds a new object suitable for chain operations. #[cfg(feature = "full-node")] pub fn new_chain_ops( @@ -1324,26 +1244,48 @@ pub fn new_chain_ops( > { config.keystore = service::config::KeystoreConfig::InMemory; - let telemetry_worker_handle = None; - #[cfg(feature = "rococo-native")] if config.chain_spec.is_rococo() || config.chain_spec.is_wococo() { - return chain_ops!(config, jaeger_agent, telemetry_worker_handle; rococo_runtime, RococoExecutorDispatch, Rococo) + let service::PartialComponents { client, backend, import_queue, task_manager, .. } = + new_partial::( + config, + jaeger_agent, + None, + )?; + return Ok((Arc::new(Client::Rococo(client)), backend, import_queue, task_manager)) } #[cfg(feature = "kusama-native")] if config.chain_spec.is_kusama() { - return chain_ops!(config, jaeger_agent, telemetry_worker_handle; kusama_runtime, KusamaExecutorDispatch, Kusama) + let service::PartialComponents { client, backend, import_queue, task_manager, .. } = + new_partial::( + config, + jaeger_agent, + None, + )?; + return Ok((Arc::new(Client::Kusama(client)), backend, import_queue, task_manager)) } #[cfg(feature = "westend-native")] if config.chain_spec.is_westend() { - return chain_ops!(config, jaeger_agent, telemetry_worker_handle; westend_runtime, WestendExecutorDispatch, Westend) + let service::PartialComponents { client, backend, import_queue, task_manager, .. } = + new_partial::( + config, + jaeger_agent, + None, + )?; + return Ok((Arc::new(Client::Westend(client)), backend, import_queue, task_manager)) } #[cfg(feature = "polkadot-native")] { - chain_ops!(config, jaeger_agent, telemetry_worker_handle; polkadot_runtime, PolkadotExecutorDispatch, Polkadot) + let service::PartialComponents { client, backend, import_queue, task_manager, .. } = + new_partial::( + config, + jaeger_agent, + None, + )?; + return Ok((Arc::new(Client::Polkadot(client)), backend, import_queue, task_manager)) } #[cfg(not(feature = "polkadot-native"))] diff --git a/node/service/src/overseer.rs b/node/service/src/overseer.rs index 385bab190266..66156fd18298 100644 --- a/node/service/src/overseer.rs +++ b/node/service/src/overseer.rs @@ -15,7 +15,6 @@ // along with Polkadot. If not, see . use super::{AuthorityDiscoveryApi, Block, Error, Hash, IsCollator, Registry, SpawnNamed}; -use lru::LruCache; use polkadot_availability_distribution::IncomingRequestReceivers; use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig; use polkadot_node_core_av_store::Config as AvailabilityConfig; @@ -23,14 +22,7 @@ use polkadot_node_core_candidate_validation::Config as CandidateValidationConfig use polkadot_node_core_chain_selection::Config as ChainSelectionConfig; use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig; use polkadot_node_network_protocol::request_response::{v1 as request_v1, IncomingRequestReceiver}; -#[cfg(any(feature = "malus", test))] -pub use polkadot_overseer::dummy::DummySubsystem; -pub use polkadot_overseer::{ - metrics::{Metrics, MetricsTrait}, - AllSubsystems, BlockInfo, HeadSupportsParachains, Overseer, OverseerBuilder, OverseerConnector, - OverseerHandle, -}; - +use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandle}; use polkadot_primitives::v1::ParachainHost; use sc_authority_discovery::Service as AuthorityDiscoveryService; use sc_client_api::AuxStore; @@ -263,176 +255,6 @@ where Ok(all_subsystems) } -/// Obtain a prepared `OverseerBuilder`, that is initialized -/// with all default values. -pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>( - OverseerGenArgs { - leaves, - keystore, - runtime_client, - parachains_db, - network_service, - authority_discovery_service, - pov_req_receiver, - chunk_req_receiver, - collation_req_receiver, - available_data_req_receiver, - statement_req_receiver, - dispute_req_receiver, - registry, - spawner, - is_collator, - approval_voting_config, - availability_config, - candidate_validation_config, - chain_selection_config, - dispute_coordinator_config, - }: OverseerGenArgs<'a, Spawner, RuntimeClient>, -) -> Result< - OverseerBuilder< - Spawner, - Arc, - CandidateValidationSubsystem, - CandidateBackingSubsystem, - StatementDistributionSubsystem, - AvailabilityDistributionSubsystem, - AvailabilityRecoverySubsystem, - BitfieldSigningSubsystem, - BitfieldDistributionSubsystem, - ProvisionerSubsystem, - RuntimeApiSubsystem, - AvailabilityStoreSubsystem, - NetworkBridgeSubsystem< - Arc>, - AuthorityDiscoveryService, - >, - ChainApiSubsystem, - CollationGenerationSubsystem, - CollatorProtocolSubsystem, - ApprovalDistributionSubsystem, - ApprovalVotingSubsystem, - GossipSupportSubsystem, - DisputeCoordinatorSubsystem, - DisputeParticipationSubsystem, - DisputeDistributionSubsystem, - ChainSelectionSubsystem, - >, - Error, -> -where - RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, - RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, - Spawner: 'static + SpawnNamed + Clone + Unpin, -{ - use polkadot_node_subsystem_util::metrics::Metrics; - use std::iter::FromIterator; - - let metrics = ::register(registry)?; - - let builder = Overseer::builder() - .availability_distribution(AvailabilityDistributionSubsystem::new( - keystore.clone(), - IncomingRequestReceivers { pov_req_receiver, chunk_req_receiver }, - Metrics::register(registry)?, - )) - .availability_recovery(AvailabilityRecoverySubsystem::with_chunks_only( - available_data_req_receiver, - Metrics::register(registry)?, - )) - .availability_store(AvailabilityStoreSubsystem::new( - parachains_db.clone(), - availability_config, - Metrics::register(registry)?, - )) - .bitfield_distribution(BitfieldDistributionSubsystem::new(Metrics::register(registry)?)) - .bitfield_signing(BitfieldSigningSubsystem::new( - spawner.clone(), - keystore.clone(), - Metrics::register(registry)?, - )) - .candidate_backing(CandidateBackingSubsystem::new( - spawner.clone(), - keystore.clone(), - Metrics::register(registry)?, - )) - .candidate_validation(CandidateValidationSubsystem::with_config( - candidate_validation_config, - Metrics::register(registry)?, // candidate-validation metrics - Metrics::register(registry)?, // validation host metrics - )) - .chain_api(ChainApiSubsystem::new(runtime_client.clone(), Metrics::register(registry)?)) - .collation_generation(CollationGenerationSubsystem::new(Metrics::register(registry)?)) - .collator_protocol({ - let side = match is_collator { - IsCollator::Yes(collator_pair) => ProtocolSide::Collator( - network_service.local_peer_id().clone(), - collator_pair, - collation_req_receiver, - Metrics::register(registry)?, - ), - IsCollator::No => ProtocolSide::Validator { - keystore: keystore.clone(), - eviction_policy: Default::default(), - metrics: Metrics::register(registry)?, - }, - }; - CollatorProtocolSubsystem::new(side) - }) - .network_bridge(NetworkBridgeSubsystem::new( - network_service.clone(), - authority_discovery_service.clone(), - Box::new(network_service.clone()), - Metrics::register(registry)?, - )) - .provisioner(ProvisionerSubsystem::new(spawner.clone(), (), Metrics::register(registry)?)) - .runtime_api(RuntimeApiSubsystem::new( - runtime_client.clone(), - Metrics::register(registry)?, - spawner.clone(), - )) - .statement_distribution(StatementDistributionSubsystem::new( - keystore.clone(), - statement_req_receiver, - Metrics::register(registry)?, - )) - .approval_distribution(ApprovalDistributionSubsystem::new(Metrics::register(registry)?)) - .approval_voting(ApprovalVotingSubsystem::with_config( - approval_voting_config, - parachains_db.clone(), - keystore.clone(), - Box::new(network_service.clone()), - Metrics::register(registry)?, - )) - .gossip_support(GossipSupportSubsystem::new(keystore.clone())) - .dispute_coordinator(DisputeCoordinatorSubsystem::new( - parachains_db.clone(), - dispute_coordinator_config, - keystore.clone(), - Metrics::register(registry)?, - )) - .dispute_participation(DisputeParticipationSubsystem::new()) - .dispute_distribution(DisputeDistributionSubsystem::new( - keystore.clone(), - dispute_req_receiver, - authority_discovery_service.clone(), - Metrics::register(registry)?, - )) - .chain_selection(ChainSelectionSubsystem::new(chain_selection_config, parachains_db)) - .leaves(Vec::from_iter( - leaves - .into_iter() - .map(|BlockInfo { hash, parent_hash: _, number }| (hash, number)), - )) - .activation_external_listeners(Default::default()) - .span_per_active_leaf(Default::default()) - .active_leaves(Default::default()) - .supports_parachains(runtime_client) - .known_leaves(LruCache::new(KNOWN_LEAVES_CACHE_SIZE)) - .metrics(metrics) - .spawner(spawner); - Ok(builder) -} - /// Trait for the `fn` generating the overseer. /// /// Default behavior is to create an unmodified overseer, as `RealOverseerGen` @@ -441,7 +263,6 @@ pub trait OverseerGen { /// Overwrite the full generation of the overseer, including the subsystems. fn generate<'a, Spawner, RuntimeClient>( &self, - connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandle), Error> where @@ -450,22 +271,19 @@ pub trait OverseerGen { Spawner: 'static + SpawnNamed + Clone + Unpin, { let gen = RealOverseerGen; - RealOverseerGen::generate::(&gen, connector, args) + RealOverseerGen::generate::(&gen, args) } // It would be nice to make `create_subsystems` part of this trait, // but the amount of generic arguments that would be required as // as consequence make this rather annoying to implement and use. } -use polkadot_overseer::KNOWN_LEAVES_CACHE_SIZE; - /// The regular set of subsystems. pub struct RealOverseerGen; impl OverseerGen for RealOverseerGen { fn generate<'a, Spawner, RuntimeClient>( &self, - connector: OverseerConnector, args: OverseerGenArgs<'a, Spawner, RuntimeClient>, ) -> Result<(Overseer>, OverseerHandle), Error> where @@ -473,8 +291,14 @@ impl OverseerGen for RealOverseerGen { RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, Spawner: 'static + SpawnNamed + Clone + Unpin, { - prepared_overseer_builder(args)? - .build_with_connector(connector) + let spawner = args.spawner.clone(); + let leaves = args.leaves.clone(); + let runtime_client = args.runtime_client.clone(); + let registry = args.registry.clone(); + + let all_subsystems = create_default_subsystems::(args)?; + + Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner) .map_err(|e| e.into()) } } diff --git a/node/service/src/relay_chain_selection.rs b/node/service/src/relay_chain_selection.rs index cece25d3e547..184d526eac47 100644 --- a/node/service/src/relay_chain_selection.rs +++ b/node/service/src/relay_chain_selection.rs @@ -39,7 +39,7 @@ use super::{HeaderProvider, HeaderProviderProvider}; use consensus_common::{Error as ConsensusError, SelectChain}; use futures::channel::oneshot; use polkadot_node_subsystem_util::metrics::{self, prometheus}; -use polkadot_overseer::{AllMessages, Handle}; +use polkadot_overseer::{AllMessages, Handle, OverseerHandle}; use polkadot_primitives::v1::{ Block as PolkadotBlock, BlockNumber, Hash, Header as PolkadotHeader, }; @@ -109,57 +109,66 @@ impl Metrics { } /// A chain-selection implementation which provides safety for relay chains. -pub struct SelectRelayChain> { - is_relay_chain: bool, - longest_chain: sc_consensus::LongestChain, - selection: SelectRelayChainInner, +pub struct SelectRelayChainWithFallback> { + // A fallback to use in case the overseer is disconnected. + // + // This is used on relay chains which have not yet enabled + // parachains as well as situations where the node is offline. + fallback: sc_consensus::LongestChain, + selection: SelectRelayChain, } -impl Clone for SelectRelayChain +impl Clone for SelectRelayChainWithFallback where B: sc_client_api::Backend, - SelectRelayChainInner: Clone, + SelectRelayChain: Clone, { fn clone(&self) -> Self { - Self { - is_relay_chain: self.is_relay_chain, - longest_chain: self.longest_chain.clone(), - selection: self.selection.clone(), - } + Self { fallback: self.fallback.clone(), selection: self.selection.clone() } } } -impl SelectRelayChain +impl SelectRelayChainWithFallback where B: sc_client_api::Backend + 'static, { - /// Create a new [`SelectRelayChain`] wrapping the given chain backend + /// Create a new [`SelectRelayChainWithFallback`] wrapping the given chain backend /// and a handle to the overseer. - pub fn new(backend: Arc, is_relay_chain: bool, overseer: Handle, metrics: Metrics) -> Self { - SelectRelayChain { - is_relay_chain, - longest_chain: sc_consensus::LongestChain::new(backend.clone()), - selection: SelectRelayChainInner::new(backend, overseer, metrics), + pub fn new(backend: Arc, overseer: Handle, metrics: Metrics) -> Self { + SelectRelayChainWithFallback { + fallback: sc_consensus::LongestChain::new(backend.clone()), + selection: SelectRelayChain::new(backend, overseer, metrics), } } } +impl SelectRelayChainWithFallback +where + B: sc_client_api::Backend + 'static, +{ + /// Given an overseer handle, this connects the [`SelectRelayChainWithFallback`]'s + /// internal handle and its clones to the same overseer. + pub fn connect_to_overseer(&mut self, handle: OverseerHandle) { + self.selection.overseer.connect_to_overseer(handle); + } +} + #[async_trait::async_trait] -impl SelectChain for SelectRelayChain +impl SelectChain for SelectRelayChainWithFallback where B: sc_client_api::Backend + 'static, { async fn leaves(&self) -> Result, ConsensusError> { - if !self.is_relay_chain { - return self.longest_chain.leaves().await + if self.selection.overseer.is_disconnected() { + return self.fallback.leaves().await } self.selection.leaves().await } async fn best_chain(&self) -> Result { - if !self.is_relay_chain { - return self.longest_chain.best_chain().await + if self.selection.overseer.is_disconnected() { + return self.fallback.best_chain().await } self.selection.best_chain().await } @@ -170,34 +179,34 @@ where maybe_max_number: Option, ) -> Result, ConsensusError> { let longest_chain_best = - self.longest_chain.finality_target(target_hash, maybe_max_number).await?; + self.fallback.finality_target(target_hash, maybe_max_number).await?; - if !self.is_relay_chain { + if self.selection.overseer.is_disconnected() { return Ok(longest_chain_best) } self.selection - .finality_target_with_longest_chain(target_hash, longest_chain_best, maybe_max_number) + .finality_target_with_fallback(target_hash, longest_chain_best, maybe_max_number) .await } } /// A chain-selection implementation which provides safety for relay chains /// but does not handle situations where the overseer is not yet connected. -pub struct SelectRelayChainInner { +pub struct SelectRelayChain { backend: Arc, overseer: OH, metrics: Metrics, } -impl SelectRelayChainInner +impl SelectRelayChain where B: HeaderProviderProvider, OH: OverseerHandleT, { - /// Create a new [`SelectRelayChainInner`] wrapping the given chain backend + /// Create a new [`SelectRelayChain`] wrapping the given chain backend /// and a handle to the overseer. pub fn new(backend: Arc, overseer: OH, metrics: Metrics) -> Self { - SelectRelayChainInner { backend, overseer, metrics } + SelectRelayChain { backend, overseer, metrics } } fn block_header(&self, hash: Hash) -> Result { @@ -225,13 +234,13 @@ where } } -impl Clone for SelectRelayChainInner +impl Clone for SelectRelayChain where B: HeaderProviderProvider + Send + Sync, OH: OverseerHandleT, { fn clone(&self) -> Self { - SelectRelayChainInner { + SelectRelayChain { backend: self.backend.clone(), overseer: self.overseer.clone(), metrics: self.metrics.clone(), @@ -264,7 +273,7 @@ impl OverseerHandleT for Handle { } } -impl SelectRelayChainInner +impl SelectRelayChain where B: HeaderProviderProvider, OH: OverseerHandleT, @@ -308,7 +317,7 @@ where /// /// It will also constrain the chain to only chains which are fully /// approved, and chains which contain no disputes. - pub(crate) async fn finality_target_with_longest_chain( + pub(crate) async fn finality_target_with_fallback( &self, target_hash: Hash, best_leaf: Option, diff --git a/node/service/src/tests.rs b/node/service/src/tests.rs index 7dc5fe19ecbd..34ac69d78cc7 100644 --- a/node/service/src/tests.rs +++ b/node/service/src/tests.rs @@ -79,7 +79,7 @@ fn test_harness>( let (finality_target_tx, finality_target_rx) = oneshot::channel::>(); - let select_relay_chain = SelectRelayChainInner::::new( + let select_relay_chain = SelectRelayChain::::new( Arc::new(case_vars.chain.clone()), context.sender().clone(), Default::default(), diff --git a/node/subsystem-test-helpers/src/lib.rs b/node/subsystem-test-helpers/src/lib.rs index c180c1d0ea88..80dae08825b0 100644 --- a/node/subsystem-test-helpers/src/lib.rs +++ b/node/subsystem-test-helpers/src/lib.rs @@ -372,9 +372,7 @@ mod tests { use super::*; use futures::executor::block_on; use polkadot_node_subsystem::messages::CollatorProtocolMessage; - use polkadot_overseer::{ - AllSubsystems, Handle, HeadSupportsParachains, Overseer, OverseerConnector, - }; + use polkadot_overseer::{AllSubsystems, Handle, HeadSupportsParachains, Overseer}; use polkadot_primitives::v1::Hash; struct AlwaysSupportsParachains; @@ -396,10 +394,9 @@ mod tests { None, AlwaysSupportsParachains, spawner.clone(), - OverseerConnector::default(), ) .unwrap(); - let mut handle = Handle(handle); + let mut handle = Handle::Connected(handle); spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed()); diff --git a/node/subsystem/src/lib.rs b/node/subsystem/src/lib.rs index 429120709a07..f0918ab1dc02 100644 --- a/node/subsystem/src/lib.rs +++ b/node/subsystem/src/lib.rs @@ -24,9 +24,7 @@ pub use jaeger::*; pub use polkadot_node_jaeger as jaeger; -pub use polkadot_overseer::{ - self as overseer, dummy::DummySubsystem, ActiveLeavesUpdate, OverseerConnector, OverseerSignal, -}; +pub use polkadot_overseer::{self as overseer, ActiveLeavesUpdate, DummySubsystem, OverseerSignal}; pub use polkadot_node_subsystem_types::{ errors::{self, *}, From 65313050a8416ea358005a0f0905a0db87f9290f Mon Sep 17 00:00:00 2001 From: Koute Date: Mon, 20 Sep 2021 22:21:40 +0900 Subject: [PATCH 8/8] Bump `parity-util-mem` to 0.10.2 (#3897) --- Cargo.lock | 107 ++++++++++++++++++++++------------------------------- 1 file changed, 44 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c46974710b2d..2a08136e0382 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1953,7 +1953,7 @@ dependencies = [ "linregress", "log", "parity-scale-codec", - "paste 1.0.5", + "paste", "scale-info", "sp-api", "sp-io", @@ -2043,7 +2043,7 @@ dependencies = [ "log", "once_cell", "parity-scale-codec", - "paste 1.0.5", + "paste", "scale-info", "serde", "smallvec", @@ -2917,38 +2917,6 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" -[[package]] -name = "jemalloc-ctl" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c502a5ff9dd2924f1ed32ba96e3b65735d837b4bfd978d3161b1702e66aca4b7" -dependencies = [ - "jemalloc-sys", - "libc", - "paste 0.1.18", -] - -[[package]] -name = "jemalloc-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" -dependencies = [ - "cc", - "fs_extra", - "libc", -] - -[[package]] -name = "jemallocator" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" -dependencies = [ - "jemalloc-sys", - "libc", -] - [[package]] name = "jobserver" version = "0.1.21" @@ -5480,21 +5448,21 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7adaf50e545c285006d384d50588e98c405c49b55c0aa05660aca081f6ee5e" +checksum = "6f4cb4e169446179cbc6b8b6320cc9fca49bd2e94e8db25f25f200a8ea774770" dependencies = [ "cfg-if 1.0.0", "ethereum-types", "hashbrown", "impl-trait-for-tuples", - "jemalloc-ctl", - "jemallocator", "lru", "parity-util-mem-derive", "parking_lot 0.11.1", "primitive-types", "smallvec", + "tikv-jemalloc-ctl", + "tikv-jemallocator", "winapi 0.3.9", ] @@ -5598,31 +5566,12 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "paste" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -dependencies = [ - "paste-impl", - "proc-macro-hack", -] - [[package]] name = "paste" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" -[[package]] -name = "paste-impl" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -dependencies = [ - "proc-macro-hack", -] - [[package]] name = "pbkdf2" version = "0.3.0" @@ -9291,7 +9240,7 @@ dependencies = [ "approx", "num-complex", "num-traits", - "paste 1.0.5", + "paste", ] [[package]] @@ -9315,7 +9264,7 @@ version = "0.9.9" dependencies = [ "enumn", "parity-scale-codec", - "paste 1.0.5", + "paste", "sp-runtime", "sp-std", ] @@ -9822,7 +9771,7 @@ dependencies = [ "log", "parity-scale-codec", "parity-util-mem", - "paste 1.0.5", + "paste", "rand 0.7.3", "scale-info", "serde", @@ -10090,7 +10039,7 @@ dependencies = [ "pallet-staking", "pallet-transaction-payment", "parity-scale-codec", - "paste 1.0.5", + "paste", "polkadot-core-primitives", "polkadot-runtime", "polkadot-runtime-common", @@ -10597,6 +10546,38 @@ dependencies = [ "threadpool", ] +[[package]] +name = "tikv-jemalloc-ctl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb833c46ecbf8b6daeccb347cefcabf9c1beb5c9b0f853e1cec45632d9963e69" +dependencies = [ + "libc", + "paste", + "tikv-jemalloc-sys", +] + +[[package]] +name = "tikv-jemalloc-sys" +version = "0.4.2+5.2.1-patched.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5844e429d797c62945a566f8da4e24c7fe3fbd5d6617fd8bf7a0b7dc1ee0f22e" +dependencies = [ + "cc", + "fs_extra", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c14a5a604eb8715bc5785018a37d00739b180bcf609916ddf4393d33d49ccdf" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + [[package]] name = "time" version = "0.1.43" @@ -11308,7 +11289,7 @@ dependencies = [ "lazy_static", "libc", "log", - "paste 1.0.5", + "paste", "psm", "region", "rustc-demangle", @@ -11787,7 +11768,7 @@ version = "0.9.9" dependencies = [ "frame-support", "parity-scale-codec", - "paste 1.0.5", + "paste", "polkadot-core-primitives", "polkadot-parachain", "polkadot-runtime-parachains",