diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index d0a5bc110c..741ff65e85 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) -> 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::(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::(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::(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 44e26224f2..784210f8a5 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 { 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 1141ce2ad0..61d2b79c0d 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -548,7 +548,7 @@ impl pallet_membership::Config for Runtime { type MembershipInitialized = TechnicalCommittee; type MembershipChanged = TechnicalCommittee; type MaxMembers = TechnicalMaxMembers; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo; } parameter_types! { diff --git a/polkadot/runtime/kusama/src/weights/mod.rs b/polkadot/runtime/kusama/src/weights/mod.rs index f4b1a3b779..5b8325b423 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 d3f2a6570c..a87d6ad7a4 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(PhantomData); impl pallet_membership::WeightInfo for WeightInfo { 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 62d0ac6bcf..7ee9adae03 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -595,7 +595,7 @@ impl pallet_membership::Config for Runtime { type MembershipInitialized = TechnicalCommittee; type MembershipChanged = TechnicalCommittee; type MaxMembers = TechnicalMaxMembers; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo; } parameter_types! { diff --git a/polkadot/runtime/polkadot/src/weights/mod.rs b/polkadot/runtime/polkadot/src/weights/mod.rs index 2daad49be6..6f72ddc2d7 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 0000000000..c4d3fb904f --- /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 . +//! 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(PhantomData); +impl pallet_membership::WeightInfo for WeightInfo { + 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 b460102355..938f5ddd19 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