From d252ce13f3c9e33b65fa25bd698c65ec886e784a Mon Sep 17 00:00:00 2001 From: gui Date: Sat, 19 Oct 2024 17:44:39 +0200 Subject: [PATCH 01/40] storage weight reclaim --- Cargo.lock | 48 +- Cargo.toml | 2 + cumulus/pallets/weight-reclaim/Cargo.toml | 63 ++ .../pallets/weight-reclaim/src/benchmarks.rs | 78 +++ cumulus/pallets/weight-reclaim/src/lib.rs | 235 +++++++ cumulus/pallets/weight-reclaim/src/tests.rs | 575 ++++++++++++++++++ cumulus/pallets/weight-reclaim/src/weights.rs | 74 +++ .../assets/asset-hub-rococo/Cargo.toml | 6 +- .../assets/asset-hub-rococo/src/lib.rs | 32 +- .../assets/asset-hub-westend/Cargo.toml | 6 +- .../assets/asset-hub-westend/src/lib.rs | 33 +- .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 6 +- .../bridge-hubs/bridge-hub-westend/Cargo.toml | 6 +- .../bridge-hubs/bridge-hub-westend/src/lib.rs | 103 ++-- .../bridge-hub-westend/tests/snowbridge.rs | 5 +- .../bridge-hub-westend/tests/tests.rs | 3 +- .../collectives-westend/Cargo.toml | 6 +- .../collectives-westend/src/lib.rs | 29 +- .../contracts/contracts-rococo/Cargo.toml | 6 +- .../contracts/contracts-rococo/src/lib.rs | 30 +- .../coretime/coretime-rococo/Cargo.toml | 6 +- .../coretime/coretime-rococo/src/lib.rs | 32 +- .../coretime/coretime-westend/Cargo.toml | 6 +- .../coretime/coretime-westend/src/lib.rs | 32 +- .../runtimes/people/people-rococo/Cargo.toml | 6 +- .../runtimes/people/people-rococo/src/lib.rs | 30 +- .../runtimes/people/people-westend/Cargo.toml | 6 +- .../runtimes/people/people-westend/src/lib.rs | 30 +- .../testing/rococo-parachain/Cargo.toml | 5 +- .../testing/rococo-parachain/src/lib.rs | 30 +- .../storage-weight-reclaim/src/lib.rs | 34 +- .../storage-weight-reclaim/src/tests.rs | 15 + cumulus/test/client/Cargo.toml | 3 +- cumulus/test/client/src/lib.rs | 5 +- cumulus/test/runtime/Cargo.toml | 4 +- cumulus/test/runtime/src/lib.rs | 27 +- cumulus/test/service/Cargo.toml | 3 +- cumulus/test/service/src/lib.rs | 5 +- docs/sdk/Cargo.toml | 1 + docs/sdk/src/guides/enable_pov_reclaim.rs | 6 +- prdoc/pr_5234.prdoc | 39 ++ templates/parachain/runtime/src/benchmarks.rs | 1 + .../parachain/runtime/src/configs/mod.rs | 5 + umbrella/src/lib.rs | 4 + 44 files changed, 1460 insertions(+), 221 deletions(-) create mode 100644 cumulus/pallets/weight-reclaim/Cargo.toml create mode 100644 cumulus/pallets/weight-reclaim/src/benchmarks.rs create mode 100644 cumulus/pallets/weight-reclaim/src/lib.rs create mode 100644 cumulus/pallets/weight-reclaim/src/tests.rs create mode 100644 cumulus/pallets/weight-reclaim/src/weights.rs create mode 100644 prdoc/pr_5234.prdoc diff --git a/Cargo.lock b/Cargo.lock index 4bb17e66dcab..07e4b58fbabf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -858,11 +858,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -991,11 +991,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -2260,11 +2260,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -2453,11 +2453,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -3128,11 +3128,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -3434,11 +3434,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -3577,11 +3577,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -3677,11 +3677,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", @@ -4427,6 +4427,25 @@ dependencies = [ "sp-runtime 31.0.1", ] +[[package]] +name = "cumulus-pallet-weight-reclaim" +version = "1.0.0" +dependencies = [ + "cumulus-primitives-proof-size-hostfunction", + "cumulus-primitives-storage-weight-reclaim", + "derivative", + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-trie 29.0.0", +] + [[package]] name = "cumulus-pallet-xcm" version = "0.7.0" @@ -4716,10 +4735,10 @@ dependencies = [ name = "cumulus-test-client" version = "0.1.0" dependencies = [ + "cumulus-pallet-weight-reclaim", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", - "cumulus-primitives-storage-weight-reclaim", "cumulus-test-relay-sproof-builder", "cumulus-test-runtime", "cumulus-test-service", @@ -4767,9 +4786,9 @@ version = "0.1.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", + "cumulus-pallet-weight-reclaim", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "frame-executive", "frame-support", "frame-system", @@ -4819,8 +4838,8 @@ dependencies = [ "cumulus-client-pov-recovery", "cumulus-client-service", "cumulus-pallet-parachain-system", + "cumulus-pallet-weight-reclaim", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", @@ -13497,11 +13516,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "enumflags2", "frame-benchmarking", @@ -13597,11 +13616,11 @@ dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "enumflags2", "frame-benchmarking", @@ -15542,6 +15561,7 @@ dependencies = [ "cumulus-client-service", "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", + "cumulus-pallet-weight-reclaim", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "docify", @@ -17656,12 +17676,12 @@ version = "0.6.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", diff --git a/Cargo.toml b/Cargo.toml index b357b99be118..74ac4baa6de6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,6 +83,7 @@ members = [ "cumulus/pallets/parachain-system/proc-macro", "cumulus/pallets/session-benchmarking", "cumulus/pallets/solo-to-para", + "cumulus/pallets/weight-reclaim", "cumulus/pallets/xcm", "cumulus/pallets/xcmp-queue", "cumulus/parachains/common", @@ -706,6 +707,7 @@ cumulus-pallet-parachain-system = { path = "cumulus/pallets/parachain-system", d cumulus-pallet-parachain-system-proc-macro = { path = "cumulus/pallets/parachain-system/proc-macro", default-features = false } cumulus-pallet-session-benchmarking = { path = "cumulus/pallets/session-benchmarking", default-features = false } cumulus-pallet-solo-to-para = { path = "cumulus/pallets/solo-to-para", default-features = false } +cumulus-pallet-weight-reclaim = { path = "cumulus/pallets/weight-reclaim", default-features = false } cumulus-pallet-xcm = { path = "cumulus/pallets/xcm", default-features = false } cumulus-pallet-xcmp-queue = { path = "cumulus/pallets/xcmp-queue", default-features = false } cumulus-ping = { path = "cumulus/parachains/pallets/ping", default-features = false } diff --git a/cumulus/pallets/weight-reclaim/Cargo.toml b/cumulus/pallets/weight-reclaim/Cargo.toml new file mode 100644 index 000000000000..050c98884f68 --- /dev/null +++ b/cumulus/pallets/weight-reclaim/Cargo.toml @@ -0,0 +1,63 @@ +[package] +name = "cumulus-pallet-weight-reclaim" +version = "1.0.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true +description = "pallet and transaction extensions for accurate proof size reclaim" + +[lints] +workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +# Substrate dependencies +sp-runtime = { workspace = true } +sp-io = { workspace = true } +sp-trie = { workspace = true } + +frame-support = { workspace = true } +frame-system = { workspace = true } +frame-benchmarking = { optional = true, workspace = true } +cumulus-primitives-storage-weight-reclaim = { workspace = true } + +# Other dependencies +codec = { features = ["derive"], workspace = true } +scale-info = { features = ["derive"], workspace = true } +log = { workspace = true, default-features = true } +derivative = { features = ["use_core"], workspace = true } +docify = { workspace = true } + +[dev-dependencies] +cumulus-primitives-proof-size-hostfunction = { workspace = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "cumulus-primitives-proof-size-hostfunction/std", + "cumulus-primitives-storage-weight-reclaim/std", + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "log/std", + "scale-info/std", + "sp-io/std", + "sp-runtime/std", + "sp-trie/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/cumulus/pallets/weight-reclaim/src/benchmarks.rs b/cumulus/pallets/weight-reclaim/src/benchmarks.rs new file mode 100644 index 000000000000..33c1e6effe87 --- /dev/null +++ b/cumulus/pallets/weight-reclaim/src/benchmarks.rs @@ -0,0 +1,78 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use frame_support::pallet_prelude::{DispatchClass, Pays}; +use frame_system::RawOrigin; +use sp_runtime::traits::DispatchTransaction; +use sp_runtime::traits::AsTransactionAuthorizedOrigin; + +#[frame_benchmarking::v2::benchmarks( + where T: Send + Sync, + ::RuntimeCall: + Dispatchable, + ::RuntimeOrigin: AsTransactionAuthorizedOrigin, +)] +mod bench { + use super::*; + use frame_benchmarking::impl_test_function; + + #[benchmark] + fn storage_weight_reclaim() -> Result<(), frame_benchmarking::BenchmarkError> { + let ext = StorageWeightReclaim::::new(()); + + + let origin = RawOrigin::Root.into(); + let call = T::RuntimeCall::from(frame_system::Call::remark { remark: alloc::vec![] }); + + let info = DispatchInfo { + call_weight: Weight::zero().add_proof_size(1000), + extension_weight: Weight::zero(), + class: DispatchClass::Normal, + pays_fee: Pays::No, + }; + + let post_info_overestimate = 15; + + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::zero().add_proof_size(post_info_overestimate)), + pays_fee: Pays::No, + }; + + let initial_block_proof_size = 1_000_000; + + let mut block_weight = frame_system::ConsumedWeight::default(); + block_weight.accrue(Weight::from_parts(0, initial_block_proof_size), info.class); + + frame_system::BlockWeight::::put(block_weight); + + #[block] + { + assert!(ext.test_run(origin, &call, &info, 0, |_| Ok(post_info)).unwrap().is_ok()); + } + + let final_block_proof_size = + frame_system::BlockWeight::::get().get(info.class).proof_size(); + + assert_eq!(final_block_proof_size, initial_block_proof_size - post_info_overestimate); + + Ok(()) + } + + impl_benchmark_test_suite!(Pallet, crate::tests::setup_test_ext_default(), crate::tests::Test); +} diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs new file mode 100644 index 000000000000..8e3ac4aaf181 --- /dev/null +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -0,0 +1,235 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Pallet and transaction extensions to reclaim PoV proof size weight after an extrinsic has been +//! applied. +//! +//! This crate provides a transaction extensions and a pallet. +//! * [`StorageWeightReclaim`] transaction extension: it must wrap the whole transaction extension +//! pipeline. +//! * The pallet required for the transaction extensions weight information and benchmarks. + +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; +use codec::{Decode, Encode}; +use cumulus_primitives_storage_weight_reclaim::get_proof_size; +use derivative::Derivative; +use frame_support::{ + dispatch::{DispatchInfo, PostDispatchInfo}, + pallet_prelude::Weight, +}; +use scale_info::TypeInfo; +use sp_runtime::{ + traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf, TransactionExtension}, + transaction_validity::{TransactionValidityError, ValidTransaction}, + DispatchResult, +}; + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarks; +#[cfg(test)] +mod tests; +mod weights; + +pub use pallet::*; +pub use weights::WeightInfo; + +const LOG_TARGET: &'static str = "runtime::storage_reclaim_pallet"; + +/// Pallet to use alongside the transaction extension [`StorageWeightReclaim`], the pallet provides +/// weight information and benchmarks. +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: WeightInfo; + } +} + +/// Storage weight reclaim mechanism. +/// +/// This extension must wrap all the transaction extensions: +#[doc = docify::embed!("./src/tests.rs", Tx)] +/// +/// This extension checks the size of the node-side storage proof +/// before and after executing a given extrinsic. The difference between +/// benchmarked and spent weight can be reclaimed. +#[derive(Encode, Decode, TypeInfo, Derivative)] +#[derivative( + Clone(bound = "S: Clone"), + Eq(bound = "S: Eq"), + PartialEq(bound = "S: PartialEq"), + Default(bound = "S: Default") +)] +#[scale_info(skip_type_params(T))] +pub struct StorageWeightReclaim(pub S, core::marker::PhantomData); + +impl StorageWeightReclaim { + /// Create a new `StorageWeightReclaim` instance. + pub fn new(s: S) -> Self { + Self(s, Default::default()) + } +} + +impl From for StorageWeightReclaim { + fn from(s: S) -> Self { + Self::new(s) + } +} + +impl core::fmt::Debug for StorageWeightReclaim { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> { + #[cfg(feature = "std")] + let _ = write!(f, "StorageWeightReclaim<{:?}>", self.0); + + #[cfg(not(feature = "std"))] + let _ = f; + + Ok(()) + } +} + +impl> + TransactionExtension for StorageWeightReclaim +where + T::RuntimeCall: Dispatchable, +{ + const IDENTIFIER: &'static str = "StorageWeightReclaim"; + type Implicit = S::Implicit; + type Val = (Option, S::Val); + type Pre = (Option, S::Pre); + + fn implicit(&self) -> Result { + self.0.implicit() + } + + fn metadata() -> Vec { + S::metadata() + } + + fn weight(&self, call: &T::RuntimeCall) -> Weight { + T::WeightInfo::storage_weight_reclaim().saturating_add(self.0.weight(call)) + } + + fn validate( + &self, + origin: T::RuntimeOrigin, + call: &T::RuntimeCall, + info: &DispatchInfoOf, + len: usize, + self_implicit: Self::Implicit, + inherited_implication: &impl Encode, + ) -> Result<(ValidTransaction, Self::Val, T::RuntimeOrigin), TransactionValidityError> { + // Trade-off: we could move it to `prepare` but better be accurate on reclaim than fast on + // `validate` + let proof_size = get_proof_size(); + + self.0 + .validate(origin, call, info, len, self_implicit, inherited_implication) + .map(|(validity, val, origin)| (validity, (proof_size, val), origin)) + } + + fn prepare( + self, + val: Self::Val, + origin: &T::RuntimeOrigin, + call: &T::RuntimeCall, + info: &DispatchInfoOf, + len: usize, + ) -> Result { + let (proof_size, inner_val) = val; + self.0.prepare(inner_val, origin, call, info, len).map(|pre| (proof_size, pre)) + } + + fn post_dispatch_details( + pre: Self::Pre, + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, + len: usize, + result: &DispatchResult, + ) -> Result { + let (pre_dispatch_proof_size, inner_pre) = pre; + + let mut post_info_with_inner = *post_info; + S::post_dispatch(inner_pre, info, &mut post_info_with_inner, len, result)?; + + let inner_refund = if let (Some(before_weight), Some(after_weight)) = + (post_info.actual_weight, post_info_with_inner.actual_weight) + { + before_weight.saturating_sub(after_weight) + } else { + Weight::zero() + }; + + let Some(pre_dispatch_proof_size) = pre_dispatch_proof_size else { + // We have no proof size information, there is nothing we can do. + return Ok(inner_refund); + }; + + let Some(post_dispatch_proof_size) = get_proof_size() else { + log::debug!( + target: LOG_TARGET, + "Proof recording enabled during prepare, now disabled. This should not happen." + ); + return Ok(inner_refund) + }; + + // Unspent weight according to the `actual_weight` from `PostDispatchInfo` + // This unspent weight will be refunded by the `CheckWeight` extension, so we need to + // account for that. + // + // Also we don't need to include the unspent weight of this transaction extension because: + // 1 - There is no unspent weight for this extension. + // 2 - `CheckWeight` computes the unspent weight wihout seeing the unspent weight of this + // extension even if there was any. Thus `post_info_with_inner` is what we want. + let unspent = post_info_with_inner.calc_unspent(info).proof_size(); + let benchmarked_weight = info.total_weight().proof_size().saturating_sub(unspent); + let consumed_weight = post_dispatch_proof_size.saturating_sub(pre_dispatch_proof_size); + + let storage_size_diff = benchmarked_weight.abs_diff(consumed_weight as u64); + + // This value will be reclaimed by [`frame_system::CheckWeight`], so we need to calculate + // that in. + frame_system::BlockWeight::::mutate(|current| { + if consumed_weight > benchmarked_weight { + log::error!( + target: LOG_TARGET, + "Benchmarked storage weight smaller than consumed storage weight. \ + benchmarked: {benchmarked_weight} consumed: {consumed_weight} unspent: \ + {unspent}" + ); + current.accrue(Weight::from_parts(0, storage_size_diff), info.class) + } else { + log::trace!( + target: LOG_TARGET, + "Reclaiming storage weight. benchmarked: {benchmarked_weight}, consumed: \ + {consumed_weight} unspent: {unspent}" + ); + current.reduce(Weight::from_parts(0, storage_size_diff), info.class) + } + }); + + Ok(inner_refund) + } +} diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs new file mode 100644 index 000000000000..e1aea8feb850 --- /dev/null +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -0,0 +1,575 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +#![cfg(test)] + +use super::*; +use cumulus_primitives_proof_size_hostfunction::PROOF_RECORDING_DISABLED; +use frame_support::{ + assert_ok, derive_impl, dispatch::GetDispatchInfo, pallet_prelude::DispatchClass, +}; +use sp_runtime::{ + generic, + traits::{Applyable, BlakeTwo256, DispatchTransaction}, + BuildStorage, +}; +use sp_trie::proof_size_extension::ProofSizeExt; + +thread_local! { + static CHECK_WEIGHT_WEIGHT: core::cell::RefCell = Default::default(); + static STORAGE_WEIGHT_RECLAIM_WEIGHT: core::cell::RefCell = Default::default(); + static MOCK_EXT_WEIGHT: core::cell::RefCell = Default::default(); + static MOCK_EXT_REFUND: core::cell::RefCell = Default::default(); +} + +/// An extension which has some proof_size weight and some proof_size refund. +#[derive(Encode, Decode, Debug, Clone, PartialEq, Eq, scale_info::TypeInfo)] +pub struct MockExtensionWithRefund; + +impl TransactionExtension for MockExtensionWithRefund { + const IDENTIFIER: &'static str = "mock_extension_with_refund"; + type Implicit = (); + type Val = (); + type Pre = (); + fn weight(&self, _: &RuntimeCall) -> Weight { + MOCK_EXT_WEIGHT.with_borrow(|v| *v) + } + fn post_dispatch_details( + _pre: Self::Pre, + _info: &DispatchInfoOf, + _post_info: &PostDispatchInfoOf, + _len: usize, + _result: &DispatchResult, + ) -> Result { + Ok(MOCK_EXT_REFUND.with_borrow(|v| *v)) + } + + sp_runtime::impl_tx_ext_default!(RuntimeCall; validate prepare); +} + +pub type Tx = + crate::StorageWeightReclaim)>; +type AccountId = u64; +type Extrinsic = generic::UncheckedExtrinsic; +type Block = generic::Block, Extrinsic>; + +#[frame_support::runtime] +mod runtime { + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Test; + + #[runtime::pallet_index(0)] + pub type System = frame_system::Pallet; + + #[runtime::pallet_index(1)] + pub type WeightReclaim = crate::Pallet; +} + +pub struct MockWeightInfo; + +impl frame_system::ExtensionsWeightInfo for MockWeightInfo { + fn check_genesis() -> Weight { + Default::default() + } + fn check_mortality_mortal_transaction() -> Weight { + Default::default() + } + fn check_mortality_immortal_transaction() -> Weight { + Default::default() + } + fn check_non_zero_sender() -> Weight { + Default::default() + } + fn check_nonce() -> Weight { + Default::default() + } + fn check_spec_version() -> Weight { + Default::default() + } + fn check_tx_version() -> Weight { + Default::default() + } + fn check_weight() -> Weight { + CHECK_WEIGHT_WEIGHT.with_borrow(|v| *v) + } +} + +impl crate::WeightInfo for MockWeightInfo { + fn storage_weight_reclaim() -> Weight { + STORAGE_WEIGHT_RECLAIM_WEIGHT.with_borrow(|v| *v) + } +} + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] +impl frame_system::Config for Test { + type Block = Block; + type AccountData = (); + type MaxConsumers = frame_support::traits::ConstU32<3>; + type ExtensionsWeightInfo = MockWeightInfo; +} + +impl crate::Config for Test { + type WeightInfo = MockWeightInfo; +} + +fn new_test_ext() -> sp_io::TestExternalities { + RuntimeGenesisConfig::default().build_storage().unwrap().into() +} + +struct TestRecorder { + return_values: Box<[usize]>, + counter: core::sync::atomic::AtomicUsize, +} + +impl TestRecorder { + fn new(values: &[usize]) -> Self { + TestRecorder { return_values: values.into(), counter: Default::default() } + } +} + +impl sp_trie::ProofSizeProvider for TestRecorder { + fn estimate_encoded_size(&self) -> usize { + let counter = self.counter.fetch_add(1, core::sync::atomic::Ordering::Relaxed); + self.return_values[counter] + } +} + +fn setup_test_externalities(proof_values: &[usize]) -> sp_io::TestExternalities { + let mut test_ext = new_test_ext(); + let test_recorder = TestRecorder::new(proof_values); + test_ext.register_extension(ProofSizeExt::new(test_recorder)); + test_ext +} + +#[cfg(feature = "runtime-benchmarks")] +pub fn setup_test_ext_default() -> sp_io::TestExternalities { + setup_test_externalities(&[0; 32]) +} + +fn set_current_storage_weight(new_weight: u64) { + frame_system::BlockWeight::::mutate(|current_weight| { + current_weight.set(Weight::from_parts(0, new_weight), DispatchClass::Normal); + }); +} + +fn get_storage_weight() -> Weight { + *frame_system::BlockWeight::::get().get(DispatchClass::Normal) +} + +const CALL: &::RuntimeCall = + &RuntimeCall::System(frame_system::Call::set_heap_pages { pages: 0u64 }); +const ALICE_ORIGIN: frame_system::Origin = frame_system::Origin::::Signed(99); +const LEN: usize = 150; + +fn new_tx_ext() -> Tx { + Tx::new((MockExtensionWithRefund, frame_system::CheckWeight::new())) +} + +fn new_extrinsic() -> generic::CheckedExtrinsic { + generic::CheckedExtrinsic { + format: generic::ExtrinsicFormat::Signed(99, new_tx_ext()), + function: RuntimeCall::System(frame_system::Call::remark { remark: vec![] }), + } +} + +#[allow(unused)] +mod doc { + type Runtime = super::Test; + use crate::StorageWeightReclaim; + + #[docify::export(Tx)] + type Tx = StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonce, + frame_system::CheckWeight, + // ... all other extensions + ), + >; +} + +#[test] +fn basic_refund() { + // The real cost will be 100 bytes of storage size + let mut test_ext = setup_test_externalities(&[0, 100]); + + test_ext.execute_with(|| { + set_current_storage_weight(1000); + + // Benchmarked storage weight: 500 + let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; + let mut post_info = PostDispatchInfo::default(); + + let tx_ext = new_tx_ext(); + + // Check weight should add 500 + 150 (len) to weight. + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + assert_eq!(pre.0, Some(0)); + + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + assert_eq!(get_storage_weight().proof_size(), 1250); + }); +} + +#[test] +fn does_nothing_without_extension() { + // Proof size extension not registered + let mut test_ext = new_test_ext(); + + test_ext.execute_with(|| { + set_current_storage_weight(1000); + + // Benchmarked storage weight: 500 + let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; + let mut post_info = PostDispatchInfo::default(); + + let tx_ext = new_tx_ext(); + + // Check weight should add 500 + 150 (len) to weight. + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + assert_eq!(pre.0, None); + + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + assert_eq!(get_storage_weight().proof_size(), 1650); + }) +} + +#[test] +fn negative_refund_is_added_to_weight() { + let mut test_ext = setup_test_externalities(&[100, 300]); + + test_ext.execute_with(|| { + set_current_storage_weight(1000); + // Benchmarked storage weight: 100 + let info = DispatchInfo { call_weight: Weight::from_parts(0, 100), ..Default::default() }; + let mut post_info = PostDispatchInfo::default(); + + let tx_ext = new_tx_ext(); + + // Weight added should be 100 + 150 (len) + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + assert_eq!(pre.0, Some(100)); + + // We expect no refund + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + assert_eq!( + get_storage_weight().proof_size(), + 1100 + LEN as u64 + info.total_weight().proof_size() + ); + }) +} + +#[test] +fn test_zero_proof_size() { + let mut test_ext = setup_test_externalities(&[0, 0]); + + test_ext.execute_with(|| { + let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; + let mut post_info = PostDispatchInfo::default(); + + let tx_ext = new_tx_ext(); + + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + assert_eq!(pre.0, Some(0)); + + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + // Proof size should be exactly equal to extrinsic length + assert_eq!(get_storage_weight().proof_size(), LEN as u64); + }); +} + +#[test] +fn test_larger_pre_dispatch_proof_size() { + let mut test_ext = setup_test_externalities(&[300, 100]); + + test_ext.execute_with(|| { + set_current_storage_weight(1300); + + let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; + let mut post_info = PostDispatchInfo::default(); + + let tx_ext = new_tx_ext(); + + // Adds 500 + 150 (len) weight, total weight is 1950 + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + assert_eq!(pre.0, Some(300)); + + // check weight: + // Refund 500 unspent weight according to `post_info`, total weight is now 1650 + // + // storage reclaim: + // Recorded proof size is negative -200, total weight is now 1450 + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + assert_eq!(get_storage_weight().proof_size(), 1450); + }); +} + +#[test] +fn test_incorporates_check_weight_unspent_weight() { + let mut test_ext = setup_test_externalities(&[100, 300]); + + test_ext.execute_with(|| { + set_current_storage_weight(1000); + + // Benchmarked storage weight: 300 + let info = DispatchInfo { call_weight: Weight::from_parts(100, 300), ..Default::default() }; + + // Actual weight is 50 + let mut post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(50, 250)), + pays_fee: Default::default(), + }; + + let tx_ext = new_tx_ext(); + + // Check weight should add 300 + 150 (len) of weight + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + assert_eq!(pre.0, Some(100)); + + // The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo` + // we always need to call `post_dispatch` to verify that they interoperate correctly. + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + // Reclaimed 100 + assert_eq!(get_storage_weight().proof_size(), 1350); + }) +} + +#[test] +fn test_incorporates_check_weight_unspent_weight_on_negative() { + let mut test_ext = setup_test_externalities(&[100, 300]); + + test_ext.execute_with(|| { + set_current_storage_weight(1000); + // Benchmarked storage weight: 50 + let info = DispatchInfo { call_weight: Weight::from_parts(100, 50), ..Default::default() }; + + // Actual weight is 25 + let mut post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(50, 25)), + pays_fee: Default::default(), + }; + + let tx_ext = new_tx_ext(); + + // Adds 50 + 150 (len) weight, total weight 1200 + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + assert_eq!(pre.0, Some(100)); + + // The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo` + // we always need to call `post_dispatch` to verify that they interoperate correctly. + // Refunds unspent 25 weight according to `post_info`, 1175 + // + // storage reclaim: + // Adds 200 - 25 (unspent) == 175 weight, total weight 1350 + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + assert_eq!(get_storage_weight().proof_size(), 1350); + }) +} + +#[test] +fn test_nothing_reclaimed() { + let mut test_ext = setup_test_externalities(&[100, 200]); + + test_ext.execute_with(|| { + set_current_storage_weight(0); + // Benchmarked storage weight: 100 + let info = DispatchInfo { call_weight: Weight::from_parts(100, 100), ..Default::default() }; + + // Actual proof size is 100 + let mut post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(50, 100)), + pays_fee: Default::default(), + }; + + let tx_ext = new_tx_ext(); + + // Adds benchmarked weight 100 + 150 (len), total weight is now 250 + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + // Weight should go up by 150 len + 100 proof size weight, total weight 250 + assert_eq!(get_storage_weight().proof_size(), 250); + + // Should return `setup_test_externalities` proof recorder value: 100. + assert_eq!(pre.0, Some(100)); + + // The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo` + // we always need to call `post_dispatch` to verify that they interoperate correctly. + // Nothing to refund, unspent is 0, total weight 250 + // + // weight reclaim: + // `setup_test_externalities` proof recorder value: 200, so this means the extrinsic + // actually used 100 proof size. + // Nothing to refund or add, weight matches proof recorder + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + // Check block len weight was not reclaimed: + // 100 weight + 150 extrinsic len == 250 proof size + assert_eq!(get_storage_weight().proof_size(), 250); + }) +} + +#[test] +fn storage_size_reported_correctly() { + let mut test_ext = setup_test_externalities(&[1000]); + test_ext.execute_with(|| { + assert_eq!(get_proof_size(), Some(1000)); + }); + + let mut test_ext = new_test_ext(); + + let test_recorder = TestRecorder::new(&[0]); + + test_ext.register_extension(ProofSizeExt::new(test_recorder)); + + test_ext.execute_with(|| { + assert_eq!(get_proof_size(), Some(0)); + }); +} + +#[test] +fn storage_size_disabled_reported_correctly() { + let mut test_ext = setup_test_externalities(&[PROOF_RECORDING_DISABLED as usize]); + + test_ext.execute_with(|| { + assert_eq!(get_proof_size(), None); + }); +} + +#[test] +fn full_basic_refund() { + // Settings for the test: + let actual_used_proof_size = 200; + let check_weight = 100; + let storage_weight_reclaim = 100; + let mock_ext = 142; + let mock_ext_refund = 100; + + // Test execution: + CHECK_WEIGHT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(1, check_weight)); + STORAGE_WEIGHT_RECLAIM_WEIGHT + .with_borrow_mut(|v| *v = Weight::from_parts(1, storage_weight_reclaim)); + MOCK_EXT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(36, mock_ext)); + MOCK_EXT_REFUND.with_borrow_mut(|v| *v = Weight::from_parts(35, mock_ext_refund)); + + let initial_storage_weight = 1212; + + let mut test_ext = setup_test_externalities(&[3232, 3232 + actual_used_proof_size]); + + test_ext.execute_with(|| { + set_current_storage_weight(initial_storage_weight); + + let extrinsic = new_extrinsic(); + let call_info = extrinsic.function.get_dispatch_info(); + + let info = extrinsic.get_dispatch_info(); + let post_info = extrinsic.apply::(&info, LEN).unwrap().unwrap(); + + // Assertions: + let post_info_tx_proof_size = + check_weight + storage_weight_reclaim + mock_ext - mock_ext_refund; + assert_eq!( + post_info.actual_weight, + Some(call_info.call_weight + Weight::from_parts(3, post_info_tx_proof_size)) + ); + assert_eq!( + get_storage_weight().proof_size(), + initial_storage_weight + actual_used_proof_size as u64 + LEN as u64 + ); + }); +} + +#[test] +fn full_accrue() { + // Settings for the test: + let actual_used_proof_size = 400; + let check_weight = 100; + let storage_weight_reclaim = 100; + let mock_ext = 142; + let mock_ext_refund = 100; + + // Test execution: + CHECK_WEIGHT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(1, check_weight)); + STORAGE_WEIGHT_RECLAIM_WEIGHT + .with_borrow_mut(|v| *v = Weight::from_parts(1, storage_weight_reclaim)); + MOCK_EXT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(36, mock_ext)); + MOCK_EXT_REFUND.with_borrow_mut(|v| *v = Weight::from_parts(35, mock_ext_refund)); + + let initial_storage_weight = 1212; + + let mut test_ext = setup_test_externalities(&[3232, 3232 + actual_used_proof_size]); + + test_ext.execute_with(|| { + set_current_storage_weight(initial_storage_weight); + + let extrinsic = new_extrinsic(); + let call_info = extrinsic.function.get_dispatch_info(); + + let info = extrinsic.get_dispatch_info(); + let post_info = extrinsic.apply::(&info, LEN).unwrap().unwrap(); + + // Assertions: + let post_info_tx_proof_size = + check_weight + storage_weight_reclaim + mock_ext - mock_ext_refund; + assert_eq!( + post_info.actual_weight, + Some(call_info.call_weight + Weight::from_parts(3, post_info_tx_proof_size)) + ); + assert_eq!( + get_storage_weight().proof_size(), + initial_storage_weight + actual_used_proof_size as u64 + LEN as u64 + ); + }); +} diff --git a/cumulus/pallets/weight-reclaim/src/weights.rs b/cumulus/pallets/weight-reclaim/src/weights.rs new file mode 100644 index 000000000000..e651c8a78318 --- /dev/null +++ b/cumulus/pallets/weight-reclaim/src/weights.rs @@ -0,0 +1,74 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `fedora`, CPU: `13th Gen Intel(R) Core(TM) i7-1360P` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/parachain-template-node +// benchmark +// pallet +// --pallet +// cumulus-pallet-weight-reclaim +// --chain +// dev +// --output +// cumulus/pallets/weight-reclaim/src/weights.rs +// --template +// substrate/.maintain/frame-weight-template.hbs +// --extrinsic +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions needed for `cumulus_pallet_weight_reclaim`. +pub trait WeightInfo { + fn storage_weight_reclaim() -> Weight; +} + +/// Weights for `cumulus_pallet_weight_reclaim` using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_466_000, 0) + } +} + +// For backwards compatibility and tests. +impl WeightInfo for () { + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_466_000, 0) + } +} diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml index 42adaba7a27c..6fe0bf7bdee3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml @@ -82,12 +82,12 @@ cumulus-pallet-xcmp-queue = { features = ["bridging"], workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } testnet-parachains-constants = { features = ["rococo"], workspace = true } assets-common = { workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } # Bridges pallet-xcm-bridge-hub-router = { workspace = true } @@ -109,6 +109,7 @@ runtime-benchmarks = [ "assets-common/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -147,6 +148,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", @@ -188,11 +190,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 64fdf4883720..b24119597f80 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -181,6 +181,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -950,6 +954,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 3, ParachainInfo: parachain_info = 4, + WeightReclaim: cumulus_pallet_weight_reclaim = 5, // Monetary stuff. Balances: pallet_balances = 10, @@ -1004,18 +1009,20 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// The extension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_asset_conversion_tx_payment::ChargeAssetTxPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, - frame_metadata_hash_extension::CheckMetadataHash, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_asset_conversion_tx_payment::ChargeAssetTxPayment, + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -1201,6 +1208,7 @@ mod benches { // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml index 5fa48381b674..274111260094 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml @@ -80,10 +80,10 @@ cumulus-pallet-parachain-system = { workspace = true } cumulus-pallet-session-benchmarking = { workspace = true } cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { features = ["bridging"], workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } @@ -110,6 +110,7 @@ runtime-benchmarks = [ "assets-common/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -149,6 +150,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", @@ -191,11 +193,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 32d121749534..190fd399e7c0 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -181,6 +181,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -944,6 +948,7 @@ construct_runtime!( // RandomnessCollectiveFlip = 2 removed Timestamp: pallet_timestamp = 3, ParachainInfo: parachain_info = 4, + WeightReclaim: cumulus_pallet_weight_reclaim = 5, // Monetary stuff. Balances: pallet_balances = 10, @@ -1000,18 +1005,21 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// The extension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_asset_conversion_tx_payment::ChargeAssetTxPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, - frame_metadata_hash_extension::CheckMetadataHash, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_asset_conversion_tx_payment::ChargeAssetTxPayment, + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), +>; + /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -1254,6 +1262,7 @@ mod benches { // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 4af8a9f43850..3bd7db8cd7d7 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -74,12 +74,12 @@ cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { features = ["bridging"], workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } cumulus-primitives-utility = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } testnet-parachains-constants = { features = ["rococo"], workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } # Bridges bp-asset-hub-rococo = { workspace = true } @@ -146,11 +146,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking/std", "frame-executive/std", @@ -225,6 +225,7 @@ runtime-benchmarks = [ "bridge-runtime-common/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -266,6 +267,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml index 637e7c710640..fd966d48b3dd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml @@ -75,7 +75,7 @@ cumulus-pallet-xcmp-queue = { features = ["bridging"], workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } @@ -143,11 +143,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking/std", "frame-executive/std", @@ -222,6 +222,7 @@ runtime-benchmarks = [ "bridge-runtime-common/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -263,6 +264,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 85be26d11704..b855ad1d43c3 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -117,20 +117,22 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The TransactionExtension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - BridgeRejectObsoleteHeadersAndMessages, - (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages,), - frame_metadata_hash_extension::CheckMetadataHash, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, + (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages,), + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = @@ -296,6 +298,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -528,6 +534,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 2, ParachainInfo: parachain_info = 3, + WeightReclaim: cumulus_pallet_weight_reclaim = 4, // Monetary stuff. Balances: pallet_balances = 10, @@ -618,6 +625,7 @@ mod benches { [snowbridge_pallet_outbound_queue, EthereumOutboundQueue] [snowbridge_pallet_system, EthereumSystem] [snowbridge_pallet_ethereum_client, EthereumBeaconClient] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } @@ -1374,40 +1382,39 @@ mod tests { use bp_polkadot_core::SuffixedCommonTransactionExtensionExt; sp_io::TestExternalities::default().execute_with(|| { - frame_system::BlockHash::::insert(BlockNumber::zero(), Hash::default()); - let payload: TxExtension = ( - frame_system::CheckNonZeroSender::new(), - frame_system::CheckSpecVersion::new(), - frame_system::CheckTxVersion::new(), - frame_system::CheckGenesis::new(), - frame_system::CheckEra::from(Era::Immortal), - frame_system::CheckNonce::from(10), - frame_system::CheckWeight::new(), - pallet_transaction_payment::ChargeTransactionPayment::from(10), - BridgeRejectObsoleteHeadersAndMessages, - ( - bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(), - ), + frame_system::BlockHash::::insert(BlockNumber::zero(), Hash::default()); + let payload: TxExtension = ( + frame_system::CheckNonZeroSender::new(), + frame_system::CheckSpecVersion::new(), + frame_system::CheckTxVersion::new(), + frame_system::CheckGenesis::new(), + frame_system::CheckEra::from(Era::Immortal), + frame_system::CheckNonce::from(10), + pallet_transaction_payment::ChargeTransactionPayment::from(10), + BridgeRejectObsoleteHeadersAndMessages, + ( + bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(), + ), frame_metadata_hash_extension::CheckMetadataHash::new(false), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::new(), - ); - - { - let bh_indirect_payload = bp_bridge_hub_westend::TransactionExtension::from_params( - VERSION.spec_version, - VERSION.transaction_version, - bp_runtime::TransactionEra::Immortal, - System::block_hash(BlockNumber::zero()), - 10, - 10, - (((), ()), ((), ())), - ); - assert_eq!(payload.encode().split_last().unwrap().1, bh_indirect_payload.encode()); - assert_eq!( - TxExtension::implicit(&payload).unwrap().encode().split_last().unwrap().1, - sp_runtime::traits::TransactionExtension::::implicit(&bh_indirect_payload).unwrap().encode() - ) - } - }); + frame_system::CheckWeight::new(), + ).into(); + + { + let bh_indirect_payload = bp_bridge_hub_westend::TransactionExtension::from_params( + VERSION.spec_version, + VERSION.transaction_version, + bp_runtime::TransactionEra::Immortal, + System::block_hash(BlockNumber::zero()), + 10, + 10, + (((), ()), ((), ())), + ); + assert_eq!(payload.encode().split_last().unwrap().1, bh_indirect_payload.encode()); + assert_eq!( + TxExtension::implicit(&payload).unwrap().encode().split_last().unwrap().1, + sp_runtime::traits::TransactionExtension::::implicit(&bh_indirect_payload).unwrap().encode() + ) + } + }); } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs index 1a1ce2a28ea3..85242f009aa3 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs @@ -180,13 +180,12 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), - frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::::new(false), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::new(), - ); + frame_system::CheckWeight::::new(), + ).into(); let payload = SignedPayload::new(call.clone(), extra.clone()).unwrap(); let signature = payload.using_encoded(|e| sender.sign(e)); UncheckedExtrinsic::new_signed(call, account_id.into(), Signature::Sr25519(signature), extra) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs index e5b67353c0f3..ac978f66798c 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs @@ -90,12 +90,11 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), - frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::new(false), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::new(), + frame_system::CheckWeight::::new(), ) .into(); let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml index e03fc934ceaf..be74b4b8f8b8 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml @@ -81,7 +81,7 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } pallet-collective-content = { workspace = true } @@ -100,6 +100,7 @@ default = ["std"] runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -139,6 +140,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", @@ -178,11 +180,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index 030ed930ed5c..107b3bfd3a17 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -191,6 +191,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -667,6 +671,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 2, ParachainInfo: parachain_info = 3, + WeightReclaim: cumulus_pallet_weight_reclaim = 4, // Monetary stuff. Balances: pallet_balances = 10, @@ -733,16 +738,19 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// The extension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + ), +>; + /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -804,6 +812,7 @@ mod benches { [pallet_salary, AmbassadorSalary] [pallet_treasury, FellowshipTreasury] [pallet_asset_rate, AssetRate] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index c98ca7ba3e74..da37ac813d18 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -74,7 +74,7 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } @@ -88,11 +88,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", @@ -146,6 +146,7 @@ std = [ runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -176,6 +177,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 0111b3d8522d..a490c6b82f61 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -88,17 +88,19 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// The extension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -201,6 +203,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -401,6 +407,7 @@ construct_runtime!( RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip = 2, Timestamp: pallet_timestamp = 3, ParachainInfo: parachain_info = 4, + WeightReclaim: cumulus_pallet_weight_reclaim = 5, // Monetary stuff. Balances: pallet_balances = 10, @@ -447,6 +454,7 @@ mod benches { [cumulus_pallet_parachain_system, ParachainSystem] [pallet_contracts, Contracts] [pallet_xcm, PalletXcmExtrinsicsBenchmark::] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml index a38b7400cfa3..7dbc47113df4 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml @@ -74,11 +74,11 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } testnet-parachains-constants = { features = ["rococo"], workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } [features] default = ["std"] @@ -87,11 +87,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", @@ -148,6 +148,7 @@ std = [ runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -179,6 +180,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index 1ce980fa5492..7082352c726a 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -99,18 +99,20 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The TransactionExtension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, - frame_metadata_hash_extension::CheckMetadataHash, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = @@ -220,6 +222,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -600,6 +606,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 3, ParachainInfo: parachain_info = 4, + WeightReclaim: cumulus_pallet_weight_reclaim = 5, // Monetary stuff. Balances: pallet_balances = 10, @@ -650,6 +657,7 @@ mod benches { // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml index 149fa5d0b045..9d7cc92c81c2 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml @@ -73,7 +73,7 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } @@ -87,11 +87,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", @@ -147,6 +147,7 @@ std = [ runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -177,6 +178,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index 632f2c657cf0..bec2a870252f 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -99,18 +99,20 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The TransactionExtension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, - frame_metadata_hash_extension::CheckMetadataHash, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = @@ -220,6 +222,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -595,6 +601,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 3, ParachainInfo: parachain_info = 4, + WeightReclaim: cumulus_pallet_weight_reclaim = 5, // Monetary stuff. Balances: pallet_balances = 10, @@ -642,6 +649,7 @@ mod benches { // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml index 373b82639def..1879c886285b 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml @@ -70,11 +70,11 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } testnet-parachains-constants = { features = ["rococo"], workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } [features] default = ["std"] @@ -83,11 +83,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "enumflags2/std", "frame-benchmarking?/std", @@ -143,6 +143,7 @@ std = [ runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -173,6 +174,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index af8e72fa0944..b351bf6f90c9 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -92,17 +92,19 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The TransactionExtension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = @@ -195,6 +197,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -545,6 +551,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 2, ParachainInfo: parachain_info = 3, + WeightReclaim: cumulus_pallet_weight_reclaim = 4, // Monetary stuff. Balances: pallet_balances = 10, @@ -600,6 +607,7 @@ mod benches { [pallet_xcm, PalletXcmExtrinsicsBenchmark::] [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml index efb67adba49d..29614fa17f20 100644 --- a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml @@ -70,11 +70,11 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } testnet-parachains-constants = { features = ["westend"], workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } [features] default = ["std"] @@ -83,11 +83,11 @@ std = [ "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "enumflags2/std", "frame-benchmarking?/std", @@ -143,6 +143,7 @@ std = [ runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", @@ -173,6 +174,7 @@ runtime-benchmarks = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-weight-reclaim/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", "frame-executive/try-runtime", diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index d0b0bec2e87f..988d21fa8cbb 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -92,17 +92,19 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The transactionExtension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = @@ -194,6 +196,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -544,6 +550,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 2, ParachainInfo: parachain_info = 3, + WeightReclaim: cumulus_pallet_weight_reclaim = 4, // Monetary stuff. Balances: pallet_balances = 10, @@ -598,6 +605,7 @@ mod benches { [pallet_xcm, PalletXcmExtrinsicsBenchmark::] [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); } diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml index bbc1185db0d8..5f01106bbe7e 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -55,8 +55,8 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-ping = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } cumulus-primitives-utility = { workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } parachains-common = { workspace = true } testnet-parachains-constants = { features = ["rococo"], workspace = true } parachain-info = { workspace = true } @@ -70,12 +70,12 @@ std = [ "codec/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-ping/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", "frame-executive/std", @@ -115,6 +115,7 @@ std = [ ] runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 34bd45b6ef99..de3f943cb0cb 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -226,6 +226,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -617,6 +621,7 @@ construct_runtime! { Timestamp: pallet_timestamp, Sudo: pallet_sudo, TransactionPayment: pallet_transaction_payment, + WeightReclaim: cumulus_pallet_weight_reclaim, ParachainSystem: cumulus_pallet_parachain_system = 20, ParachainInfo: parachain_info = 21, @@ -657,17 +662,20 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// The extension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_system::CheckWeight, + ), +>; + /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; diff --git a/cumulus/primitives/storage-weight-reclaim/src/lib.rs b/cumulus/primitives/storage-weight-reclaim/src/lib.rs index 5471640695ca..f6c2610fe32d 100644 --- a/cumulus/primitives/storage-weight-reclaim/src/lib.rs +++ b/cumulus/primitives/storage-weight-reclaim/src/lib.rs @@ -100,15 +100,31 @@ pub fn get_proof_size() -> Option { (proof_size != PROOF_RECORDING_DISABLED).then_some(proof_size) } -/// Storage weight reclaim mechanism. -/// -/// This extension checks the size of the node-side storage proof -/// before and after executing a given extrinsic. The difference between -/// benchmarked and spent weight can be reclaimed. -#[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] -#[scale_info(skip_type_params(T))] -pub struct StorageWeightReclaim(PhantomData); +// Encapsulate into a mod so that macro generated code doesn't trigger a warning about deprecated +// usage. +#[allow(deprecated)] +mod allow_deprecated { + use super::*; + + /// Storage weight reclaim mechanism. + /// + /// This extension checks the size of the node-side storage proof + /// before and after executing a given extrinsic. The difference between + /// benchmarked and spent weight can be reclaimed. + #[deprecated(note = "This extension doesn't provide accurate reclaim for storage intensive \ + transaction extension pipeline; it ignores the validation and preparation of extensions prior \ + to itself and ignores the post dispatch logic for extensions subsequent to itself, it also + doesn't provide weight information. \ + Use `StorageWeightReclaim` and `StorageWeightRecord` in the `cumulus-pallet-weight-reclaim`\ + crate")] + #[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] + #[scale_info(skip_type_params(T))] + pub struct StorageWeightReclaim(pub(super) PhantomData); +} +#[allow(deprecated)] +pub use allow_deprecated::StorageWeightReclaim; +#[allow(deprecated)] impl StorageWeightReclaim { /// Create a new `StorageWeightReclaim` instance. pub fn new() -> Self { @@ -116,6 +132,7 @@ impl StorageWeightReclaim { } } +#[allow(deprecated)] impl core::fmt::Debug for StorageWeightReclaim { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> { let _ = write!(f, "StorageWeightReclaim"); @@ -123,6 +140,7 @@ impl core::fmt::Debug for StorageWeightReclaim { } } +#[allow(deprecated)] impl TransactionExtension for StorageWeightReclaim where T::RuntimeCall: Dispatchable, diff --git a/cumulus/primitives/storage-weight-reclaim/src/tests.rs b/cumulus/primitives/storage-weight-reclaim/src/tests.rs index c5552b0f0a33..caed13156f24 100644 --- a/cumulus/primitives/storage-weight-reclaim/src/tests.rs +++ b/cumulus/primitives/storage-weight-reclaim/src/tests.rs @@ -74,6 +74,7 @@ fn get_storage_weight() -> PerDispatchClass { } #[test] +#[allow(deprecated)] fn basic_refund() { // The real cost will be 100 bytes of storage size let mut test_ext = setup_test_externalities(&[0, 100]); @@ -109,6 +110,7 @@ fn basic_refund() { } #[test] +#[allow(deprecated)] fn underestimating_refund() { // We fixed a bug where `pre dispatch info weight > consumed weight > post info weight` // resulted in error. @@ -149,6 +151,7 @@ fn underestimating_refund() { } #[test] +#[allow(deprecated)] fn sets_to_node_storage_proof_if_higher() { // The storage proof reported by the proof recorder is higher than what is stored on // the runtime side. @@ -240,6 +243,7 @@ fn sets_to_node_storage_proof_if_higher() { } #[test] +#[allow(deprecated)] fn does_nothing_without_extension() { let mut test_ext = new_test_ext(); @@ -274,6 +278,7 @@ fn does_nothing_without_extension() { } #[test] +#[allow(deprecated)] fn negative_refund_is_added_to_weight() { let mut test_ext = setup_test_externalities(&[100, 300]); @@ -310,6 +315,7 @@ fn negative_refund_is_added_to_weight() { } #[test] +#[allow(deprecated)] fn test_zero_proof_size() { let mut test_ext = setup_test_externalities(&[0, 0]); @@ -340,6 +346,7 @@ fn test_zero_proof_size() { } #[test] +#[allow(deprecated)] fn test_larger_pre_dispatch_proof_size() { let mut test_ext = setup_test_externalities(&[300, 100]); @@ -374,6 +381,7 @@ fn test_larger_pre_dispatch_proof_size() { } #[test] +#[allow(deprecated)] fn test_incorporates_check_weight_unspent_weight() { let mut test_ext = setup_test_externalities(&[100, 300]); @@ -415,6 +423,7 @@ fn test_incorporates_check_weight_unspent_weight() { } #[test] +#[allow(deprecated)] fn test_incorporates_check_weight_unspent_weight_on_negative() { let mut test_ext = setup_test_externalities(&[100, 300]); @@ -456,6 +465,7 @@ fn test_incorporates_check_weight_unspent_weight_on_negative() { } #[test] +#[allow(deprecated)] fn test_nothing_relcaimed() { let mut test_ext = setup_test_externalities(&[0, 100]); @@ -505,6 +515,7 @@ fn test_nothing_relcaimed() { } #[test] +#[allow(deprecated)] fn test_incorporates_check_weight_unspent_weight_reverse_order() { let mut test_ext = setup_test_externalities(&[100, 300]); @@ -548,6 +559,7 @@ fn test_incorporates_check_weight_unspent_weight_reverse_order() { } #[test] +#[allow(deprecated)] fn test_incorporates_check_weight_unspent_weight_on_negative_reverse_order() { let mut test_ext = setup_test_externalities(&[100, 300]); @@ -616,6 +628,7 @@ fn storage_size_disabled_reported_correctly() { } #[test] +#[allow(deprecated)] fn test_reclaim_helper() { let mut test_ext = setup_test_externalities(&[1000, 1300, 1800]); @@ -635,6 +648,7 @@ fn test_reclaim_helper() { } #[test] +#[allow(deprecated)] fn test_reclaim_helper_does_not_reclaim_negative() { // Benchmarked weight does not change at all let mut test_ext = setup_test_externalities(&[1000, 1300]); @@ -669,6 +683,7 @@ fn get_benched_weight() -> Weight { /// Just here for doc purposes fn do_work() {} +#[allow(deprecated)] #[docify::export_content(simple_reclaimer_example)] fn reclaim_with_weight_meter() { let mut remaining_weight_meter = WeightMeter::with_limit(Weight::from_parts(10, 10)); diff --git a/cumulus/test/client/Cargo.toml b/cumulus/test/client/Cargo.toml index 33023816c718..69cad9e4b864 100644 --- a/cumulus/test/client/Cargo.toml +++ b/cumulus/test/client/Cargo.toml @@ -45,10 +45,11 @@ cumulus-test-relay-sproof-builder = { workspace = true, default-features = true cumulus-primitives-core = { workspace = true, default-features = true } cumulus-primitives-proof-size-hostfunction = { workspace = true, default-features = true } cumulus-primitives-parachain-inherent = { workspace = true, default-features = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true, default-features = true } +cumulus-pallet-weight-reclaim = { workspace = true, default-features = true } [features] runtime-benchmarks = [ + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-test-service/runtime-benchmarks", "frame-system/runtime-benchmarks", diff --git a/cumulus/test/client/src/lib.rs b/cumulus/test/client/src/lib.rs index eaf81699f6d7..d04ab71c5f01 100644 --- a/cumulus/test/client/src/lib.rs +++ b/cumulus/test/client/src/lib.rs @@ -141,9 +141,8 @@ pub fn generate_extrinsic_with_pair( frame_system::CheckGenesis::::new(), frame_system::CheckEra::::from(Era::mortal(period, current_block)), frame_system::CheckNonce::::from(nonce), - frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::::new(), + frame_system::CheckWeight::::new(), ) .into(); @@ -152,7 +151,7 @@ pub fn generate_extrinsic_with_pair( let raw_payload = SignedPayload::from_raw( function.clone(), tx_ext.clone(), - ((), VERSION.spec_version, genesis_block, current_block_hash, (), (), (), ()), + ((), VERSION.spec_version, genesis_block, current_block_hash, (), (), ()), ); let signature = raw_payload.using_encoded(|e| origin.sign(e)); diff --git a/cumulus/test/runtime/Cargo.toml b/cumulus/test/runtime/Cargo.toml index 54b83e2dfeda..025f7bc76b90 100644 --- a/cumulus/test/runtime/Cargo.toml +++ b/cumulus/test/runtime/Cargo.toml @@ -46,7 +46,7 @@ cumulus-primitives-aura = { workspace = true } pallet-collator-selection = { workspace = true } cumulus-pallet-aura-ext = { workspace = true } cumulus-primitives-core = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true } +cumulus-pallet-weight-reclaim = { workspace = true } [build-dependencies] substrate-wasm-builder = { optional = true, workspace = true, default-features = true } @@ -57,9 +57,9 @@ std = [ "codec/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", + "cumulus-pallet-weight-reclaim/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", "frame-executive/std", "frame-support/std", "frame-system-rpc-runtime-api/std", diff --git a/cumulus/test/runtime/src/lib.rs b/cumulus/test/runtime/src/lib.rs index 5443bb5f526b..600f03296591 100644 --- a/cumulus/test/runtime/src/lib.rs +++ b/cumulus/test/runtime/src/lib.rs @@ -228,6 +228,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + parameter_types! { pub const MinimumPeriod: u64 = SLOT_DURATION / 2; pub const PotId: PalletId = PalletId(*b"PotStake"); @@ -343,6 +347,7 @@ construct_runtime! { Glutton: pallet_glutton, Aura: pallet_aura, AuraExt: cumulus_pallet_aura_ext, + WeightReclaim: cumulus_pallet_weight_reclaim, } } @@ -373,16 +378,18 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// The extension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; diff --git a/cumulus/test/service/Cargo.toml b/cumulus/test/service/Cargo.toml index 3ef9424b9ed6..460a7f03734e 100644 --- a/cumulus/test/service/Cargo.toml +++ b/cumulus/test/service/Cargo.toml @@ -87,7 +87,7 @@ cumulus-relay-chain-minimal-node = { workspace = true, default-features = true } cumulus-client-pov-recovery = { workspace = true, default-features = true } cumulus-test-relay-sproof-builder = { workspace = true, default-features = true } cumulus-pallet-parachain-system = { workspace = true } -cumulus-primitives-storage-weight-reclaim = { workspace = true, default-features = true } +cumulus-pallet-weight-reclaim = { workspace = true, default-features = true } pallet-timestamp = { workspace = true, default-features = true } [dev-dependencies] @@ -106,6 +106,7 @@ substrate-test-utils = { workspace = true } [features] runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-weight-reclaim/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "cumulus-test-client/runtime-benchmarks", "frame-system/runtime-benchmarks", diff --git a/cumulus/test/service/src/lib.rs b/cumulus/test/service/src/lib.rs index a3e519a68b91..416c4806de7d 100644 --- a/cumulus/test/service/src/lib.rs +++ b/cumulus/test/service/src/lib.rs @@ -978,15 +978,14 @@ pub fn construct_extrinsic( current_block, )), frame_system::CheckNonce::::from(nonce), - frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::::new(), + frame_system::CheckWeight::::new(), ) .into(); let raw_payload = runtime::SignedPayload::from_raw( function.clone(), tx_ext.clone(), - ((), runtime::VERSION.spec_version, genesis_block, current_block_hash, (), (), (), ()), + ((), runtime::VERSION.spec_version, genesis_block, current_block_hash, (), (), ()), ); let signature = raw_payload.using_encoded(|e| caller.sign(e)); runtime::UncheckedExtrinsic::new_signed( diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index b86ce9868208..1f10674e3ce7 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -69,6 +69,7 @@ parachain-info = { workspace = true, default-features = true } cumulus-primitives-proof-size-hostfunction = { workspace = true, default-features = true } cumulus-client-service = { workspace = true, default-features = true } cumulus-primitives-storage-weight-reclaim = { workspace = true, default-features = true } +cumulus-pallet-weight-reclaim = { workspace = true, default-features = true } # Pallets and FRAME internals pallet-aura = { workspace = true, default-features = true } diff --git a/docs/sdk/src/guides/enable_pov_reclaim.rs b/docs/sdk/src/guides/enable_pov_reclaim.rs index cb6960b3df4e..71abeacd18c8 100644 --- a/docs/sdk/src/guides/enable_pov_reclaim.rs +++ b/docs/sdk/src/guides/enable_pov_reclaim.rs @@ -62,8 +62,10 @@ //! //! In your runtime, you will find a list of TransactionExtensions. //! To enable the reclaiming, -//! add [`StorageWeightReclaim`](cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim) -//! to that list. For maximum efficiency, make sure that `StorageWeightReclaim` is last in the list. +//! set [`StorageWeightReclaim`](cumulus_pallet_weight_reclaim::StorageWeightReclaim) +//! as a warpper of that list. +//! It is necessary that this extension wraps all the other transaction extensions in order to catch +//! the whole PoV size of the transactions. //! The extension will check the size of the storage proof before and after an extrinsic execution. //! It reclaims the difference between the calculated size and the benchmarked size. #![doc = docify::embed!("../../templates/parachain/runtime/src/lib.rs", template_signed_extra)] diff --git a/prdoc/pr_5234.prdoc b/prdoc/pr_5234.prdoc new file mode 100644 index 000000000000..69bec77ac774 --- /dev/null +++ b/prdoc/pr_5234.prdoc @@ -0,0 +1,39 @@ +title: Accurate `StorageWeightReclaim` transaction extension + +doc: + - audience: Runtime Dev + description: | + `StorageWeightReclaim` in `cumulus-primitives-storage-weight-reclaim` is deprecated. + Since the introduction of transaction extension, the transaction extension weight is no longer part of base extrinsic weight. As a consequence some weight of transaction extensions are missed when calculating the actual used proof size in `StorageWeightReclaim`. + So a new `StorageWeightReclaim` in `cumulus-pallet-weight-reclaim` is introduced. + This transaction extension is meant to be used as a wrapping of the whole transaction extension pipeline, and will take into account all proof size accurately. + + The new wrapping transaction extension is used like this: + ```rust + /// The TransactionExtension to the basic transaction logic. + pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, + (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages,), + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), + >; + ``` + + NOTE: Ideally `CheckWeight` should be last because it doesn't refund the transaction + extensions following itself. But `StorageWeightReclaim` doesn't do refund so it is ok. + +crates: +- name: cumulus-pallet-weight-reclaim + bump: major +- name: cumulus-primitives-storage-weight-reclaim + bump: major diff --git a/templates/parachain/runtime/src/benchmarks.rs b/templates/parachain/runtime/src/benchmarks.rs index aae50e7258c0..ca9d423bf856 100644 --- a/templates/parachain/runtime/src/benchmarks.rs +++ b/templates/parachain/runtime/src/benchmarks.rs @@ -33,4 +33,5 @@ polkadot_sdk::frame_benchmarking::define_benchmarks!( [pallet_collator_selection, CollatorSelection] [cumulus_pallet_parachain_system, ParachainSystem] [cumulus_pallet_xcmp_queue, XcmpQueue] + [cumulus_pallet_weight_reclaim, WeightReclaim] ); diff --git a/templates/parachain/runtime/src/configs/mod.rs b/templates/parachain/runtime/src/configs/mod.rs index ba4c71c7f218..be0cf104c35c 100644 --- a/templates/parachain/runtime/src/configs/mod.rs +++ b/templates/parachain/runtime/src/configs/mod.rs @@ -315,3 +315,8 @@ impl pallet_parachain_template::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_parachain_template::weights::SubstrateWeight; } + +/// Configure the palelt weight reclaim tx. +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); +} diff --git a/umbrella/src/lib.rs b/umbrella/src/lib.rs index f3fc949c66ec..6de9b167b1ad 100644 --- a/umbrella/src/lib.rs +++ b/umbrella/src/lib.rs @@ -141,6 +141,10 @@ pub use cumulus_pallet_session_benchmarking; #[cfg(feature = "cumulus-pallet-solo-to-para")] pub use cumulus_pallet_solo_to_para; +/// pallet and transaction extensions for accurate proof size reclaim. +#[cfg(feature = "cumulus-pallet-weight-reclaim")] +pub use cumulus_pallet_weight_reclaim; + /// Pallet for stuff specific to parachains' usage of XCM. #[cfg(feature = "cumulus-pallet-xcm")] pub use cumulus_pallet_xcm; From 670add6313d6930ec12095dde032da16ed346818 Mon Sep 17 00:00:00 2001 From: gui Date: Sat, 19 Oct 2024 18:55:54 +0200 Subject: [PATCH 02/40] move prdoc --- prdoc/{pr_5234.prdoc => pr_6140.prdoc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename prdoc/{pr_5234.prdoc => pr_6140.prdoc} (100%) diff --git a/prdoc/pr_5234.prdoc b/prdoc/pr_6140.prdoc similarity index 100% rename from prdoc/pr_5234.prdoc rename to prdoc/pr_6140.prdoc From d1e480a37d891a47200846e6b3c7afb5498913e9 Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 16:33:58 +0200 Subject: [PATCH 03/40] fmt --- cumulus/pallets/weight-reclaim/src/benchmarks.rs | 4 +--- .../runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs | 6 +++++- .../bridge-hubs/bridge-hub-westend/tests/snowbridge.rs | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/benchmarks.rs b/cumulus/pallets/weight-reclaim/src/benchmarks.rs index 33c1e6effe87..e00f7828ff3c 100644 --- a/cumulus/pallets/weight-reclaim/src/benchmarks.rs +++ b/cumulus/pallets/weight-reclaim/src/benchmarks.rs @@ -19,8 +19,7 @@ use super::*; use frame_support::pallet_prelude::{DispatchClass, Pays}; use frame_system::RawOrigin; -use sp_runtime::traits::DispatchTransaction; -use sp_runtime::traits::AsTransactionAuthorizedOrigin; +use sp_runtime::traits::{AsTransactionAuthorizedOrigin, DispatchTransaction}; #[frame_benchmarking::v2::benchmarks( where T: Send + Sync, @@ -36,7 +35,6 @@ mod bench { fn storage_weight_reclaim() -> Result<(), frame_benchmarking::BenchmarkError> { let ext = StorageWeightReclaim::::new(()); - let origin = RawOrigin::Root.into(); let call = T::RuntimeCall::from(frame_system::Call::remark { remark: alloc::vec![] }); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index b855ad1d43c3..efcf757e04ad 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -1412,7 +1412,11 @@ mod tests { assert_eq!(payload.encode().split_last().unwrap().1, bh_indirect_payload.encode()); assert_eq!( TxExtension::implicit(&payload).unwrap().encode().split_last().unwrap().1, - sp_runtime::traits::TransactionExtension::::implicit(&bh_indirect_payload).unwrap().encode() + sp_runtime::traits::TransactionExtension::::implicit( + &bh_indirect_payload + ) + .unwrap() + .encode() ) } }); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs index 85242f009aa3..30fcfd5c3d91 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs @@ -185,7 +185,8 @@ fn construct_extrinsic( (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::::new(false), frame_system::CheckWeight::::new(), - ).into(); + ) + .into(); let payload = SignedPayload::new(call.clone(), extra.clone()).unwrap(); let signature = payload.using_encoded(|e| sender.sign(e)); UncheckedExtrinsic::new_signed(call, account_id.into(), Signature::Sr25519(signature), extra) From 06903c83fdfa3d5e25c589c40e7303eaca0ca33e Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 16:41:11 +0200 Subject: [PATCH 04/40] use new extension for bridge hub rococo --- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 111 ++++++++++-------- .../bridge-hub-rococo/tests/snowbridge.rs | 6 +- .../bridge-hub-rococo/tests/tests.rs | 3 +- 3 files changed, 65 insertions(+), 55 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 259b0355916e..85a9e660b5cb 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -121,20 +121,22 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The TransactionExtension to the basic transaction logic. -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - BridgeRejectObsoleteHeadersAndMessages, - (bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages,), - frame_metadata_hash_extension::CheckMetadataHash, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, + (bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages,), + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = @@ -311,6 +313,10 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -552,6 +558,7 @@ construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 2, ParachainInfo: parachain_info = 3, + WeightReclaim: cumulus_pallet_weight_reclaim = 4, // Monetary stuff. Balances: pallet_balances = 10, @@ -664,6 +671,7 @@ mod benches { [pallet_collator_selection, CollatorSelection] [cumulus_pallet_parachain_system, ParachainSystem] [cumulus_pallet_xcmp_queue, XcmpQueue] + [cumulus_pallet_weight_reclaim, WeightReclaim] // XCM [pallet_xcm, PalletXcmExtrinsicsBenchmark::] // NOTE: Make sure you point to the individual modules below. @@ -1553,41 +1561,44 @@ mod tests { use bp_polkadot_core::SuffixedCommonTransactionExtensionExt; sp_io::TestExternalities::default().execute_with(|| { - frame_system::BlockHash::::insert(BlockNumber::zero(), Hash::default()); - let payload: TxExtension = ( - frame_system::CheckNonZeroSender::new(), - frame_system::CheckSpecVersion::new(), - frame_system::CheckTxVersion::new(), - frame_system::CheckGenesis::new(), - frame_system::CheckEra::from(Era::Immortal), - frame_system::CheckNonce::from(10), - frame_system::CheckWeight::new(), - pallet_transaction_payment::ChargeTransactionPayment::from(10), - BridgeRejectObsoleteHeadersAndMessages, - ( - bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages::default(), - ), - frame_metadata_hash_extension::CheckMetadataHash::new(false), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::new(), - ); - - // for BridgeHubRococo - { - let bhr_indirect_payload = bp_bridge_hub_rococo::TransactionExtension::from_params( - VERSION.spec_version, - VERSION.transaction_version, - bp_runtime::TransactionEra::Immortal, - System::block_hash(BlockNumber::zero()), - 10, - 10, - (((), ()), ((), ())), - ); - assert_eq!(payload.encode().split_last().unwrap().1, bhr_indirect_payload.encode()); - assert_eq!( - TxExtension::implicit(&payload).unwrap().encode().split_last().unwrap().1, - sp_runtime::traits::TransactionExtension::::implicit(&bhr_indirect_payload).unwrap().encode() - ) - } - }); + frame_system::BlockHash::::insert(BlockNumber::zero(), Hash::default()); + let payload: TxExtension = ( + frame_system::CheckNonZeroSender::new(), + frame_system::CheckSpecVersion::new(), + frame_system::CheckTxVersion::new(), + frame_system::CheckGenesis::new(), + frame_system::CheckEra::from(Era::Immortal), + frame_system::CheckNonce::from(10), + pallet_transaction_payment::ChargeTransactionPayment::from(10), + BridgeRejectObsoleteHeadersAndMessages, + ( + bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages::default(), + ), + frame_metadata_hash_extension::CheckMetadataHash::new(false), + frame_system::CheckWeight::new(), + ).into(); + + // for BridgeHubRococo + { + let bhr_indirect_payload = bp_bridge_hub_rococo::TransactionExtension::from_params( + VERSION.spec_version, + VERSION.transaction_version, + bp_runtime::TransactionEra::Immortal, + System::block_hash(BlockNumber::zero()), + 10, + 10, + (((), ()), ((), ())), + ); + assert_eq!(payload.encode().split_last().unwrap().1, bhr_indirect_payload.encode()); + assert_eq!( + TxExtension::implicit(&payload).unwrap().encode().split_last().unwrap().1, + sp_runtime::traits::TransactionExtension::::implicit( + &bhr_indirect_payload + ) + .unwrap() + .encode() + ) + } + }); } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs index 8be2993c68f4..d0679e5e7922 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs @@ -179,13 +179,13 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), - frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (OnBridgeHubRococoRefundBridgeHubWestendMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::::new(false), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::new(), - ); + frame_system::CheckWeight::::new(), + ) + .into(); let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); let signature = payload.using_encoded(|e| sender.sign(e)); UncheckedExtrinsic::new_signed(call, account_id.into(), Signature::Sr25519(signature), tx_ext) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs index 01674287fde1..cb244b36fa8b 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs @@ -58,12 +58,11 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), - frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::new(false), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::new(), + frame_system::CheckWeight::::new(), ) .into(); let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); From 9500cd109a7a4b075d92f940a2fd70323320ebd5 Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 16:48:27 +0200 Subject: [PATCH 05/40] fix macro --- .../runtime/src/traits/transaction_extension/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs b/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs index 58cd0974661a..24dfd95af906 100644 --- a/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs +++ b/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs @@ -418,7 +418,7 @@ pub trait TransactionExtension: #[macro_export] macro_rules! impl_tx_ext_default { ($call:ty ; , $( $rest:tt )*) => { - impl_tx_ext_default!{$call ; $( $rest )*} + $crate::impl_tx_ext_default!{$call ; $( $rest )*} }; ($call:ty ; validate $( $rest:tt )*) => { fn validate( @@ -432,7 +432,7 @@ macro_rules! impl_tx_ext_default { ) -> $crate::traits::ValidateResult { Ok((Default::default(), Default::default(), origin)) } - impl_tx_ext_default!{$call ; $( $rest )*} + $crate::impl_tx_ext_default!{$call ; $( $rest )*} }; ($call:ty ; prepare $( $rest:tt )*) => { fn prepare( @@ -445,13 +445,13 @@ macro_rules! impl_tx_ext_default { ) -> Result { Ok(Default::default()) } - impl_tx_ext_default!{$call ; $( $rest )*} + $crate::impl_tx_ext_default!{$call ; $( $rest )*} }; ($call:ty ; weight $( $rest:tt )*) => { fn weight(&self, _call: &$call) -> $crate::Weight { $crate::Weight::zero() } - impl_tx_ext_default!{$call ; $( $rest )*} + $crate::impl_tx_ext_default!{$call ; $( $rest )*} }; ($call:ty ;) => {}; } From 9bc4f6c84d8dfa6db4088d5ec0660072b139e322 Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 16:51:01 +0200 Subject: [PATCH 06/40] remove unnecessary deprecated --- substrate/primitives/runtime/src/generic/checked_extrinsic.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/substrate/primitives/runtime/src/generic/checked_extrinsic.rs b/substrate/primitives/runtime/src/generic/checked_extrinsic.rs index e2ecd5ed6da7..3ab9a645a166 100644 --- a/substrate/primitives/runtime/src/generic/checked_extrinsic.rs +++ b/substrate/primitives/runtime/src/generic/checked_extrinsic.rs @@ -79,7 +79,6 @@ where match self.format { ExtrinsicFormat::Bare => { let inherent_validation = I::validate_unsigned(source, &self.function)?; - #[allow(deprecated)] let legacy_validation = Extension::bare_validate(&self.function, info, len)?; Ok(legacy_validation.combine_with(inherent_validation)) }, From c316f8a7de81f9369c9f61cb79545b4ef5384a58 Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 16:56:31 +0200 Subject: [PATCH 07/40] umbrella --- Cargo.lock | 1 + umbrella/Cargo.toml | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 07e4b58fbabf..3e1cca5ed83d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15208,6 +15208,7 @@ dependencies = [ "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 7147a11fb9cd..aa151f07e45f 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -29,6 +29,7 @@ std = [ "cumulus-pallet-parachain-system?/std", "cumulus-pallet-session-benchmarking?/std", "cumulus-pallet-solo-to-para?/std", + "cumulus-pallet-weight-reclaim?/std", "cumulus-pallet-xcm?/std", "cumulus-pallet-xcmp-queue?/std", "cumulus-ping?/std", @@ -240,6 +241,7 @@ runtime-benchmarks = [ "cumulus-pallet-dmp-queue?/runtime-benchmarks", "cumulus-pallet-parachain-system?/runtime-benchmarks", "cumulus-pallet-session-benchmarking?/runtime-benchmarks", + "cumulus-pallet-weight-reclaim?/runtime-benchmarks", "cumulus-pallet-xcmp-queue?/runtime-benchmarks", "cumulus-primitives-core?/runtime-benchmarks", "cumulus-primitives-utility?/runtime-benchmarks", @@ -370,6 +372,7 @@ try-runtime = [ "cumulus-pallet-dmp-queue?/try-runtime", "cumulus-pallet-parachain-system?/try-runtime", "cumulus-pallet-solo-to-para?/try-runtime", + "cumulus-pallet-weight-reclaim?/try-runtime", "cumulus-pallet-xcm?/try-runtime", "cumulus-pallet-xcmp-queue?/try-runtime", "cumulus-ping?/try-runtime", @@ -541,7 +544,7 @@ with-tracing = [ "sp-tracing?/with-tracing", "sp-tracing?/with-tracing", ] -runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-fixtures", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-outbound-queue-merkle-tree", "snowbridge-outbound-queue-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", "snowbridge-router-primitives", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] +runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-fixtures", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-outbound-queue-merkle-tree", "snowbridge-outbound-queue-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", "snowbridge-router-primitives", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] runtime = [ "frame-benchmarking", "frame-benchmarking-pallet-pov", @@ -722,6 +725,11 @@ path = "../cumulus/pallets/solo-to-para" default-features = false optional = true +[dependencies.cumulus-pallet-weight-reclaim] +path = "../cumulus/pallets/weight-reclaim" +default-features = false +optional = true + [dependencies.cumulus-pallet-xcm] path = "../cumulus/pallets/xcm" default-features = false From 6e7b072ed1541dff329bf740d45b3305503a899b Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 17:02:46 +0200 Subject: [PATCH 08/40] use in template --- templates/parachain/runtime/Cargo.toml | 2 +- .../parachain/runtime/src/configs/mod.rs | 10 +++---- templates/parachain/runtime/src/lib.rs | 26 ++++++++++--------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/templates/parachain/runtime/Cargo.toml b/templates/parachain/runtime/Cargo.toml index f1d33b4143e4..b2b467226718 100644 --- a/templates/parachain/runtime/Cargo.toml +++ b/templates/parachain/runtime/Cargo.toml @@ -48,11 +48,11 @@ polkadot-sdk = { workspace = true, default-features = false, features = [ "cumulus-pallet-aura-ext", "cumulus-pallet-session-benchmarking", + "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-utility", "pallet-collator-selection", "parachains-common", diff --git a/templates/parachain/runtime/src/configs/mod.rs b/templates/parachain/runtime/src/configs/mod.rs index be0cf104c35c..4548d7d221bc 100644 --- a/templates/parachain/runtime/src/configs/mod.rs +++ b/templates/parachain/runtime/src/configs/mod.rs @@ -129,6 +129,11 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +/// Configure the palelt weight reclaim tx. +impl cumulus_pallet_weight_reclaim::Config for Runtime { + type WeightInfo = (); // TODO TODO: run CI weights generation +} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -315,8 +320,3 @@ impl pallet_parachain_template::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_parachain_template::weights::SubstrateWeight; } - -/// Configure the palelt weight reclaim tx. -impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); -} diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index 78dc38ef427f..dfae0203e04c 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -74,18 +74,20 @@ pub type BlockId = generic::BlockId; /// The extension to the basic transaction logic. #[docify::export(template_signed_extra)] -pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, - frame_metadata_hash_extension::CheckMetadataHash, -); +pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< + Runtime, + ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + pallet_transaction_payment::ChargeTransactionPayment, + frame_metadata_hash_extension::CheckMetadataHash, + frame_system::CheckWeight, + ), +>; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = From 7c777db7f9e4a99058624959a97e2e0c1419f9be Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 18:42:40 +0200 Subject: [PATCH 09/40] fix template --- templates/parachain/runtime/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index dfae0203e04c..9ed985a42dba 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -273,6 +273,8 @@ mod runtime { pub type Timestamp = pallet_timestamp; #[runtime::pallet_index(3)] pub type ParachainInfo = parachain_info; + #[runtime::pallet_index(4)] + pub type WeightReclaim = cumulus_pallet_weight_reclaim; // Monetary stuff. #[runtime::pallet_index(10)] From f336a34e79533dfa595d46eadc07bd95525b1609 Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 20:41:07 +0200 Subject: [PATCH 10/40] prdoc semver --- prdoc/pr_6140.prdoc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/prdoc/pr_6140.prdoc b/prdoc/pr_6140.prdoc index 69bec77ac774..30161851ba3e 100644 --- a/prdoc/pr_6140.prdoc +++ b/prdoc/pr_6140.prdoc @@ -37,3 +37,27 @@ crates: bump: major - name: cumulus-primitives-storage-weight-reclaim bump: major +- name: sp-runtime + bump: patch +- name: polkadot-sdk + bump: minor +- name: asset-hub-rococo-runtime + bump: major +- name: asset-hub-westend-runtime + bump: major +- name: bridge-hub-rococo-runtime + bump: major +- name: bridge-hub-westend-runtime + bump: major +- name: collectives-westend-runtime + bump: major +- name: coretime-rococo-runtime + bump: major +- name: coretime-westend-runtime + bump: major +- name: people-rococo-runtime + bump: major +- name: people-westend-runtime + bump: major +- name: contracts-rococo-runtime + bump: major From f40892f5aaebe3f3bca16a6e1241726dc6b89d0b Mon Sep 17 00:00:00 2001 From: gui Date: Sun, 20 Oct 2024 20:56:21 +0200 Subject: [PATCH 11/40] complete wrapper including bare stuff --- cumulus/pallets/weight-reclaim/src/lib.rs | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 8e3ac4aaf181..7057c88a4d5d 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -232,4 +232,29 @@ where Ok(inner_refund) } + + fn bare_validate( + call: &T::RuntimeCall, + info: &DispatchInfoOf, + len: usize, + ) -> frame_support::pallet_prelude::TransactionValidity { + S::bare_validate(call, info, len) + } + + fn bare_validate_and_prepare( + call: &T::RuntimeCall, + info: &DispatchInfoOf, + len: usize, + ) -> Result<(), TransactionValidityError> { + S::bare_validate_and_prepare(call, info, len) + } + + fn bare_post_dispatch( + info: &DispatchInfoOf, + post_info: &mut PostDispatchInfoOf, + len: usize, + result: &DispatchResult, + ) -> Result<(), TransactionValidityError> { + S::bare_post_dispatch(info, post_info, len, result) + } } From 337d5c8369a1204ba4df6c38973389a708c8cbe9 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 24 Oct 2024 16:14:44 +0900 Subject: [PATCH 12/40] coordinate refunds with a storage --- cumulus/pallets/weight-reclaim/src/lib.rs | 68 +++++----- cumulus/pallets/weight-reclaim/src/tests.rs | 7 +- .../system/src/extensions/check_weight.rs | 119 +++++++++++++++++- substrate/frame/system/src/lib.rs | 10 ++ substrate/frame/system/src/tests.rs | 15 +++ 5 files changed, 180 insertions(+), 39 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 7057c88a4d5d..493bb9f145d7 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -195,39 +195,41 @@ where return Ok(inner_refund) }; - // Unspent weight according to the `actual_weight` from `PostDispatchInfo` - // This unspent weight will be refunded by the `CheckWeight` extension, so we need to - // account for that. - // - // Also we don't need to include the unspent weight of this transaction extension because: - // 1 - There is no unspent weight for this extension. - // 2 - `CheckWeight` computes the unspent weight wihout seeing the unspent weight of this - // extension even if there was any. Thus `post_info_with_inner` is what we want. - let unspent = post_info_with_inner.calc_unspent(info).proof_size(); - let benchmarked_weight = info.total_weight().proof_size().saturating_sub(unspent); - let consumed_weight = post_dispatch_proof_size.saturating_sub(pre_dispatch_proof_size); - - let storage_size_diff = benchmarked_weight.abs_diff(consumed_weight as u64); - - // This value will be reclaimed by [`frame_system::CheckWeight`], so we need to calculate - // that in. - frame_system::BlockWeight::::mutate(|current| { - if consumed_weight > benchmarked_weight { - log::error!( - target: LOG_TARGET, - "Benchmarked storage weight smaller than consumed storage weight. \ - benchmarked: {benchmarked_weight} consumed: {consumed_weight} unspent: \ - {unspent}" - ); - current.accrue(Weight::from_parts(0, storage_size_diff), info.class) - } else { - log::trace!( - target: LOG_TARGET, - "Reclaiming storage weight. benchmarked: {benchmarked_weight}, consumed: \ - {consumed_weight} unspent: {unspent}" - ); - current.reduce(Weight::from_parts(0, storage_size_diff), info.class) - } + // The consumed proof size as measured by the host. + let measured_proof_size = post_dispatch_proof_size.saturating_sub(pre_dispatch_proof_size); + + // The consumed weight as benchamrked. + let benchmarked_weight = post_info_with_inner.calc_actual_weight(info); + + let benchmarked_proof_size = benchmarked_weight.proof_size(); + if benchmarked_proof_size < measured_proof_size { + log::error!( + target: LOG_TARGET, + "Benchmarked storage weight smaller than consumed storage weight. \ + benchmarked: {benchmarked_proof_size} consumed: {measured_proof_size}" + ); + } else { + log::trace!( + target: LOG_TARGET, + "Reclaiming storage weight. benchmarked: {benchmarked_proof_size}, + consumed: {measured_proof_size}" + ); + } + + let accurate_weight = benchmarked_weight.set_proof_size(measured_proof_size); + + frame_system::BlockWeight::::mutate(|current_weight| { + let already_refunded = frame_system::ExtrinsicWeightRefunded::::get(); + dbg!(&already_refunded); + current_weight.accrue(already_refunded, info.class); + current_weight.reduce(info.total_weight(), info.class); + current_weight.accrue(accurate_weight, info.class); + + // The saturation will happen if the pre dispatch weight is underestimated. + // In this case the extrinsic refund is considered 0. + // TODO TODO: maybe change `ExtrinsicWeightRefunded` to just `ExtrinsicWeight`. + let accurate_unspent = info.total_weight().saturating_sub(accurate_weight); + frame_system::ExtrinsicWeightRefunded::::put(accurate_unspent); }); Ok(inner_refund) diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index e1aea8feb850..1087eb9785c3 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -61,7 +61,7 @@ impl TransactionExtension for MockExtensionWithRefund { } pub type Tx = - crate::StorageWeightReclaim)>; + crate::StorageWeightReclaim, MockExtensionWithRefund)>; type AccountId = u64; type Extrinsic = generic::UncheckedExtrinsic; type Block = generic::Block, Extrinsic>; @@ -186,7 +186,7 @@ const ALICE_ORIGIN: frame_system::Origin = frame_system::Origin::::S const LEN: usize = 150; fn new_tx_ext() -> Tx { - Tx::new((MockExtensionWithRefund, frame_system::CheckWeight::new())) + Tx::new((frame_system::CheckWeight::new(), MockExtensionWithRefund)) } fn new_extrinsic() -> generic::CheckedExtrinsic { @@ -406,8 +406,7 @@ fn test_incorporates_check_weight_unspent_weight_on_negative() { assert_eq!(pre.0, Some(100)); // The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo` - // we always need to call `post_dispatch` to verify that they interoperate correctly. - // Refunds unspent 25 weight according to `post_info`, 1175 + // CheckWeight: refunds unspent 25 weight according to `post_info`, 1175 // // storage reclaim: // Adds 200 - 25 (unspent) == 175 weight, total weight 1350 diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index 131057f54a78..d44a8d84bbb4 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -138,11 +138,14 @@ where info: &DispatchInfoOf, post_info: &PostDispatchInfoOf, ) -> Result<(), TransactionValidityError> { + let already_refunded = crate::ExtrinsicWeightRefunded::::get(); let unspent = post_info.calc_unspent(info); - if unspent.any_gt(Weight::zero()) { + if unspent.any_gt(already_refunded) { crate::BlockWeight::::mutate(|current_weight| { + current_weight.accrue(already_refunded, info.class); current_weight.reduce(unspent, info.class); - }) + }); + crate::ExtrinsicWeightRefunded::::put(unspent); } log::trace!( @@ -738,6 +741,118 @@ mod tests { }) } + #[test] + fn extrinsic_already_refunded_more_precisely() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = + DispatchInfo { call_weight: Weight::from_parts(512, 0), ..Default::default() }; + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(128, 0)), + pays_fee: Default::default(), + }; + let prior_block_weight = Weight::from_parts(64, 0); + let accurate_refund = Weight::from_parts(510, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Normal).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(Weight::zero(), DispatchClass::Mandatory); + current_weight.set(prior_block_weight, DispatchClass::Normal); + }); + + // Validate and prepare extrinsic + let pre = CheckWeight::(PhantomData) + .validate_and_prepare(Some(1).into(), CALL, &info, len) + .unwrap() + .0; + + assert_eq!( + BlockWeight::::get().total(), + info.total_weight() + prior_block_weight + base_extrinsic + ); + + // Refund more accurately than the benchmark + BlockWeight::::mutate(|current_weight| { + current_weight.reduce(accurate_refund, DispatchClass::Normal); + }); + crate::ExtrinsicWeightRefunded::::put(accurate_refund); + + // Do the post dispatch + assert_ok!(CheckWeight::::post_dispatch_details( + pre, + &info, + &post_info, + len, + &Ok(()) + )); + + // Ensure the accurate refund is used + assert_eq!(crate::ExtrinsicWeightRefunded::::get(), accurate_refund); + assert_eq!( + BlockWeight::::get().total(), + info.total_weight() - accurate_refund + prior_block_weight + base_extrinsic + ); + }) + } + + #[test] + fn extrinsic_already_refunded_less_precisely() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = + DispatchInfo { call_weight: Weight::from_parts(512, 0), ..Default::default() }; + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(128, 0)), + pays_fee: Default::default(), + }; + let prior_block_weight = Weight::from_parts(64, 0); + let inaccurate_refund = Weight::from_parts(110, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Normal).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(Weight::zero(), DispatchClass::Mandatory); + current_weight.set(prior_block_weight, DispatchClass::Normal); + }); + + // Validate and prepare extrinsic + let pre = CheckWeight::(PhantomData) + .validate_and_prepare(Some(1).into(), CALL, &info, len) + .unwrap() + .0; + + assert_eq!( + BlockWeight::::get().total(), + info.total_weight() + prior_block_weight + base_extrinsic + ); + + // Refund less accurately than the benchmark + BlockWeight::::mutate(|current_weight| { + current_weight.reduce(inaccurate_refund, DispatchClass::Normal); + }); + crate::ExtrinsicWeightRefunded::::put(inaccurate_refund); + + // Do the post dispatch + assert_ok!(CheckWeight::::post_dispatch_details( + pre, + &info, + &post_info, + len, + &Ok(()) + )); + + // Ensure the accurate refund from benchmark is used + assert_eq!(crate::ExtrinsicWeightRefunded::::get(), post_info.calc_unspent(&info)); + assert_eq!( + BlockWeight::::get().total(), + post_info.actual_weight.unwrap() + prior_block_weight + base_extrinsic + ); + }) + } + #[test] fn zero_weight_extrinsic_still_has_base_weight() { new_test_ext().execute_with(|| { diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 02d61921741c..3b15765e4336 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -1036,6 +1036,15 @@ pub mod pallet { pub(super) type AuthorizedUpgrade = StorageValue<_, CodeUpgradeAuthorization, OptionQuery>; + /// The weight refunded for the extrinsic. + /// + /// This information is available until the end of the extrinsic execution. + /// More precisely this information is removed in `note_applied_extrinsic`. + /// + /// Logic doing some weight refund can coordinate using this storage. + #[pallet::storage] + pub type ExtrinsicWeightRefunded = StorageValue<_, Weight, ValueQuery>; + #[derive(frame_support::DefaultNoBound)] #[pallet::genesis_config] pub struct GenesisConfig { @@ -2074,6 +2083,7 @@ impl Pallet { storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &next_extrinsic_index); ExecutionPhase::::put(Phase::ApplyExtrinsic(next_extrinsic_index)); + ExtrinsicWeightRefunded::::kill(); } /// To be called immediately after `note_applied_extrinsic` of the last extrinsic of the block diff --git a/substrate/frame/system/src/tests.rs b/substrate/frame/system/src/tests.rs index 6b903f5b7e79..8450b81bbe91 100644 --- a/substrate/frame/system/src/tests.rs +++ b/substrate/frame/system/src/tests.rs @@ -892,3 +892,18 @@ fn test_default_account_nonce() { assert_eq!(System::account_nonce(&1), 5u64.into()); }); } + +#[test] +fn extrinsic_weight_refunded_is_cleaned() { + new_test_ext().execute_with(|| { + crate::ExtrinsicWeightRefunded::::put(Weight::from_parts(1, 2)); + assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::from_parts(1, 2)); + System::note_applied_extrinsic(&Ok(().into()), Default::default()); + assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::zero()); + + crate::ExtrinsicWeightRefunded::::put(Weight::from_parts(1, 2)); + assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::from_parts(1, 2)); + System::note_applied_extrinsic(&Err(DispatchError::BadOrigin.into()), Default::default()); + assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::zero()); + }); +} From 643cfda3b25b606ed5ffd45cf96436e16a73c557 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 24 Oct 2024 21:42:23 +0900 Subject: [PATCH 13/40] do not change check weight position --- .../parachains/runtimes/assets/asset-hub-rococo/src/lib.rs | 2 +- .../parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 3 +-- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 4 ++-- .../bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs | 2 +- .../runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs | 2 +- .../runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs | 4 ++-- .../bridge-hubs/bridge-hub-westend/tests/snowbridge.rs | 2 +- .../runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs | 2 +- .../parachains/runtimes/contracts/contracts-rococo/src/lib.rs | 2 +- .../parachains/runtimes/coretime/coretime-rococo/src/lib.rs | 2 +- .../parachains/runtimes/coretime/coretime-westend/src/lib.rs | 2 +- cumulus/parachains/runtimes/people/people-rococo/src/lib.rs | 2 +- cumulus/parachains/runtimes/people/people-westend/src/lib.rs | 2 +- .../parachains/runtimes/testing/rococo-parachain/src/lib.rs | 2 +- cumulus/test/client/src/lib.rs | 2 +- cumulus/test/runtime/src/lib.rs | 2 +- cumulus/test/service/src/lib.rs | 2 +- templates/parachain/runtime/src/lib.rs | 2 +- 18 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index a699bf0e38ee..390c196bd696 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -1018,9 +1018,9 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, + frame_system::CheckWeight, pallet_asset_conversion_tx_payment::ChargeAssetTxPayment, frame_metadata_hash_extension::CheckMetadataHash, - frame_system::CheckWeight, ), >; /// Unchecked extrinsic type as expected by this runtime. diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 5f37c914d61c..30af25690521 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1086,9 +1086,8 @@ impl EthExtra for EthExtraImpl { frame_system::CheckNonce::::from(nonce), frame_system::CheckWeight::::new(), pallet_asset_conversion_tx_payment::ChargeAssetTxPayment::::from(tip, None), - cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::::new(), frame_metadata_hash_extension::CheckMetadataHash::::new(false), - ) + ).into() } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 70b361e90387..594ec33bdef2 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -130,11 +130,11 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, + frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, BridgeRejectObsoleteHeadersAndMessages, (bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages,), frame_metadata_hash_extension::CheckMetadataHash, - frame_system::CheckWeight, ), >; @@ -1569,13 +1569,13 @@ mod tests { frame_system::CheckGenesis::new(), frame_system::CheckEra::from(Era::Immortal), frame_system::CheckNonce::from(10), + frame_system::CheckWeight::new(), pallet_transaction_payment::ChargeTransactionPayment::from(10), BridgeRejectObsoleteHeadersAndMessages, ( bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages::default(), ), frame_metadata_hash_extension::CheckMetadataHash::new(false), - frame_system::CheckWeight::new(), ).into(); // for BridgeHubRococo diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs index d0679e5e7922..0133dbd06969 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs @@ -179,11 +179,11 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), + frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (OnBridgeHubRococoRefundBridgeHubWestendMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::::new(false), - frame_system::CheckWeight::::new(), ) .into(); let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs index cb244b36fa8b..98c8b4f11501 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs @@ -58,11 +58,11 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), + frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (bridge_to_westend_config::OnBridgeHubRococoRefundBridgeHubWestendMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::new(false), - frame_system::CheckWeight::::new(), ) .into(); let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 90955598828d..38d6c5939b90 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -126,11 +126,11 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, + frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, BridgeRejectObsoleteHeadersAndMessages, (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages,), frame_metadata_hash_extension::CheckMetadataHash, - frame_system::CheckWeight, ), >; @@ -1390,13 +1390,13 @@ mod tests { frame_system::CheckGenesis::new(), frame_system::CheckEra::from(Era::Immortal), frame_system::CheckNonce::from(10), + frame_system::CheckWeight::new(), pallet_transaction_payment::ChargeTransactionPayment::from(10), BridgeRejectObsoleteHeadersAndMessages, ( bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(), ), frame_metadata_hash_extension::CheckMetadataHash::new(false), - frame_system::CheckWeight::new(), ).into(); { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs index 30fcfd5c3d91..8a7572c9e990 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/snowbridge.rs @@ -180,11 +180,11 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), + frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::::new(false), - frame_system::CheckWeight::::new(), ) .into(); let payload = SignedPayload::new(call.clone(), extra.clone()).unwrap(); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs index ac978f66798c..074ed9f54a70 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs @@ -90,11 +90,11 @@ fn construct_extrinsic( frame_system::CheckNonce::::from( frame_system::Pallet::::account(&account_id).nonce, ), + frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), BridgeRejectObsoleteHeadersAndMessages::default(), (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages::default(),), frame_metadata_hash_extension::CheckMetadataHash::new(false), - frame_system::CheckWeight::::new(), ) .into(); let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 8ee3d552b68e..e89935156d97 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -97,8 +97,8 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, - pallet_transaction_payment::ChargeTransactionPayment, frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, ), >; /// Unchecked extrinsic type as expected by this runtime. diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index ddb3bc69dc4d..6284695693f4 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -108,9 +108,9 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, + frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, frame_metadata_hash_extension::CheckMetadataHash, - frame_system::CheckWeight, ), >; diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index c45b27bf28e2..fc1438dcdeea 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -108,9 +108,9 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, + frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, frame_metadata_hash_extension::CheckMetadataHash, - frame_system::CheckWeight, ), >; diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index 9ae98064e695..11d0bd7d4ef0 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -101,8 +101,8 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, - pallet_transaction_payment::ChargeTransactionPayment, frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, ), >; diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index f91e0de08c50..2891b325e9c1 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -101,8 +101,8 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, - pallet_transaction_payment::ChargeTransactionPayment, frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, ), >; diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index de3f943cb0cb..7e071b00b989 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -671,8 +671,8 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, - pallet_transaction_payment::ChargeTransactionPayment, frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, ), >; diff --git a/cumulus/test/client/src/lib.rs b/cumulus/test/client/src/lib.rs index d04ab71c5f01..388ca7484ab8 100644 --- a/cumulus/test/client/src/lib.rs +++ b/cumulus/test/client/src/lib.rs @@ -141,8 +141,8 @@ pub fn generate_extrinsic_with_pair( frame_system::CheckGenesis::::new(), frame_system::CheckEra::::from(Era::mortal(period, current_block)), frame_system::CheckNonce::::from(nonce), - pallet_transaction_payment::ChargeTransactionPayment::::from(tip), frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), ) .into(); diff --git a/cumulus/test/runtime/src/lib.rs b/cumulus/test/runtime/src/lib.rs index 600f03296591..316ecfff492e 100644 --- a/cumulus/test/runtime/src/lib.rs +++ b/cumulus/test/runtime/src/lib.rs @@ -386,8 +386,8 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, - pallet_transaction_payment::ChargeTransactionPayment, frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, ), >; /// Unchecked extrinsic type as expected by this runtime. diff --git a/cumulus/test/service/src/lib.rs b/cumulus/test/service/src/lib.rs index 416c4806de7d..7403e7ba459b 100644 --- a/cumulus/test/service/src/lib.rs +++ b/cumulus/test/service/src/lib.rs @@ -978,8 +978,8 @@ pub fn construct_extrinsic( current_block, )), frame_system::CheckNonce::::from(nonce), - pallet_transaction_payment::ChargeTransactionPayment::::from(tip), frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), ) .into(); let raw_payload = runtime::SignedPayload::from_raw( diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index 9ed985a42dba..391321d726fc 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -83,9 +83,9 @@ pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim< frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, + frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, frame_metadata_hash_extension::CheckMetadataHash, - frame_system::CheckWeight, ), >; From 52cc2aabff0035e44f826feaf58a07d7134d7819 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 24 Oct 2024 21:42:58 +0900 Subject: [PATCH 14/40] fmt --- .../parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 3 ++- substrate/frame/system/src/extensions/check_weight.rs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 30af25690521..ef745f982b15 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1087,7 +1087,8 @@ impl EthExtra for EthExtraImpl { frame_system::CheckWeight::::new(), pallet_asset_conversion_tx_payment::ChargeAssetTxPayment::::from(tip, None), frame_metadata_hash_extension::CheckMetadataHash::::new(false), - ).into() + ) + .into() } } diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index d44a8d84bbb4..e8fa846710a5 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -845,7 +845,10 @@ mod tests { )); // Ensure the accurate refund from benchmark is used - assert_eq!(crate::ExtrinsicWeightRefunded::::get(), post_info.calc_unspent(&info)); + assert_eq!( + crate::ExtrinsicWeightRefunded::::get(), + post_info.calc_unspent(&info) + ); assert_eq!( BlockWeight::::get().total(), post_info.actual_weight.unwrap() + prior_block_weight + base_extrinsic From f4f5e192afda252823848e7362771a5698599854 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 24 Oct 2024 21:59:51 +0900 Subject: [PATCH 15/40] remove forgotten dbg --- cumulus/pallets/weight-reclaim/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 493bb9f145d7..6d6c0ce35fa1 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -220,7 +220,6 @@ where frame_system::BlockWeight::::mutate(|current_weight| { let already_refunded = frame_system::ExtrinsicWeightRefunded::::get(); - dbg!(&already_refunded); current_weight.accrue(already_refunded, info.class); current_weight.reduce(info.total_weight(), info.class); current_weight.accrue(accurate_weight, info.class); From cf2275f70105d9de3021723382b97830d8d52bad Mon Sep 17 00:00:00 2001 From: gui Date: Fri, 25 Oct 2024 15:00:28 +0900 Subject: [PATCH 16/40] fix benchmark --- cumulus/pallets/weight-reclaim/src/benchmarks.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/benchmarks.rs b/cumulus/pallets/weight-reclaim/src/benchmarks.rs index e00f7828ff3c..d6b1d84cc9e1 100644 --- a/cumulus/pallets/weight-reclaim/src/benchmarks.rs +++ b/cumulus/pallets/weight-reclaim/src/benchmarks.rs @@ -38,24 +38,21 @@ mod bench { let origin = RawOrigin::Root.into(); let call = T::RuntimeCall::from(frame_system::Call::remark { remark: alloc::vec![] }); + let overestimate = 10_000; let info = DispatchInfo { - call_weight: Weight::zero().add_proof_size(1000), + call_weight: Weight::zero().add_proof_size(overestimate), extension_weight: Weight::zero(), class: DispatchClass::Normal, pays_fee: Pays::No, }; - let post_info_overestimate = 15; - let post_info = PostDispatchInfo { - actual_weight: Some(Weight::zero().add_proof_size(post_info_overestimate)), + actual_weight: None, pays_fee: Pays::No, }; - let initial_block_proof_size = 1_000_000; - let mut block_weight = frame_system::ConsumedWeight::default(); - block_weight.accrue(Weight::from_parts(0, initial_block_proof_size), info.class); + block_weight.accrue(Weight::from_parts(0, overestimate), info.class); frame_system::BlockWeight::::put(block_weight); @@ -67,7 +64,10 @@ mod bench { let final_block_proof_size = frame_system::BlockWeight::::get().get(info.class).proof_size(); - assert_eq!(final_block_proof_size, initial_block_proof_size - post_info_overestimate); + assert!( + final_block_proof_size < overestimate, + "The proof size measured should be less than {overestimate}" + ); Ok(()) } From 947352361b9f52734e593b24fbda287bc0fd72bc Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 25 Oct 2024 06:19:36 +0000 Subject: [PATCH 17/40] Update from gui1117 running command 'bench --runtime asset-hub-rococo --pallet cumulus_pallet_weight_reclaim' --- .../weights/cumulus_pallet_weight_reclaim.rs | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..429c1f6833f9 --- /dev/null +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,68 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `e6b893b5178c`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_712_000 picoseconds. + Weight::from_parts(5_021_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} From ac6ec39b86d5a2f2e6a3ad7da3c440b64a064259 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 25 Oct 2024 07:02:10 +0000 Subject: [PATCH 18/40] Update from gui1117 running command 'bench --runtime asset-hub-westend bridge-hub-rococo bridge-hub-westend collectives-westend contracts-rococo coretime-rococo coretime-westend people-rococo people-westend --pallet cumulus_pallet_weight_reclaim' --- .../weights/cumulus_pallet_weight_reclaim.rs | 68 ++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 68 ++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 68 ++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 68 ++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 70 +++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 70 +++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 70 +++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 70 +++++++++++++++++++ .../weights/cumulus_pallet_weight_reclaim.rs | 70 +++++++++++++++++++ 9 files changed, 622 insertions(+) create mode 100644 cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_weight_reclaim.rs create mode 100644 cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_weight_reclaim.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..24066af7ab6a --- /dev/null +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,68 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_630_000 picoseconds. + Weight::from_parts(5_011_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..1f50f333474e --- /dev/null +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,68 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_529_000 picoseconds. + Weight::from_parts(4_936_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..f04f82b7ecb7 --- /dev/null +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,68 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_735_000 picoseconds. + Weight::from_parts(5_010_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..f703cc937b29 --- /dev/null +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,68 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/collectives-westend-runtime/collectives_westend_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/collectives/collectives-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_506_000 picoseconds. + Weight::from_parts(4_683_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..bd68d3566b7f --- /dev/null +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,70 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 3_564_000 picoseconds. + Weight::from_parts(3_890_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..c26223701862 --- /dev/null +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,70 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/coretime-rococo-runtime/coretime_rococo_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 3_480_000 picoseconds. + Weight::from_parts(3_706_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..585aabc0b603 --- /dev/null +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,70 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/coretime-westend-runtime/coretime_westend_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/coretime/coretime-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 3_563_000 picoseconds. + Weight::from_parts(3_840_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..fc7f112dd6d7 --- /dev/null +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,70 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/people-rococo-runtime/people_rococo_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 3_400_000 picoseconds. + Weight::from_parts(3_583_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_weight_reclaim.rs new file mode 100644 index 000000000000..d6b64e6ec79f --- /dev/null +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_weight_reclaim.rs @@ -0,0 +1,70 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `cumulus_pallet_weight_reclaim` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/people-westend-runtime/people_westend_runtime.wasm +// --pallet=cumulus_pallet_weight_reclaim +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_weight_reclaim`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn storage_weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 3_496_000 picoseconds. + Weight::from_parts(3_802_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} From b45868c9bc6ff2df16ade4b7f28d119382cdcef1 Mon Sep 17 00:00:00 2001 From: gui Date: Fri, 25 Oct 2024 16:14:20 +0900 Subject: [PATCH 19/40] link to correct weights --- cumulus/pallets/weight-reclaim/src/benchmarks.rs | 5 +---- .../parachains/runtimes/assets/asset-hub-rococo/src/lib.rs | 2 +- .../runtimes/assets/asset-hub-rococo/src/weights/mod.rs | 1 + .../parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 2 +- .../runtimes/assets/asset-hub-westend/src/weights/mod.rs | 1 + .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 2 +- .../bridge-hubs/bridge-hub-rococo/src/weights/mod.rs | 1 + .../runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs | 2 +- .../bridge-hubs/bridge-hub-westend/src/weights/mod.rs | 1 + .../runtimes/collectives/collectives-westend/src/lib.rs | 2 +- .../collectives/collectives-westend/src/weights/mod.rs | 1 + .../runtimes/contracts/contracts-rococo/src/lib.rs | 2 +- .../runtimes/contracts/contracts-rococo/src/weights/mod.rs | 1 + .../parachains/runtimes/coretime/coretime-rococo/src/lib.rs | 2 +- .../runtimes/coretime/coretime-rococo/src/weights/mod.rs | 1 + .../parachains/runtimes/coretime/coretime-westend/src/lib.rs | 2 +- .../runtimes/coretime/coretime-westend/src/weights/mod.rs | 1 + cumulus/parachains/runtimes/people/people-rococo/src/lib.rs | 2 +- .../runtimes/people/people-rococo/src/weights/mod.rs | 1 + cumulus/parachains/runtimes/people/people-westend/src/lib.rs | 2 +- .../runtimes/people/people-westend/src/weights/mod.rs | 1 + .../parachains/runtimes/testing/rococo-parachain/src/lib.rs | 2 +- 22 files changed, 22 insertions(+), 15 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/benchmarks.rs b/cumulus/pallets/weight-reclaim/src/benchmarks.rs index d6b1d84cc9e1..49583f53e2df 100644 --- a/cumulus/pallets/weight-reclaim/src/benchmarks.rs +++ b/cumulus/pallets/weight-reclaim/src/benchmarks.rs @@ -46,10 +46,7 @@ mod bench { pays_fee: Pays::No, }; - let post_info = PostDispatchInfo { - actual_weight: None, - pays_fee: Pays::No, - }; + let post_info = PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }; let mut block_weight = frame_system::ConsumedWeight::default(); block_weight.accrue(Weight::from_parts(0, overestimate), info.class); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 390c196bd696..55afe8d2ce19 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -182,7 +182,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs index 33f111009ed0..ae78a56d8b3c 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs @@ -16,6 +16,7 @@ pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index ef745f982b15..adaa6f59c257 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -183,7 +183,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs index b0f986768f40..442b58635f48 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs @@ -15,6 +15,7 @@ pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 594ec33bdef2..ab317efd5166 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -314,7 +314,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs index 74796e626a2e..7a0accf2e7a4 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs @@ -24,6 +24,7 @@ use ::pallet_bridge_relayers::WeightInfo as _; pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 38d6c5939b90..1750b2d0a072 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -299,7 +299,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs index c1c5c337aca8..313da55831c8 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs @@ -24,6 +24,7 @@ use ::pallet_bridge_relayers::WeightInfo as _; pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index 28a8cb602f0d..cd1ea4e1941c 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -192,7 +192,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs index 00b3bd92d5ef..a1663dc98a34 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs @@ -15,6 +15,7 @@ pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index e89935156d97..0513074ab997 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -204,7 +204,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs index 850dae6fbd06..4120ab34f814 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs @@ -18,6 +18,7 @@ //! Expose the auto generated weight files. pub mod block_weights; +pub mod cumulus_pallet_weight_reclaim; pub mod extrinsic_weights; pub mod paritydb_weights; pub mod rocksdb_weights; diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index 6284695693f4..a11ba47bd5bf 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -223,7 +223,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/mod.rs index 24c4f50e6ab8..7fee4a728b9e 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/mod.rs @@ -19,6 +19,7 @@ pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index fc1438dcdeea..f77d4cd4c784 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -223,7 +223,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/mod.rs index 24c4f50e6ab8..7fee4a728b9e 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/mod.rs @@ -19,6 +19,7 @@ pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index 11d0bd7d4ef0..fe3c2f288331 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -198,7 +198,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/mod.rs index 58480231f068..218cc03341e1 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/mod.rs @@ -17,6 +17,7 @@ pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index 2891b325e9c1..4b0f2c6479f3 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -197,7 +197,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/mod.rs index 58480231f068..218cc03341e1 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/mod.rs @@ -17,6 +17,7 @@ pub mod block_weights; pub mod cumulus_pallet_parachain_system; +pub mod cumulus_pallet_weight_reclaim; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 7e071b00b989..4349529bd627 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -227,7 +227,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = (); } impl pallet_timestamp::Config for Runtime { From f8028e765786a48af6c1d68e45cfe4b30b0406a2 Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 30 Oct 2024 17:37:27 +0900 Subject: [PATCH 20/40] add system weight reclaim for solo and relay chains --- cumulus/pallets/weight-reclaim/src/lib.rs | 9 +- cumulus/test/runtime/src/lib.rs | 2 +- substrate/frame/support/src/dispatch.rs | 13 + .../system/benchmarking/src/extensions.rs | 43 ++ .../system/src/extensions/check_weight.rs | 16 +- substrate/frame/system/src/extensions/mod.rs | 1 + .../system/src/extensions/weight_reclaim.rs | 418 ++++++++++++++++++ .../frame/system/src/extensions/weights.rs | 9 + substrate/frame/system/src/lib.rs | 11 +- substrate/frame/system/src/tests.rs | 12 +- 10 files changed, 510 insertions(+), 24 deletions(-) create mode 100644 substrate/frame/system/src/extensions/weight_reclaim.rs diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 6d6c0ce35fa1..d8248950077b 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -219,16 +219,17 @@ where let accurate_weight = benchmarked_weight.set_proof_size(measured_proof_size); frame_system::BlockWeight::::mutate(|current_weight| { - let already_refunded = frame_system::ExtrinsicWeightRefunded::::get(); - current_weight.accrue(already_refunded, info.class); + let already_reclaimed = frame_system::ExtrinsicWeightReclaimed::::get(); + current_weight.accrue(already_reclaimed, info.class); current_weight.reduce(info.total_weight(), info.class); + // TODO TODO: this is different from the original implementation as the post dispatch is + // always taken even if the pre dispatch is less. current_weight.accrue(accurate_weight, info.class); // The saturation will happen if the pre dispatch weight is underestimated. // In this case the extrinsic refund is considered 0. - // TODO TODO: maybe change `ExtrinsicWeightRefunded` to just `ExtrinsicWeight`. let accurate_unspent = info.total_weight().saturating_sub(accurate_weight); - frame_system::ExtrinsicWeightRefunded::::put(accurate_unspent); + frame_system::ExtrinsicWeightReclaimed::::put(accurate_unspent); }); Ok(inner_refund) diff --git a/cumulus/test/runtime/src/lib.rs b/cumulus/test/runtime/src/lib.rs index 316ecfff492e..64eea9610377 100644 --- a/cumulus/test/runtime/src/lib.rs +++ b/cumulus/test/runtime/src/lib.rs @@ -229,7 +229,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = (); } parameter_types! { diff --git a/substrate/frame/support/src/dispatch.rs b/substrate/frame/support/src/dispatch.rs index 3678f958980a..d05b45f4dc95 100644 --- a/substrate/frame/support/src/dispatch.rs +++ b/substrate/frame/support/src/dispatch.rs @@ -308,6 +308,19 @@ impl PostDispatchInfo { /// Calculate how much weight was actually spent by the `Dispatchable`. pub fn calc_actual_weight(&self, info: &DispatchInfo) -> Weight { if let Some(actual_weight) = self.actual_weight { + let info_total_weight = info.total_weight(); + if actual_weight.any_gt(info_total_weight) { + log::error!( + target: crate::LOG_TARGET, + "Post dispatch weight is greater than pre dispatch weight. \ + Pre dispatch weight may underestimating the actual weight. \ + Greater post dispatch weight components are ignored. + Pre dispatch weight: {:?}, + Post dispatch weight: {:?}", + actual_weight, + info_total_weight, + ); + } actual_weight.min(info.total_weight()) } else { info.total_weight() diff --git a/substrate/frame/system/benchmarking/src/extensions.rs b/substrate/frame/system/benchmarking/src/extensions.rs index 3c6626030e22..a61395581d12 100644 --- a/substrate/frame/system/benchmarking/src/extensions.rs +++ b/substrate/frame/system/benchmarking/src/extensions.rs @@ -244,5 +244,48 @@ mod benchmarks { Ok(()) } + #[benchmark] + fn weight_reclaim() -> Result<(), BenchmarkError> { + let caller = account("caller", 0, 0); + let base_extrinsic = ::BlockWeights::get() + .get(DispatchClass::Normal) + .base_extrinsic; + let extension_weight = ::ExtensionsWeightInfo::weight_reclaim(); + let info = DispatchInfo { + call_weight: Weight::from_parts(base_extrinsic.ref_time() * 5, 0), + extension_weight, + class: DispatchClass::Normal, + ..Default::default() + }; + let call: T::RuntimeCall = frame_system::Call::remark { remark: vec![] }.into(); + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(base_extrinsic.ref_time() * 2, 0)), + pays_fee: Default::default(), + }; + let len = 0_usize; + let ext = WeightReclaim::::new(); + + let initial_block_weight = Weight::from_parts(base_extrinsic.ref_time() * 2, 0); + frame_system::BlockWeight::::mutate(|current_weight| { + current_weight.set(Weight::zero(), DispatchClass::Mandatory); + current_weight.set(initial_block_weight, DispatchClass::Normal); + }); + + #[block] + { + ext.test_run(RawOrigin::Signed(caller).into(), &call, &info, len, |_| Ok(post_info)) + .unwrap() + .unwrap(); + } + + assert_eq!( + System::::block_weight().total(), + initial_block_weight + + base_extrinsic + + post_info.actual_weight.unwrap().saturating_add(extension_weight), + ); + Ok(()) + } + impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test,); } diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index e8fa846710a5..5d869bf8714f 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -138,14 +138,14 @@ where info: &DispatchInfoOf, post_info: &PostDispatchInfoOf, ) -> Result<(), TransactionValidityError> { - let already_refunded = crate::ExtrinsicWeightRefunded::::get(); + let already_reclaimed = crate::ExtrinsicWeightReclaimed::::get(); let unspent = post_info.calc_unspent(info); - if unspent.any_gt(already_refunded) { + if unspent.any_gt(already_reclaimed) { crate::BlockWeight::::mutate(|current_weight| { - current_weight.accrue(already_refunded, info.class); + current_weight.accrue(already_reclaimed, info.class); current_weight.reduce(unspent, info.class); }); - crate::ExtrinsicWeightRefunded::::put(unspent); + crate::ExtrinsicWeightReclaimed::::put(unspent); } log::trace!( @@ -777,7 +777,7 @@ mod tests { BlockWeight::::mutate(|current_weight| { current_weight.reduce(accurate_refund, DispatchClass::Normal); }); - crate::ExtrinsicWeightRefunded::::put(accurate_refund); + crate::ExtrinsicWeightReclaimed::::put(accurate_refund); // Do the post dispatch assert_ok!(CheckWeight::::post_dispatch_details( @@ -789,7 +789,7 @@ mod tests { )); // Ensure the accurate refund is used - assert_eq!(crate::ExtrinsicWeightRefunded::::get(), accurate_refund); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), accurate_refund); assert_eq!( BlockWeight::::get().total(), info.total_weight() - accurate_refund + prior_block_weight + base_extrinsic @@ -833,7 +833,7 @@ mod tests { BlockWeight::::mutate(|current_weight| { current_weight.reduce(inaccurate_refund, DispatchClass::Normal); }); - crate::ExtrinsicWeightRefunded::::put(inaccurate_refund); + crate::ExtrinsicWeightReclaimed::::put(inaccurate_refund); // Do the post dispatch assert_ok!(CheckWeight::::post_dispatch_details( @@ -846,7 +846,7 @@ mod tests { // Ensure the accurate refund from benchmark is used assert_eq!( - crate::ExtrinsicWeightRefunded::::get(), + crate::ExtrinsicWeightReclaimed::::get(), post_info.calc_unspent(&info) ); assert_eq!( diff --git a/substrate/frame/system/src/extensions/mod.rs b/substrate/frame/system/src/extensions/mod.rs index d79104d22403..66a8b17d30ae 100644 --- a/substrate/frame/system/src/extensions/mod.rs +++ b/substrate/frame/system/src/extensions/mod.rs @@ -22,6 +22,7 @@ pub mod check_nonce; pub mod check_spec_version; pub mod check_tx_version; pub mod check_weight; +pub mod weight_reclaim; pub mod weights; pub use weights::WeightInfo; diff --git a/substrate/frame/system/src/extensions/weight_reclaim.rs b/substrate/frame/system/src/extensions/weight_reclaim.rs new file mode 100644 index 000000000000..71d2f9c4d997 --- /dev/null +++ b/substrate/frame/system/src/extensions/weight_reclaim.rs @@ -0,0 +1,418 @@ +// This file is part of Substrate. + +// Copyright (C) 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. + +use crate::Config; +use codec::{Decode, Encode}; +use frame_support::dispatch::{DispatchInfo, PostDispatchInfo}; +use scale_info::TypeInfo; +use sp_runtime::{ + traits::{ + DispatchInfoOf, Dispatchable, PostDispatchInfoOf, TransactionExtension, ValidateResult, + }, + transaction_validity::{TransactionValidityError, ValidTransaction}, + DispatchResult, +}; +use sp_weights::Weight; + +/// Reclaim the unused weight using the post dispatch information +/// +/// After the dispatch of the extrinsic, calculate the unused weight using the post dispatch +/// information and the block consumed weight according to the new calculated extrinsic weight. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] +#[scale_info(skip_type_params(T))] +pub struct WeightReclaim(core::marker::PhantomData); + +impl WeightReclaim +where + T::RuntimeCall: Dispatchable, +{ + /// Creates new `TransactionExtension` to recalculate the extrinsic weight after dispatch. + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn do_post_dispatch( + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, + ) -> Result<(), TransactionValidityError> { + let already_reclaimed = crate::ExtrinsicWeightReclaimed::::get(); + let unspent = post_info.calc_unspent(info); + let accurate_reclaim = already_reclaimed.max(unspent); + + if already_reclaimed != accurate_reclaim { + crate::BlockWeight::::mutate(|current_weight| { + current_weight.accrue(already_reclaimed, info.class); + current_weight.reduce(accurate_reclaim, info.class); + }); + crate::ExtrinsicWeightReclaimed::::put(accurate_reclaim); + } + Ok(()) + } +} + +impl TransactionExtension for WeightReclaim +where + T::RuntimeCall: Dispatchable, +{ + const IDENTIFIER: &'static str = "WeightReclaim"; + type Implicit = (); + type Pre = (); + type Val = (); + + fn weight(&self, _: &T::RuntimeCall) -> Weight { + ::weight_reclaim() + } + + fn validate( + &self, + origin: T::RuntimeOrigin, + _call: &T::RuntimeCall, + _info: &DispatchInfoOf, + _len: usize, + _self_implicit: Self::Implicit, + _inherited_implication: &impl Encode, + ) -> ValidateResult { + Ok((ValidTransaction::default(), (), origin)) + } + + fn prepare( + self, + _val: Self::Val, + _origin: &T::RuntimeOrigin, + _call: &T::RuntimeCall, + _info: &DispatchInfoOf, + _len: usize, + ) -> Result { + Ok(()) + } + + fn post_dispatch_details( + _pre: Self::Pre, + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, + _len: usize, + _result: &DispatchResult, + ) -> Result { + Self::do_post_dispatch(info, post_info)?; + Ok(Weight::zero()) + } + + fn bare_validate( + _call: &T::RuntimeCall, + _info: &DispatchInfoOf, + _len: usize, + ) -> frame_support::pallet_prelude::TransactionValidity { + Ok(ValidTransaction::default()) + } + + fn bare_validate_and_prepare( + _call: &T::RuntimeCall, + _info: &DispatchInfoOf, + _len: usize, + ) -> Result<(), TransactionValidityError> { + Ok(()) + } + + fn bare_post_dispatch( + info: &DispatchInfoOf, + post_info: &mut PostDispatchInfoOf, + _len: usize, + _result: &DispatchResult, + ) -> Result<(), TransactionValidityError> { + Self::do_post_dispatch(info, post_info) + } +} + +impl core::fmt::Debug for WeightReclaim +where + T::RuntimeCall: Dispatchable, +{ + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + write!(f, "{}", Self::IDENTIFIER) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ + mock::{new_test_ext, Test}, + BlockWeight, DispatchClass, + }; + use frame_support::{assert_ok, weights::Weight}; + + fn block_weights() -> crate::limits::BlockWeights { + ::BlockWeights::get() + } + + #[test] + fn extrinsic_already_refunded_more_precisely() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = + DispatchInfo { call_weight: Weight::from_parts(512, 0), ..Default::default() }; + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(128, 0)), + pays_fee: Default::default(), + }; + let prior_block_weight = Weight::from_parts(64, 0); + let accurate_refund = Weight::from_parts(510, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Normal).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(prior_block_weight, DispatchClass::Normal); + current_weight.accrue( + base_extrinsic + info.total_weight() - accurate_refund, + DispatchClass::Normal, + ); + }); + crate::ExtrinsicWeightReclaimed::::put(accurate_refund); + + // Do the post dispatch + assert_ok!(WeightReclaim::::post_dispatch_details( + (), + &info, + &post_info, + len, + &Ok(()) + )); + + // Ensure the accurate refund is used + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), accurate_refund); + assert_eq!( + *BlockWeight::::get().get(DispatchClass::Normal), + info.total_weight() - accurate_refund + prior_block_weight + base_extrinsic + ); + }) + } + + #[test] + fn extrinsic_already_refunded_less_precisely() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = + DispatchInfo { call_weight: Weight::from_parts(512, 0), ..Default::default() }; + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(128, 0)), + pays_fee: Default::default(), + }; + let prior_block_weight = Weight::from_parts(64, 0); + let inaccurate_refund = Weight::from_parts(110, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Normal).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(prior_block_weight, DispatchClass::Normal); + current_weight.accrue( + base_extrinsic + info.total_weight() - inaccurate_refund, + DispatchClass::Normal, + ); + }); + crate::ExtrinsicWeightReclaimed::::put(inaccurate_refund); + + // Do the post dispatch + assert_ok!(WeightReclaim::::post_dispatch_details( + (), + &info, + &post_info, + len, + &Ok(()) + )); + + // Ensure the accurate refund from benchmark is used + assert_eq!( + crate::ExtrinsicWeightReclaimed::::get(), + post_info.calc_unspent(&info) + ); + assert_eq!( + *BlockWeight::::get().get(DispatchClass::Normal), + post_info.actual_weight.unwrap() + prior_block_weight + base_extrinsic + ); + }) + } + + #[test] + fn extrinsic_not_refunded_before() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = + DispatchInfo { call_weight: Weight::from_parts(512, 0), ..Default::default() }; + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(128, 0)), + pays_fee: Default::default(), + }; + let prior_block_weight = Weight::from_parts(64, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Normal).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(prior_block_weight, DispatchClass::Normal); + current_weight.accrue(base_extrinsic + info.total_weight(), DispatchClass::Normal); + }); + + // Do the post dispatch + assert_ok!(WeightReclaim::::post_dispatch_details( + (), + &info, + &post_info, + len, + &Ok(()) + )); + + // Ensure the accurate refund from benchmark is used + assert_eq!( + crate::ExtrinsicWeightReclaimed::::get(), + post_info.calc_unspent(&info) + ); + assert_eq!( + *BlockWeight::::get().get(DispatchClass::Normal), + post_info.actual_weight.unwrap() + prior_block_weight + base_extrinsic + ); + }) + } + + #[test] + fn no_actual_post_dispatch_weight() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = + DispatchInfo { call_weight: Weight::from_parts(512, 0), ..Default::default() }; + let post_info = PostDispatchInfo { actual_weight: None, pays_fee: Default::default() }; + let prior_block_weight = Weight::from_parts(64, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Normal).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(prior_block_weight, DispatchClass::Normal); + current_weight.accrue(base_extrinsic + info.total_weight(), DispatchClass::Normal); + }); + + // Do the post dispatch + assert_ok!(WeightReclaim::::post_dispatch_details( + (), + &info, + &post_info, + len, + &Ok(()) + )); + + // Ensure the accurate refund from benchmark is used + assert_eq!( + crate::ExtrinsicWeightReclaimed::::get(), + post_info.calc_unspent(&info) + ); + assert_eq!( + *BlockWeight::::get().get(DispatchClass::Normal), + info.total_weight() + prior_block_weight + base_extrinsic + ); + }) + } + + #[test] + fn different_dispatch_class() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = DispatchInfo { + call_weight: Weight::from_parts(512, 0), + class: DispatchClass::Operational, + ..Default::default() + }; + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(128, 0)), + pays_fee: Default::default(), + }; + let prior_block_weight = Weight::from_parts(64, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Operational).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(prior_block_weight, DispatchClass::Operational); + current_weight + .accrue(base_extrinsic + info.total_weight(), DispatchClass::Operational); + }); + + // Do the post dispatch + assert_ok!(WeightReclaim::::post_dispatch_details( + (), + &info, + &post_info, + len, + &Ok(()) + )); + + // Ensure the accurate refund from benchmark is used + assert_eq!( + crate::ExtrinsicWeightReclaimed::::get(), + post_info.calc_unspent(&info) + ); + assert_eq!( + *BlockWeight::::get().get(DispatchClass::Operational), + post_info.actual_weight.unwrap() + prior_block_weight + base_extrinsic + ); + }) + } + + #[test] + fn bare_also_works() { + new_test_ext().execute_with(|| { + // This is half of the max block weight + let info = DispatchInfo { + call_weight: Weight::from_parts(512, 0), + class: DispatchClass::Operational, + ..Default::default() + }; + let post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(128, 0)), + pays_fee: Default::default(), + }; + let prior_block_weight = Weight::from_parts(64, 0); + let len = 0_usize; + let base_extrinsic = block_weights().get(DispatchClass::Operational).base_extrinsic; + + // Set initial info + BlockWeight::::mutate(|current_weight| { + current_weight.set(prior_block_weight, DispatchClass::Operational); + current_weight + .accrue(base_extrinsic + info.total_weight(), DispatchClass::Operational); + }); + + // Do the bare post dispatch + assert_ok!(WeightReclaim::::bare_post_dispatch( + &info, + &mut post_info.clone(), + len, + &Ok(()) + )); + + // Ensure the accurate refund from benchmark is used + assert_eq!( + crate::ExtrinsicWeightReclaimed::::get(), + post_info.calc_unspent(&info) + ); + assert_eq!( + *BlockWeight::::get().get(DispatchClass::Operational), + post_info.actual_weight.unwrap() + prior_block_weight + base_extrinsic + ); + }) + } +} diff --git a/substrate/frame/system/src/extensions/weights.rs b/substrate/frame/system/src/extensions/weights.rs index 1c0136ae7802..3c60fc66cf64 100644 --- a/substrate/frame/system/src/extensions/weights.rs +++ b/substrate/frame/system/src/extensions/weights.rs @@ -59,6 +59,7 @@ pub trait WeightInfo { fn check_spec_version() -> Weight; fn check_tx_version() -> Weight; fn check_weight() -> Weight; + fn weight_reclaim() -> Weight { Weight::zero() } // TODO TODO: remove default implementation after CI } /// Weights for `frame_system_extensions` using the Substrate node and recommended hardware. @@ -137,6 +138,10 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + fn weight_reclaim() -> Weight { + // TODO TODO + Weight::zero() + } } // For backwards compatibility and tests. @@ -214,4 +219,8 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } + fn weight_reclaim() -> Weight { + // TODO TODO + Weight::zero() + } } diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 3b15765e4336..4313cf963c8f 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -169,7 +169,7 @@ pub use extensions::{ check_genesis::CheckGenesis, check_mortality::CheckMortality, check_non_zero_sender::CheckNonZeroSender, check_nonce::CheckNonce, check_spec_version::CheckSpecVersion, check_tx_version::CheckTxVersion, - check_weight::CheckWeight, WeightInfo as ExtensionsWeightInfo, + check_weight::CheckWeight, weight_reclaim::WeightReclaim, WeightInfo as ExtensionsWeightInfo, }; // Backward compatible re-export. pub use extensions::check_mortality::CheckMortality as CheckEra; @@ -1036,14 +1036,15 @@ pub mod pallet { pub(super) type AuthorizedUpgrade = StorageValue<_, CodeUpgradeAuthorization, OptionQuery>; - /// The weight refunded for the extrinsic. + /// The weight reclaimed for the extrinsic. /// /// This information is available until the end of the extrinsic execution. /// More precisely this information is removed in `note_applied_extrinsic`. /// - /// Logic doing some weight refund can coordinate using this storage. + /// Logic doing some post dispatch weight reduction must update this storage to avoid duplicate + /// reduction. #[pallet::storage] - pub type ExtrinsicWeightRefunded = StorageValue<_, Weight, ValueQuery>; + pub type ExtrinsicWeightReclaimed = StorageValue<_, Weight, ValueQuery>; #[derive(frame_support::DefaultNoBound)] #[pallet::genesis_config] @@ -2083,7 +2084,7 @@ impl Pallet { storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &next_extrinsic_index); ExecutionPhase::::put(Phase::ApplyExtrinsic(next_extrinsic_index)); - ExtrinsicWeightRefunded::::kill(); + ExtrinsicWeightReclaimed::::kill(); } /// To be called immediately after `note_applied_extrinsic` of the last extrinsic of the block diff --git a/substrate/frame/system/src/tests.rs b/substrate/frame/system/src/tests.rs index 8450b81bbe91..40a8ee56d9de 100644 --- a/substrate/frame/system/src/tests.rs +++ b/substrate/frame/system/src/tests.rs @@ -896,14 +896,14 @@ fn test_default_account_nonce() { #[test] fn extrinsic_weight_refunded_is_cleaned() { new_test_ext().execute_with(|| { - crate::ExtrinsicWeightRefunded::::put(Weight::from_parts(1, 2)); - assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::from_parts(1, 2)); + crate::ExtrinsicWeightReclaimed::::put(Weight::from_parts(1, 2)); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::from_parts(1, 2)); System::note_applied_extrinsic(&Ok(().into()), Default::default()); - assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::zero()); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::zero()); - crate::ExtrinsicWeightRefunded::::put(Weight::from_parts(1, 2)); - assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::from_parts(1, 2)); + crate::ExtrinsicWeightReclaimed::::put(Weight::from_parts(1, 2)); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::from_parts(1, 2)); System::note_applied_extrinsic(&Err(DispatchError::BadOrigin.into()), Default::default()); - assert_eq!(crate::ExtrinsicWeightRefunded::::get(), Weight::zero()); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::zero()); }); } From ae0f0b704f3e1f7402cf1cfc9aa3b10105337096 Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 30 Oct 2024 19:06:33 +0900 Subject: [PATCH 21/40] fixes --- substrate/frame/system/benchmarking/src/extensions.rs | 3 ++- substrate/frame/system/src/extensions/weights.rs | 2 +- substrate/frame/system/src/lib.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/substrate/frame/system/benchmarking/src/extensions.rs b/substrate/frame/system/benchmarking/src/extensions.rs index a61395581d12..99895527a95c 100644 --- a/substrate/frame/system/benchmarking/src/extensions.rs +++ b/substrate/frame/system/benchmarking/src/extensions.rs @@ -28,7 +28,7 @@ use frame_support::{ use frame_system::{ pallet_prelude::*, CheckGenesis, CheckMortality, CheckNonZeroSender, CheckNonce, CheckSpecVersion, CheckTxVersion, CheckWeight, Config, ExtensionsWeightInfo, Pallet as System, - RawOrigin, + RawOrigin, WeightReclaim, }; use sp_runtime::{ generic::Era, @@ -269,6 +269,7 @@ mod benchmarks { frame_system::BlockWeight::::mutate(|current_weight| { current_weight.set(Weight::zero(), DispatchClass::Mandatory); current_weight.set(initial_block_weight, DispatchClass::Normal); + current_weight.accrue(base_extrinsic + info.total_weight(), DispatchClass::Normal); }); #[block] diff --git a/substrate/frame/system/src/extensions/weights.rs b/substrate/frame/system/src/extensions/weights.rs index 3c60fc66cf64..d10be4ad2ec1 100644 --- a/substrate/frame/system/src/extensions/weights.rs +++ b/substrate/frame/system/src/extensions/weights.rs @@ -59,7 +59,7 @@ pub trait WeightInfo { fn check_spec_version() -> Weight; fn check_tx_version() -> Weight; fn check_weight() -> Weight; - fn weight_reclaim() -> Weight { Weight::zero() } // TODO TODO: remove default implementation after CI + fn weight_reclaim() -> Weight; } /// Weights for `frame_system_extensions` using the Substrate node and recommended hardware. diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 4313cf963c8f..3227ead6d785 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -1044,6 +1044,7 @@ pub mod pallet { /// Logic doing some post dispatch weight reduction must update this storage to avoid duplicate /// reduction. #[pallet::storage] + #[pallet::whitelist_storage] pub type ExtrinsicWeightReclaimed = StorageValue<_, Weight, ValueQuery>; #[derive(frame_support::DefaultNoBound)] From a6d4bd1516b2b8e48862150cda9cb737a1a8afa4 Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 30 Oct 2024 22:43:19 +0900 Subject: [PATCH 22/40] fix WeightInfo usages --- cumulus/pallets/weight-reclaim/src/tests.rs | 3 +++ .../asset-hub-rococo/src/weights/frame_system_extensions.rs | 3 +++ .../asset-hub-westend/src/weights/frame_system_extensions.rs | 3 +++ .../bridge-hub-rococo/src/weights/frame_system_extensions.rs | 3 +++ .../bridge-hub-westend/src/weights/frame_system_extensions.rs | 3 +++ .../collectives-westend/src/weights/frame_system_extensions.rs | 3 +++ .../coretime-rococo/src/weights/frame_system_extensions.rs | 3 +++ .../coretime-westend/src/weights/frame_system_extensions.rs | 3 +++ .../glutton-westend/src/weights/frame_system_extensions.rs | 3 +++ .../people-rococo/src/weights/frame_system_extensions.rs | 3 +++ .../people-westend/src/weights/frame_system_extensions.rs | 3 +++ polkadot/runtime/rococo/src/weights/frame_system_extensions.rs | 3 +++ .../runtime/westend/src/weights/frame_system_extensions.rs | 3 +++ substrate/frame/executive/src/tests.rs | 3 +++ 14 files changed, 42 insertions(+) diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index 1087eb9785c3..5692e5bf1990 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -116,6 +116,9 @@ impl frame_system::ExtensionsWeightInfo for MockWeightInfo { fn check_weight() -> Weight { CHECK_WEIGHT_WEIGHT.with_borrow(|v| *v) } + fn weight_reclaim() -> Weight { + Default::default() + } } impl crate::WeightInfo for MockWeightInfo { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs index 182410f20fff..1979a9da31be 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs index e8dd9763c282..6115543ec8eb 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs index 64eef1b4f740..aec7fb300fa3 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs index 459b137d3b84..1bf0993046cc 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs index f32f27303135..5a9904c6c8a2 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs index a4d09696a1a1..3599aea2cd55 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs index d928b73613a3..c487de0e621c 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs index 4fbbb8d6f781..f0d6db71c9fe 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs @@ -127,4 +127,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs index fb2b69e23e82..c8e1673acc8e 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs index 0a4b9e8e2681..faca078ee1f6 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs @@ -129,4 +129,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs b/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs index 99dac1ba75f0..20dd493f046f 100644 --- a/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs +++ b/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs @@ -131,4 +131,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/polkadot/runtime/westend/src/weights/frame_system_extensions.rs b/polkadot/runtime/westend/src/weights/frame_system_extensions.rs index 048f23fbcb91..9443b83a35bb 100644 --- a/polkadot/runtime/westend/src/weights/frame_system_extensions.rs +++ b/polkadot/runtime/westend/src/weights/frame_system_extensions.rs @@ -128,4 +128,7 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + fn weight_reclaim() -> Weight { + Weight::zero() // TODO TODO: rerun + } } diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index 3841b010325b..a506256ebd6e 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -335,6 +335,9 @@ impl frame_system::ExtensionsWeightInfo for MockExtensionsWeights { fn check_weight() -> Weight { Weight::from_parts(10, 0) } + fn weight_reclaim() -> Weight { + Weight::zero() + } } #[derive_impl(frame_system::config_preludes::TestDefaultConfig)] From 5b7d968ea82f590d1a791ec2376522bb05f88858 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 09:34:14 +0900 Subject: [PATCH 23/40] fix CI --- .github/workflows/runtimes-matrix.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/runtimes-matrix.json b/.github/workflows/runtimes-matrix.json index e4e3a2dbe6d1..5e84edbf9cda 100644 --- a/.github/workflows/runtimes-matrix.json +++ b/.github/workflows/runtimes-matrix.json @@ -122,7 +122,7 @@ { "name": "glutton-westend", "package": "glutton-westend-runtime", - "path": "cumulus/parachains/runtimes/gluttons/glutton-westend", + "path": "cumulus/parachains/runtimes/glutton/glutton-westend", "header": "cumulus/file_header.txt", "template": "cumulus/templates/xcm-bench-template.hbs", "bench_features": "runtime-benchmarks", From eebb5c74dfe30276eb70c8cad133f28bce7f2be5 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 31 Oct 2024 01:33:31 +0000 Subject: [PATCH 24/40] Update from gui1117 running command 'bench --pallet frame_system --clean' --- .../src/weights/frame_system.rs | 121 ++++++----- .../src/weights/frame_system.rs | 144 +++++++------ .../src/weights/frame_system.rs | 146 +++++++------ .../src/weights/frame_system.rs | 121 ++++++----- .../src/weights/frame_system.rs | 146 +++++++------ .../src/weights/frame_system.rs | 193 ++++++++++++++++++ .../src/weights/frame_system.rs | 101 ++++----- .../src/weights/frame_system.rs | 101 ++++----- .../src/weights/frame_system.rs | 120 ++++++----- .../people-rococo/src/weights/frame_system.rs | 181 +++++++++------- .../src/weights/frame_system.rs | 177 +++++++++------- .../rococo/src/weights/frame_system.rs | 79 +++---- .../westend/src/weights/frame_system.rs | 117 +++++------ substrate/frame/system/src/weights.rs | 153 +++++++------- 14 files changed, 1115 insertions(+), 785 deletions(-) create mode 100644 cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs index b257c3825a7e..eb5d6365e03b 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=asset-hub-rococo-dev -// --wasm-execution=compiled -// --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/release/wbuild/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,22 +56,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_106_000 picoseconds. - Weight::from_parts(1_884_213, 0) + // Minimum execution time: 3_748_000 picoseconds. + Weight::from_parts(2_229_977, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(395, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_528_000 picoseconds. - Weight::from_parts(27_081_927, 0) + // Minimum execution time: 8_921_000 picoseconds. + Weight::from_parts(28_573_508, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_730, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_400, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -80,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_882_000 picoseconds. - Weight::from_parts(4_149_000, 0) + // Minimum execution time: 6_391_000 picoseconds. + Weight::from_parts(6_596_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -100,11 +101,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `119` - // Estimated: `1604` - // Minimum execution time: 103_389_161_000 picoseconds. - Weight::from_parts(106_870_091_000, 0) - .saturating_add(Weight::from_parts(0, 1604)) + // Measured: `164` + // Estimated: `1649` + // Minimum execution time: 124_591_204_000 picoseconds. + Weight::from_parts(125_778_305_000, 0) + .saturating_add(Weight::from_parts(0, 1649)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -115,11 +116,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_302_000, 0) + // Minimum execution time: 3_710_000 picoseconds. + Weight::from_parts(3_758_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_045 - .saturating_add(Weight::from_parts(763_456, 0).saturating_mul(i.into())) + // Standard Error: 789 + .saturating_add(Weight::from_parts(941_726, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -129,11 +130,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_175_000 picoseconds. - Weight::from_parts(2_238_000, 0) + // Minimum execution time: 3_704_000 picoseconds. + Weight::from_parts(3_815_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_040 - .saturating_add(Weight::from_parts(571_397, 0).saturating_mul(i.into())) + // Standard Error: 899 + .saturating_add(Weight::from_parts(738_508, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -141,13 +142,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `84 + p * (69 ±0)` - // Estimated: `80 + p * (70 ±0)` - // Minimum execution time: 3_843_000 picoseconds. - Weight::from_parts(3_947_000, 0) - .saturating_add(Weight::from_parts(0, 80)) - // Standard Error: 2_188 - .saturating_add(Weight::from_parts(1_212_360, 0).saturating_mul(p.into())) + // Measured: `83 + p * (69 ±0)` + // Estimated: `96 + p * (70 ±0)` + // Minimum execution time: 6_758_000 picoseconds. + Weight::from_parts(6_846_000, 0) + .saturating_add(Weight::from_parts(0, 96)) + // Standard Error: 1_470 + .saturating_add(Weight::from_parts(1_618_292, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -158,25 +159,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 14_405_000 picoseconds. + Weight::from_parts(14_837_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `186` + // Estimated: `1671` + // Minimum execution time: 130_730_000_000 picoseconds. + Weight::from_parts(131_578_055_000, 0) + .saturating_add(Weight::from_parts(0, 1671)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs index 687b87e43915..b8ea9713c9f5 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs @@ -1,42 +1,44 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 +// This file is part of Cumulus. -// 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. +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=asset-hub-westend-dev -// --wasm-execution=compiled -// --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/release/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/assets/asset-hub-westend/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,22 +56,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_105_000 picoseconds. - Weight::from_parts(2_139_000, 0) + // Minimum execution time: 3_534_000 picoseconds. + Weight::from_parts(5_673_017, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(380, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_540_000 picoseconds. - Weight::from_parts(7_767_000, 0) + // Minimum execution time: 9_014_000 picoseconds. + Weight::from_parts(30_088_184, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_730, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_389, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -79,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_980_000 picoseconds. - Weight::from_parts(4_120_000, 0) + // Minimum execution time: 6_381_000 picoseconds. + Weight::from_parts(6_662_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -99,11 +101,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `156` - // Estimated: `1641` - // Minimum execution time: 102_511_794_000 picoseconds. - Weight::from_parts(105_688_965_000, 0) - .saturating_add(Weight::from_parts(0, 1641)) + // Measured: `164` + // Estimated: `1649` + // Minimum execution time: 125_594_470_000 picoseconds. + Weight::from_parts(126_838_892_000, 0) + .saturating_add(Weight::from_parts(0, 1649)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -114,11 +116,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_241_000 picoseconds. - Weight::from_parts(2_329_000, 0) + // Minimum execution time: 3_608_000 picoseconds. + Weight::from_parts(3_733_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_336 - .saturating_add(Weight::from_parts(756_084, 0).saturating_mul(i.into())) + // Standard Error: 756 + .saturating_add(Weight::from_parts(948_225, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -128,11 +130,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_233_000 picoseconds. - Weight::from_parts(2_295_000, 0) + // Minimum execution time: 3_637_000 picoseconds. + Weight::from_parts(3_724_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 990 - .saturating_add(Weight::from_parts(573_213, 0).saturating_mul(i.into())) + // Standard Error: 966 + .saturating_add(Weight::from_parts(736_979, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -140,13 +142,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `83 + p * (69 ±0)` - // Estimated: `86 + p * (70 ±0)` - // Minimum execution time: 3_990_000 picoseconds. - Weight::from_parts(4_110_000, 0) - .saturating_add(Weight::from_parts(0, 86)) - // Standard Error: 1_782 - .saturating_add(Weight::from_parts(1_220_573, 0).saturating_mul(p.into())) + // Measured: `86 + p * (69 ±0)` + // Estimated: `100 + p * (70 ±0)` + // Minimum execution time: 6_552_000 picoseconds. + Weight::from_parts(6_783_000, 0) + .saturating_add(Weight::from_parts(0, 100)) + // Standard Error: 1_351 + .saturating_add(Weight::from_parts(1_623_781, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -157,25 +159,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 14_068_000 picoseconds. + Weight::from_parts(14_601_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `186` + // Estimated: `1671` + // Minimum execution time: 130_673_987_000 picoseconds. + Weight::from_parts(131_160_146_000, 0) + .saturating_add(Weight::from_parts(0, 1671)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs index df440a68a36d..a21dc6c3e9ba 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs @@ -1,42 +1,44 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 +// This file is part of Cumulus. -// 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. +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=bridge-hub-rococo-dev -// --wasm-execution=compiled -// --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,22 +56,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_956_000 picoseconds. - Weight::from_parts(2_974_450, 0) + // Minimum execution time: 3_669_000 picoseconds. + Weight::from_parts(5_581_024, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(381, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_432_000 picoseconds. - Weight::from_parts(7_686_000, 0) + // Minimum execution time: 9_251_000 picoseconds. + Weight::from_parts(24_778_824, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_767, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_390, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -79,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_715_000 picoseconds. - Weight::from_parts(3_983_000, 0) + // Minimum execution time: 6_362_000 picoseconds. + Weight::from_parts(6_964_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -99,11 +101,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `119` - // Estimated: `1604` - // Minimum execution time: 99_688_458_000 picoseconds. - Weight::from_parts(103_623_061_000, 0) - .saturating_add(Weight::from_parts(0, 1604)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 125_485_347_000 picoseconds. + Weight::from_parts(126_321_597_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -114,11 +116,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_318_000 picoseconds. - Weight::from_parts(2_421_000, 0) + // Minimum execution time: 3_646_000 picoseconds. + Weight::from_parts(3_786_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_168 - .saturating_add(Weight::from_parts(765_555, 0).saturating_mul(i.into())) + // Standard Error: 792 + .saturating_add(Weight::from_parts(941_436, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -128,11 +130,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_228_000, 0) + // Minimum execution time: 3_598_000 picoseconds. + Weight::from_parts(3_814_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 951 - .saturating_add(Weight::from_parts(569_773, 0).saturating_mul(i.into())) + // Standard Error: 964 + .saturating_add(Weight::from_parts(737_625, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -140,13 +142,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `68 + p * (69 ±0)` - // Estimated: `71 + p * (70 ±0)` - // Minimum execution time: 3_795_000 picoseconds. - Weight::from_parts(3_895_000, 0) - .saturating_add(Weight::from_parts(0, 71)) - // Standard Error: 1_869 - .saturating_add(Weight::from_parts(1_209_251, 0).saturating_mul(p.into())) + // Measured: `66 + p * (69 ±0)` + // Estimated: `83 + p * (70 ±0)` + // Minimum execution time: 6_702_000 picoseconds. + Weight::from_parts(6_847_000, 0) + .saturating_add(Weight::from_parts(0, 83)) + // Standard Error: 1_443 + .saturating_add(Weight::from_parts(1_617_214, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -157,25 +159,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 14_243_000 picoseconds. + Weight::from_parts(15_228_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `149` + // Estimated: `1634` + // Minimum execution time: 130_925_320_000 picoseconds. + Weight::from_parts(132_045_811_000, 0) + .saturating_add(Weight::from_parts(0, 1634)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs index 7db371d6af93..b8a7a78dab85 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=bridge-hub-rococo-dev -// --wasm-execution=compiled -// --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,22 +56,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_956_000 picoseconds. - Weight::from_parts(2_974_450, 0) + // Minimum execution time: 3_654_000 picoseconds. + Weight::from_parts(6_142_493, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(380, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_432_000 picoseconds. - Weight::from_parts(7_686_000, 0) + // Minimum execution time: 8_952_000 picoseconds. + Weight::from_parts(31_116_786, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_767, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_386, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -80,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_715_000 picoseconds. - Weight::from_parts(3_983_000, 0) + // Minimum execution time: 6_091_000 picoseconds. + Weight::from_parts(6_485_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -100,11 +101,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `119` - // Estimated: `1604` - // Minimum execution time: 99_688_458_000 picoseconds. - Weight::from_parts(103_623_061_000, 0) - .saturating_add(Weight::from_parts(0, 1604)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 124_822_265_000 picoseconds. + Weight::from_parts(126_580_793_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -115,11 +116,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_318_000 picoseconds. - Weight::from_parts(2_421_000, 0) + // Minimum execution time: 3_594_000 picoseconds. + Weight::from_parts(3_794_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_168 - .saturating_add(Weight::from_parts(765_555, 0).saturating_mul(i.into())) + // Standard Error: 799 + .saturating_add(Weight::from_parts(942_127, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -129,11 +130,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_228_000, 0) + // Minimum execution time: 3_630_000 picoseconds. + Weight::from_parts(3_769_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 951 - .saturating_add(Weight::from_parts(569_773, 0).saturating_mul(i.into())) + // Standard Error: 907 + .saturating_add(Weight::from_parts(735_591, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -141,13 +142,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `68 + p * (69 ±0)` - // Estimated: `71 + p * (70 ±0)` - // Minimum execution time: 3_795_000 picoseconds. - Weight::from_parts(3_895_000, 0) - .saturating_add(Weight::from_parts(0, 71)) - // Standard Error: 1_869 - .saturating_add(Weight::from_parts(1_209_251, 0).saturating_mul(p.into())) + // Measured: `66 + p * (69 ±0)` + // Estimated: `83 + p * (70 ±0)` + // Minimum execution time: 6_720_000 picoseconds. + Weight::from_parts(6_988_000, 0) + .saturating_add(Weight::from_parts(0, 83)) + // Standard Error: 1_480 + .saturating_add(Weight::from_parts(1_621_666, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -158,25 +159,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 14_190_000 picoseconds. + Weight::from_parts(14_593_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `149` + // Estimated: `1634` + // Minimum execution time: 131_076_470_000 picoseconds. + Weight::from_parts(132_064_451_000, 0) + .saturating_add(Weight::from_parts(0, 1634)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs index f43c5e0a40b6..81b92db7f9f3 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs @@ -1,42 +1,44 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 +// This file is part of Cumulus. -// 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. +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=collectives-polkadot-dev -// --wasm-execution=compiled -// --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/release/wbuild/collectives-westend-runtime/collectives_westend_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/collectives/collectives-westend/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,22 +56,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_926_000 picoseconds. - Weight::from_parts(1_929_666, 0) + // Minimum execution time: 3_589_000 picoseconds. + Weight::from_parts(3_495_703, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(395, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_221_000 picoseconds. - Weight::from_parts(34_449_539, 0) + // Minimum execution time: 9_473_000 picoseconds. + Weight::from_parts(21_583_193, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_706, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_405, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -79,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_681_000 picoseconds. - Weight::from_parts(3_857_000, 0) + // Minimum execution time: 6_113_000 picoseconds. + Weight::from_parts(6_447_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -99,11 +101,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `156` - // Estimated: `1641` - // Minimum execution time: 101_899_621_000 picoseconds. - Weight::from_parts(106_377_672_000, 0) - .saturating_add(Weight::from_parts(0, 1641)) + // Measured: `164` + // Estimated: `1649` + // Minimum execution time: 125_032_713_000 picoseconds. + Weight::from_parts(126_083_581_000, 0) + .saturating_add(Weight::from_parts(0, 1649)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -114,11 +116,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_039_000 picoseconds. - Weight::from_parts(2_094_000, 0) + // Minimum execution time: 3_527_000 picoseconds. + Weight::from_parts(608_901, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_124 - .saturating_add(Weight::from_parts(754_465, 0).saturating_mul(i.into())) + // Standard Error: 1_343 + .saturating_add(Weight::from_parts(950_299, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -128,11 +130,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_103_000 picoseconds. - Weight::from_parts(2_182_000, 0) + // Minimum execution time: 3_498_000 picoseconds. + Weight::from_parts(3_636_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_031 - .saturating_add(Weight::from_parts(570_563, 0).saturating_mul(i.into())) + // Standard Error: 990 + .saturating_add(Weight::from_parts(744_369, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -140,13 +142,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `82 + p * (69 ±0)` - // Estimated: `78 + p * (70 ±0)` - // Minimum execution time: 3_728_000 picoseconds. - Weight::from_parts(3_836_000, 0) - .saturating_add(Weight::from_parts(0, 78)) - // Standard Error: 1_802 - .saturating_add(Weight::from_parts(1_199_345, 0).saturating_mul(p.into())) + // Measured: `113 + p * (69 ±0)` + // Estimated: `107 + p * (70 ±0)` + // Minimum execution time: 6_508_000 picoseconds. + Weight::from_parts(6_609_000, 0) + .saturating_add(Weight::from_parts(0, 107)) + // Standard Error: 1_482 + .saturating_add(Weight::from_parts(1_617_365, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -157,25 +159,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 14_939_000 picoseconds. + Weight::from_parts(15_420_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `186` + // Estimated: `1671` + // Minimum execution time: 130_872_160_000 picoseconds. + Weight::from_parts(132_364_830_000, 0) + .saturating_add(Weight::from_parts(0, 1671)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs new file mode 100644 index 000000000000..fcd2582d91e8 --- /dev/null +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs @@ -0,0 +1,193 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + /// The range of component `b` is `[0, 3932160]`. + fn remark(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_657_000 picoseconds. + Weight::from_parts(2_735_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 0 + .saturating_add(Weight::from_parts(392, 0).saturating_mul(b.into())) + } + /// The range of component `b` is `[0, 3932160]`. + fn remark_with_event(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_983_000 picoseconds. + Weight::from_parts(24_213_093, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_400, 0).saturating_mul(b.into())) + } + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + fn set_heap_pages() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 4_755_000 picoseconds. + Weight::from_parts(5_101_000, 0) + .saturating_add(Weight::from_parts(0, 1485)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn set_code() -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `1591` + // Minimum execution time: 124_581_442_000 picoseconds. + Weight::from_parts(125_375_451_000, 0) + .saturating_add(Weight::from_parts(0, 1591)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `i` is `[0, 1000]`. + fn set_storage(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_746_000 picoseconds. + Weight::from_parts(2_898_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 943 + .saturating_add(Weight::from_parts(947_175, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `i` is `[0, 1000]`. + fn kill_storage(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_847_000 picoseconds. + Weight::from_parts(2_937_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 890 + .saturating_add(Weight::from_parts(736_211, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `p` is `[0, 1000]`. + fn kill_prefix(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `17 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_407_000 picoseconds. + Weight::from_parts(4_576_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 1_252 + .saturating_add(Weight::from_parts(1_613_624, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) + } + /// Storage: `System::AuthorizedUpgrade` (r:0 w:1) + /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + fn authorize_upgrade() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 14_075_000 picoseconds. + Weight::from_parts(14_388_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) + /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn apply_authorized_upgrade() -> Weight { + // Proof Size summary in bytes: + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 130_631_384_000 picoseconds. + Weight::from_parts(131_416_815_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs index 428976e3e036..3596c7941a45 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs @@ -16,28 +16,31 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-01-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=coretime-rococo-dev -// --wasm-execution=compiled -// --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/release/wbuild/coretime-rococo-runtime/coretime_rococo_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,22 +58,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_760_000 picoseconds. - Weight::from_parts(6_086_623, 0) + // Minimum execution time: 2_744_000 picoseconds. + Weight::from_parts(2_066_252, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(430, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(384, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_315_000 picoseconds. - Weight::from_parts(20_446_491, 0) + // Minimum execution time: 7_880_000 picoseconds. + Weight::from_parts(18_574_050, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_725, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_394, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -80,8 +83,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_046_000 picoseconds. - Weight::from_parts(3_249_000, 0) + // Minimum execution time: 5_104_000 picoseconds. + Weight::from_parts(5_629_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -100,11 +103,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `164` - // Estimated: `1649` - // Minimum execution time: 108_366_941_000 picoseconds. - Weight::from_parts(111_101_742_000, 0) - .saturating_add(Weight::from_parts(0, 1649)) + // Measured: `106` + // Estimated: `1591` + // Minimum execution time: 123_250_392_000 picoseconds. + Weight::from_parts(125_327_078_000, 0) + .saturating_add(Weight::from_parts(0, 1591)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -115,11 +118,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_877_000 picoseconds. - Weight::from_parts(1_947_000, 0) + // Minimum execution time: 2_789_000 picoseconds. + Weight::from_parts(2_965_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_035 - .saturating_add(Weight::from_parts(763_800, 0).saturating_mul(i.into())) + // Standard Error: 1_001 + .saturating_add(Weight::from_parts(939_233, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -129,11 +132,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_847_000 picoseconds. - Weight::from_parts(1_931_000, 0) + // Minimum execution time: 2_861_000 picoseconds. + Weight::from_parts(2_959_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 932 - .saturating_add(Weight::from_parts(565_066, 0).saturating_mul(i.into())) + // Standard Error: 840 + .saturating_add(Weight::from_parts(737_161, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -141,13 +144,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `71 + p * (69 ±0)` - // Estimated: `72 + p * (70 ±0)` - // Minimum execution time: 3_587_000 picoseconds. - Weight::from_parts(3_654_000, 0) - .saturating_add(Weight::from_parts(0, 72)) - // Standard Error: 1_468 - .saturating_add(Weight::from_parts(1_170_655, 0).saturating_mul(p.into())) + // Measured: `17 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_646_000 picoseconds. + Weight::from_parts(4_716_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 1_344 + .saturating_add(Weight::from_parts(1_610_852, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -158,8 +161,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_701_000 picoseconds. - Weight::from_parts(10_142_000, 0) + // Minimum execution time: 13_460_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -179,11 +182,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `186` - // Estimated: `1671` - // Minimum execution time: 113_812_980_000 picoseconds. - Weight::from_parts(115_758_263_000, 0) - .saturating_add(Weight::from_parts(0, 1671)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 129_596_420_000 picoseconds. + Weight::from_parts(130_231_283_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs index b4b7cbf05a5e..0e60e1a289b4 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs @@ -17,27 +17,30 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-02-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=coretime-westend-dev -// --wasm-execution=compiled -// --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/release/wbuild/coretime-westend-runtime/coretime_westend_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/coretime/coretime-westend/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,22 +58,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_584_000 picoseconds. - Weight::from_parts(2_117_975, 0) + // Minimum execution time: 2_801_000 picoseconds. + Weight::from_parts(10_049_977, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(384, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(442, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_607_000 picoseconds. - Weight::from_parts(14_948_582, 0) + // Minimum execution time: 7_604_000 picoseconds. + Weight::from_parts(36_853_712, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_673, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_447, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -80,8 +83,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_681_000 picoseconds. - Weight::from_parts(2_877_000, 0) + // Minimum execution time: 4_870_000 picoseconds. + Weight::from_parts(5_204_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -100,11 +103,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `164` - // Estimated: `1649` - // Minimum execution time: 95_893_701_000 picoseconds. - Weight::from_parts(98_086_094_000, 0) - .saturating_add(Weight::from_parts(0, 1649)) + // Measured: `106` + // Estimated: `1591` + // Minimum execution time: 123_025_571_000 picoseconds. + Weight::from_parts(124_622_088_000, 0) + .saturating_add(Weight::from_parts(0, 1591)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -115,11 +118,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_597_000 picoseconds. - Weight::from_parts(1_660_000, 0) + // Minimum execution time: 2_686_000 picoseconds. + Weight::from_parts(2_776_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_871 - .saturating_add(Weight::from_parts(748_346, 0).saturating_mul(i.into())) + // Standard Error: 845 + .saturating_add(Weight::from_parts(952_828, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -129,11 +132,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_625_000 picoseconds. - Weight::from_parts(1_669_000, 0) + // Minimum execution time: 2_691_000 picoseconds. + Weight::from_parts(2_841_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 903 - .saturating_add(Weight::from_parts(561_709, 0).saturating_mul(i.into())) + // Standard Error: 852 + .saturating_add(Weight::from_parts(745_428, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -141,13 +144,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `71 + p * (69 ±0)` - // Estimated: `72 + p * (70 ±0)` - // Minimum execution time: 3_306_000 picoseconds. - Weight::from_parts(3_412_000, 0) - .saturating_add(Weight::from_parts(0, 72)) - // Standard Error: 1_366 - .saturating_add(Weight::from_parts(1_138_953, 0).saturating_mul(p.into())) + // Measured: `17 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_443_000 picoseconds. + Weight::from_parts(4_713_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 1_451 + .saturating_add(Weight::from_parts(1_623_216, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -158,8 +161,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_834_000 picoseconds. - Weight::from_parts(8_344_000, 0) + // Minimum execution time: 13_421_000 picoseconds. + Weight::from_parts(14_150_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -179,11 +182,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `186` - // Estimated: `1671` - // Minimum execution time: 98_682_277_000 picoseconds. - Weight::from_parts(101_609_257_000, 0) - .saturating_add(Weight::from_parts(0, 1671)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 127_653_677_000 picoseconds. + Weight::from_parts(129_158_916_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs index b68f16c98658..acd8eae56d17 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs @@ -16,26 +16,30 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-yprdrvc7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("glutton-westend-dev-1300")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --steps=50 -// --repeat=20 // --extrinsic=* +// --runtime=target/release/wbuild/glutton-westend-runtime/glutton_westend_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/glutton/glutton-westend/src/weights // --wasm-execution=compiled +// --steps=50 +// --repeat=20 // --heap-pages=4096 -// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json -// --pallet=frame_system -// --chain=glutton-westend-dev-1300 -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/ +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,22 +57,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_570_000 picoseconds. - Weight::from_parts(1_626_000, 0) + // Minimum execution time: 2_777_000 picoseconds. + Weight::from_parts(4_101_813, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(448, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_200_000 picoseconds. - Weight::from_parts(4_262_000, 0) + // Minimum execution time: 7_470_000 picoseconds. + Weight::from_parts(27_543_265, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 4 - .saturating_add(Weight::from_parts(1_791, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_452, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -78,8 +82,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_680_000 picoseconds. - Weight::from_parts(2_936_000, 0) + // Minimum execution time: 4_804_000 picoseconds. + Weight::from_parts(5_122_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -98,11 +102,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 119_097_302_000 picoseconds. - Weight::from_parts(120_914_576_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) + // Measured: `106` + // Estimated: `1591` + // Minimum execution time: 124_015_557_000 picoseconds. + Weight::from_parts(125_310_656_000, 0) + .saturating_add(Weight::from_parts(0, 1591)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -113,11 +117,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_606_000 picoseconds. - Weight::from_parts(1_704_000, 0) + // Minimum execution time: 2_780_000 picoseconds. + Weight::from_parts(2_908_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_090 - .saturating_add(Weight::from_parts(765_829, 0).saturating_mul(i.into())) + // Standard Error: 762 + .saturating_add(Weight::from_parts(938_307, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -127,11 +131,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_646_000 picoseconds. - Weight::from_parts(1_719_000, 0) + // Minimum execution time: 2_833_000 picoseconds. + Weight::from_parts(2_888_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_067 - .saturating_add(Weight::from_parts(578_598, 0).saturating_mul(i.into())) + // Standard Error: 857 + .saturating_add(Weight::from_parts(735_140, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -139,13 +143,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `58 + p * (69 ±0)` - // Estimated: `53 + p * (70 ±0)` - // Minimum execution time: 2_933_000 picoseconds. - Weight::from_parts(3_069_000, 0) - .saturating_add(Weight::from_parts(0, 53)) - // Standard Error: 1_844 - .saturating_add(Weight::from_parts(1_214_377, 0).saturating_mul(p.into())) + // Measured: `23 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_541_000 picoseconds. + Weight::from_parts(4_714_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 1_363 + .saturating_add(Weight::from_parts(1_615_617, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -156,25 +160,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 13_332_000 picoseconds. + Weight::from_parts(13_876_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 128_737_877_000 picoseconds. + Weight::from_parts(130_471_394_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs index 495903a4669e..d1eadf3188bc 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs @@ -1,40 +1,46 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 +// This file is part of Cumulus. -// 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. +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("people-kusama-dev"), DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=people-kusama-dev -// --execution=wasm -// --wasm-execution=compiled -// --pallet=frame_system // --extrinsic=* +// --runtime=target/release/wbuild/people-rococo-runtime/people_rococo_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./cumulus/parachains/runtimes/people/people-kusama/src/weights/frame_system.rs +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -52,80 +58,99 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_356_000 picoseconds. - Weight::from_parts(1_100_689, 0) + // Minimum execution time: 2_763_000 picoseconds. + Weight::from_parts(2_966_888, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(412, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(380, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_879_000 picoseconds. - Weight::from_parts(8_041_000, 0) + // Minimum execution time: 7_924_000 picoseconds. + Weight::from_parts(28_554_454, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_451, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_386, 0).saturating_mul(b.into())) } - fn set_code() -> Weight { - Weight::from_parts(1_000_000, 0) - } - /// Storage: System Digest (r:1 w:1) - /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: unknown `0x3a686561707061676573` (r:0 w:1) - /// Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_358_000 picoseconds. - Weight::from_parts(4_537_000, 0) + // Minimum execution time: 5_174_000 picoseconds. + Weight::from_parts(5_474_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn set_code() -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `1591` + // Minimum execution time: 124_375_910_000 picoseconds. + Weight::from_parts(125_777_716_000, 0) + .saturating_add(Weight::from_parts(0, 1591)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_373_000 picoseconds. - Weight::from_parts(2_395_000, 0) + // Minimum execution time: 2_823_000 picoseconds. + Weight::from_parts(3_010_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_727 - .saturating_add(Weight::from_parts(690_266, 0).saturating_mul(i.into())) + // Standard Error: 910 + .saturating_add(Weight::from_parts(946_628, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_513_000 picoseconds. - Weight::from_parts(2_540_000, 0) + // Minimum execution time: 2_941_000 picoseconds. + Weight::from_parts(3_016_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 815 - .saturating_add(Weight::from_parts(505_090, 0).saturating_mul(i.into())) + // Standard Error: 925 + .saturating_add(Weight::from_parts(737_563, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `68 + p * (69 ±0)` - // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 4_242_000 picoseconds. - Weight::from_parts(4_308_000, 0) - .saturating_add(Weight::from_parts(0, 66)) - // Standard Error: 1_130 - .saturating_add(Weight::from_parts(1_032_054, 0).saturating_mul(p.into())) + // Measured: `17 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_604_000 picoseconds. + Weight::from_parts(4_766_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 1_499 + .saturating_add(Weight::from_parts(1_615_989, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -136,25 +161,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 14_013_000 picoseconds. + Weight::from_parts(14_698_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 129_500_670_000 picoseconds. + Weight::from_parts(130_232_350_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs index d763fe1c4261..24583299979e 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs @@ -1,40 +1,46 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 +// This file is part of Cumulus. -// 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. +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("people-polkadot-dev"), DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=people-polkadot-dev -// --execution=wasm -// --wasm-execution=compiled -// --pallet=frame_system // --extrinsic=* +// --runtime=target/release/wbuild/people-westend-runtime/people_westend_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-westend/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./cumulus/parachains/runtimes/people/people-polkadot/src/weights/frame_system.rs +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -52,80 +58,99 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_432_000 picoseconds. - Weight::from_parts(2_458_000, 0) + // Minimum execution time: 2_766_000 picoseconds. + Weight::from_parts(2_852_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(367, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(386, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_911_000 picoseconds. - Weight::from_parts(8_031_000, 0) + // Minimum execution time: 7_770_000 picoseconds. + Weight::from_parts(26_784_051, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_405, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_395, 0).saturating_mul(b.into())) } - /// Storage: System Digest (r:1 w:1) - /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: unknown `0x3a686561707061676573` (r:0 w:1) - /// Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_304_000 picoseconds. - Weight::from_parts(4_553_000, 0) + // Minimum execution time: 4_987_000 picoseconds. + Weight::from_parts(5_274_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { - Weight::from_parts(1_000_000, 0) + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `1591` + // Minimum execution time: 122_695_835_000 picoseconds. + Weight::from_parts(124_623_525_000, 0) + .saturating_add(Weight::from_parts(0, 1591)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_493_000 picoseconds. - Weight::from_parts(2_523_000, 0) + // Minimum execution time: 2_731_000 picoseconds. + Weight::from_parts(2_833_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_594 - .saturating_add(Weight::from_parts(663_439, 0).saturating_mul(i.into())) + // Standard Error: 821 + .saturating_add(Weight::from_parts(946_782, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_492_000 picoseconds. - Weight::from_parts(2_526_000, 0) + // Minimum execution time: 2_715_000 picoseconds. + Weight::from_parts(2_884_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 784 - .saturating_add(Weight::from_parts(493_844, 0).saturating_mul(i.into())) + // Standard Error: 842 + .saturating_add(Weight::from_parts(743_382, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `68 + p * (69 ±0)` - // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 4_200_000 picoseconds. - Weight::from_parts(4_288_000, 0) - .saturating_add(Weight::from_parts(0, 66)) - // Standard Error: 1_195 - .saturating_add(Weight::from_parts(1_021_563, 0).saturating_mul(p.into())) + // Measured: `17 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_451_000 picoseconds. + Weight::from_parts(4_592_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 1_393 + .saturating_add(Weight::from_parts(1_612_887, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -136,25 +161,33 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 13_609_000 picoseconds. + Weight::from_parts(14_039_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 128_040_477_000 picoseconds. + Weight::from_parts(129_804_744_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } diff --git a/polkadot/runtime/rococo/src/weights/frame_system.rs b/polkadot/runtime/rococo/src/weights/frame_system.rs index 1742a761ca77..8dde104ccc5a 100644 --- a/polkadot/runtime/rococo/src/weights/frame_system.rs +++ b/polkadot/runtime/rococo/src/weights/frame_system.rs @@ -17,27 +17,28 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-02-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=rococo-dev +// --extrinsic=* +// --runtime=target/release/wbuild/rococo-runtime/rococo_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt +// --output=./polkadot/runtime/rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --pallet=frame_system -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --header=./polkadot/file_header.txt -// --output=./polkadot/runtime/rococo/src/weights/ +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,22 +56,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_541_000 picoseconds. - Weight::from_parts(2_581_470, 0) + // Minimum execution time: 4_054_000 picoseconds. + Weight::from_parts(2_653_801, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(395, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_060_000 picoseconds. - Weight::from_parts(5_167_000, 0) + // Minimum execution time: 10_008_000 picoseconds. + Weight::from_parts(24_351_449, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_696, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_404, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -80,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_649_000 picoseconds. - Weight::from_parts(2_909_000, 0) + // Minimum execution time: 6_868_000 picoseconds. + Weight::from_parts(7_098_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -94,8 +95,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 88_417_540_000 picoseconds. - Weight::from_parts(91_809_291_000, 0) + // Minimum execution time: 122_943_408_000 picoseconds. + Weight::from_parts(123_603_986_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -107,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_538_000 picoseconds. - Weight::from_parts(1_589_000, 0) + // Minimum execution time: 4_002_000 picoseconds. + Weight::from_parts(4_069_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_740 - .saturating_add(Weight::from_parts(730_941, 0).saturating_mul(i.into())) + // Standard Error: 826 + .saturating_add(Weight::from_parts(961_066, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -121,11 +122,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_567_000 picoseconds. - Weight::from_parts(1_750_000, 0) + // Minimum execution time: 4_036_000 picoseconds. + Weight::from_parts(4_190_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 835 - .saturating_add(Weight::from_parts(543_218, 0).saturating_mul(i.into())) + // Standard Error: 1_076 + .saturating_add(Weight::from_parts(737_434, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -135,11 +136,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `80 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_412_000 picoseconds. - Weight::from_parts(3_448_000, 0) + // Minimum execution time: 7_369_000 picoseconds. + Weight::from_parts(7_498_000, 0) .saturating_add(Weight::from_parts(0, 83)) - // Standard Error: 1_395 - .saturating_add(Weight::from_parts(1_142_347, 0).saturating_mul(p.into())) + // Standard Error: 1_545 + .saturating_add(Weight::from_parts(1_617_904, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -150,8 +151,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_178_000 picoseconds. - Weight::from_parts(9_780_000, 0) + // Minimum execution time: 15_434_000 picoseconds. + Weight::from_parts(16_165_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -165,8 +166,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `22` // Estimated: `1518` - // Minimum execution time: 94_523_563_000 picoseconds. - Weight::from_parts(96_983_131_000, 0) + // Minimum execution time: 129_632_750_000 picoseconds. + Weight::from_parts(130_056_126_000, 0) .saturating_add(Weight::from_parts(0, 1518)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/polkadot/runtime/westend/src/weights/frame_system.rs b/polkadot/runtime/westend/src/weights/frame_system.rs index f679be517151..ec4315e20af3 100644 --- a/polkadot/runtime/westend/src/weights/frame_system.rs +++ b/polkadot/runtime/westend/src/weights/frame_system.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-06-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner--ss9ysm1-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=westend-dev +// --extrinsic=* +// --runtime=target/release/wbuild/westend-runtime/westend_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt +// --output=./polkadot/runtime/westend/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --pallet=frame_system -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --header=./file_header.txt -// --output=./runtime/westend/src/weights/ +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,91 +56,91 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_050_000 picoseconds. - Weight::from_parts(2_094_000, 0) + // Minimum execution time: 3_899_000 picoseconds. + Weight::from_parts(4_189_159, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(490, 0).saturating_mul(b.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(386, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_620_000 picoseconds. - Weight::from_parts(7_824_000, 0) + // Minimum execution time: 9_997_000 picoseconds. + Weight::from_parts(20_688_715, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 6 - .saturating_add(Weight::from_parts(2_180, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_398, 0).saturating_mul(b.into())) } - /// Storage: System Digest (r:1 w:1) - /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: unknown `0x3a686561707061676573` (r:0 w:1) - /// Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_746_000 picoseconds. - Weight::from_parts(4_096_000, 0) + // Minimum execution time: 6_739_000 picoseconds. + Weight::from_parts(7_168_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: System Digest (r:1 w:1) - /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: unknown `0x3a636f6465` (r:0 w:1) - /// Proof Skipped: unknown `0x3a636f6465` (r:0 w:1) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn set_code() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 120_822_538_000 picoseconds. - Weight::from_parts(128_806_623_000, 0) + // Minimum execution time: 124_386_135_000 picoseconds. + Weight::from_parts(124_937_568_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_198_000, 0) + // Minimum execution time: 3_870_000 picoseconds. + Weight::from_parts(4_015_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_376 - .saturating_add(Weight::from_parts(824_994, 0).saturating_mul(i.into())) + // Standard Error: 841 + .saturating_add(Weight::from_parts(952_584, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_110_000 picoseconds. - Weight::from_parts(2_200_000, 0) + // Minimum execution time: 3_772_000 picoseconds. + Weight::from_parts(3_913_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_859 - .saturating_add(Weight::from_parts(630_789, 0).saturating_mul(i.into())) + // Standard Error: 968 + .saturating_add(Weight::from_parts(729_754, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `132 + p * (69 ±0)` - // Estimated: `107 + p * (70 ±0)` - // Minimum execution time: 4_151_000 picoseconds. - Weight::from_parts(4_226_000, 0) - .saturating_add(Weight::from_parts(0, 107)) - // Standard Error: 4_953 - .saturating_add(Weight::from_parts(1_418_957, 0).saturating_mul(p.into())) + // Measured: `75 + p * (69 ±0)` + // Estimated: `82 + p * (70 ±0)` + // Minimum execution time: 7_019_000 picoseconds. + Weight::from_parts(7_120_000, 0) + .saturating_add(Weight::from_parts(0, 82)) + // Standard Error: 1_405 + .saturating_add(Weight::from_parts(1_628_558, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -150,8 +151,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 33_027_000 picoseconds. - Weight::from_parts(33_027_000, 0) + // Minimum execution time: 15_887_000 picoseconds. + Weight::from_parts(16_871_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -165,8 +166,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `22` // Estimated: `1518` - // Minimum execution time: 118_101_992_000 picoseconds. - Weight::from_parts(118_101_992_000, 0) + // Minimum execution time: 129_281_835_000 picoseconds. + Weight::from_parts(130_595_229_000, 0) .saturating_add(Weight::from_parts(0, 1518)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/substrate/frame/system/src/weights.rs b/substrate/frame/system/src/weights.rs index fca14e452657..ce48d44ca3aa 100644 --- a/substrate/frame/system/src/weights.rs +++ b/substrate/frame/system/src/weights.rs @@ -18,28 +18,31 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-anb7yjbi-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// ./target/production/substrate-node +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=dev +// --extrinsic=* +// --runtime=target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm +// --pallet=frame_system +// --header=/__w/polkadot-sdk/polkadot-sdk/substrate/HEADER-APACHE2 +// --output=/__w/polkadot-sdk/polkadot-sdk/substrate/frame/system/src/weights.rs +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --pallet=frame_system +// --heap-pages=4096 +// --template=substrate/.maintain/frame-weight-template.hbs // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./substrate/frame/system/src/weights.rs -// --header=./substrate/HEADER-APACHE2 -// --template=./substrate/.maintain/frame-weight-template.hbs +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -70,20 +73,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_078_000 picoseconds. - Weight::from_parts(1_137_744, 0) + // Minimum execution time: 2_738_000 picoseconds. + Weight::from_parts(2_576_756, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(393, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_980_000 picoseconds. - Weight::from_parts(2_562_415, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_391, 0).saturating_mul(b.into())) + // Minimum execution time: 7_720_000 picoseconds. + Weight::from_parts(17_054_712, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_407, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -93,8 +96,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_834_000 picoseconds. - Weight::from_parts(4_109_000, 1485) + // Minimum execution time: 5_836_000 picoseconds. + Weight::from_parts(6_133_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -106,10 +109,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 81_326_496_000 picoseconds. - Weight::from_parts(81_880_651_000, 67035) + // Minimum execution time: 122_859_747_000 picoseconds. + Weight::from_parts(123_966_163_000, 67035) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -120,10 +123,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_059_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 720 - .saturating_add(Weight::from_parts(742_610, 0).saturating_mul(i.into())) + // Minimum execution time: 2_718_000 picoseconds. + Weight::from_parts(2_794_000, 0) + // Standard Error: 771 + .saturating_add(Weight::from_parts(937_068, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -133,10 +136,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 774 - .saturating_add(Weight::from_parts(569_424, 0).saturating_mul(i.into())) + // Minimum execution time: 2_767_000 picoseconds. + Weight::from_parts(2_903_000, 0) + // Standard Error: 881 + .saturating_add(Weight::from_parts(731_528, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -144,12 +147,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `127 + p * (69 ±0)` - // Estimated: `134 + p * (70 ±0)` - // Minimum execution time: 3_990_000 picoseconds. - Weight::from_parts(4_172_000, 134) - // Standard Error: 1_485 - .saturating_add(Weight::from_parts(1_227_281, 0).saturating_mul(p.into())) + // Measured: `17 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_542_000 picoseconds. + Weight::from_parts(4_670_000, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(1_619_220, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -160,8 +163,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_851_000 picoseconds. - Weight::from_parts(9_643_000, 0) + // Minimum execution time: 13_355_000 picoseconds. + Weight::from_parts(14_069_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) @@ -174,10 +177,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `164` + // Measured: `21` // Estimated: `67035` - // Minimum execution time: 86_295_879_000 picoseconds. - Weight::from_parts(87_636_595_000, 67035) + // Minimum execution time: 127_834_147_000 picoseconds. + Weight::from_parts(129_695_644_000, 67035) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -190,20 +193,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_078_000 picoseconds. - Weight::from_parts(1_137_744, 0) + // Minimum execution time: 2_738_000 picoseconds. + Weight::from_parts(2_576_756, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(393, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_980_000 picoseconds. - Weight::from_parts(2_562_415, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_391, 0).saturating_mul(b.into())) + // Minimum execution time: 7_720_000 picoseconds. + Weight::from_parts(17_054_712, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_407, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -213,8 +216,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_834_000 picoseconds. - Weight::from_parts(4_109_000, 1485) + // Minimum execution time: 5_836_000 picoseconds. + Weight::from_parts(6_133_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -226,10 +229,10 @@ impl WeightInfo for () { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 81_326_496_000 picoseconds. - Weight::from_parts(81_880_651_000, 67035) + // Minimum execution time: 122_859_747_000 picoseconds. + Weight::from_parts(123_966_163_000, 67035) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -240,10 +243,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_059_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 720 - .saturating_add(Weight::from_parts(742_610, 0).saturating_mul(i.into())) + // Minimum execution time: 2_718_000 picoseconds. + Weight::from_parts(2_794_000, 0) + // Standard Error: 771 + .saturating_add(Weight::from_parts(937_068, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -253,10 +256,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 774 - .saturating_add(Weight::from_parts(569_424, 0).saturating_mul(i.into())) + // Minimum execution time: 2_767_000 picoseconds. + Weight::from_parts(2_903_000, 0) + // Standard Error: 881 + .saturating_add(Weight::from_parts(731_528, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -264,12 +267,12 @@ impl WeightInfo for () { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `127 + p * (69 ±0)` - // Estimated: `134 + p * (70 ±0)` - // Minimum execution time: 3_990_000 picoseconds. - Weight::from_parts(4_172_000, 134) - // Standard Error: 1_485 - .saturating_add(Weight::from_parts(1_227_281, 0).saturating_mul(p.into())) + // Measured: `17 + p * (69 ±0)` + // Estimated: `0 + p * (70 ±0)` + // Minimum execution time: 4_542_000 picoseconds. + Weight::from_parts(4_670_000, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(1_619_220, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -280,8 +283,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_851_000 picoseconds. - Weight::from_parts(9_643_000, 0) + // Minimum execution time: 13_355_000 picoseconds. + Weight::from_parts(14_069_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) @@ -294,10 +297,10 @@ impl WeightInfo for () { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `164` + // Measured: `21` // Estimated: `67035` - // Minimum execution time: 86_295_879_000 picoseconds. - Weight::from_parts(87_636_595_000, 67035) + // Minimum execution time: 127_834_147_000 picoseconds. + Weight::from_parts(129_695_644_000, 67035) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } From 906f15030faeb1f77823db2dabfb9b9f35148cb0 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 14:13:17 +0900 Subject: [PATCH 25/40] Revert "Update from gui1117 running command 'bench --pallet frame_system --clean'" This reverts commit eebb5c74dfe30276eb70c8cad133f28bce7f2be5. --- .../src/weights/frame_system.rs | 121 +++++------ .../src/weights/frame_system.rs | 144 ++++++------- .../src/weights/frame_system.rs | 146 ++++++------- .../src/weights/frame_system.rs | 121 +++++------ .../src/weights/frame_system.rs | 146 ++++++------- .../src/weights/frame_system.rs | 193 ------------------ .../src/weights/frame_system.rs | 101 +++++---- .../src/weights/frame_system.rs | 101 +++++---- .../src/weights/frame_system.rs | 120 +++++------ .../people-rococo/src/weights/frame_system.rs | 181 +++++++--------- .../src/weights/frame_system.rs | 177 +++++++--------- .../rococo/src/weights/frame_system.rs | 79 ++++--- .../westend/src/weights/frame_system.rs | 117 ++++++----- substrate/frame/system/src/weights.rs | 153 +++++++------- 14 files changed, 785 insertions(+), 1115 deletions(-) delete mode 100644 cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs index eb5d6365e03b..b257c3825a7e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system.rs @@ -16,29 +16,28 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights +// --chain=asset-hub-rococo-dev // --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes +// --no-min-squares +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,22 +55,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_748_000 picoseconds. - Weight::from_parts(2_229_977, 0) + // Minimum execution time: 2_106_000 picoseconds. + Weight::from_parts(1_884_213, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(395, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_921_000 picoseconds. - Weight::from_parts(28_573_508, 0) + // Minimum execution time: 7_528_000 picoseconds. + Weight::from_parts(27_081_927, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_400, 0).saturating_mul(b.into())) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_730, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -81,8 +80,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_391_000 picoseconds. - Weight::from_parts(6_596_000, 0) + // Minimum execution time: 3_882_000 picoseconds. + Weight::from_parts(4_149_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,11 +100,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `164` - // Estimated: `1649` - // Minimum execution time: 124_591_204_000 picoseconds. - Weight::from_parts(125_778_305_000, 0) - .saturating_add(Weight::from_parts(0, 1649)) + // Measured: `119` + // Estimated: `1604` + // Minimum execution time: 103_389_161_000 picoseconds. + Weight::from_parts(106_870_091_000, 0) + .saturating_add(Weight::from_parts(0, 1604)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -116,11 +115,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_710_000 picoseconds. - Weight::from_parts(3_758_000, 0) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_302_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 789 - .saturating_add(Weight::from_parts(941_726, 0).saturating_mul(i.into())) + // Standard Error: 2_045 + .saturating_add(Weight::from_parts(763_456, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -130,11 +129,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_704_000 picoseconds. - Weight::from_parts(3_815_000, 0) + // Minimum execution time: 2_175_000 picoseconds. + Weight::from_parts(2_238_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 899 - .saturating_add(Weight::from_parts(738_508, 0).saturating_mul(i.into())) + // Standard Error: 1_040 + .saturating_add(Weight::from_parts(571_397, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -142,13 +141,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `83 + p * (69 ±0)` - // Estimated: `96 + p * (70 ±0)` - // Minimum execution time: 6_758_000 picoseconds. - Weight::from_parts(6_846_000, 0) - .saturating_add(Weight::from_parts(0, 96)) - // Standard Error: 1_470 - .saturating_add(Weight::from_parts(1_618_292, 0).saturating_mul(p.into())) + // Measured: `84 + p * (69 ±0)` + // Estimated: `80 + p * (70 ±0)` + // Minimum execution time: 3_843_000 picoseconds. + Weight::from_parts(3_947_000, 0) + .saturating_add(Weight::from_parts(0, 80)) + // Standard Error: 2_188 + .saturating_add(Weight::from_parts(1_212_360, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -159,33 +158,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_405_000 picoseconds. - Weight::from_parts(14_837_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `186` - // Estimated: `1671` - // Minimum execution time: 130_730_000_000 picoseconds. - Weight::from_parts(131_578_055_000, 0) - .saturating_add(Weight::from_parts(0, 1671)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs index b8ea9713c9f5..687b87e43915 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system.rs @@ -1,44 +1,42 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. +// SPDX-License-Identifier: Apache-2.0 -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . +// 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. //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-westend-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights +// --chain=asset-hub-westend-dev // --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes +// --no-min-squares +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/asset-hub-westend/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,22 +54,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_534_000 picoseconds. - Weight::from_parts(5_673_017, 0) + // Minimum execution time: 2_105_000 picoseconds. + Weight::from_parts(2_139_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(380, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_014_000 picoseconds. - Weight::from_parts(30_088_184, 0) + // Minimum execution time: 7_540_000 picoseconds. + Weight::from_parts(7_767_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_389, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_730, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -81,8 +79,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_381_000 picoseconds. - Weight::from_parts(6_662_000, 0) + // Minimum execution time: 3_980_000 picoseconds. + Weight::from_parts(4_120_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,11 +99,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `164` - // Estimated: `1649` - // Minimum execution time: 125_594_470_000 picoseconds. - Weight::from_parts(126_838_892_000, 0) - .saturating_add(Weight::from_parts(0, 1649)) + // Measured: `156` + // Estimated: `1641` + // Minimum execution time: 102_511_794_000 picoseconds. + Weight::from_parts(105_688_965_000, 0) + .saturating_add(Weight::from_parts(0, 1641)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -116,11 +114,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_608_000 picoseconds. - Weight::from_parts(3_733_000, 0) + // Minimum execution time: 2_241_000 picoseconds. + Weight::from_parts(2_329_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 756 - .saturating_add(Weight::from_parts(948_225, 0).saturating_mul(i.into())) + // Standard Error: 2_336 + .saturating_add(Weight::from_parts(756_084, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -130,11 +128,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_637_000 picoseconds. - Weight::from_parts(3_724_000, 0) + // Minimum execution time: 2_233_000 picoseconds. + Weight::from_parts(2_295_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 966 - .saturating_add(Weight::from_parts(736_979, 0).saturating_mul(i.into())) + // Standard Error: 990 + .saturating_add(Weight::from_parts(573_213, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -142,13 +140,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `86 + p * (69 ±0)` - // Estimated: `100 + p * (70 ±0)` - // Minimum execution time: 6_552_000 picoseconds. - Weight::from_parts(6_783_000, 0) - .saturating_add(Weight::from_parts(0, 100)) - // Standard Error: 1_351 - .saturating_add(Weight::from_parts(1_623_781, 0).saturating_mul(p.into())) + // Measured: `83 + p * (69 ±0)` + // Estimated: `86 + p * (70 ±0)` + // Minimum execution time: 3_990_000 picoseconds. + Weight::from_parts(4_110_000, 0) + .saturating_add(Weight::from_parts(0, 86)) + // Standard Error: 1_782 + .saturating_add(Weight::from_parts(1_220_573, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -159,33 +157,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_068_000 picoseconds. - Weight::from_parts(14_601_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `186` - // Estimated: `1671` - // Minimum execution time: 130_673_987_000 picoseconds. - Weight::from_parts(131_160_146_000, 0) - .saturating_add(Weight::from_parts(0, 1671)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs index a21dc6c3e9ba..df440a68a36d 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs @@ -1,44 +1,42 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. +// SPDX-License-Identifier: Apache-2.0 -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . +// 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. //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-rococo-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --chain=bridge-hub-rococo-dev // --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes +// --no-min-squares +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,22 +54,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_669_000 picoseconds. - Weight::from_parts(5_581_024, 0) + // Minimum execution time: 1_956_000 picoseconds. + Weight::from_parts(2_974_450, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(381, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_251_000 picoseconds. - Weight::from_parts(24_778_824, 0) + // Minimum execution time: 7_432_000 picoseconds. + Weight::from_parts(7_686_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_390, 0).saturating_mul(b.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_767, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -81,8 +79,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_362_000 picoseconds. - Weight::from_parts(6_964_000, 0) + // Minimum execution time: 3_715_000 picoseconds. + Weight::from_parts(3_983_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,11 +99,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 125_485_347_000 picoseconds. - Weight::from_parts(126_321_597_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) + // Measured: `119` + // Estimated: `1604` + // Minimum execution time: 99_688_458_000 picoseconds. + Weight::from_parts(103_623_061_000, 0) + .saturating_add(Weight::from_parts(0, 1604)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -116,11 +114,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_646_000 picoseconds. - Weight::from_parts(3_786_000, 0) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_421_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 792 - .saturating_add(Weight::from_parts(941_436, 0).saturating_mul(i.into())) + // Standard Error: 2_168 + .saturating_add(Weight::from_parts(765_555, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -130,11 +128,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_598_000 picoseconds. - Weight::from_parts(3_814_000, 0) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_228_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 964 - .saturating_add(Weight::from_parts(737_625, 0).saturating_mul(i.into())) + // Standard Error: 951 + .saturating_add(Weight::from_parts(569_773, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -142,13 +140,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `66 + p * (69 ±0)` - // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 6_702_000 picoseconds. - Weight::from_parts(6_847_000, 0) - .saturating_add(Weight::from_parts(0, 83)) - // Standard Error: 1_443 - .saturating_add(Weight::from_parts(1_617_214, 0).saturating_mul(p.into())) + // Measured: `68 + p * (69 ±0)` + // Estimated: `71 + p * (70 ±0)` + // Minimum execution time: 3_795_000 picoseconds. + Weight::from_parts(3_895_000, 0) + .saturating_add(Weight::from_parts(0, 71)) + // Standard Error: 1_869 + .saturating_add(Weight::from_parts(1_209_251, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -159,33 +157,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_243_000 picoseconds. - Weight::from_parts(15_228_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `149` - // Estimated: `1634` - // Minimum execution time: 130_925_320_000 picoseconds. - Weight::from_parts(132_045_811_000, 0) - .saturating_add(Weight::from_parts(0, 1634)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs index b8a7a78dab85..7db371d6af93 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system.rs @@ -16,29 +16,28 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-rococo-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights +// --chain=bridge-hub-rococo-dev // --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes +// --no-min-squares +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,22 +55,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_654_000 picoseconds. - Weight::from_parts(6_142_493, 0) + // Minimum execution time: 1_956_000 picoseconds. + Weight::from_parts(2_974_450, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(380, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_952_000 picoseconds. - Weight::from_parts(31_116_786, 0) + // Minimum execution time: 7_432_000 picoseconds. + Weight::from_parts(7_686_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_386, 0).saturating_mul(b.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_767, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -81,8 +80,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_091_000 picoseconds. - Weight::from_parts(6_485_000, 0) + // Minimum execution time: 3_715_000 picoseconds. + Weight::from_parts(3_983_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,11 +100,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 124_822_265_000 picoseconds. - Weight::from_parts(126_580_793_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) + // Measured: `119` + // Estimated: `1604` + // Minimum execution time: 99_688_458_000 picoseconds. + Weight::from_parts(103_623_061_000, 0) + .saturating_add(Weight::from_parts(0, 1604)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -116,11 +115,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_594_000 picoseconds. - Weight::from_parts(3_794_000, 0) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_421_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 799 - .saturating_add(Weight::from_parts(942_127, 0).saturating_mul(i.into())) + // Standard Error: 2_168 + .saturating_add(Weight::from_parts(765_555, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -130,11 +129,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_630_000 picoseconds. - Weight::from_parts(3_769_000, 0) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_228_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 907 - .saturating_add(Weight::from_parts(735_591, 0).saturating_mul(i.into())) + // Standard Error: 951 + .saturating_add(Weight::from_parts(569_773, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -142,13 +141,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `66 + p * (69 ±0)` - // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 6_720_000 picoseconds. - Weight::from_parts(6_988_000, 0) - .saturating_add(Weight::from_parts(0, 83)) - // Standard Error: 1_480 - .saturating_add(Weight::from_parts(1_621_666, 0).saturating_mul(p.into())) + // Measured: `68 + p * (69 ±0)` + // Estimated: `71 + p * (70 ±0)` + // Minimum execution time: 3_795_000 picoseconds. + Weight::from_parts(3_895_000, 0) + .saturating_add(Weight::from_parts(0, 71)) + // Standard Error: 1_869 + .saturating_add(Weight::from_parts(1_209_251, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -159,33 +158,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_190_000 picoseconds. - Weight::from_parts(14_593_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `149` - // Estimated: `1634` - // Minimum execution time: 131_076_470_000 picoseconds. - Weight::from_parts(132_064_451_000, 0) - .saturating_add(Weight::from_parts(0, 1634)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs index 81b92db7f9f3..f43c5e0a40b6 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system.rs @@ -1,44 +1,42 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. +// SPDX-License-Identifier: Apache-2.0 -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . +// 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. //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/collectives-westend-runtime/collectives_westend_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/collectives/collectives-westend/src/weights +// --chain=collectives-polkadot-dev // --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes +// --no-min-squares +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,22 +54,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_589_000 picoseconds. - Weight::from_parts(3_495_703, 0) + // Minimum execution time: 1_926_000 picoseconds. + Weight::from_parts(1_929_666, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(395, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_473_000 picoseconds. - Weight::from_parts(21_583_193, 0) + // Minimum execution time: 7_221_000 picoseconds. + Weight::from_parts(34_449_539, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_405, 0).saturating_mul(b.into())) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_706, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -81,8 +79,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_113_000 picoseconds. - Weight::from_parts(6_447_000, 0) + // Minimum execution time: 3_681_000 picoseconds. + Weight::from_parts(3_857_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,11 +99,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `164` - // Estimated: `1649` - // Minimum execution time: 125_032_713_000 picoseconds. - Weight::from_parts(126_083_581_000, 0) - .saturating_add(Weight::from_parts(0, 1649)) + // Measured: `156` + // Estimated: `1641` + // Minimum execution time: 101_899_621_000 picoseconds. + Weight::from_parts(106_377_672_000, 0) + .saturating_add(Weight::from_parts(0, 1641)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -116,11 +114,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_527_000 picoseconds. - Weight::from_parts(608_901, 0) + // Minimum execution time: 2_039_000 picoseconds. + Weight::from_parts(2_094_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_343 - .saturating_add(Weight::from_parts(950_299, 0).saturating_mul(i.into())) + // Standard Error: 2_124 + .saturating_add(Weight::from_parts(754_465, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -130,11 +128,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_498_000 picoseconds. - Weight::from_parts(3_636_000, 0) + // Minimum execution time: 2_103_000 picoseconds. + Weight::from_parts(2_182_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 990 - .saturating_add(Weight::from_parts(744_369, 0).saturating_mul(i.into())) + // Standard Error: 1_031 + .saturating_add(Weight::from_parts(570_563, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -142,13 +140,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `113 + p * (69 ±0)` - // Estimated: `107 + p * (70 ±0)` - // Minimum execution time: 6_508_000 picoseconds. - Weight::from_parts(6_609_000, 0) - .saturating_add(Weight::from_parts(0, 107)) - // Standard Error: 1_482 - .saturating_add(Weight::from_parts(1_617_365, 0).saturating_mul(p.into())) + // Measured: `82 + p * (69 ±0)` + // Estimated: `78 + p * (70 ±0)` + // Minimum execution time: 3_728_000 picoseconds. + Weight::from_parts(3_836_000, 0) + .saturating_add(Weight::from_parts(0, 78)) + // Standard Error: 1_802 + .saturating_add(Weight::from_parts(1_199_345, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -159,33 +157,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_939_000 picoseconds. - Weight::from_parts(15_420_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `186` - // Estimated: `1671` - // Minimum execution time: 130_872_160_000 picoseconds. - Weight::from_parts(132_364_830_000, 0) - .saturating_add(Weight::from_parts(0, 1671)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs deleted file mode 100644 index fcd2582d91e8..000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . - -//! Autogenerated weights for `frame_system` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/release/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `frame_system`. -pub struct WeightInfo(PhantomData); -impl frame_system::WeightInfo for WeightInfo { - /// The range of component `b` is `[0, 3932160]`. - fn remark(b: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_657_000 picoseconds. - Weight::from_parts(2_735_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(392, 0).saturating_mul(b.into())) - } - /// The range of component `b` is `[0, 3932160]`. - fn remark_with_event(b: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_983_000 picoseconds. - Weight::from_parts(24_213_093, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_400, 0).saturating_mul(b.into())) - } - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) - fn set_heap_pages() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1485` - // Minimum execution time: 4_755_000 picoseconds. - Weight::from_parts(5_101_000, 0) - .saturating_add(Weight::from_parts(0, 1485)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn set_code() -> Weight { - // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `1591` - // Minimum execution time: 124_581_442_000 picoseconds. - Weight::from_parts(125_375_451_000, 0) - .saturating_add(Weight::from_parts(0, 1591)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `i` is `[0, 1000]`. - fn set_storage(i: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_746_000 picoseconds. - Weight::from_parts(2_898_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 943 - .saturating_add(Weight::from_parts(947_175, 0).saturating_mul(i.into())) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `i` is `[0, 1000]`. - fn kill_storage(i: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_847_000 picoseconds. - Weight::from_parts(2_937_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 890 - .saturating_add(Weight::from_parts(736_211, 0).saturating_mul(i.into())) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `p` is `[0, 1000]`. - fn kill_prefix(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `17 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_407_000 picoseconds. - Weight::from_parts(4_576_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_252 - .saturating_add(Weight::from_parts(1_613_624, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) - } - /// Storage: `System::AuthorizedUpgrade` (r:0 w:1) - /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - fn authorize_upgrade() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 14_075_000 picoseconds. - Weight::from_parts(14_388_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) - /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn apply_authorized_upgrade() -> Weight { - // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 130_631_384_000 picoseconds. - Weight::from_parts(131_416_815_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } -} diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs index 3596c7941a45..428976e3e036 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system.rs @@ -16,31 +16,28 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2024-01-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-rococo-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/coretime-rococo-runtime/coretime_rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights +// --chain=coretime-rococo-dev // --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic +// --no-min-squares +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -58,22 +55,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_744_000 picoseconds. - Weight::from_parts(2_066_252, 0) + // Minimum execution time: 1_760_000 picoseconds. + Weight::from_parts(6_086_623, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(384, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(430, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_880_000 picoseconds. - Weight::from_parts(18_574_050, 0) + // Minimum execution time: 5_315_000 picoseconds. + Weight::from_parts(20_446_491, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_394, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_725, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -83,8 +80,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 5_104_000 picoseconds. - Weight::from_parts(5_629_000, 0) + // Minimum execution time: 3_046_000 picoseconds. + Weight::from_parts(3_249_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -103,11 +100,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `1591` - // Minimum execution time: 123_250_392_000 picoseconds. - Weight::from_parts(125_327_078_000, 0) - .saturating_add(Weight::from_parts(0, 1591)) + // Measured: `164` + // Estimated: `1649` + // Minimum execution time: 108_366_941_000 picoseconds. + Weight::from_parts(111_101_742_000, 0) + .saturating_add(Weight::from_parts(0, 1649)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -118,11 +115,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_789_000 picoseconds. - Weight::from_parts(2_965_000, 0) + // Minimum execution time: 1_877_000 picoseconds. + Weight::from_parts(1_947_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_001 - .saturating_add(Weight::from_parts(939_233, 0).saturating_mul(i.into())) + // Standard Error: 2_035 + .saturating_add(Weight::from_parts(763_800, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -132,11 +129,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_861_000 picoseconds. - Weight::from_parts(2_959_000, 0) + // Minimum execution time: 1_847_000 picoseconds. + Weight::from_parts(1_931_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 840 - .saturating_add(Weight::from_parts(737_161, 0).saturating_mul(i.into())) + // Standard Error: 932 + .saturating_add(Weight::from_parts(565_066, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -144,13 +141,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `17 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_646_000 picoseconds. - Weight::from_parts(4_716_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_344 - .saturating_add(Weight::from_parts(1_610_852, 0).saturating_mul(p.into())) + // Measured: `71 + p * (69 ±0)` + // Estimated: `72 + p * (70 ±0)` + // Minimum execution time: 3_587_000 picoseconds. + Weight::from_parts(3_654_000, 0) + .saturating_add(Weight::from_parts(0, 72)) + // Standard Error: 1_468 + .saturating_add(Weight::from_parts(1_170_655, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -161,8 +158,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_460_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 9_701_000 picoseconds. + Weight::from_parts(10_142_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -182,11 +179,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 129_596_420_000 picoseconds. - Weight::from_parts(130_231_283_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) + // Measured: `186` + // Estimated: `1671` + // Minimum execution time: 113_812_980_000 picoseconds. + Weight::from_parts(115_758_263_000, 0) + .saturating_add(Weight::from_parts(0, 1671)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs index 0e60e1a289b4..b4b7cbf05a5e 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system.rs @@ -17,30 +17,27 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-02-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-westend-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/coretime-westend-runtime/coretime_westend_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/coretime/coretime-westend/src/weights +// --chain=coretime-westend-dev // --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic +// --no-min-squares +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -58,22 +55,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_801_000 picoseconds. - Weight::from_parts(10_049_977, 0) + // Minimum execution time: 1_584_000 picoseconds. + Weight::from_parts(2_117_975, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(442, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(384, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_604_000 picoseconds. - Weight::from_parts(36_853_712, 0) + // Minimum execution time: 4_607_000 picoseconds. + Weight::from_parts(14_948_582, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_447, 0).saturating_mul(b.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_673, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -83,8 +80,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_870_000 picoseconds. - Weight::from_parts(5_204_000, 0) + // Minimum execution time: 2_681_000 picoseconds. + Weight::from_parts(2_877_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -103,11 +100,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `1591` - // Minimum execution time: 123_025_571_000 picoseconds. - Weight::from_parts(124_622_088_000, 0) - .saturating_add(Weight::from_parts(0, 1591)) + // Measured: `164` + // Estimated: `1649` + // Minimum execution time: 95_893_701_000 picoseconds. + Weight::from_parts(98_086_094_000, 0) + .saturating_add(Weight::from_parts(0, 1649)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -118,11 +115,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_686_000 picoseconds. - Weight::from_parts(2_776_000, 0) + // Minimum execution time: 1_597_000 picoseconds. + Weight::from_parts(1_660_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 845 - .saturating_add(Weight::from_parts(952_828, 0).saturating_mul(i.into())) + // Standard Error: 1_871 + .saturating_add(Weight::from_parts(748_346, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -132,11 +129,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_691_000 picoseconds. - Weight::from_parts(2_841_000, 0) + // Minimum execution time: 1_625_000 picoseconds. + Weight::from_parts(1_669_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 852 - .saturating_add(Weight::from_parts(745_428, 0).saturating_mul(i.into())) + // Standard Error: 903 + .saturating_add(Weight::from_parts(561_709, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -144,13 +141,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `17 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_443_000 picoseconds. - Weight::from_parts(4_713_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_451 - .saturating_add(Weight::from_parts(1_623_216, 0).saturating_mul(p.into())) + // Measured: `71 + p * (69 ±0)` + // Estimated: `72 + p * (70 ±0)` + // Minimum execution time: 3_306_000 picoseconds. + Weight::from_parts(3_412_000, 0) + .saturating_add(Weight::from_parts(0, 72)) + // Standard Error: 1_366 + .saturating_add(Weight::from_parts(1_138_953, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -161,8 +158,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_421_000 picoseconds. - Weight::from_parts(14_150_000, 0) + // Minimum execution time: 7_834_000 picoseconds. + Weight::from_parts(8_344_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -182,11 +179,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 127_653_677_000 picoseconds. - Weight::from_parts(129_158_916_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) + // Measured: `186` + // Estimated: `1671` + // Minimum execution time: 98_682_277_000 picoseconds. + Weight::from_parts(101_609_257_000, 0) + .saturating_add(Weight::from_parts(0, 1671)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs index acd8eae56d17..b68f16c98658 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system.rs @@ -16,30 +16,26 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-yprdrvc7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("glutton-westend-dev-1300")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// target/production/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/glutton-westend-runtime/glutton_westend_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/glutton/glutton-westend/src/weights -// --wasm-execution=compiled // --steps=50 // --repeat=20 +// --extrinsic=* +// --wasm-execution=compiled // --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json +// --pallet=frame_system +// --chain=glutton-westend-dev-1300 +// --header=./cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -57,22 +53,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_777_000 picoseconds. - Weight::from_parts(4_101_813, 0) + // Minimum execution time: 1_570_000 picoseconds. + Weight::from_parts(1_626_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(448, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_470_000 picoseconds. - Weight::from_parts(27_543_265, 0) + // Minimum execution time: 4_200_000 picoseconds. + Weight::from_parts(4_262_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_452, 0).saturating_mul(b.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_791, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -82,8 +78,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_804_000 picoseconds. - Weight::from_parts(5_122_000, 0) + // Minimum execution time: 2_680_000 picoseconds. + Weight::from_parts(2_936_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -102,11 +98,11 @@ impl frame_system::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `1591` - // Minimum execution time: 124_015_557_000 picoseconds. - Weight::from_parts(125_310_656_000, 0) - .saturating_add(Weight::from_parts(0, 1591)) + // Measured: `127` + // Estimated: `1612` + // Minimum execution time: 119_097_302_000 picoseconds. + Weight::from_parts(120_914_576_000, 0) + .saturating_add(Weight::from_parts(0, 1612)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -117,11 +113,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_780_000 picoseconds. - Weight::from_parts(2_908_000, 0) + // Minimum execution time: 1_606_000 picoseconds. + Weight::from_parts(1_704_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 762 - .saturating_add(Weight::from_parts(938_307, 0).saturating_mul(i.into())) + // Standard Error: 2_090 + .saturating_add(Weight::from_parts(765_829, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -131,11 +127,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_833_000 picoseconds. - Weight::from_parts(2_888_000, 0) + // Minimum execution time: 1_646_000 picoseconds. + Weight::from_parts(1_719_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 857 - .saturating_add(Weight::from_parts(735_140, 0).saturating_mul(i.into())) + // Standard Error: 1_067 + .saturating_add(Weight::from_parts(578_598, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -143,13 +139,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `23 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_541_000 picoseconds. - Weight::from_parts(4_714_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_363 - .saturating_add(Weight::from_parts(1_615_617, 0).saturating_mul(p.into())) + // Measured: `58 + p * (69 ±0)` + // Estimated: `53 + p * (70 ±0)` + // Minimum execution time: 2_933_000 picoseconds. + Weight::from_parts(3_069_000, 0) + .saturating_add(Weight::from_parts(0, 53)) + // Standard Error: 1_844 + .saturating_add(Weight::from_parts(1_214_377, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -160,33 +156,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_332_000 picoseconds. - Weight::from_parts(13_876_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 128_737_877_000 picoseconds. - Weight::from_parts(130_471_394_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs index d1eadf3188bc..495903a4669e 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system.rs @@ -1,46 +1,40 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. +// SPDX-License-Identifier: Apache-2.0 -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . +// 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. //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("people-kusama-dev"), DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./artifacts/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/people-rococo-runtime/people_rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/people/people-rococo/src/weights +// --chain=people-kusama-dev +// --execution=wasm // --wasm-execution=compiled +// --pallet=frame_system +// --extrinsic=* // --steps=50 // --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic +// --json +// --header=./file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-kusama/src/weights/frame_system.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -58,99 +52,80 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_763_000 picoseconds. - Weight::from_parts(2_966_888, 0) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_100_689, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(380, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(412, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_924_000 picoseconds. - Weight::from_parts(28_554_454, 0) + // Minimum execution time: 7_879_000 picoseconds. + Weight::from_parts(8_041_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_386, 0).saturating_mul(b.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_451, 0).saturating_mul(b.into())) } - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) + } + /// Storage: System Digest (r:1 w:1) + /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: unknown `0x3a686561707061676573` (r:0 w:1) + /// Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 5_174_000 picoseconds. - Weight::from_parts(5_474_000, 0) + // Minimum execution time: 4_358_000 picoseconds. + Weight::from_parts(4_537_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn set_code() -> Weight { - // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `1591` - // Minimum execution time: 124_375_910_000 picoseconds. - Weight::from_parts(125_777_716_000, 0) - .saturating_add(Weight::from_parts(0, 1591)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_823_000 picoseconds. - Weight::from_parts(3_010_000, 0) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_395_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 910 - .saturating_add(Weight::from_parts(946_628, 0).saturating_mul(i.into())) + // Standard Error: 1_727 + .saturating_add(Weight::from_parts(690_266, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_941_000 picoseconds. - Weight::from_parts(3_016_000, 0) + // Minimum execution time: 2_513_000 picoseconds. + Weight::from_parts(2_540_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 925 - .saturating_add(Weight::from_parts(737_563, 0).saturating_mul(i.into())) + // Standard Error: 815 + .saturating_add(Weight::from_parts(505_090, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `17 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_604_000 picoseconds. - Weight::from_parts(4_766_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_499 - .saturating_add(Weight::from_parts(1_615_989, 0).saturating_mul(p.into())) + // Measured: `68 + p * (69 ±0)` + // Estimated: `66 + p * (70 ±0)` + // Minimum execution time: 4_242_000 picoseconds. + Weight::from_parts(4_308_000, 0) + .saturating_add(Weight::from_parts(0, 66)) + // Standard Error: 1_130 + .saturating_add(Weight::from_parts(1_032_054, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -161,33 +136,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_013_000 picoseconds. - Weight::from_parts(14_698_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 129_500_670_000 picoseconds. - Weight::from_parts(130_232_350_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs index 24583299979e..d763fe1c4261 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system.rs @@ -1,46 +1,40 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. +// SPDX-License-Identifier: Apache-2.0 -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . +// 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. //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("people-polkadot-dev"), DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./artifacts/polkadot-parachain // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/people-westend-runtime/people_westend_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/people/people-westend/src/weights +// --chain=people-polkadot-dev +// --execution=wasm // --wasm-execution=compiled +// --pallet=frame_system +// --extrinsic=* // --steps=50 // --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic +// --json +// --header=./file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-polkadot/src/weights/frame_system.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -58,99 +52,80 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_766_000 picoseconds. - Weight::from_parts(2_852_000, 0) + // Minimum execution time: 2_432_000 picoseconds. + Weight::from_parts(2_458_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(386, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(367, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_770_000 picoseconds. - Weight::from_parts(26_784_051, 0) + // Minimum execution time: 7_911_000 picoseconds. + Weight::from_parts(8_031_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_395, 0).saturating_mul(b.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_405, 0).saturating_mul(b.into())) } - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + /// Storage: System Digest (r:1 w:1) + /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: unknown `0x3a686561707061676573` (r:0 w:1) + /// Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_987_000 picoseconds. - Weight::from_parts(5_274_000, 0) + // Minimum execution time: 4_304_000 picoseconds. + Weight::from_parts(4_553_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_code() -> Weight { - // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `1591` - // Minimum execution time: 122_695_835_000 picoseconds. - Weight::from_parts(124_623_525_000, 0) - .saturating_add(Weight::from_parts(0, 1591)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + Weight::from_parts(1_000_000, 0) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_731_000 picoseconds. - Weight::from_parts(2_833_000, 0) + // Minimum execution time: 2_493_000 picoseconds. + Weight::from_parts(2_523_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 821 - .saturating_add(Weight::from_parts(946_782, 0).saturating_mul(i.into())) + // Standard Error: 1_594 + .saturating_add(Weight::from_parts(663_439, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_715_000 picoseconds. - Weight::from_parts(2_884_000, 0) + // Minimum execution time: 2_492_000 picoseconds. + Weight::from_parts(2_526_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 842 - .saturating_add(Weight::from_parts(743_382, 0).saturating_mul(i.into())) + // Standard Error: 784 + .saturating_add(Weight::from_parts(493_844, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `17 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_451_000 picoseconds. - Weight::from_parts(4_592_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_393 - .saturating_add(Weight::from_parts(1_612_887, 0).saturating_mul(p.into())) + // Measured: `68 + p * (69 ±0)` + // Estimated: `66 + p * (70 ±0)` + // Minimum execution time: 4_200_000 picoseconds. + Weight::from_parts(4_288_000, 0) + .saturating_add(Weight::from_parts(0, 66)) + // Standard Error: 1_195 + .saturating_add(Weight::from_parts(1_021_563, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -161,33 +136,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_609_000 picoseconds. - Weight::from_parts(14_039_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 128_040_477_000 picoseconds. - Weight::from_parts(129_804_744_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/polkadot/runtime/rococo/src/weights/frame_system.rs b/polkadot/runtime/rococo/src/weights/frame_system.rs index 8dde104ccc5a..1742a761ca77 100644 --- a/polkadot/runtime/rococo/src/weights/frame_system.rs +++ b/polkadot/runtime/rococo/src/weights/frame_system.rs @@ -17,28 +17,27 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-02-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/rococo-runtime/rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt -// --output=./polkadot/runtime/rococo/src/weights -// --wasm-execution=compiled +// --chain=rococo-dev // --steps=50 // --repeat=20 -// --heap-pages=4096 // --no-storage-info -// --no-min-squares // --no-median-slopes +// --no-min-squares +// --pallet=frame_system +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./polkadot/file_header.txt +// --output=./polkadot/runtime/rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,22 +55,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_054_000 picoseconds. - Weight::from_parts(2_653_801, 0) + // Minimum execution time: 1_541_000 picoseconds. + Weight::from_parts(2_581_470, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(395, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_008_000 picoseconds. - Weight::from_parts(24_351_449, 0) + // Minimum execution time: 5_060_000 picoseconds. + Weight::from_parts(5_167_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_404, 0).saturating_mul(b.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_696, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -81,8 +80,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_868_000 picoseconds. - Weight::from_parts(7_098_000, 0) + // Minimum execution time: 2_649_000 picoseconds. + Weight::from_parts(2_909_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -95,8 +94,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 122_943_408_000 picoseconds. - Weight::from_parts(123_603_986_000, 0) + // Minimum execution time: 88_417_540_000 picoseconds. + Weight::from_parts(91_809_291_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -108,11 +107,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_002_000 picoseconds. - Weight::from_parts(4_069_000, 0) + // Minimum execution time: 1_538_000 picoseconds. + Weight::from_parts(1_589_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 826 - .saturating_add(Weight::from_parts(961_066, 0).saturating_mul(i.into())) + // Standard Error: 1_740 + .saturating_add(Weight::from_parts(730_941, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -122,11 +121,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_036_000 picoseconds. - Weight::from_parts(4_190_000, 0) + // Minimum execution time: 1_567_000 picoseconds. + Weight::from_parts(1_750_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_076 - .saturating_add(Weight::from_parts(737_434, 0).saturating_mul(i.into())) + // Standard Error: 835 + .saturating_add(Weight::from_parts(543_218, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -136,11 +135,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `80 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 7_369_000 picoseconds. - Weight::from_parts(7_498_000, 0) + // Minimum execution time: 3_412_000 picoseconds. + Weight::from_parts(3_448_000, 0) .saturating_add(Weight::from_parts(0, 83)) - // Standard Error: 1_545 - .saturating_add(Weight::from_parts(1_617_904, 0).saturating_mul(p.into())) + // Standard Error: 1_395 + .saturating_add(Weight::from_parts(1_142_347, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -151,8 +150,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_434_000 picoseconds. - Weight::from_parts(16_165_000, 0) + // Minimum execution time: 9_178_000 picoseconds. + Weight::from_parts(9_780_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -166,8 +165,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `22` // Estimated: `1518` - // Minimum execution time: 129_632_750_000 picoseconds. - Weight::from_parts(130_056_126_000, 0) + // Minimum execution time: 94_523_563_000 picoseconds. + Weight::from_parts(96_983_131_000, 0) .saturating_add(Weight::from_parts(0, 1518)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/polkadot/runtime/westend/src/weights/frame_system.rs b/polkadot/runtime/westend/src/weights/frame_system.rs index ec4315e20af3..f679be517151 100644 --- a/polkadot/runtime/westend/src/weights/frame_system.rs +++ b/polkadot/runtime/westend/src/weights/frame_system.rs @@ -16,29 +16,28 @@ //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-06-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 +//! HOSTNAME: `runner--ss9ysm1-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/polkadot // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/westend-runtime/westend_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt -// --output=./polkadot/runtime/westend/src/weights -// --wasm-execution=compiled +// --chain=westend-dev // --steps=50 // --repeat=20 -// --heap-pages=4096 // --no-storage-info -// --no-min-squares // --no-median-slopes +// --no-min-squares +// --pallet=frame_system +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/westend/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,91 +55,91 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_899_000 picoseconds. - Weight::from_parts(4_189_159, 0) + // Minimum execution time: 2_050_000 picoseconds. + Weight::from_parts(2_094_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(386, 0).saturating_mul(b.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(490, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_997_000 picoseconds. - Weight::from_parts(20_688_715, 0) + // Minimum execution time: 7_620_000 picoseconds. + Weight::from_parts(7_824_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_398, 0).saturating_mul(b.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(2_180, 0).saturating_mul(b.into())) } - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + /// Storage: System Digest (r:1 w:1) + /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: unknown `0x3a686561707061676573` (r:0 w:1) + /// Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_739_000 picoseconds. - Weight::from_parts(7_168_000, 0) + // Minimum execution time: 3_746_000 picoseconds. + Weight::from_parts(4_096_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: `System::Digest` (r:1 w:1) - /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Storage: System Digest (r:1 w:1) + /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: unknown `0x3a636f6465` (r:0 w:1) + /// Proof Skipped: unknown `0x3a636f6465` (r:0 w:1) fn set_code() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 124_386_135_000 picoseconds. - Weight::from_parts(124_937_568_000, 0) + // Minimum execution time: 120_822_538_000 picoseconds. + Weight::from_parts(128_806_623_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_870_000 picoseconds. - Weight::from_parts(4_015_000, 0) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_198_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 841 - .saturating_add(Weight::from_parts(952_584, 0).saturating_mul(i.into())) + // Standard Error: 3_376 + .saturating_add(Weight::from_parts(824_994, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_772_000 picoseconds. - Weight::from_parts(3_913_000, 0) + // Minimum execution time: 2_110_000 picoseconds. + Weight::from_parts(2_200_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 968 - .saturating_add(Weight::from_parts(729_754, 0).saturating_mul(i.into())) + // Standard Error: 1_859 + .saturating_add(Weight::from_parts(630_789, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `75 + p * (69 ±0)` - // Estimated: `82 + p * (70 ±0)` - // Minimum execution time: 7_019_000 picoseconds. - Weight::from_parts(7_120_000, 0) - .saturating_add(Weight::from_parts(0, 82)) - // Standard Error: 1_405 - .saturating_add(Weight::from_parts(1_628_558, 0).saturating_mul(p.into())) + // Measured: `132 + p * (69 ±0)` + // Estimated: `107 + p * (70 ±0)` + // Minimum execution time: 4_151_000 picoseconds. + Weight::from_parts(4_226_000, 0) + .saturating_add(Weight::from_parts(0, 107)) + // Standard Error: 4_953 + .saturating_add(Weight::from_parts(1_418_957, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -151,8 +150,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_887_000 picoseconds. - Weight::from_parts(16_871_000, 0) + // Minimum execution time: 33_027_000 picoseconds. + Weight::from_parts(33_027_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -166,8 +165,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `22` // Estimated: `1518` - // Minimum execution time: 129_281_835_000 picoseconds. - Weight::from_parts(130_595_229_000, 0) + // Minimum execution time: 118_101_992_000 picoseconds. + Weight::from_parts(118_101_992_000, 0) .saturating_add(Weight::from_parts(0, 1518)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/substrate/frame/system/src/weights.rs b/substrate/frame/system/src/weights.rs index ce48d44ca3aa..fca14e452657 100644 --- a/substrate/frame/system/src/weights.rs +++ b/substrate/frame/system/src/weights.rs @@ -18,31 +18,28 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `f3d33175cf1e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` +//! HOSTNAME: `runner-anb7yjbi-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: -// frame-omni-bencher -// v1 +// ./target/production/substrate-node // benchmark // pallet -// --extrinsic=* -// --runtime=target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/substrate/HEADER-APACHE2 -// --output=/__w/polkadot-sdk/polkadot-sdk/substrate/frame/system/src/weights.rs -// --wasm-execution=compiled +// --chain=dev // --steps=50 // --repeat=20 -// --heap-pages=4096 -// --template=substrate/.maintain/frame-weight-template.hbs +// --pallet=frame_system // --no-storage-info -// --no-min-squares // --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage +// --no-min-squares +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./substrate/frame/system/src/weights.rs +// --header=./substrate/HEADER-APACHE2 +// --template=./substrate/.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -73,20 +70,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_738_000 picoseconds. - Weight::from_parts(2_576_756, 0) + // Minimum execution time: 2_078_000 picoseconds. + Weight::from_parts(1_137_744, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(393, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_720_000 picoseconds. - Weight::from_parts(17_054_712, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_407, 0).saturating_mul(b.into())) + // Minimum execution time: 5_980_000 picoseconds. + Weight::from_parts(2_562_415, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_391, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -96,8 +93,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 5_836_000 picoseconds. - Weight::from_parts(6_133_000, 1485) + // Minimum execution time: 3_834_000 picoseconds. + Weight::from_parts(4_109_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -109,10 +106,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `0` + // Measured: `142` // Estimated: `67035` - // Minimum execution time: 122_859_747_000 picoseconds. - Weight::from_parts(123_966_163_000, 67035) + // Minimum execution time: 81_326_496_000 picoseconds. + Weight::from_parts(81_880_651_000, 67035) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -123,10 +120,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_718_000 picoseconds. - Weight::from_parts(2_794_000, 0) - // Standard Error: 771 - .saturating_add(Weight::from_parts(937_068, 0).saturating_mul(i.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 720 + .saturating_add(Weight::from_parts(742_610, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -136,10 +133,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_767_000 picoseconds. - Weight::from_parts(2_903_000, 0) - // Standard Error: 881 - .saturating_add(Weight::from_parts(731_528, 0).saturating_mul(i.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 774 + .saturating_add(Weight::from_parts(569_424, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -147,12 +144,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `17 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_542_000 picoseconds. - Weight::from_parts(4_670_000, 0) - // Standard Error: 1_402 - .saturating_add(Weight::from_parts(1_619_220, 0).saturating_mul(p.into())) + // Measured: `127 + p * (69 ±0)` + // Estimated: `134 + p * (70 ±0)` + // Minimum execution time: 3_990_000 picoseconds. + Weight::from_parts(4_172_000, 134) + // Standard Error: 1_485 + .saturating_add(Weight::from_parts(1_227_281, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -163,8 +160,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_355_000 picoseconds. - Weight::from_parts(14_069_000, 0) + // Minimum execution time: 8_851_000 picoseconds. + Weight::from_parts(9_643_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) @@ -177,10 +174,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `21` + // Measured: `164` // Estimated: `67035` - // Minimum execution time: 127_834_147_000 picoseconds. - Weight::from_parts(129_695_644_000, 67035) + // Minimum execution time: 86_295_879_000 picoseconds. + Weight::from_parts(87_636_595_000, 67035) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -193,20 +190,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_738_000 picoseconds. - Weight::from_parts(2_576_756, 0) + // Minimum execution time: 2_078_000 picoseconds. + Weight::from_parts(1_137_744, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(393, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(387, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_720_000 picoseconds. - Weight::from_parts(17_054_712, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_407, 0).saturating_mul(b.into())) + // Minimum execution time: 5_980_000 picoseconds. + Weight::from_parts(2_562_415, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_391, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -216,8 +213,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 5_836_000 picoseconds. - Weight::from_parts(6_133_000, 1485) + // Minimum execution time: 3_834_000 picoseconds. + Weight::from_parts(4_109_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -229,10 +226,10 @@ impl WeightInfo for () { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `0` + // Measured: `142` // Estimated: `67035` - // Minimum execution time: 122_859_747_000 picoseconds. - Weight::from_parts(123_966_163_000, 67035) + // Minimum execution time: 81_326_496_000 picoseconds. + Weight::from_parts(81_880_651_000, 67035) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -243,10 +240,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_718_000 picoseconds. - Weight::from_parts(2_794_000, 0) - // Standard Error: 771 - .saturating_add(Weight::from_parts(937_068, 0).saturating_mul(i.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 720 + .saturating_add(Weight::from_parts(742_610, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -256,10 +253,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_767_000 picoseconds. - Weight::from_parts(2_903_000, 0) - // Standard Error: 881 - .saturating_add(Weight::from_parts(731_528, 0).saturating_mul(i.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 774 + .saturating_add(Weight::from_parts(569_424, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -267,12 +264,12 @@ impl WeightInfo for () { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `17 + p * (69 ±0)` - // Estimated: `0 + p * (70 ±0)` - // Minimum execution time: 4_542_000 picoseconds. - Weight::from_parts(4_670_000, 0) - // Standard Error: 1_402 - .saturating_add(Weight::from_parts(1_619_220, 0).saturating_mul(p.into())) + // Measured: `127 + p * (69 ±0)` + // Estimated: `134 + p * (70 ±0)` + // Minimum execution time: 3_990_000 picoseconds. + Weight::from_parts(4_172_000, 134) + // Standard Error: 1_485 + .saturating_add(Weight::from_parts(1_227_281, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -283,8 +280,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_355_000 picoseconds. - Weight::from_parts(14_069_000, 0) + // Minimum execution time: 8_851_000 picoseconds. + Weight::from_parts(9_643_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) @@ -297,10 +294,10 @@ impl WeightInfo for () { /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) fn apply_authorized_upgrade() -> Weight { // Proof Size summary in bytes: - // Measured: `21` + // Measured: `164` // Estimated: `67035` - // Minimum execution time: 127_834_147_000 picoseconds. - Weight::from_parts(129_695_644_000, 67035) + // Minimum execution time: 86_295_879_000 picoseconds. + Weight::from_parts(87_636_595_000, 67035) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } From e5b8bf6b4902707e4e6fc44019c2a3c6cf5c37b9 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 14:15:00 +0900 Subject: [PATCH 26/40] fix test --- substrate/frame/system/benchmarking/src/mock.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/substrate/frame/system/benchmarking/src/mock.rs b/substrate/frame/system/benchmarking/src/mock.rs index 6b126619ce5b..61b5b885ec62 100644 --- a/substrate/frame/system/benchmarking/src/mock.rs +++ b/substrate/frame/system/benchmarking/src/mock.rs @@ -65,6 +65,10 @@ impl frame_system::ExtensionsWeightInfo for MockWeights { fn check_weight() -> Weight { Weight::from_parts(10, 0) } + + fn weight_reclaim() -> Weight { + Weight::from_parts(10, 0) + } } #[derive_impl(frame_system::config_preludes::TestDefaultConfig)] From ba1b3bf4162430642971c92d8ff916fed17483e3 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 31 Oct 2024 06:22:19 +0000 Subject: [PATCH 27/40] Update from gui1117 running command 'bench --pallet frame_system_extensions --clean' --- .../src/weights/frame_system_extensions.rs | 90 ++++++---- .../src/weights/frame_system_extensions.rs | 90 ++++++---- .../src/weights/frame_system_extensions.rs | 90 ++++++---- .../src/weights/frame_system_extensions.rs | 90 ++++++---- .../src/weights/frame_system_extensions.rs | 90 ++++++---- .../src/weights/frame_system_extensions.rs | 155 ++++++++++++++++++ .../src/weights/frame_system_extensions.rs | 93 ++++++----- .../src/weights/frame_system_extensions.rs | 80 ++++----- .../src/weights/frame_system_extensions.rs | 79 ++++----- 9 files changed, 558 insertions(+), 299 deletions(-) create mode 100644 cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs index 1979a9da31be..a5c9fea3cdf5 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/frame_system_extensions.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system_extensions` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-21, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `gleipnir`, CPU: `AMD Ryzen 9 7900X 12-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --wasm-execution=compiled +// --extrinsic=* +// --runtime=target/release/wbuild/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm // --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --steps=2 -// --repeat=2 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/ -// --chain=asset-hub-rococo-dev +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,8 +57,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `54` // Estimated: `3509` - // Minimum execution time: 3_637_000 picoseconds. - Weight::from_parts(6_382_000, 0) + // Minimum execution time: 8_313_000 picoseconds. + Weight::from_parts(8_528_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -67,8 +68,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_841_000 picoseconds. - Weight::from_parts(8_776_000, 0) + // Minimum execution time: 12_527_000 picoseconds. + Weight::from_parts(13_006_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -78,8 +79,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_841_000 picoseconds. - Weight::from_parts(8_776_000, 0) + // Minimum execution time: 12_380_000 picoseconds. + Weight::from_parts(12_922_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -87,49 +88,66 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 561_000 picoseconds. - Weight::from_parts(2_705_000, 0) + // Minimum execution time: 782_000 picoseconds. + Weight::from_parts(855_000, 0) .saturating_add(Weight::from_parts(0, 0)) } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn check_nonce() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_316_000 picoseconds. - Weight::from_parts(5_771_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `101` + // Estimated: `3593` + // Minimum execution time: 11_743_000 picoseconds. + Weight::from_parts(12_067_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } fn check_spec_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 511_000 picoseconds. - Weight::from_parts(2_575_000, 0) + // Minimum execution time: 644_000 picoseconds. + Weight::from_parts(697_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 501_000 picoseconds. - Weight::from_parts(2_595_000, 0) + // Minimum execution time: 605_000 picoseconds. + Weight::from_parts(700_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::BlockWeight` (r:1 w:1) /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: // Measured: `24` // Estimated: `1533` - // Minimum execution time: 3_687_000 picoseconds. - Weight::from_parts(6_192_000, 0) + // Minimum execution time: 9_796_000 picoseconds. + Weight::from_parts(10_365_000, 0) .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_855_000 picoseconds. + Weight::from_parts(5_050_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs index 6115543ec8eb..a1bb92cf7008 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/frame_system_extensions.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system_extensions` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-21, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `gleipnir`, CPU: `AMD Ryzen 9 7900X 12-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --wasm-execution=compiled +// --extrinsic=* +// --runtime=target/release/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm // --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --steps=2 -// --repeat=2 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/ -// --chain=asset-hub-westend-dev +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,8 +57,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `54` // Estimated: `3509` - // Minimum execution time: 3_206_000 picoseconds. - Weight::from_parts(6_212_000, 0) + // Minimum execution time: 6_329_000 picoseconds. + Weight::from_parts(6_665_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -67,8 +68,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_851_000 picoseconds. - Weight::from_parts(8_847_000, 0) + // Minimum execution time: 12_110_000 picoseconds. + Weight::from_parts(12_883_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -78,8 +79,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_851_000 picoseconds. - Weight::from_parts(8_847_000, 0) + // Minimum execution time: 12_241_000 picoseconds. + Weight::from_parts(12_780_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -87,49 +88,66 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 631_000 picoseconds. - Weight::from_parts(3_086_000, 0) + // Minimum execution time: 825_000 picoseconds. + Weight::from_parts(890_000, 0) .saturating_add(Weight::from_parts(0, 0)) } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn check_nonce() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_446_000 picoseconds. - Weight::from_parts(5_911_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `101` + // Estimated: `3593` + // Minimum execution time: 10_159_000 picoseconds. + Weight::from_parts(10_461_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } fn check_spec_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 481_000 picoseconds. - Weight::from_parts(2_916_000, 0) + // Minimum execution time: 578_000 picoseconds. + Weight::from_parts(660_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 501_000 picoseconds. - Weight::from_parts(2_595_000, 0) + // Minimum execution time: 618_000 picoseconds. + Weight::from_parts(682_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::BlockWeight` (r:1 w:1) /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: // Measured: `24` // Estimated: `1533` - // Minimum execution time: 3_927_000 picoseconds. - Weight::from_parts(6_613_000, 0) + // Minimum execution time: 9_964_000 picoseconds. + Weight::from_parts(10_419_000, 0) .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_890_000 picoseconds. + Weight::from_parts(5_163_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs index aec7fb300fa3..39ac3daa1d96 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system_extensions.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system_extensions` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-21, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `gleipnir`, CPU: `AMD Ryzen 9 7900X 12-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --wasm-execution=compiled +// --extrinsic=* +// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm // --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --steps=2 -// --repeat=2 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ -// --chain=bridge-hub-rococo-dev +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,8 +57,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `54` // Estimated: `3509` - // Minimum execution time: 3_136_000 picoseconds. - Weight::from_parts(5_842_000, 0) + // Minimum execution time: 6_094_000 picoseconds. + Weight::from_parts(6_350_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -67,8 +68,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_771_000 picoseconds. - Weight::from_parts(8_857_000, 0) + // Minimum execution time: 12_011_000 picoseconds. + Weight::from_parts(12_522_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -78,8 +79,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_771_000 picoseconds. - Weight::from_parts(8_857_000, 0) + // Minimum execution time: 12_110_000 picoseconds. + Weight::from_parts(12_503_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -87,49 +88,66 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 732_000 picoseconds. - Weight::from_parts(2_875_000, 0) + // Minimum execution time: 805_000 picoseconds. + Weight::from_parts(915_000, 0) .saturating_add(Weight::from_parts(0, 0)) } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn check_nonce() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_627_000 picoseconds. - Weight::from_parts(6_322_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `101` + // Estimated: `3593` + // Minimum execution time: 9_812_000 picoseconds. + Weight::from_parts(10_178_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } fn check_spec_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 471_000 picoseconds. - Weight::from_parts(2_455_000, 0) + // Minimum execution time: 643_000 picoseconds. + Weight::from_parts(699_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 491_000 picoseconds. - Weight::from_parts(2_916_000, 0) + // Minimum execution time: 652_000 picoseconds. + Weight::from_parts(691_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::BlockWeight` (r:1 w:1) /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: // Measured: `24` // Estimated: `1533` - // Minimum execution time: 3_798_000 picoseconds. - Weight::from_parts(6_272_000, 0) + // Minimum execution time: 10_066_000 picoseconds. + Weight::from_parts(10_435_000, 0) .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_759_000 picoseconds. + Weight::from_parts(5_025_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs index 1bf0993046cc..00cf850f94b7 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/frame_system_extensions.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system_extensions` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-21, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `gleipnir`, CPU: `AMD Ryzen 9 7900X 12-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --wasm-execution=compiled +// --extrinsic=* +// --runtime=target/release/wbuild/bridge-hub-rococo-runtime/bridge_hub_rococo_runtime.wasm // --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --steps=2 -// --repeat=2 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/ -// --chain=bridge-hub-westend-dev +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,8 +57,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `54` // Estimated: `3509` - // Minimum execution time: 3_166_000 picoseconds. - Weight::from_parts(6_021_000, 0) + // Minimum execution time: 6_316_000 picoseconds. + Weight::from_parts(6_522_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -67,8 +68,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_651_000 picoseconds. - Weight::from_parts(9_177_000, 0) + // Minimum execution time: 12_151_000 picoseconds. + Weight::from_parts(12_814_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -78,8 +79,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_651_000 picoseconds. - Weight::from_parts(9_177_000, 0) + // Minimum execution time: 12_413_000 picoseconds. + Weight::from_parts(12_824_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -87,49 +88,66 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 601_000 picoseconds. - Weight::from_parts(2_805_000, 0) + // Minimum execution time: 826_000 picoseconds. + Weight::from_parts(906_000, 0) .saturating_add(Weight::from_parts(0, 0)) } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn check_nonce() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_727_000 picoseconds. - Weight::from_parts(6_051_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `101` + // Estimated: `3593` + // Minimum execution time: 9_837_000 picoseconds. + Weight::from_parts(10_345_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } fn check_spec_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 471_000 picoseconds. - Weight::from_parts(2_494_000, 0) + // Minimum execution time: 590_000 picoseconds. + Weight::from_parts(690_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 521_000 picoseconds. - Weight::from_parts(2_655_000, 0) + // Minimum execution time: 631_000 picoseconds. + Weight::from_parts(688_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::BlockWeight` (r:1 w:1) /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: // Measured: `24` // Estimated: `1533` - // Minimum execution time: 3_808_000 picoseconds. - Weight::from_parts(6_402_000, 0) + // Minimum execution time: 9_837_000 picoseconds. + Weight::from_parts(10_304_000, 0) .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_859_000 picoseconds. + Weight::from_parts(5_067_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs index 5a9904c6c8a2..7ca481af6c35 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/frame_system_extensions.rs @@ -16,28 +16,29 @@ //! Autogenerated weights for `frame_system_extensions` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-21, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `gleipnir`, CPU: `AMD Ryzen 9 7900X 12-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --wasm-execution=compiled +// --extrinsic=* +// --runtime=target/release/wbuild/collectives-westend-runtime/collectives_westend_runtime.wasm // --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/collectives/collectives-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --steps=2 -// --repeat=2 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/ -// --chain=collectives-westend-dev +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -56,8 +57,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `54` // Estimated: `3509` - // Minimum execution time: 3_497_000 picoseconds. - Weight::from_parts(5_961_000, 0) + // Minimum execution time: 6_181_000 picoseconds. + Weight::from_parts(6_439_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -67,8 +68,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_240_000 picoseconds. - Weight::from_parts(8_175_000, 0) + // Minimum execution time: 10_096_000 picoseconds. + Weight::from_parts(10_464_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -78,8 +79,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `92` // Estimated: `3509` - // Minimum execution time: 5_240_000 picoseconds. - Weight::from_parts(8_175_000, 0) + // Minimum execution time: 10_189_000 picoseconds. + Weight::from_parts(10_565_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -87,49 +88,66 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 671_000 picoseconds. - Weight::from_parts(3_005_000, 0) + // Minimum execution time: 790_000 picoseconds. + Weight::from_parts(835_000, 0) .saturating_add(Weight::from_parts(0, 0)) } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn check_nonce() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_426_000 picoseconds. - Weight::from_parts(6_131_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `101` + // Estimated: `3593` + // Minimum execution time: 9_642_000 picoseconds. + Weight::from_parts(9_990_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } fn check_spec_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 501_000 picoseconds. - Weight::from_parts(2_715_000, 0) + // Minimum execution time: 615_000 picoseconds. + Weight::from_parts(652_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 491_000 picoseconds. - Weight::from_parts(2_635_000, 0) + // Minimum execution time: 599_000 picoseconds. + Weight::from_parts(650_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::BlockWeight` (r:1 w:1) /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: // Measured: `24` // Estimated: `1533` - // Minimum execution time: 3_958_000 picoseconds. - Weight::from_parts(6_753_000, 0) + // Minimum execution time: 9_757_000 picoseconds. + Weight::from_parts(10_016_000, 0) .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 4_536_000 picoseconds. + Weight::from_parts(4_819_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs new file mode 100644 index 000000000000..970433643db3 --- /dev/null +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs @@ -0,0 +1,155 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `frame_system_extensions` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/release/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm +// --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `frame_system_extensions`. +pub struct WeightInfo(PhantomData); +impl frame_system::ExtensionsWeightInfo for WeightInfo { + /// Storage: `System::BlockHash` (r:1 w:0) + /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + fn check_genesis() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `3509` + // Minimum execution time: 2_506_000 picoseconds. + Weight::from_parts(2_609_000, 0) + .saturating_add(Weight::from_parts(0, 3509)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `System::BlockHash` (r:1 w:0) + /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + fn check_mortality_mortal_transaction() -> Weight { + // Proof Size summary in bytes: + // Measured: `30` + // Estimated: `3509` + // Minimum execution time: 6_809_000 picoseconds. + Weight::from_parts(7_113_000, 0) + .saturating_add(Weight::from_parts(0, 3509)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `System::BlockHash` (r:1 w:0) + /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + fn check_mortality_immortal_transaction() -> Weight { + // Proof Size summary in bytes: + // Measured: `68` + // Estimated: `3509` + // Minimum execution time: 7_875_000 picoseconds. + Weight::from_parts(8_311_000, 0) + .saturating_add(Weight::from_parts(0, 3509)) + .saturating_add(T::DbWeight::get().reads(1)) + } + fn check_non_zero_sender() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 734_000 picoseconds. + Weight::from_parts(775_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn check_nonce() -> Weight { + // Proof Size summary in bytes: + // Measured: `52` + // Estimated: `3593` + // Minimum execution time: 7_331_000 picoseconds. + Weight::from_parts(7_624_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn check_spec_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 548_000 picoseconds. + Weight::from_parts(573_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + fn check_tx_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 527_000 picoseconds. + Weight::from_parts(559_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) + /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn check_weight() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 6_594_000 picoseconds. + Weight::from_parts(6_806_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) + /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + fn weight_reclaim() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1533` + // Minimum execution time: 3_680_000 picoseconds. + Weight::from_parts(3_899_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs index f0d6db71c9fe..db9a14e2cf24 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/frame_system_extensions.rs @@ -16,28 +16,30 @@ //! Autogenerated weights for `frame_system_extensions` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-21, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `gleipnir`, CPU: `AMD Ryzen 9 7900X 12-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("glutton-westend-dev-1300")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --wasm-execution=compiled +// --extrinsic=* +// --runtime=target/release/wbuild/glutton-westend-runtime/glutton_westend_runtime.wasm // --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/glutton/glutton-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --steps=2 -// --repeat=2 -// --json -// --header=./cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/glutton/glutton-westend/src/weights/ -// --chain=glutton-westend-dev-1300 +// --no-median-slopes +// --genesis-builder-policy=none #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,10 +56,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_genesis() -> Weight { // Proof Size summary in bytes: - // Measured: `54` + // Measured: `0` // Estimated: `3509` - // Minimum execution time: 3_908_000 picoseconds. - Weight::from_parts(4_007_000, 0) + // Minimum execution time: 2_572_000 picoseconds. + Weight::from_parts(2_680_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -65,10 +67,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_mortality_mortal_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `92` + // Measured: `0` // Estimated: `3509` - // Minimum execution time: 5_510_000 picoseconds. - Weight::from_parts(6_332_000, 0) + // Minimum execution time: 5_818_000 picoseconds. + Weight::from_parts(6_024_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -76,10 +78,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_mortality_immortal_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `92` + // Measured: `14` // Estimated: `3509` - // Minimum execution time: 5_510_000 picoseconds. - Weight::from_parts(6_332_000, 0) + // Minimum execution time: 7_364_000 picoseconds. + Weight::from_parts(7_676_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -87,47 +89,52 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 651_000 picoseconds. - Weight::from_parts(851_000, 0) + // Minimum execution time: 657_000 picoseconds. + Weight::from_parts(686_000, 0) .saturating_add(Weight::from_parts(0, 0)) } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) fn check_nonce() -> Weight { // Proof Size summary in bytes: // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_387_000 picoseconds. - Weight::from_parts(3_646_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Estimated: `3529` + // Minimum execution time: 6_931_000 picoseconds. + Weight::from_parts(7_096_000, 0) + .saturating_add(Weight::from_parts(0, 3529)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } fn check_spec_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 491_000 picoseconds. - Weight::from_parts(651_000, 0) + // Minimum execution time: 518_000 picoseconds. + Weight::from_parts(539_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 451_000 picoseconds. - Weight::from_parts(662_000, 0) + // Minimum execution time: 530_000 picoseconds. + Weight::from_parts(550_000, 0) .saturating_add(Weight::from_parts(0, 0)) } - /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) - /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: - // Measured: `24` - // Estimated: `1489` - // Minimum execution time: 3_537_000 picoseconds. - Weight::from_parts(4_208_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_691_000 picoseconds. + Weight::from_parts(5_955_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_249_000 picoseconds. + Weight::from_parts(3_372_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs b/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs index 20dd493f046f..09fb5e7b1d22 100644 --- a/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs +++ b/polkadot/runtime/rococo/src/weights/frame_system_extensions.rs @@ -17,27 +17,28 @@ //! Autogenerated weights for `frame_system_extensions` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-02-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=rococo-dev +// --extrinsic=* +// --runtime=target/release/wbuild/rococo-runtime/rococo_runtime.wasm +// --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt +// --output=./polkadot/runtime/rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 +// --heap-pages=4096 // --no-storage-info -// --no-median-slopes // --no-min-squares -// --pallet=frame_system_extensions -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --header=./polkadot/file_header.txt -// --output=./polkadot/runtime/rococo/src/weights/ +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,10 +55,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_genesis() -> Weight { // Proof Size summary in bytes: - // Measured: `54` + // Measured: `30` // Estimated: `3509` - // Minimum execution time: 3_262_000 picoseconds. - Weight::from_parts(3_497_000, 0) + // Minimum execution time: 4_912_000 picoseconds. + Weight::from_parts(5_120_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -65,10 +66,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_mortality_mortal_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `92` + // Measured: `68` // Estimated: `3509` - // Minimum execution time: 5_416_000 picoseconds. - Weight::from_parts(5_690_000, 0) + // Minimum execution time: 9_212_000 picoseconds. + Weight::from_parts(9_661_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -76,10 +77,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_mortality_immortal_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `92` + // Measured: `68` // Estimated: `3509` - // Minimum execution time: 5_416_000 picoseconds. - Weight::from_parts(5_690_000, 0) + // Minimum execution time: 9_157_000 picoseconds. + Weight::from_parts(9_775_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -87,8 +88,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 471_000 picoseconds. - Weight::from_parts(552_000, 0) + // Minimum execution time: 834_000 picoseconds. + Weight::from_parts(912_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::Account` (r:1 w:1) @@ -97,8 +98,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 4_847_000 picoseconds. - Weight::from_parts(5_091_000, 0) + // Minimum execution time: 10_058_000 picoseconds. + Weight::from_parts(10_641_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -107,31 +108,32 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 388_000 picoseconds. - Weight::from_parts(421_000, 0) + // Minimum execution time: 664_000 picoseconds. + Weight::from_parts(730_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 378_000 picoseconds. - Weight::from_parts(440_000, 0) + // Minimum execution time: 669_000 picoseconds. + Weight::from_parts(731_000, 0) .saturating_add(Weight::from_parts(0, 0)) } - /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) - /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: - // Measured: `24` - // Estimated: `1489` - // Minimum execution time: 3_402_000 picoseconds. - Weight::from_parts(3_627_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_024_000 picoseconds. + Weight::from_parts(7_266_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_259_000 picoseconds. + Weight::from_parts(4_475_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/polkadot/runtime/westend/src/weights/frame_system_extensions.rs b/polkadot/runtime/westend/src/weights/frame_system_extensions.rs index 9443b83a35bb..a069ae675e8b 100644 --- a/polkadot/runtime/westend/src/weights/frame_system_extensions.rs +++ b/polkadot/runtime/westend/src/weights/frame_system_extensions.rs @@ -17,24 +17,28 @@ //! Autogenerated weights for `frame_system_extensions` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-09-12, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `gleipnir`, CPU: `AMD Ryzen 9 7900X 12-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/debug/polkadot +// frame-omni-bencher +// v1 // benchmark // pallet -// --steps=2 -// --repeat=2 // --extrinsic=* +// --runtime=target/release/wbuild/westend-runtime/westend_runtime.wasm +// --pallet=frame_system_extensions +// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt +// --output=./polkadot/runtime/westend/src/weights // --wasm-execution=compiled +// --steps=50 +// --repeat=20 // --heap-pages=4096 -// --pallet=frame-system-extensions -// --chain=westend-dev -// --output=./polkadot/runtime/westend/src/weights/ -// --header=./polkadot/file_header.txt +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -51,10 +55,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_genesis() -> Weight { // Proof Size summary in bytes: - // Measured: `54` + // Measured: `30` // Estimated: `3509` - // Minimum execution time: 75_764_000 picoseconds. - Weight::from_parts(85_402_000, 0) + // Minimum execution time: 4_885_000 picoseconds. + Weight::from_parts(5_205_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -62,10 +66,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_mortality_mortal_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `92` + // Measured: `68` // Estimated: `3509` - // Minimum execution time: 118_233_000 picoseconds. - Weight::from_parts(126_539_000, 0) + // Minimum execution time: 9_220_000 picoseconds. + Weight::from_parts(9_503_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -73,10 +77,10 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn check_mortality_immortal_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `92` + // Measured: `68` // Estimated: `3509` - // Minimum execution time: 118_233_000 picoseconds. - Weight::from_parts(126_539_000, 0) + // Minimum execution time: 9_070_000 picoseconds. + Weight::from_parts(9_654_000, 0) .saturating_add(Weight::from_parts(0, 3509)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -84,8 +88,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_885_000 picoseconds. - Weight::from_parts(12_784_000, 0) + // Minimum execution time: 772_000 picoseconds. + Weight::from_parts(870_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::Account` (r:1 w:1) @@ -94,8 +98,8 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 104_237_000 picoseconds. - Weight::from_parts(110_910_000, 0) + // Minimum execution time: 9_830_000 picoseconds. + Weight::from_parts(10_328_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -104,31 +108,32 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_141_000 picoseconds. - Weight::from_parts(11_502_000, 0) + // Minimum execution time: 637_000 picoseconds. + Weight::from_parts(680_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_192_000 picoseconds. - Weight::from_parts(11_481_000, 0) + // Minimum execution time: 620_000 picoseconds. + Weight::from_parts(683_000, 0) .saturating_add(Weight::from_parts(0, 0)) } - /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) - /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn check_weight() -> Weight { // Proof Size summary in bytes: - // Measured: `24` - // Estimated: `1489` - // Minimum execution time: 87_616_000 picoseconds. - Weight::from_parts(93_607_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_812_000 picoseconds. + Weight::from_parts(7_155_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_995_000 picoseconds. + Weight::from_parts(4_190_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } } From be6b34e4923573d993c46df9f75746e32a766fdb Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 15:41:11 +0900 Subject: [PATCH 28/40] remove unused --- .../contracts/contracts-rococo/src/lib.rs | 2 +- .../weights/cumulus_pallet_weight_reclaim.rs | 70 -------- .../src/weights/frame_system_extensions.rs | 155 ------------------ .../contracts-rococo/src/weights/mod.rs | 1 - 4 files changed, 1 insertion(+), 227 deletions(-) delete mode 100644 cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs delete mode 100644 cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 0513074ab997..fa0d6187e54b 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -204,7 +204,7 @@ impl frame_system::Config for Runtime { } impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo; + type WeightInfo = (); } impl pallet_timestamp::Config for Runtime { diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs deleted file mode 100644 index bd68d3566b7f..000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . - -//! Autogenerated weights for `cumulus_pallet_weight_reclaim` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `d7b3ce5d4fc8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/release/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=cumulus_pallet_weight_reclaim -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `cumulus_pallet_weight_reclaim`. -pub struct WeightInfo(PhantomData); -impl cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo { - /// Storage: `System::BlockWeight` (r:1 w:1) - /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) - /// Storage: `System::ExtrinsicWeightRefunded` (r:1 w:1) - /// Proof: `System::ExtrinsicWeightRefunded` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn storage_weight_reclaim() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1533` - // Minimum execution time: 3_564_000 picoseconds. - Weight::from_parts(3_890_000, 0) - .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs deleted file mode 100644 index 970433643db3..000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Cumulus 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. - -// Cumulus 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 Cumulus. If not, see . - -//! Autogenerated weights for `frame_system_extensions` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `697235d969a1`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/release/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=frame_system_extensions -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `frame_system_extensions`. -pub struct WeightInfo(PhantomData); -impl frame_system::ExtensionsWeightInfo for WeightInfo { - /// Storage: `System::BlockHash` (r:1 w:0) - /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - fn check_genesis() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3509` - // Minimum execution time: 2_506_000 picoseconds. - Weight::from_parts(2_609_000, 0) - .saturating_add(Weight::from_parts(0, 3509)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `System::BlockHash` (r:1 w:0) - /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - fn check_mortality_mortal_transaction() -> Weight { - // Proof Size summary in bytes: - // Measured: `30` - // Estimated: `3509` - // Minimum execution time: 6_809_000 picoseconds. - Weight::from_parts(7_113_000, 0) - .saturating_add(Weight::from_parts(0, 3509)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `System::BlockHash` (r:1 w:0) - /// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - fn check_mortality_immortal_transaction() -> Weight { - // Proof Size summary in bytes: - // Measured: `68` - // Estimated: `3509` - // Minimum execution time: 7_875_000 picoseconds. - Weight::from_parts(8_311_000, 0) - .saturating_add(Weight::from_parts(0, 3509)) - .saturating_add(T::DbWeight::get().reads(1)) - } - fn check_non_zero_sender() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 734_000 picoseconds. - Weight::from_parts(775_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn check_nonce() -> Weight { - // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `3593` - // Minimum execution time: 7_331_000 picoseconds. - Weight::from_parts(7_624_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn check_spec_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 548_000 picoseconds. - Weight::from_parts(573_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn check_tx_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 527_000 picoseconds. - Weight::from_parts(559_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) - /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `System::BlockWeight` (r:1 w:1) - /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) - /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) - /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn check_weight() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1533` - // Minimum execution time: 6_594_000 picoseconds. - Weight::from_parts(6_806_000, 0) - .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `System::ExtrinsicWeightReclaimed` (r:1 w:1) - /// Proof: `System::ExtrinsicWeightReclaimed` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `System::BlockWeight` (r:1 w:1) - /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) - fn weight_reclaim() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1533` - // Minimum execution time: 3_680_000 picoseconds. - Weight::from_parts(3_899_000, 0) - .saturating_add(Weight::from_parts(0, 1533)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs index 4120ab34f814..850dae6fbd06 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs @@ -18,7 +18,6 @@ //! Expose the auto generated weight files. pub mod block_weights; -pub mod cumulus_pallet_weight_reclaim; pub mod extrinsic_weights; pub mod paritydb_weights; pub mod rocksdb_weights; From bc625fc389dbe46953d92f1983d8e8685477a4f1 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 16:04:19 +0900 Subject: [PATCH 29/40] better trace and some comment --- cumulus/pallets/weight-reclaim/src/lib.rs | 10 ++++++---- .../frame/system/src/extensions/check_weight.rs | 12 ------------ substrate/frame/system/src/lib.rs | 13 +++++++++++++ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index d8248950077b..ecf155b0ca5a 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -199,6 +199,9 @@ where let measured_proof_size = post_dispatch_proof_size.saturating_sub(pre_dispatch_proof_size); // The consumed weight as benchamrked. + // NOTE: `calc_actual_weight` will take the minimum of `post_info` and `info` weights. + // This means any underestimation of compute time in the pre dispatch info will not be + // taken into account. let benchmarked_weight = post_info_with_inner.calc_actual_weight(info); let benchmarked_proof_size = benchmarked_weight.proof_size(); @@ -222,12 +225,11 @@ where let already_reclaimed = frame_system::ExtrinsicWeightReclaimed::::get(); current_weight.accrue(already_reclaimed, info.class); current_weight.reduce(info.total_weight(), info.class); - // TODO TODO: this is different from the original implementation as the post dispatch is - // always taken even if the pre dispatch is less. current_weight.accrue(accurate_weight, info.class); - // The saturation will happen if the pre dispatch weight is underestimated. - // In this case the extrinsic refund is considered 0. + // The saturation will happen if the pre dispatch weight is underestimating the proof + // size. + // In this case the extrinsic proof size weight reclaimed is 0. let accurate_unspent = info.total_weight().saturating_sub(accurate_weight); frame_system::ExtrinsicWeightReclaimed::::put(accurate_unspent); }); diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index 5d869bf8714f..9e2c300d6f64 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -148,18 +148,6 @@ where crate::ExtrinsicWeightReclaimed::::put(unspent); } - log::trace!( - target: LOG_TARGET, - "Used block weight: {:?}", - crate::BlockWeight::::get(), - ); - - log::trace!( - target: LOG_TARGET, - "Used block length: {:?}", - Pallet::::all_extrinsics_len(), - ); - Ok(()) } } diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 3227ead6d785..d1afb25e3831 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -2081,6 +2081,19 @@ impl Pallet { }, }); + log::trace!( + target: LOG_TARGET, + "Used block weight: {:?}", + BlockWeight::::get(), + ); + + log::trace!( + target: LOG_TARGET, + "Used block length: {:?}", + Pallet::::all_extrinsics_len(), + ); + + let next_extrinsic_index = Self::extrinsic_index().unwrap_or_default() + 1u32; storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &next_extrinsic_index); From f792821459980bc80d685caf8c7efa0cbc8fed26 Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 16:53:53 +0900 Subject: [PATCH 30/40] use weight reclaim everywhere --- .../parachains/runtimes/glutton/glutton-westend/src/lib.rs | 1 + cumulus/parachains/runtimes/testing/penpal/src/lib.rs | 1 + polkadot/node/service/src/benchmarking.rs | 4 ++++ polkadot/node/test/service/src/lib.rs | 2 ++ polkadot/runtime/rococo/src/lib.rs | 2 ++ polkadot/runtime/test-runtime/src/lib.rs | 2 ++ polkadot/runtime/westend/src/lib.rs | 2 ++ polkadot/xcm/xcm-builder/src/tests/pay/mock.rs | 1 + polkadot/xcm/xcm-runtime-apis/tests/mock.rs | 5 ++++- substrate/bin/node/cli/src/service.rs | 5 +++++ substrate/bin/node/runtime/src/lib.rs | 3 +++ substrate/bin/node/testing/src/keyring.rs | 1 + substrate/frame/executive/src/tests.rs | 2 ++ substrate/frame/metadata-hash-extension/src/tests.rs | 1 + substrate/frame/src/lib.rs | 1 + substrate/test-utils/runtime/src/extrinsic.rs | 1 + substrate/test-utils/runtime/src/lib.rs | 1 + templates/minimal/runtime/src/lib.rs | 4 ++++ templates/solochain/node/src/benchmarking.rs | 2 ++ templates/solochain/runtime/src/lib.rs | 1 + 20 files changed, 41 insertions(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs index ad656cdbb83a..d6eb77439848 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs @@ -300,6 +300,7 @@ pub type TxExtension = ( frame_system::CheckEra, frame_system::CheckNonce, frame_system::CheckWeight, + frame_system::WeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs index 136592c56026..11824653e0cc 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs @@ -139,6 +139,7 @@ pub type TxExtension = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_asset_tx_payment::ChargeAssetTxPayment, + frame_system::WeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. diff --git a/polkadot/node/service/src/benchmarking.rs b/polkadot/node/service/src/benchmarking.rs index 186bea3960e8..20d7c802a922 100644 --- a/polkadot/node/service/src/benchmarking.rs +++ b/polkadot/node/service/src/benchmarking.rs @@ -202,6 +202,7 @@ fn westend_sign_call( frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), frame_metadata_hash_extension::CheckMetadataHash::::new(false), + frame_system::WeightReclaim::::new(), ) .into(); @@ -218,6 +219,7 @@ fn westend_sign_call( (), (), None, + (), ), ); @@ -257,6 +259,7 @@ fn rococo_sign_call( frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), frame_metadata_hash_extension::CheckMetadataHash::::new(false), + frame_system::WeightReclaim::::new(), ) .into(); @@ -273,6 +276,7 @@ fn rococo_sign_call( (), (), None, + (), ), ); diff --git a/polkadot/node/test/service/src/lib.rs b/polkadot/node/test/service/src/lib.rs index 6e09bb9e4310..892fe7d2a0fc 100644 --- a/polkadot/node/test/service/src/lib.rs +++ b/polkadot/node/test/service/src/lib.rs @@ -423,6 +423,7 @@ pub fn construct_extrinsic( frame_system::CheckNonce::::from(nonce), frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + frame_system::WeightReclaim::::new(), ) .into(); let raw_payload = SignedPayload::from_raw( @@ -437,6 +438,7 @@ pub fn construct_extrinsic( (), (), (), + (), ), ); let signature = raw_payload.using_encoded(|e| caller.sign(e)); diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 44dd820f8c3c..f96b40a3c2df 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -661,6 +661,7 @@ where frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), frame_metadata_hash_extension::CheckMetadataHash::new(true), + frame_system::WeightReclaim::::new(), ) .into(); let raw_payload = SignedPayload::new(call, tx_ext) @@ -1576,6 +1577,7 @@ pub type TxExtension = ( frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, frame_metadata_hash_extension::CheckMetadataHash, + frame_system::WeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index 9e7ee488af72..c2bd92090fb8 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -444,6 +444,7 @@ where frame_system::CheckNonce::::from(nonce), frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + frame_system::WeightReclaim::::new(), ) .into(); let raw_payload = SignedPayload::new(call, tx_ext) @@ -835,6 +836,7 @@ pub type TxExtension = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + frame_system::WeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index a91ca399db41..80df0e3a3600 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -920,6 +920,7 @@ where frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(tip), frame_metadata_hash_extension::CheckMetadataHash::::new(true), + frame_system::WeightReclaim::::new(), ) .into(); let raw_payload = SignedPayload::new(call, tx_ext) @@ -1782,6 +1783,7 @@ pub type TxExtension = ( frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, frame_metadata_hash_extension::CheckMetadataHash, + frame_system::WeightReclaim, ); parameter_types! { diff --git a/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs b/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs index d76ff21b8597..4f30b401b595 100644 --- a/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs +++ b/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs @@ -37,6 +37,7 @@ pub type TxExtension = ( frame_system::CheckMortality, frame_system::CheckNonce, frame_system::CheckWeight, + frame_system::WeightReclaim, ); pub type Address = sp_runtime::MultiAddress; pub type UncheckedExtrinsic = diff --git a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs index b3afa23503e3..11df3976b32d 100644 --- a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs +++ b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs @@ -60,7 +60,10 @@ construct_runtime! { } } -pub type TxExtension = (frame_system::CheckWeight,); +pub type TxExtension = ( + frame_system::CheckWeight, + frame_system::WeightReclaim, +); // we only use the hash type from this, so using the mock should be fine. pub(crate) type Extrinsic = sp_runtime::generic::UncheckedExtrinsic< diff --git a/substrate/bin/node/cli/src/service.rs b/substrate/bin/node/cli/src/service.rs index 7b166f94bcc8..d0704ccc4cb5 100644 --- a/substrate/bin/node/cli/src/service.rs +++ b/substrate/bin/node/cli/src/service.rs @@ -139,6 +139,7 @@ pub fn create_extrinsic( >::from(tip, None), ), frame_metadata_hash_extension::CheckMetadataHash::new(false), + frame_system::WeightReclaim::::new(), ); let raw_payload = kitchensink_runtime::SignedPayload::from_raw( @@ -154,6 +155,7 @@ pub fn create_extrinsic( (), (), None, + (), ), ); let signature = raw_payload.using_encoded(|e| sender.sign(e)); @@ -1072,6 +1074,7 @@ mod tests { let tx_payment = pallet_skip_feeless_payment::SkipCheckIfFeeless::from( pallet_asset_conversion_tx_payment::ChargeAssetTxPayment::from(0, None), ); + let weight_reclaim = frame_system::WeightReclaim::new(); let metadata_hash = frame_metadata_hash_extension::CheckMetadataHash::new(false); let tx_ext: TxExtension = ( check_non_zero_sender, @@ -1083,6 +1086,7 @@ mod tests { check_weight, tx_payment, metadata_hash, + weight_reclaim, ); let raw_payload = SignedPayload::from_raw( function, @@ -1097,6 +1101,7 @@ mod tests { (), (), None, + (), ), ); let signature = raw_payload.using_encoded(|payload| signer.sign(payload)); diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index d6a17856e470..29963fc96ec1 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1490,6 +1490,7 @@ where ), ), frame_metadata_hash_extension::CheckMetadataHash::new(false), + frame_system::WeightReclaim::::new(), ); let raw_payload = SignedPayload::new(call, tx_ext) @@ -2627,6 +2628,7 @@ pub type TxExtension = ( pallet_asset_conversion_tx_payment::ChargeAssetTxPayment, >, frame_metadata_hash_extension::CheckMetadataHash, + frame_system::WeightReclaim, ); #[derive(Clone, PartialEq, Eq, Debug)] @@ -2648,6 +2650,7 @@ impl EthExtra for EthExtraImpl { pallet_asset_conversion_tx_payment::ChargeAssetTxPayment::::from(tip, None) .into(), frame_metadata_hash_extension::CheckMetadataHash::::new(false), + frame_system::WeightReclaim::::new(), ) } } diff --git a/substrate/bin/node/testing/src/keyring.rs b/substrate/bin/node/testing/src/keyring.rs index 20497e85eab9..784696a18cc2 100644 --- a/substrate/bin/node/testing/src/keyring.rs +++ b/substrate/bin/node/testing/src/keyring.rs @@ -86,6 +86,7 @@ pub fn tx_ext(nonce: Nonce, extra_fee: Balance) -> TxExtension { pallet_asset_conversion_tx_payment::ChargeAssetTxPayment::from(extra_fee, None), ), frame_metadata_hash_extension::CheckMetadataHash::new(false), + frame_system::WeightReclaim::new(), ) } diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index a506256ebd6e..882d875f3d80 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -455,6 +455,7 @@ type TxExtension = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + frame_system::WeightReclaim, ); type UncheckedXt = sp_runtime::generic::UncheckedExtrinsic< u64, @@ -563,6 +564,7 @@ fn tx_ext(nonce: u64, fee: Balance) -> TxExtension { frame_system::CheckNonce::from(nonce), frame_system::CheckWeight::new(), pallet_transaction_payment::ChargeTransactionPayment::from(fee), + frame_system::WeightReclaim::new(), ) .into() } diff --git a/substrate/frame/metadata-hash-extension/src/tests.rs b/substrate/frame/metadata-hash-extension/src/tests.rs index 11a3345ee15c..7a6966f46290 100644 --- a/substrate/frame/metadata-hash-extension/src/tests.rs +++ b/substrate/frame/metadata-hash-extension/src/tests.rs @@ -144,6 +144,7 @@ mod docs { // Add the `CheckMetadataHash` extension. // The position in this list is not important, so we could also add it to beginning. frame_metadata_hash_extension::CheckMetadataHash, + frame_system::WeightReclaim, ); /// In your runtime this will be your real address type. diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index ade1095cc504..c64ca01725f1 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -320,6 +320,7 @@ pub mod runtime { frame_system::CheckEra, frame_system::CheckNonce, frame_system::CheckWeight, + frame_system::WeightReclaim, ); } diff --git a/substrate/test-utils/runtime/src/extrinsic.rs b/substrate/test-utils/runtime/src/extrinsic.rs index 8f94dd10a834..7052e79b460b 100644 --- a/substrate/test-utils/runtime/src/extrinsic.rs +++ b/substrate/test-utils/runtime/src/extrinsic.rs @@ -212,6 +212,7 @@ impl ExtrinsicBuilder { self.metadata_hash .map(CheckMetadataHash::new_with_custom_hash) .unwrap_or_else(|| CheckMetadataHash::new(false)), + frame_system::WeightReclaim::new(), ); let raw_payload = SignedPayload::from_raw( self.function.clone(), diff --git a/substrate/test-utils/runtime/src/lib.rs b/substrate/test-utils/runtime/src/lib.rs index a4a0d348a390..d0f3f4488547 100644 --- a/substrate/test-utils/runtime/src/lib.rs +++ b/substrate/test-utils/runtime/src/lib.rs @@ -155,6 +155,7 @@ pub type TxExtension = ( (CheckNonce, CheckWeight), CheckSubstrateCall, frame_metadata_hash_extension::CheckMetadataHash, + frame_system::WeightReclaim, ); /// The payload being signed in transactions. pub type SignedPayload = sp_runtime::generic::SignedPayload; diff --git a/templates/minimal/runtime/src/lib.rs b/templates/minimal/runtime/src/lib.rs index 4f914a823bf6..35a7c6b94862 100644 --- a/templates/minimal/runtime/src/lib.rs +++ b/templates/minimal/runtime/src/lib.rs @@ -122,6 +122,10 @@ type TxExtension = ( // Ensures that the sender has enough funds to pay for the transaction // and deducts the fee from the sender's account. pallet_transaction_payment::ChargeTransactionPayment, + // Reclaim the unused weight from the block using post dispatch information. + // It must be last in the pipeline in order to catch the refund in previous transaction + // extensions + frame_system::WeightReclaim, ); // Composes the runtime by adding all the used pallets and deriving necessary types. diff --git a/templates/solochain/node/src/benchmarking.rs b/templates/solochain/node/src/benchmarking.rs index 0d60230cd19c..467cad4c0aaa 100644 --- a/templates/solochain/node/src/benchmarking.rs +++ b/templates/solochain/node/src/benchmarking.rs @@ -122,6 +122,7 @@ pub fn create_benchmark_extrinsic( frame_system::CheckWeight::::new(), pallet_transaction_payment::ChargeTransactionPayment::::from(0), frame_metadata_hash_extension::CheckMetadataHash::::new(false), + frame_system::WeightReclaim::::new(), ); let raw_payload = runtime::SignedPayload::from_raw( @@ -137,6 +138,7 @@ pub fn create_benchmark_extrinsic( (), (), None, + (), ), ); let signature = raw_payload.using_encoded(|e| sender.sign(e)); diff --git a/templates/solochain/runtime/src/lib.rs b/templates/solochain/runtime/src/lib.rs index f2eb49592be9..fc18dbbef2d8 100644 --- a/templates/solochain/runtime/src/lib.rs +++ b/templates/solochain/runtime/src/lib.rs @@ -157,6 +157,7 @@ pub type TxExtension = ( frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, frame_metadata_hash_extension::CheckMetadataHash, + frame_system::WeightReclaim, ); /// Unchecked extrinsic type as expected by this runtime. From 1704d7045c56f76645b9400a4709a21ba9256a4b Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 17:05:28 +0900 Subject: [PATCH 31/40] fmt --- polkadot/xcm/xcm-runtime-apis/tests/mock.rs | 6 ++---- substrate/frame/system/src/lib.rs | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs index 11df3976b32d..d18c87a746cb 100644 --- a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs +++ b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs @@ -60,10 +60,8 @@ construct_runtime! { } } -pub type TxExtension = ( - frame_system::CheckWeight, - frame_system::WeightReclaim, -); +pub type TxExtension = + (frame_system::CheckWeight, frame_system::WeightReclaim); // we only use the hash type from this, so using the mock should be fine. pub(crate) type Extrinsic = sp_runtime::generic::UncheckedExtrinsic< diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index d1afb25e3831..4bd1237af0ca 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -2093,7 +2093,6 @@ impl Pallet { Pallet::::all_extrinsics_len(), ); - let next_extrinsic_index = Self::extrinsic_index().unwrap_or_default() + 1u32; storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &next_extrinsic_index); From 10b0ef0e06a4ad86b75cefcd834ed95b808fbc9f Mon Sep 17 00:00:00 2001 From: gui Date: Thu, 31 Oct 2024 18:20:21 +0900 Subject: [PATCH 32/40] add tests --- cumulus/pallets/weight-reclaim/src/lib.rs | 15 ++++-- cumulus/pallets/weight-reclaim/src/tests.rs | 48 ++++++++++++++++++ .../src/weights/frame_system_extensions.rs | 13 ++++- .../src/weights/frame_system_extensions.rs | 13 ++++- .../src/weights/frame_system_extensions.rs | 13 ++++- .../src/weights/frame_system_extensions.rs | 13 ++++- .../storage-weight-reclaim/src/lib.rs | 3 +- prdoc/pr_6140.prdoc | 16 +++--- .../system/src/extensions/check_weight.rs | 18 ++----- .../system/src/extensions/weight_reclaim.rs | 23 +-------- .../frame/system/src/extensions/weights.rs | 22 +++++++-- substrate/frame/system/src/lib.rs | 30 ++++++++++++ substrate/frame/system/src/tests.rs | 49 +++++++++++++++++++ .../parachain/runtime/src/configs/mod.rs | 2 +- 14 files changed, 221 insertions(+), 57 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index ecf155b0ca5a..4f4b46a905dd 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -74,7 +74,9 @@ pub mod pallet { /// /// This extension checks the size of the node-side storage proof /// before and after executing a given extrinsic. The difference between -/// benchmarked and spent weight can be reclaimed. +/// benchmarked and used weight is reclaimed. +/// +/// If the benchmark was underestimating the proof size, then it is added to the block weight. #[derive(Encode, Decode, TypeInfo, Derivative)] #[derivative( Clone(bound = "S: Clone"), @@ -116,8 +118,13 @@ where T::RuntimeCall: Dispatchable, { const IDENTIFIER: &'static str = "StorageWeightReclaim"; + type Implicit = S::Implicit; + + // Initial proof size and inner extension value. type Val = (Option, S::Val); + + // Initial proof size and inner extension pre. type Pre = (Option, S::Pre); fn implicit(&self) -> Result { @@ -141,8 +148,6 @@ where self_implicit: Self::Implicit, inherited_implication: &impl Encode, ) -> Result<(ValidTransaction, Self::Val, T::RuntimeOrigin), TransactionValidityError> { - // Trade-off: we could move it to `prepare` but better be accurate on reclaim than fast on - // `validate` let proof_size = get_proof_size(); self.0 @@ -259,6 +264,8 @@ where len: usize, result: &DispatchResult, ) -> Result<(), TransactionValidityError> { - S::bare_post_dispatch(info, post_info, len, result) + S::bare_post_dispatch(info, post_info, len, result)?; + + frame_system::Pallet::::reclaim_weight(info, post_info) } } diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index 5692e5bf1990..16a32f536a4e 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -56,6 +56,17 @@ impl TransactionExtension for MockExtensionWithRefund { ) -> Result { Ok(MOCK_EXT_REFUND.with_borrow(|v| *v)) } + fn bare_post_dispatch( + _info: &DispatchInfoOf, + post_info: &mut PostDispatchInfoOf, + _len: usize, + _result: &DispatchResult, + ) -> Result<(), TransactionValidityError> { + if let Some(ref mut w) = post_info.actual_weight { + *w -= MOCK_EXT_REFUND.with_borrow(|v| *v); + } + Ok(()) + } sp_runtime::impl_tx_ext_default!(RuntimeCall; validate prepare); } @@ -211,6 +222,7 @@ mod doc { frame_system::CheckNonce, frame_system::CheckWeight, // ... all other extensions + // No need for `frame_system::WeightReclaim` as the reclaim. ), >; } @@ -575,3 +587,39 @@ fn full_accrue() { ); }); } + +#[test] +fn bare_is_reclaimed() { + let mut test_ext = setup_test_externalities(&[]); + test_ext.execute_with(|| { + let info = DispatchInfo { + call_weight: Weight::from_parts(100, 100), + extension_weight: Weight::from_parts(100, 100), + class: DispatchClass::Normal, + pays_fee: Default::default(), + }; + let mut post_info = PostDispatchInfo { + actual_weight: Some(Weight::from_parts(100, 100)), + pays_fee: Default::default(), + }; + MOCK_EXT_REFUND.with_borrow_mut(|v| *v = Weight::from_parts(10, 10)); + + frame_system::BlockWeight::::mutate(|current_weight| { + current_weight + .set(Weight::from_parts(45, 45) + info.total_weight(), DispatchClass::Normal); + }); + + StorageWeightReclaim::::bare_post_dispatch( + &info, + &mut post_info, + 0, + &Ok(()), + ) + .expect("tx is valid"); + + assert_eq!( + *frame_system::BlockWeight::::get().get(DispatchClass::Normal), + Weight::from_parts(45 + 90, 45 + 90), + ); + }); +} diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs index 3599aea2cd55..04b695b57693 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/frame_system_extensions.rs @@ -129,7 +129,18 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) + /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `24` + // Estimated: `1533` + // Minimum execution time: 3_687_000 picoseconds. + Weight::from_parts(6_192_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs index c487de0e621c..9527e0c5549a 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/frame_system_extensions.rs @@ -129,7 +129,18 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) + /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `24` + // Estimated: `1533` + // Minimum execution time: 3_687_000 picoseconds. + Weight::from_parts(6_192_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs index c8e1673acc8e..3f12b25540ea 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/frame_system_extensions.rs @@ -129,7 +129,18 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) + /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `24` + // Estimated: `1533` + // Minimum execution time: 3_687_000 picoseconds. + Weight::from_parts(6_192_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs index faca078ee1f6..422b8566ad08 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/frame_system_extensions.rs @@ -129,7 +129,18 @@ impl frame_system::ExtensionsWeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) + /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - Weight::zero() // TODO TODO: rerun + // Proof Size summary in bytes: + // Measured: `24` + // Estimated: `1533` + // Minimum execution time: 3_687_000 picoseconds. + Weight::from_parts(6_192_000, 0) + .saturating_add(Weight::from_parts(0, 1533)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/cumulus/primitives/storage-weight-reclaim/src/lib.rs b/cumulus/primitives/storage-weight-reclaim/src/lib.rs index f6c2610fe32d..06be7b23d82f 100644 --- a/cumulus/primitives/storage-weight-reclaim/src/lib.rs +++ b/cumulus/primitives/storage-weight-reclaim/src/lib.rs @@ -115,8 +115,7 @@ mod allow_deprecated { transaction extension pipeline; it ignores the validation and preparation of extensions prior \ to itself and ignores the post dispatch logic for extensions subsequent to itself, it also doesn't provide weight information. \ - Use `StorageWeightReclaim` and `StorageWeightRecord` in the `cumulus-pallet-weight-reclaim`\ - crate")] + Use `StorageWeightReclaim` in the `cumulus-pallet-weight-reclaim` crate")] #[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct StorageWeightReclaim(pub(super) PhantomData); diff --git a/prdoc/pr_6140.prdoc b/prdoc/pr_6140.prdoc index 30161851ba3e..83d76ef1a5d1 100644 --- a/prdoc/pr_6140.prdoc +++ b/prdoc/pr_6140.prdoc @@ -1,12 +1,15 @@ -title: Accurate `StorageWeightReclaim` transaction extension +title: Accurate weight reclaim with frame_system::WeightReclaim and cumulus `StorageWeightReclaim` transaction extensions doc: - audience: Runtime Dev description: | - `StorageWeightReclaim` in `cumulus-primitives-storage-weight-reclaim` is deprecated. - Since the introduction of transaction extension, the transaction extension weight is no longer part of base extrinsic weight. As a consequence some weight of transaction extensions are missed when calculating the actual used proof size in `StorageWeightReclaim`. - So a new `StorageWeightReclaim` in `cumulus-pallet-weight-reclaim` is introduced. - This transaction extension is meant to be used as a wrapping of the whole transaction extension pipeline, and will take into account all proof size accurately. + Since the introduction of transaction extension, the transaction extension weight is no longer part of base extrinsic weight. As a consequence some weight of transaction extensions are missed when calculating post dispatch weight and reclaiming unused block weight. + + For solo chains, in order to reclaim the weight accurately `frame_system::WeightReclaim` transaction extension must be used at the end of the transaction extension pipeline. + + For para chains `StorageWeightReclaim` in `cumulus-primitives-storage-weight-reclaim` is deprecated. + A new transaction extension `StorageWeightReclaim` in `cumulus-pallet-weight-reclaim` is introduced. + `StorageWeightReclaim` is meant to be used as a wrapping of the whole transaction extension pipeline, and will take into account all proof size accurately. The new wrapping transaction extension is used like this: ```rust @@ -29,8 +32,7 @@ doc: >; ``` - NOTE: Ideally `CheckWeight` should be last because it doesn't refund the transaction - extensions following itself. But `StorageWeightReclaim` doesn't do refund so it is ok. + NOTE: prior to transaction extension, `StorageWeightReclaim` also missed the some proof size used by other transaction extension prior to itself. This is also fixed by the wrapping `StorageWeightReclaim`. crates: - name: cumulus-pallet-weight-reclaim diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index 9e2c300d6f64..efb07ec3e7bf 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -134,21 +134,12 @@ where Ok(()) } + #[deprecated(note = "Use `frame_system::Pallet::reclaim_weight` instead.")] pub fn do_post_dispatch( info: &DispatchInfoOf, post_info: &PostDispatchInfoOf, ) -> Result<(), TransactionValidityError> { - let already_reclaimed = crate::ExtrinsicWeightReclaimed::::get(); - let unspent = post_info.calc_unspent(info); - if unspent.any_gt(already_reclaimed) { - crate::BlockWeight::::mutate(|current_weight| { - current_weight.accrue(already_reclaimed, info.class); - current_weight.reduce(unspent, info.class); - }); - crate::ExtrinsicWeightReclaimed::::put(unspent); - } - - Ok(()) + crate::Pallet::::reclaim_weight(info, post_info) } } @@ -268,8 +259,7 @@ where _len: usize, _result: &DispatchResult, ) -> Result { - Self::do_post_dispatch(info, post_info)?; - Ok(Weight::zero()) + crate::Pallet::::reclaim_weight(info, post_info).map(|()| Weight::zero()) } fn bare_validate( @@ -295,7 +285,7 @@ where _len: usize, _result: &DispatchResult, ) -> Result<(), TransactionValidityError> { - Self::do_post_dispatch(info, post_info) + crate::Pallet::::reclaim_weight(info, post_info) } } diff --git a/substrate/frame/system/src/extensions/weight_reclaim.rs b/substrate/frame/system/src/extensions/weight_reclaim.rs index 71d2f9c4d997..1ec579930d5c 100644 --- a/substrate/frame/system/src/extensions/weight_reclaim.rs +++ b/substrate/frame/system/src/extensions/weight_reclaim.rs @@ -44,24 +44,6 @@ where pub fn new() -> Self { Self(Default::default()) } - - pub fn do_post_dispatch( - info: &DispatchInfoOf, - post_info: &PostDispatchInfoOf, - ) -> Result<(), TransactionValidityError> { - let already_reclaimed = crate::ExtrinsicWeightReclaimed::::get(); - let unspent = post_info.calc_unspent(info); - let accurate_reclaim = already_reclaimed.max(unspent); - - if already_reclaimed != accurate_reclaim { - crate::BlockWeight::::mutate(|current_weight| { - current_weight.accrue(already_reclaimed, info.class); - current_weight.reduce(accurate_reclaim, info.class); - }); - crate::ExtrinsicWeightReclaimed::::put(accurate_reclaim); - } - Ok(()) - } } impl TransactionExtension for WeightReclaim @@ -107,8 +89,7 @@ where _len: usize, _result: &DispatchResult, ) -> Result { - Self::do_post_dispatch(info, post_info)?; - Ok(Weight::zero()) + crate::Pallet::::reclaim_weight(info, post_info).map(|()| Weight::zero()) } fn bare_validate( @@ -133,7 +114,7 @@ where _len: usize, _result: &DispatchResult, ) -> Result<(), TransactionValidityError> { - Self::do_post_dispatch(info, post_info) + crate::Pallet::::reclaim_weight(info, post_info) } } diff --git a/substrate/frame/system/src/extensions/weights.rs b/substrate/frame/system/src/extensions/weights.rs index d10be4ad2ec1..dbce1ace5f4a 100644 --- a/substrate/frame/system/src/extensions/weights.rs +++ b/substrate/frame/system/src/extensions/weights.rs @@ -138,9 +138,16 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) + /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - // TODO TODO - Weight::zero() + // Proof Size summary in bytes: + // Measured: `24` + // Estimated: `1489` + // Minimum execution time: 4_375_000 picoseconds. + Weight::from_parts(4_747_000, 1489) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } @@ -219,8 +226,15 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } + /// Storage: `System::AllExtrinsicsLen` (r:1 w:1) + /// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn weight_reclaim() -> Weight { - // TODO TODO - Weight::zero() + // Proof Size summary in bytes: + // Measured: `24` + // Estimated: `1489` + // Minimum execution time: 4_375_000 picoseconds. + Weight::from_parts(4_747_000, 1489) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 4bd1237af0ca..587f86f08625 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -145,6 +145,10 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_core::storage::well_known_keys; +use sp_runtime::{ + traits::{DispatchInfoOf, PostDispatchInfoOf}, + transaction_validity::TransactionValidityError, +}; use sp_weights::{RuntimeDbWeight, Weight}; #[cfg(any(feature = "std", test))] @@ -2195,6 +2199,32 @@ impl Pallet { } Ok(actual_hash) } + + /// Reclaim the weight for the extrinsic given info and post info. + /// + /// This function will check the already reclaimed weight, and reclaim more if the + /// difference between pre dispatch and post dispatch weight is higher. + pub fn reclaim_weight( + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, + ) -> Result<(), TransactionValidityError> + where + T::RuntimeCall: Dispatchable, + { + let already_reclaimed = crate::ExtrinsicWeightReclaimed::::get(); + let unspent = post_info.calc_unspent(info); + let accurate_reclaim = already_reclaimed.max(unspent); + + if already_reclaimed != accurate_reclaim { + crate::BlockWeight::::mutate(|current_weight| { + current_weight.accrue(already_reclaimed, info.class); + current_weight.reduce(accurate_reclaim, info.class); + }); + crate::ExtrinsicWeightReclaimed::::put(accurate_reclaim); + } + + Ok(()) + } } /// Returns a 32 byte datum which is guaranteed to be universally unique. `entropy` is provided diff --git a/substrate/frame/system/src/tests.rs b/substrate/frame/system/src/tests.rs index 40a8ee56d9de..6415380b2848 100644 --- a/substrate/frame/system/src/tests.rs +++ b/substrate/frame/system/src/tests.rs @@ -907,3 +907,52 @@ fn extrinsic_weight_refunded_is_cleaned() { assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::zero()); }); } + +#[test] +fn reclaim_works() { + new_test_ext().execute_with(|| { + let info = DispatchInfo { call_weight: Weight::from_parts(100, 200), ..Default::default() }; + crate::Pallet::::reclaim_weight( + &info, + &PostDispatchInfo { + actual_weight: Some(Weight::from_parts(50, 100)), + ..Default::default() + }, + ) + .unwrap(); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::from_parts(50, 100)); + + crate::Pallet::::reclaim_weight( + &info, + &PostDispatchInfo { + actual_weight: Some(Weight::from_parts(25, 200)), + ..Default::default() + }, + ) + .unwrap(); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::from_parts(75, 100)); + + crate::Pallet::::reclaim_weight( + &info, + &PostDispatchInfo { + actual_weight: Some(Weight::from_parts(300, 50)), + ..Default::default() + }, + ) + .unwrap(); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::from_parts(75, 150)); + + crate::Pallet::::reclaim_weight( + &info, + &PostDispatchInfo { + actual_weight: Some(Weight::from_parts(300, 300)), + ..Default::default() + }, + ) + .unwrap(); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::from_parts(75, 150)); + + System::note_applied_extrinsic(&Ok(().into()), Default::default()); + assert_eq!(crate::ExtrinsicWeightReclaimed::::get(), Weight::zero()); + }); +} diff --git a/templates/parachain/runtime/src/configs/mod.rs b/templates/parachain/runtime/src/configs/mod.rs index 4548d7d221bc..1e9155f59a57 100644 --- a/templates/parachain/runtime/src/configs/mod.rs +++ b/templates/parachain/runtime/src/configs/mod.rs @@ -131,7 +131,7 @@ impl frame_system::Config for Runtime { /// Configure the palelt weight reclaim tx. impl cumulus_pallet_weight_reclaim::Config for Runtime { - type WeightInfo = (); // TODO TODO: run CI weights generation + type WeightInfo = (); } impl pallet_timestamp::Config for Runtime { From 5e8cae0901dfa1aff2acdd4e7c966ecbab15048f Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Wed, 6 Nov 2024 10:45:47 +0900 Subject: [PATCH 33/40] Update cumulus/pallets/weight-reclaim/src/lib.rs Co-authored-by: georgepisaltu <52418509+georgepisaltu@users.noreply.github.com> --- cumulus/pallets/weight-reclaim/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 4f4b46a905dd..00216e0fe5a4 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -203,7 +203,7 @@ where // The consumed proof size as measured by the host. let measured_proof_size = post_dispatch_proof_size.saturating_sub(pre_dispatch_proof_size); - // The consumed weight as benchamrked. + // The consumed weight as benchmarked. // NOTE: `calc_actual_weight` will take the minimum of `post_info` and `info` weights. // This means any underestimation of compute time in the pre dispatch info will not be // taken into account. From a0a05897fe8ee9a22ed7ae3773ce41ea8010de10 Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere Date: Wed, 6 Nov 2024 11:18:31 +0900 Subject: [PATCH 34/40] Update substrate/frame/system/src/lib.rs Co-authored-by: georgepisaltu <52418509+georgepisaltu@users.noreply.github.com> --- substrate/frame/system/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 587f86f08625..b651cb9421a9 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -2217,8 +2217,8 @@ impl Pallet { if already_reclaimed != accurate_reclaim { crate::BlockWeight::::mutate(|current_weight| { - current_weight.accrue(already_reclaimed, info.class); - current_weight.reduce(accurate_reclaim, info.class); + let to_reclaim = accurate_reclaim.saturating_sub(already_reclaimed); + current_weight.reduce(to_reclaim, info.class); }); crate::ExtrinsicWeightReclaimed::::put(accurate_reclaim); } From 5322297303f165cc1f55ec32ac6779ec49a4bfbc Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 6 Nov 2024 11:19:22 +0900 Subject: [PATCH 35/40] more explicit names --- cumulus/pallets/weight-reclaim/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 00216e0fe5a4..5cdc4abefba3 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -203,28 +203,28 @@ where // The consumed proof size as measured by the host. let measured_proof_size = post_dispatch_proof_size.saturating_sub(pre_dispatch_proof_size); - // The consumed weight as benchmarked. + // The consumed weight as benchmarked. Calculated from post info and info. // NOTE: `calc_actual_weight` will take the minimum of `post_info` and `info` weights. // This means any underestimation of compute time in the pre dispatch info will not be // taken into account. - let benchmarked_weight = post_info_with_inner.calc_actual_weight(info); + let benchmarked_actual_weight = post_info_with_inner.calc_actual_weight(info); - let benchmarked_proof_size = benchmarked_weight.proof_size(); - if benchmarked_proof_size < measured_proof_size { + let benchmarked_actual_proof_size = benchmarked_actual_weight.proof_size(); + if benchmarked_actual_proof_size < measured_proof_size { log::error!( target: LOG_TARGET, "Benchmarked storage weight smaller than consumed storage weight. \ - benchmarked: {benchmarked_proof_size} consumed: {measured_proof_size}" + benchmarked: {benchmarked_actual_proof_size} consumed: {measured_proof_size}" ); } else { log::trace!( target: LOG_TARGET, - "Reclaiming storage weight. benchmarked: {benchmarked_proof_size}, + "Reclaiming storage weight. benchmarked: {benchmarked_actual_proof_size}, consumed: {measured_proof_size}" ); } - let accurate_weight = benchmarked_weight.set_proof_size(measured_proof_size); + let accurate_weight = benchmarked_actual_weight.set_proof_size(measured_proof_size); frame_system::BlockWeight::::mutate(|current_weight| { let already_reclaimed = frame_system::ExtrinsicWeightReclaimed::::get(); From 472d63ce81333a0ecb738e8bacfeee7b12cd1a84 Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 6 Nov 2024 11:31:36 +0900 Subject: [PATCH 36/40] single operation on weight --- substrate/frame/system/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index b651cb9421a9..fd9aa67368f7 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -2214,11 +2214,11 @@ impl Pallet { let already_reclaimed = crate::ExtrinsicWeightReclaimed::::get(); let unspent = post_info.calc_unspent(info); let accurate_reclaim = already_reclaimed.max(unspent); - - if already_reclaimed != accurate_reclaim { + // Saturation never happens, we took the maximum above. + let to_reclaim_more = accurate_reclaim.saturating_sub(already_reclaimed); + if to_reclaim_more != Weight::zero() { crate::BlockWeight::::mutate(|current_weight| { - let to_reclaim = accurate_reclaim.saturating_sub(already_reclaimed); - current_weight.reduce(to_reclaim, info.class); + current_weight.reduce(to_reclaim_more, info.class); }); crate::ExtrinsicWeightReclaimed::::put(accurate_reclaim); } From 597fde45aed898df8880eaaed0dedcee0255ef56 Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 6 Nov 2024 11:51:16 +0900 Subject: [PATCH 37/40] return more accurate unspent from storage reclaim tx ext --- cumulus/pallets/weight-reclaim/src/lib.rs | 14 ++++++-------- cumulus/pallets/weight-reclaim/src/tests.rs | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 5cdc4abefba3..2f4ce19f3e94 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -225,21 +225,19 @@ where } let accurate_weight = benchmarked_actual_weight.set_proof_size(measured_proof_size); - frame_system::BlockWeight::::mutate(|current_weight| { let already_reclaimed = frame_system::ExtrinsicWeightReclaimed::::get(); current_weight.accrue(already_reclaimed, info.class); current_weight.reduce(info.total_weight(), info.class); current_weight.accrue(accurate_weight, info.class); - - // The saturation will happen if the pre dispatch weight is underestimating the proof - // size. - // In this case the extrinsic proof size weight reclaimed is 0. - let accurate_unspent = info.total_weight().saturating_sub(accurate_weight); - frame_system::ExtrinsicWeightReclaimed::::put(accurate_unspent); }); - Ok(inner_refund) + // The saturation will happen if the pre dispatch weight is underestimating the proof + // size. + // In this case the extrinsic proof size weight reclaimed is 0. + let accurate_unspent = info.total_weight().saturating_sub(accurate_weight); + frame_system::ExtrinsicWeightReclaimed::::put(accurate_unspent); + Ok(accurate_unspent) } fn bare_validate( diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index 16a32f536a4e..990c515b8cd4 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -250,6 +250,7 @@ fn basic_refund() { assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + // TODO TODO: assert_eq!(post_info.actual_weight, Weight::from_parts(0, 650)); assert_eq!(get_storage_weight().proof_size(), 1250); }); } @@ -532,11 +533,14 @@ fn full_basic_refund() { let post_info = extrinsic.apply::(&info, LEN).unwrap().unwrap(); // Assertions: - let post_info_tx_proof_size = - check_weight + storage_weight_reclaim + mock_ext - mock_ext_refund; assert_eq!( - post_info.actual_weight, - Some(call_info.call_weight + Weight::from_parts(3, post_info_tx_proof_size)) + post_info.actual_weight.unwrap().ref_time(), + call_info.call_weight.ref_time() + 3, + ); + assert_eq!( + post_info.actual_weight.unwrap().proof_size(), + // LEN is part of the base extrinsic, not the post info weight actual weight. + actual_used_proof_size as u64, ); assert_eq!( get_storage_weight().proof_size(), @@ -578,8 +582,12 @@ fn full_accrue() { let post_info_tx_proof_size = check_weight + storage_weight_reclaim + mock_ext - mock_ext_refund; assert_eq!( - post_info.actual_weight, - Some(call_info.call_weight + Weight::from_parts(3, post_info_tx_proof_size)) + post_info.actual_weight.unwrap().ref_time(), + call_info.call_weight.ref_time() + 3, + ); + assert_eq!( + post_info.actual_weight.unwrap().proof_size(), + info.total_weight().proof_size(), // The post info doesn't get the accrue. ); assert_eq!( get_storage_weight().proof_size(), From 1ad6e56260fc3b95663a6782f042bddd655bb21c Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 6 Nov 2024 13:17:31 +0900 Subject: [PATCH 38/40] Keep accrue when node proof size is bigger: https://github.com/paritytech/polkadot-sdk/pull/5281 --- cumulus/pallets/weight-reclaim/src/lib.rs | 18 +++ cumulus/pallets/weight-reclaim/src/tests.rs | 115 ++++++++++++++++++-- 2 files changed, 125 insertions(+), 8 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 2f4ce19f3e94..3d57e1b81f0a 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -230,6 +230,24 @@ where current_weight.accrue(already_reclaimed, info.class); current_weight.reduce(info.total_weight(), info.class); current_weight.accrue(accurate_weight, info.class); + + // If we encounter a situation where the node-side proof size is already higher than + // what we have in the runtime bookkeeping, we add the difference to the `BlockWeight`. + // This prevents that the proof size grows faster than the runtime proof size. + let extrinsic_len = frame_system::AllExtrinsicsLen::::get().unwrap_or(0); + let node_side_pov_size = post_dispatch_proof_size.saturating_add(extrinsic_len.into()); + let block_weight_proof_size = current_weight.total().proof_size(); + let missing_from_node = node_side_pov_size.saturating_sub(block_weight_proof_size); + if missing_from_node > 0 { + log::warn!( + target: LOG_TARGET, + "Node-side PoV size higher than runtime proof size weight. node-side: \ + {node_side_pov_size} extrinsic_len: {extrinsic_len} runtime: \ + {block_weight_proof_size}, missing: {missing_from_node}. Setting to node-side \ + proof size." + ); + current_weight.accrue(Weight::from_parts(0, missing_from_node), info.class); + } }); // The saturation will happen if the pre dispatch weight is underestimating the proof diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index 990c515b8cd4..ffdad24752e6 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -132,6 +132,36 @@ impl frame_system::ExtensionsWeightInfo for MockWeightInfo { } } +impl frame_system::WeightInfo for MockWeightInfo { + fn remark(_b: u32) -> Weight { + Weight::from_parts(400, 0) + } + fn set_code() -> Weight { + Weight::zero() + } + fn set_storage(_i: u32) -> Weight { + Weight::zero() + } + fn kill_prefix(_p: u32) -> Weight { + Weight::zero() + } + fn kill_storage(_i: u32) -> Weight { + Weight::zero() + } + fn set_heap_pages() -> Weight { + Weight::zero() + } + fn remark_with_event(_b: u32) -> Weight { + Weight::zero() + } + fn authorize_upgrade() -> Weight { + Weight::zero() + } + fn apply_authorized_upgrade() -> Weight { + Weight::zero() + } +} + impl crate::WeightInfo for MockWeightInfo { fn storage_weight_reclaim() -> Weight { STORAGE_WEIGHT_RECLAIM_WEIGHT.with_borrow(|v| *v) @@ -434,7 +464,7 @@ fn test_incorporates_check_weight_unspent_weight_on_negative() { #[test] fn test_nothing_reclaimed() { - let mut test_ext = setup_test_externalities(&[100, 200]); + let mut test_ext = setup_test_externalities(&[0, 100]); test_ext.execute_with(|| { set_current_storage_weight(0); @@ -458,7 +488,7 @@ fn test_nothing_reclaimed() { assert_eq!(get_storage_weight().proof_size(), 250); // Should return `setup_test_externalities` proof recorder value: 100. - assert_eq!(pre.0, Some(100)); + assert_eq!(pre.0, Some(0)); // The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo` // we always need to call `post_dispatch` to verify that they interoperate correctly. @@ -519,9 +549,12 @@ fn full_basic_refund() { MOCK_EXT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(36, mock_ext)); MOCK_EXT_REFUND.with_borrow_mut(|v| *v = Weight::from_parts(35, mock_ext_refund)); - let initial_storage_weight = 1212; + let initial_storage_weight = 1212u64; - let mut test_ext = setup_test_externalities(&[3232, 3232 + actual_used_proof_size]); + let mut test_ext = setup_test_externalities(&[ + initial_storage_weight as usize, + initial_storage_weight as usize + actual_used_proof_size, + ]); test_ext.execute_with(|| { set_current_storage_weight(initial_storage_weight); @@ -565,9 +598,12 @@ fn full_accrue() { MOCK_EXT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(36, mock_ext)); MOCK_EXT_REFUND.with_borrow_mut(|v| *v = Weight::from_parts(35, mock_ext_refund)); - let initial_storage_weight = 1212; + let initial_storage_weight = 1212u64; - let mut test_ext = setup_test_externalities(&[3232, 3232 + actual_used_proof_size]); + let mut test_ext = setup_test_externalities(&[ + initial_storage_weight as usize, + initial_storage_weight as usize + actual_used_proof_size, + ]); test_ext.execute_with(|| { set_current_storage_weight(initial_storage_weight); @@ -579,8 +615,6 @@ fn full_accrue() { let post_info = extrinsic.apply::(&info, LEN).unwrap().unwrap(); // Assertions: - let post_info_tx_proof_size = - check_weight + storage_weight_reclaim + mock_ext - mock_ext_refund; assert_eq!( post_info.actual_weight.unwrap().ref_time(), call_info.call_weight.ref_time() + 3, @@ -631,3 +665,68 @@ fn bare_is_reclaimed() { ); }); } + +#[test] +fn sets_to_node_storage_proof_if_higher() { + struct TestCfg { + initial_proof_size: u64, + post_dispatch_proof_size: u64, + mock_ext_proof_size: u64, + pre_dispatch_block_proof_size: u64, + assert_final_block_proof_size: u64, + } + + let tests = vec![ + // The storage proof reported by the proof recorder is higher than what is stored on + // the runtime side. + TestCfg { + initial_proof_size: 1000, + post_dispatch_proof_size: 1005, + mock_ext_proof_size: 0, + pre_dispatch_block_proof_size: 5, + // We expect that the storage weight was set to the node-side proof size (1005) + + // extrinsics length (150) + assert_final_block_proof_size: 1155, + }, + // In this second scenario the proof size on the node side is only lower + // after reclaim happened. + TestCfg { + initial_proof_size: 175, + post_dispatch_proof_size: 180, + mock_ext_proof_size: 100, + pre_dispatch_block_proof_size: 85, + // After the pre_dispatch, the BlockWeight proof size will be + // 85 (initial) + 100 (benched) + 150 (tx length) = 335 + // + // We expect that the storage weight was set to the node-side proof weight + // First we will reclaim 95 (mock ext reclaim), which leaves us with 240 BlockWeight. + // This is lower than 180 (proof size hf) + 150 (length). + // So we expect it to be set to 330. + assert_final_block_proof_size: 330, + }, + ]; + + for test in tests { + let mut test_ext = setup_test_externalities(&[ + test.initial_proof_size as usize, + test.post_dispatch_proof_size as usize, + ]); + + CHECK_WEIGHT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(0, 0)); + STORAGE_WEIGHT_RECLAIM_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(0, 0)); + MOCK_EXT_WEIGHT.with_borrow_mut(|v| *v = Weight::from_parts(0, test.mock_ext_proof_size)); + + test_ext.execute_with(|| { + set_current_storage_weight(test.pre_dispatch_block_proof_size); + + let extrinsic = new_extrinsic(); + let call_info = extrinsic.function.get_dispatch_info(); + assert_eq!(call_info.call_weight.proof_size(), 0); + + let info = extrinsic.get_dispatch_info(); + let _post_info = extrinsic.apply::(&info, LEN).unwrap().unwrap(); + + assert_eq!(get_storage_weight().proof_size(), test.assert_final_block_proof_size); + }) + } +} From 898caa6fda2ec05ffe8cee291ca7b7037a44d8a1 Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 6 Nov 2024 13:19:12 +0900 Subject: [PATCH 39/40] outdated comment --- cumulus/pallets/weight-reclaim/src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index ffdad24752e6..b0a62400a0dc 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -699,7 +699,7 @@ fn sets_to_node_storage_proof_if_higher() { // 85 (initial) + 100 (benched) + 150 (tx length) = 335 // // We expect that the storage weight was set to the node-side proof weight - // First we will reclaim 95 (mock ext reclaim), which leaves us with 240 BlockWeight. + // First we will reclaim 95, which leaves us with 240 BlockWeight. // This is lower than 180 (proof size hf) + 150 (length). // So we expect it to be set to 330. assert_final_block_proof_size: 330, From 363f7d3cd9ec2e097979cc0ecb1c9541bdcab7e5 Mon Sep 17 00:00:00 2001 From: gui Date: Wed, 6 Nov 2024 21:54:24 +0900 Subject: [PATCH 40/40] fix post info + tests --- cumulus/pallets/weight-reclaim/src/lib.rs | 6 +- cumulus/pallets/weight-reclaim/src/tests.rs | 188 +++++++++++++++++++- 2 files changed, 190 insertions(+), 4 deletions(-) diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 3d57e1b81f0a..f93ba97b88d5 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -255,7 +255,11 @@ where // In this case the extrinsic proof size weight reclaimed is 0. let accurate_unspent = info.total_weight().saturating_sub(accurate_weight); frame_system::ExtrinsicWeightReclaimed::::put(accurate_unspent); - Ok(accurate_unspent) + + // Call have already returned their unspent amount. + // (also transaction extension prior in the pipeline, but there shouldn't be any.) + let already_unspent_in_tx_ext_pipeline = post_info.calc_unspent(info); + Ok(accurate_unspent.saturating_sub(already_unspent_in_tx_ext_pipeline)) } fn bare_validate( diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index b0a62400a0dc..2c389cf95f18 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -23,7 +23,7 @@ use frame_support::{ }; use sp_runtime::{ generic, - traits::{Applyable, BlakeTwo256, DispatchTransaction}, + traits::{Applyable, BlakeTwo256, DispatchTransaction, Get}, BuildStorage, }; use sp_trie::proof_size_extension::ProofSizeExt; @@ -258,7 +258,7 @@ mod doc { } #[test] -fn basic_refund() { +fn basic_refund_no_post_info() { // The real cost will be 100 bytes of storage size let mut test_ext = setup_test_externalities(&[0, 100]); @@ -280,7 +280,36 @@ fn basic_refund() { assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); - // TODO TODO: assert_eq!(post_info.actual_weight, Weight::from_parts(0, 650)); + assert_eq!(post_info.actual_weight, None); + assert_eq!(get_storage_weight().proof_size(), 1250); + }); +} + +#[test] +fn basic_refund_some_post_info() { + // The real cost will be 100 bytes of storage size + let mut test_ext = setup_test_externalities(&[0, 100]); + + test_ext.execute_with(|| { + set_current_storage_weight(1000); + + // Benchmarked storage weight: 500 + let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; + let mut post_info = PostDispatchInfo::default(); + post_info.actual_weight = Some(info.total_weight()); + + let tx_ext = new_tx_ext(); + + // Check weight should add 500 + 150 (len) to weight. + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + + assert_eq!(pre.0, Some(0)); + + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + assert_eq!(post_info.actual_weight.unwrap(), Weight::from_parts(0, 100)); assert_eq!(get_storage_weight().proof_size(), 1250); }); } @@ -296,6 +325,7 @@ fn does_nothing_without_extension() { // Benchmarked storage weight: 500 let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; let mut post_info = PostDispatchInfo::default(); + post_info.actual_weight = Some(info.total_weight()); let tx_ext = new_tx_ext(); @@ -308,6 +338,7 @@ fn does_nothing_without_extension() { assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + assert_eq!(post_info.actual_weight.unwrap(), info.total_weight()); assert_eq!(get_storage_weight().proof_size(), 1650); }) } @@ -321,6 +352,7 @@ fn negative_refund_is_added_to_weight() { // Benchmarked storage weight: 100 let info = DispatchInfo { call_weight: Weight::from_parts(0, 100), ..Default::default() }; let mut post_info = PostDispatchInfo::default(); + post_info.actual_weight = Some(info.total_weight()); let tx_ext = new_tx_ext(); @@ -334,6 +366,7 @@ fn negative_refund_is_added_to_weight() { // We expect no refund assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + assert_eq!(post_info.actual_weight.unwrap(), info.total_weight()); assert_eq!( get_storage_weight().proof_size(), 1100 + LEN as u64 + info.total_weight().proof_size() @@ -348,6 +381,7 @@ fn test_zero_proof_size() { test_ext.execute_with(|| { let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; let mut post_info = PostDispatchInfo::default(); + post_info.actual_weight = Some(info.total_weight()); let tx_ext = new_tx_ext(); @@ -359,6 +393,7 @@ fn test_zero_proof_size() { assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + assert_eq!(post_info.actual_weight.unwrap(), Weight::from_parts(0, 0)); // Proof size should be exactly equal to extrinsic length assert_eq!(get_storage_weight().proof_size(), LEN as u64); }); @@ -373,6 +408,7 @@ fn test_larger_pre_dispatch_proof_size() { let info = DispatchInfo { call_weight: Weight::from_parts(0, 500), ..Default::default() }; let mut post_info = PostDispatchInfo::default(); + post_info.actual_weight = Some(info.total_weight()); let tx_ext = new_tx_ext(); @@ -390,6 +426,7 @@ fn test_larger_pre_dispatch_proof_size() { // Recorded proof size is negative -200, total weight is now 1450 assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + assert_eq!(post_info.actual_weight.unwrap(), Weight::from_parts(0, 0)); assert_eq!(get_storage_weight().proof_size(), 1450); }); } @@ -423,6 +460,7 @@ fn test_incorporates_check_weight_unspent_weight() { // we always need to call `post_dispatch` to verify that they interoperate correctly. assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + assert_eq!(post_info.actual_weight.unwrap(), Weight::from_parts(50, 350 - LEN as u64)); // Reclaimed 100 assert_eq!(get_storage_weight().proof_size(), 1350); }) @@ -458,6 +496,7 @@ fn test_incorporates_check_weight_unspent_weight_on_negative() { // Adds 200 - 25 (unspent) == 175 weight, total weight 1350 assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + assert_eq!(post_info.actual_weight.unwrap(), Weight::from_parts(50, 25)); assert_eq!(get_storage_weight().proof_size(), 1350); }) } @@ -500,12 +539,155 @@ fn test_nothing_reclaimed() { // Nothing to refund or add, weight matches proof recorder assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + assert_eq!(post_info.actual_weight.unwrap(), Weight::from_parts(50, 100)); // Check block len weight was not reclaimed: // 100 weight + 150 extrinsic len == 250 proof size assert_eq!(get_storage_weight().proof_size(), 250); }) } +// Test for refund of calls and related proof size +#[test] +fn test_series() { + struct TestCfg { + measured_proof_size_pre_dispatch: u64, + measured_proof_size_post_dispatch: u64, + info_call_weight: Weight, + info_extension_weight: Weight, + post_info_actual_weight: Option, + block_weight_pre_dispatch: Weight, + mock_ext_refund: Weight, + assert_post_info_weight: Option, + assert_block_weight_post_dispatch: Weight, + } + + let base_extrinsic = <::BlockWeights as Get< + frame_system::limits::BlockWeights, + >>::get() + .per_class + .get(DispatchClass::Normal) + .base_extrinsic; + + let tests = vec![ + // Info is exact, no post info, no refund. + TestCfg { + measured_proof_size_pre_dispatch: 100, + measured_proof_size_post_dispatch: 400, + info_call_weight: Weight::from_parts(40, 100), + info_extension_weight: Weight::from_parts(60, 200), + post_info_actual_weight: None, + block_weight_pre_dispatch: Weight::from_parts(1000, 1000), + mock_ext_refund: Weight::from_parts(0, 0), + assert_post_info_weight: None, + assert_block_weight_post_dispatch: base_extrinsic + + Weight::from_parts(1100, 1300 + LEN as u64), + }, + // some tx ext refund is ignored, because post info is None. + TestCfg { + measured_proof_size_pre_dispatch: 100, + measured_proof_size_post_dispatch: 400, + info_call_weight: Weight::from_parts(40, 100), + info_extension_weight: Weight::from_parts(60, 200), + post_info_actual_weight: None, + block_weight_pre_dispatch: Weight::from_parts(1000, 1000), + mock_ext_refund: Weight::from_parts(20, 20), + assert_post_info_weight: None, + assert_block_weight_post_dispatch: base_extrinsic + + Weight::from_parts(1100, 1300 + LEN as u64), + }, + // some tx ext refund is ignored on proof size because lower than actual measure. + TestCfg { + measured_proof_size_pre_dispatch: 100, + measured_proof_size_post_dispatch: 400, + info_call_weight: Weight::from_parts(40, 100), + info_extension_weight: Weight::from_parts(60, 200), + post_info_actual_weight: Some(Weight::from_parts(100, 300)), + block_weight_pre_dispatch: Weight::from_parts(1000, 1000), + mock_ext_refund: Weight::from_parts(20, 20), + assert_post_info_weight: Some(Weight::from_parts(80, 300)), + assert_block_weight_post_dispatch: base_extrinsic + + Weight::from_parts(1080, 1300 + LEN as u64), + }, + // post info doesn't double refund the call and is missing some. + TestCfg { + measured_proof_size_pre_dispatch: 100, + measured_proof_size_post_dispatch: 350, + info_call_weight: Weight::from_parts(40, 100), + info_extension_weight: Weight::from_parts(60, 200), + post_info_actual_weight: Some(Weight::from_parts(60, 200)), + block_weight_pre_dispatch: Weight::from_parts(1000, 1000), + mock_ext_refund: Weight::from_parts(20, 20), + // 50 are missed in pov because 100 is unspent in post info but it should be only 50. + assert_post_info_weight: Some(Weight::from_parts(40, 200)), + assert_block_weight_post_dispatch: base_extrinsic + + Weight::from_parts(1040, 1250 + LEN as u64), + }, + // post info doesn't double refund the call and is accurate. + TestCfg { + measured_proof_size_pre_dispatch: 100, + measured_proof_size_post_dispatch: 250, + info_call_weight: Weight::from_parts(40, 100), + info_extension_weight: Weight::from_parts(60, 200), + post_info_actual_weight: Some(Weight::from_parts(60, 200)), + block_weight_pre_dispatch: Weight::from_parts(1000, 1000), + mock_ext_refund: Weight::from_parts(20, 20), + assert_post_info_weight: Some(Weight::from_parts(40, 150)), + assert_block_weight_post_dispatch: base_extrinsic + + Weight::from_parts(1040, 1150 + LEN as u64), + }, + // post info doesn't double refund the call and is accurate. Even if mock ext is refunding + // too much. + TestCfg { + measured_proof_size_pre_dispatch: 100, + measured_proof_size_post_dispatch: 250, + info_call_weight: Weight::from_parts(40, 100), + info_extension_weight: Weight::from_parts(60, 200), + post_info_actual_weight: Some(Weight::from_parts(60, 200)), + block_weight_pre_dispatch: Weight::from_parts(1000, 1000), + mock_ext_refund: Weight::from_parts(20, 300), + assert_post_info_weight: Some(Weight::from_parts(40, 150)), + assert_block_weight_post_dispatch: base_extrinsic + + Weight::from_parts(1040, 1150 + LEN as u64), + }, + ]; + + for (i, test) in tests.into_iter().enumerate() { + dbg!("test number: ", i); + MOCK_EXT_REFUND.with_borrow_mut(|v| *v = test.mock_ext_refund); + let mut test_ext = setup_test_externalities(&[ + test.measured_proof_size_pre_dispatch as usize, + test.measured_proof_size_post_dispatch as usize, + ]); + + test_ext.execute_with(|| { + frame_system::BlockWeight::::mutate(|current_weight| { + current_weight.set(test.block_weight_pre_dispatch, DispatchClass::Normal); + }); + // Benchmarked storage weight: 50 + let info = DispatchInfo { + call_weight: test.info_call_weight, + extension_weight: test.info_extension_weight, + ..Default::default() + }; + let mut post_info = PostDispatchInfo { + actual_weight: test.post_info_actual_weight, + pays_fee: Default::default(), + }; + let tx_ext = new_tx_ext(); + let (pre, _) = tx_ext + .validate_and_prepare(ALICE_ORIGIN.clone().into(), CALL, &info, LEN) + .unwrap(); + assert_ok!(Tx::post_dispatch(pre, &info, &mut post_info, LEN, &Ok(()))); + + assert_eq!(post_info.actual_weight, test.assert_post_info_weight); + assert_eq!( + *frame_system::BlockWeight::::get().get(DispatchClass::Normal), + test.assert_block_weight_post_dispatch, + ); + }) + } +} + #[test] fn storage_size_reported_correctly() { let mut test_ext = setup_test_externalities(&[1000]);