diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index d0a5bc110cd95a1ef63a5efba37ccce594506985..741ff65e8517551303bba4b9ba6da41d033df48a 100644 --- a/polkadot/cli/src/command.rs +++ b/polkadot/cli/src/command.rs @@ -142,7 +142,11 @@ const DEV_ONLY_ERROR_PATTERN: &'static str = "can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev], got "; fn ensure_dev(spec: &Box<dyn service::ChainSpec>) -> std::result::Result<(), String> { - if spec.is_dev() { Ok(()) } else { Err(format!("{}{}", DEV_ONLY_ERROR_PATTERN, spec.id())) } + if spec.is_dev() { + Ok(()) + } else { + Err(format!("{}{}", DEV_ONLY_ERROR_PATTERN, spec.id())) + } } /// Parses polkadot specific CLI arguments and run the service. @@ -298,12 +302,7 @@ pub fn run() -> Result<()> { set_default_ss58_version(chain_spec); ensure_dev(chain_spec).map_err(Error::Other)?; - if chain_spec.is_polkadot() { - Ok(runner.sync_run(|config| { - cmd.run::<service::polkadot_runtime::Block, service::PolkadotExecutor>(config) - .map_err(|e| Error::SubstrateCli(e)) - })?) - } else if chain_spec.is_kusama() { + if chain_spec.is_kusama() { Ok(runner.sync_run(|config| { cmd.run::<service::kusama_runtime::Block, service::KusamaExecutor>(config) .map_err(|e| Error::SubstrateCli(e)) @@ -314,7 +313,11 @@ pub fn run() -> Result<()> { .map_err(|e| Error::SubstrateCli(e)) })?) } else { - Err(format!("{}{}", DEV_ONLY_ERROR_PATTERN, chain_spec.id()).into()) + // else we assume it is polkadot. + Ok(runner.sync_run(|config| { + cmd.run::<service::polkadot_runtime::Block, service::PolkadotExecutor>(config) + .map_err(|e| Error::SubstrateCli(e)) + })?) } }, Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?), @@ -332,14 +335,7 @@ pub fn run() -> Result<()> { ).map_err(|e| Error::SubstrateService(sc_service::Error::Prometheus(e)))?; ensure_dev(chain_spec).map_err(Error::Other)?; - if chain_spec.is_polkadot() { - runner.async_run(|config| { - Ok((cmd.run::< - service::polkadot_runtime::Block, - service::PolkadotExecutor, - >(config).map_err(Error::SubstrateCli), task_manager)) - }) - } else if chain_spec.is_kusama() { + if chain_spec.is_kusama() { runner.async_run(|config| { Ok((cmd.run::< service::kusama_runtime::Block, @@ -354,7 +350,13 @@ pub fn run() -> Result<()> { >(config).map_err(Error::SubstrateCli), task_manager)) }) } else { - Err(format!("{}{}", DEV_ONLY_ERROR_PATTERN, chain_spec.id()).into()) + // else we assume it is polkadot. + runner.async_run(|config| { + Ok((cmd.run::< + service::polkadot_runtime::Block, + service::PolkadotExecutor, + >(config).map_err(Error::SubstrateCli), task_manager)) + }) } } }?; diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index 44e26224f24edac512b619bd64c9f99fe907d381..784210f8a575a2550243bec4632ebccbe9dc5043 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -162,9 +162,6 @@ pub trait IdentifyVariant { /// Returns if this is a configuration for the `Rococo` network. fn is_rococo(&self) -> bool; - /// Returns if this is a configuration for the `Polkadot` network. - fn is_polkadot(&self) -> bool; - /// Returns true if this configuration is for a development network. fn is_dev(&self) -> bool; } @@ -179,9 +176,6 @@ impl IdentifyVariant for Box<dyn ChainSpec> { fn is_rococo(&self) -> bool { self.id().starts_with("rococo") || self.id().starts_with("rco") } - fn is_polkadot(&self) -> bool { - self.id().starts_with("polkadot") || self.id().starts_with("dot") - } fn is_dev(&self) -> bool { self.id().ends_with("dev") } diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index 1141ce2ad04f2166e41c8125e523257b8461f947..61d2b79c0dcf7df136040f8ffcac205e25c14246 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -548,7 +548,7 @@ impl pallet_membership::Config<pallet_membership::Instance1> for Runtime { type MembershipInitialized = TechnicalCommittee; type MembershipChanged = TechnicalCommittee; type MaxMembers = TechnicalMaxMembers; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo<Runtime>; } parameter_types! { diff --git a/polkadot/runtime/kusama/src/weights/mod.rs b/polkadot/runtime/kusama/src/weights/mod.rs index f4b1a3b77906e03f8d56411d7d92fa01921fcef4..5b8325b4233181d32032a99b6095b73bb82278b1 100644 --- a/polkadot/runtime/kusama/src/weights/mod.rs +++ b/polkadot/runtime/kusama/src/weights/mod.rs @@ -25,6 +25,7 @@ pub mod pallet_election_provider_multi_phase; pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_indices; +pub mod pallet_membership; pub mod pallet_multisig; pub mod pallet_proxy; pub mod pallet_scheduler; diff --git a/polkadot/runtime/kusama/src/weights/pallet_membership.rs b/polkadot/runtime/kusama/src/weights/pallet_membership.rs index d3f2a6570c6564dd6d7155580e8f301bc616a3a8..a87d6ad7a4dc60baf2540246015db2e26a5fcc3d 100644 --- a/polkadot/runtime/kusama/src/weights/pallet_membership.rs +++ b/polkadot/runtime/kusama/src/weights/pallet_membership.rs @@ -16,7 +16,7 @@ //! Autogenerated weights for pallet_membership //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-04-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-04-21, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128 // Executed Command: @@ -44,49 +44,51 @@ use sp_std::marker::PhantomData; pub struct WeightInfo<T>(PhantomData<T>); impl<T: frame_system::Config> pallet_membership::WeightInfo for WeightInfo<T> { fn add_member(m: u32, ) -> Weight { - (24_568_000 as Weight) + (23_269_000 as Weight) // Standard Error: 3_000 - .saturating_add((242_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((250_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn remove_member(m: u32, ) -> Weight { - (29_822_000 as Weight) + (28_329_000 as Weight) // Standard Error: 0 - .saturating_add((195_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((204_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn swap_member(m: u32, ) -> Weight { - (29_885_000 as Weight) + (28_550_000 as Weight) // Standard Error: 0 - .saturating_add((214_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((219_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn reset_member(m: u32, ) -> Weight { - (30_347_000 as Weight) - // Standard Error: 1_000 - .saturating_add((440_000 as Weight).saturating_mul(m as Weight)) + (29_358_000 as Weight) + // Standard Error: 3_000 + .saturating_add((442_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn change_key(m: u32, ) -> Weight { - (31_762_000 as Weight) + (30_386_000 as Weight) // Standard Error: 0 - .saturating_add((208_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((212_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn set_prime(m: u32, ) -> Weight { - (7_818_000 as Weight) + (7_366_000 as Weight) // Standard Error: 0 - .saturating_add((114_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((115_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } - fn clear_prime(_m: u32, ) -> Weight { - (2_946_000 as Weight) + fn clear_prime(m: u32, ) -> Weight { + (2_778_000 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(m as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } } diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index 62d0ac6bcfff21c3b2aa82e974b034cd3c3df462..7ee9adae0390c0767c3e1e7e68035e566f8234b3 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -595,7 +595,7 @@ impl pallet_membership::Config<pallet_membership::Instance1> for Runtime { type MembershipInitialized = TechnicalCommittee; type MembershipChanged = TechnicalCommittee; type MaxMembers = TechnicalMaxMembers; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo<Runtime>; } parameter_types! { diff --git a/polkadot/runtime/polkadot/src/weights/mod.rs b/polkadot/runtime/polkadot/src/weights/mod.rs index 2daad49be6eb8cee5c5f1309d2b267cc48b0df26..6f72ddc2d70e40268125eeb7bd429c6c9aee411d 100644 --- a/polkadot/runtime/polkadot/src/weights/mod.rs +++ b/polkadot/runtime/polkadot/src/weights/mod.rs @@ -24,6 +24,7 @@ pub mod pallet_election_provider_multi_phase; pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_indices; +pub mod pallet_membership; pub mod pallet_multisig; pub mod pallet_proxy; pub mod pallet_scheduler; diff --git a/polkadot/runtime/polkadot/src/weights/pallet_membership.rs b/polkadot/runtime/polkadot/src/weights/pallet_membership.rs new file mode 100644 index 0000000000000000000000000000000000000000..c4d3fb904f539f1bac538f202933d207ed648dad --- /dev/null +++ b/polkadot/runtime/polkadot/src/weights/pallet_membership.rs @@ -0,0 +1,92 @@ +// Copyright 2017-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 <http://www.gnu.org/licenses/>. +//! Autogenerated weights for pallet_membership +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-04-19, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 128 + +// Executed Command: +// target/release/polkadot +// benchmark +// --chain=polkadot-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_membership +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/polkadot/src/weights/ + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_membership. +pub struct WeightInfo<T>(PhantomData<T>); +impl<T: frame_system::Config> pallet_membership::WeightInfo for WeightInfo<T> { + fn add_member(m: u32, ) -> Weight { + (24_063_000 as Weight) + // Standard Error: 3_000 + .saturating_add((243_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn remove_member(m: u32, ) -> Weight { + (29_176_000 as Weight) + // Standard Error: 0 + .saturating_add((201_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn swap_member(m: u32, ) -> Weight { + (29_528_000 as Weight) + // Standard Error: 0 + .saturating_add((216_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn reset_member(m: u32, ) -> Weight { + (29_847_000 as Weight) + // Standard Error: 0 + .saturating_add((439_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn change_key(m: u32, ) -> Weight { + (31_408_000 as Weight) + // Standard Error: 0 + .saturating_add((209_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + fn set_prime(m: u32, ) -> Weight { + (7_753_000 as Weight) + // Standard Error: 0 + .saturating_add((114_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn clear_prime(_m: u32, ) -> Weight { + (2_878_000 as Weight) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/polkadot/xcm/src/v0/traits.rs b/polkadot/xcm/src/v0/traits.rs index b4601023555a4189b21b5bd82223f07ec0615296..938f5ddd1904004b77e0f81e2b6caea3bf94e2e7 100644 --- a/polkadot/xcm/src/v0/traits.rs +++ b/polkadot/xcm/src/v0/traits.rs @@ -60,10 +60,10 @@ pub enum Error { /// of the message is invalid, which could be due to it containing overly nested structures or an invalid /// nested data segment (e.g. for the call in `Transact`). WeightNotComputable, - /// The XCM did noto pass the barrier condition for execution. The barrier condition differs on different + /// The XCM did not pass the barrier condition for execution. The barrier condition differs on different /// chains and in different circumstances, but generally it means that the conditions surrounding the message /// were not such that the chain considers the message worth spending time executing. Since most chains - /// lift the barrier to execution on apropriate payment, presentation of an NFT voucher, or based on the + /// lift the barrier to execution on appropriate payment, presentation of an NFT voucher, or based on the /// message origin, it means that none of those were the case. Barrier, /// Indicates that it is not possible for a location to have an asset be withdrawn or transferred from its