diff --git a/polkadot/runtime/common/src/integration_tests.rs b/polkadot/runtime/common/src/integration_tests.rs index f8f84b5f1f..87d15bb992 100644 --- a/polkadot/runtime/common/src/integration_tests.rs +++ b/polkadot/runtime/common/src/integration_tests.rs @@ -159,7 +159,7 @@ impl pallet_balances::Config for Test { } impl configuration::Config for Test { - type WeightInfo = configuration::weights::WeightInfo; + type WeightInfo = configuration::TestWeightInfo; } impl shared::Config for Test {} @@ -167,7 +167,7 @@ impl shared::Config for Test {} impl paras::Config for Test { type Origin = Origin; type Event = Event; - type WeightInfo = paras::weights::WeightInfo; + type WeightInfo = paras::TestWeightInfo; } parameter_types! { diff --git a/polkadot/runtime/common/src/paras_registrar.rs b/polkadot/runtime/common/src/paras_registrar.rs index 6b6c8fd493..a714a45a55 100644 --- a/polkadot/runtime/common/src/paras_registrar.rs +++ b/polkadot/runtime/common/src/paras_registrar.rs @@ -657,11 +657,11 @@ mod tests { impl paras::Config for Test { type Origin = Origin; type Event = Event; - type WeightInfo = paras::weights::WeightInfo; + type WeightInfo = paras::TestWeightInfo; } impl configuration::Config for Test { - type WeightInfo = configuration::weights::WeightInfo; + type WeightInfo = configuration::TestWeightInfo; } parameter_types! { diff --git a/polkadot/runtime/parachains/src/configuration.rs b/polkadot/runtime/parachains/src/configuration.rs index 69ff436156..3a58ddfdc8 100644 --- a/polkadot/runtime/parachains/src/configuration.rs +++ b/polkadot/runtime/parachains/src/configuration.rs @@ -28,7 +28,6 @@ use sp_std::prelude::*; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -pub mod weights; pub use pallet::*; @@ -278,6 +277,28 @@ pub trait WeightInfo { fn set_hrmp_open_request_ttl() -> Weight; } +pub struct TestWeightInfo; +impl WeightInfo for TestWeightInfo { + fn set_config_with_block_number() -> Weight { + Weight::MAX + } + fn set_config_with_u32() -> Weight { + Weight::MAX + } + fn set_config_with_option_u32() -> Weight { + Weight::MAX + } + fn set_config_with_weight() -> Weight { + Weight::MAX + } + fn set_config_with_balance() -> Weight { + Weight::MAX + } + fn set_hrmp_open_request_ttl() -> Weight { + Weight::MAX + } +} + #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index 9e646dbbc1..a5b58cc54b 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -116,7 +116,7 @@ impl crate::initializer::Config for Test { } impl crate::configuration::Config for Test { - type WeightInfo = crate::configuration::weights::WeightInfo; + type WeightInfo = crate::configuration::TestWeightInfo; } impl crate::shared::Config for Test {} @@ -124,7 +124,7 @@ impl crate::shared::Config for Test {} impl crate::paras::Config for Test { type Origin = Origin; type Event = Event; - type WeightInfo = crate::paras::weights::WeightInfo; + type WeightInfo = crate::paras::TestWeightInfo; } impl crate::dmp::Config for Test {} diff --git a/polkadot/runtime/parachains/src/paras.rs b/polkadot/runtime/parachains/src/paras.rs index 666012a3b4..4582e3e99c 100644 --- a/polkadot/runtime/parachains/src/paras.rs +++ b/polkadot/runtime/parachains/src/paras.rs @@ -43,7 +43,6 @@ pub use crate::Origin as ParachainOrigin; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -pub mod weights; pub use pallet::*; @@ -279,6 +278,25 @@ pub trait WeightInfo { fn force_queue_action() -> Weight; } +pub struct TestWeightInfo; +impl WeightInfo for TestWeightInfo { + fn force_set_current_code(_c: u32) -> Weight { + Weight::MAX + } + fn force_set_current_head(_s: u32) -> Weight { + Weight::MAX + } + fn force_schedule_code_upgrade(_c: u32) -> Weight { + Weight::MAX + } + fn force_note_new_head(_s: u32) -> Weight { + Weight::MAX + } + fn force_queue_action() -> Weight { + Weight::MAX + } +} + #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index db00630ede..febdfb0160 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -578,7 +578,7 @@ impl pallet_authorship::Config for Runtime { impl parachains_origin::Config for Runtime {} impl parachains_configuration::Config for Runtime { - type WeightInfo = parachains_configuration::weights::WeightInfo; + type WeightInfo = weights::runtime_parachains_configuration::WeightInfo; } impl parachains_shared::Config for Runtime {} @@ -599,7 +599,7 @@ impl parachains_inclusion::Config for Runtime { impl parachains_paras::Config for Runtime { type Origin = Origin; type Event = Event; - type WeightInfo = parachains_paras::weights::WeightInfo; + type WeightInfo = weights::runtime_parachains_paras::WeightInfo; } parameter_types! { @@ -1599,7 +1599,9 @@ sp_api::impl_runtime_apis! { let mut list = Vec::::new(); + list_benchmark!(list, extra, runtime_parachains::configuration, Configuration); list_benchmark!(list, extra, runtime_parachains::disputes, ParasDisputes); + list_benchmark!(list, extra, runtime_parachains::paras, Paras); let storage_info = AllPalletsWithSystem::storage_info(); @@ -1629,7 +1631,9 @@ sp_api::impl_runtime_apis! { ]; let params = (&config, &whitelist); + add_benchmark!(params, batches, runtime_parachains::configuration, Configuration); add_benchmark!(params, batches, runtime_parachains::disputes, ParasDisputes); + add_benchmark!(params, batches, runtime_parachains::paras, Paras); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) diff --git a/polkadot/runtime/rococo/src/weights/mod.rs b/polkadot/runtime/rococo/src/weights/mod.rs index bcd0ec248a..0c18d1ff92 100644 --- a/polkadot/runtime/rococo/src/weights/mod.rs +++ b/polkadot/runtime/rococo/src/weights/mod.rs @@ -1 +1,20 @@ +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! A list of the different weight modules for our runtime. + +pub mod runtime_parachains_configuration; pub mod runtime_parachains_disputes; +pub mod runtime_parachains_paras; diff --git a/polkadot/runtime/parachains/src/configuration/weights.rs b/polkadot/runtime/rococo/src/weights/runtime_parachains_configuration.rs similarity index 64% rename from polkadot/runtime/parachains/src/configuration/weights.rs rename to polkadot/runtime/rococo/src/weights/runtime_parachains_configuration.rs index da70d6cb29..c783fb4131 100644 --- a/polkadot/runtime/parachains/src/configuration/weights.rs +++ b/polkadot/runtime/rococo/src/weights/runtime_parachains_configuration.rs @@ -1,28 +1,37 @@ +// 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 +//! DATE: 2021-09-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 128 // Executed Command: -// ./target/release/polkadot +// target/release/polkadot // benchmark -// --chain -// westend-dev +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=runtime_parachains::configuration +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --pallet -// runtime_parachains::configuration -// --steps -// 50 -// --repeat -// 20 -// --raw -// --extrinsic -// * -// --output -// runtime/parachains/src/configuration/weights.rs +// --heap-pages=4096 +// --output=./runtime/rococo/src/weights/runtime_parachains_configuration.rs +// --header=./file_header.txt #![cfg_attr(rustfmt, rustfmt_skip)] @@ -34,12 +43,12 @@ use sp_std::marker::PhantomData; /// Weight functions for `runtime_parachains::configuration`. pub struct WeightInfo(PhantomData); -impl super::WeightInfo for WeightInfo { +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 { - (16_730_000 as Weight) + (13_098_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -47,7 +56,7 @@ impl super::WeightInfo for WeightInfo { // 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) + (13_216_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -55,7 +64,7 @@ impl super::WeightInfo for WeightInfo { // 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) + (13_080_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -63,7 +72,7 @@ impl super::WeightInfo for WeightInfo { // 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) + (13_178_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -75,7 +84,7 @@ impl super::WeightInfo for WeightInfo { // 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) + (13_080_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } diff --git a/polkadot/runtime/parachains/src/paras/weights.rs b/polkadot/runtime/rococo/src/weights/runtime_parachains_paras.rs similarity index 67% rename from polkadot/runtime/parachains/src/paras/weights.rs rename to polkadot/runtime/rococo/src/weights/runtime_parachains_paras.rs index d02acf4bc6..b3d93dd5c6 100644 --- a/polkadot/runtime/parachains/src/paras/weights.rs +++ b/polkadot/runtime/rococo/src/weights/runtime_parachains_paras.rs @@ -1,28 +1,37 @@ +// 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::paras` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-09-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128 +//! DATE: 2021-09-24, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 128 // Executed Command: -// ./target/release/polkadot +// target/release/polkadot // benchmark -// --chain -// westend-dev +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=runtime_parachains::paras +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --pallet -// runtime_parachains::paras -// --steps -// 50 -// --repeat -// 20 -// --raw -// --extrinsic -// * -// --output -// runtime/parachains/src/paras/weights.rs +// --heap-pages=4096 +// --output=./runtime/rococo/src/weights/runtime_parachains_paras.rs +// --header=./file_header.txt #![cfg_attr(rustfmt, rustfmt_skip)] @@ -34,7 +43,7 @@ use sp_std::marker::PhantomData; /// Weight functions for `runtime_parachains::paras`. pub struct WeightInfo(PhantomData); -impl super::WeightInfo for WeightInfo { +impl runtime_parachains::paras::WeightInfo for WeightInfo { // Storage: Paras CurrentCodeHash (r:1 w:1) // Storage: Paras CodeByHashRefs (r:1 w:1) // Storage: Paras PastCodeMeta (r:1 w:1) @@ -42,7 +51,7 @@ impl super::WeightInfo for WeightInfo { // Storage: Paras PastCodeHash (r:0 w:1) // Storage: Paras CodeByHash (r:0 w:1) fn force_set_current_code(c: u32, ) -> Weight { - (14_669_000 as Weight) + (0 as Weight) // Standard Error: 0 .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) @@ -50,9 +59,9 @@ impl super::WeightInfo for WeightInfo { } // Storage: Paras Heads (r:0 w:1) fn force_set_current_head(s: u32, ) -> Weight { - (0 as Weight) + (18_653_000 as Weight) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Configuration ActiveConfig (r:1 w:0) @@ -65,7 +74,7 @@ impl super::WeightInfo for WeightInfo { // Storage: Paras FutureCodeHash (r:0 w:1) // Storage: Paras UpgradeRestrictionSignal (r:0 w:1) fn force_schedule_code_upgrade(c: u32, ) -> Weight { - (37_383_000 as Weight) + (0 as Weight) // Standard Error: 0 .saturating_add((3_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) @@ -81,16 +90,16 @@ impl super::WeightInfo for WeightInfo { // Storage: Paras PastCodeHash (r:0 w:1) // Storage: Paras UpgradeGoAheadSignal (r:0 w:1) fn force_note_new_head(s: u32, ) -> Weight { - (60_855_000 as Weight) + (69_515_000 as Weight) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(9 as Weight)) } // Storage: ParasShared CurrentSessionIndex (r:1 w:0) // Storage: Paras ActionsQueue (r:1 w:1) fn force_queue_action() -> Weight { - (32_014_000 as Weight) + (26_804_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index 560d286e16..ccecc33f4a 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -461,7 +461,7 @@ impl pallet_sudo::Config for Runtime { } impl parachains_configuration::Config for Runtime { - type WeightInfo = parachains_configuration::weights::WeightInfo; + type WeightInfo = parachains_configuration::TestWeightInfo; } impl parachains_shared::Config for Runtime {} @@ -492,7 +492,7 @@ impl parachains_session_info::Config for Runtime {} impl parachains_paras::Config for Runtime { type Origin = Origin; type Event = Event; - type WeightInfo = parachains_paras::weights::WeightInfo; + type WeightInfo = parachains_paras::TestWeightInfo; } impl parachains_dmp::Config for Runtime {} diff --git a/polkadot/xcm/xcm-builder/tests/mock/mod.rs b/polkadot/xcm/xcm-builder/tests/mock/mod.rs index 1f0a594204..69ef0088a9 100644 --- a/polkadot/xcm/xcm-builder/tests/mock/mod.rs +++ b/polkadot/xcm/xcm-builder/tests/mock/mod.rs @@ -108,7 +108,7 @@ impl pallet_balances::Config for Runtime { impl shared::Config for Runtime {} impl configuration::Config for Runtime { - type WeightInfo = configuration::weights::WeightInfo; + type WeightInfo = configuration::TestWeightInfo; } // aims to closely emulate the Kusama XcmConfig diff --git a/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs b/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs index cc50aec90d..8dcb5f1f31 100644 --- a/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs +++ b/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs @@ -89,7 +89,7 @@ impl pallet_balances::Config for Runtime { impl shared::Config for Runtime {} impl configuration::Config for Runtime { - type WeightInfo = configuration::weights::WeightInfo; + type WeightInfo = configuration::TestWeightInfo; } parameter_types! {