difftreelog
feat(maintenance) new weight + benchmark
in: master
2 files changed
pallets/maintenance/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/maintenance/src/benchmarking.rs
+++ b/pallets/maintenance/src/benchmarking.rs
@@ -18,8 +18,10 @@
use crate::{Pallet as Maintenance, Config};
use frame_benchmarking::benchmarks;
-use frame_system::RawOrigin;
-use frame_support::ensure;
+use frame_system::{Call as RuntimeCall, RawOrigin};
+use frame_support::{ensure, traits::StorePreimage};
+use codec::Encode;
+use sp_std::vec;
benchmarks! {
enable {
@@ -34,4 +36,11 @@
verify {
ensure!(!<Enabled<T>>::get(), "didn't disable the MM");
}
+
+ execute_preimage {
+ let call_hash = RuntimeCall::<T>::set_storage { items: vec![] }.encode();
+ let hash = T::Preimages::note(call_hash.into())?;
+ }: _(RawOrigin::Root, hash)
+ verify {
+ }
}
pallets/maintenance/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_maintenance4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-11-01, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-maintenance15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/maintenance/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_maintenance.35pub trait WeightInfo {36 fn enable() -> Weight;37 fn disable() -> Weight;38}3940/// Weights for pallet_maintenance using the Substrate node and recommended hardware.41pub struct SubstrateWeight<T>(PhantomData<T>);42impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {43 // Storage: Maintenance Enabled (r:0 w:1)44 fn enable() -> Weight {45 Weight::from_ref_time(7_367_000)46 .saturating_add(T::DbWeight::get().writes(1))47 }48 // Storage: Maintenance Enabled (r:0 w:1)49 fn disable() -> Weight {50 Weight::from_ref_time(7_273_000)51 .saturating_add(T::DbWeight::get().writes(1))52 }53}5455// For backwards compatibility and tests56impl WeightInfo for () {57 // Storage: Maintenance Enabled (r:0 w:1)58 fn enable() -> Weight {59 Weight::from_ref_time(7_367_000)60 .saturating_add(RocksDbWeight::get().writes(1))61 }62 // Storage: Maintenance Enabled (r:0 w:1)63 fn disable() -> Weight {64 Weight::from_ref_time(7_273_000)65 .saturating_add(RocksDbWeight::get().writes(1))66 }67}1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_maintenance4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-11-01, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-maintenance15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/maintenance/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_maintenance.35pub trait WeightInfo {36 fn enable() -> Weight;37 fn disable() -> Weight;38 fn execute_preimage() -> Weight;39}4041/// Weights for pallet_maintenance using the Substrate node and recommended hardware.42pub struct SubstrateWeight<T>(PhantomData<T>);43impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {44 // Storage: Maintenance Enabled (r:0 w:1)45 fn enable() -> Weight {46 Weight::from_ref_time(7_367_000)47 .saturating_add(T::DbWeight::get().writes(1))48 }49 // Storage: Maintenance Enabled (r:0 w:1)50 fn disable() -> Weight {51 Weight::from_ref_time(7_273_000)52 .saturating_add(T::DbWeight::get().writes(1))53 }54 // Storage: 55 fn execute_preimage() -> Weight {56 Weight::from_ref_time(7_273_000)57 .saturating_add(T::DbWeight::get().reads(2))58 .saturating_add(T::DbWeight::get().writes(1))59 }60}6162// For backwards compatibility and tests63impl WeightInfo for () {64 // Storage: Maintenance Enabled (r:0 w:1)65 fn enable() -> Weight {66 Weight::from_ref_time(7_367_000)67 .saturating_add(RocksDbWeight::get().writes(1))68 }69 // Storage: Maintenance Enabled (r:0 w:1)70 fn disable() -> Weight {71 Weight::from_ref_time(7_273_000)72 .saturating_add(RocksDbWeight::get().writes(1))73 }74 // Storage: 75 fn execute_preimage() -> Weight {76 Weight::from_ref_time(7_273_000)77 .saturating_add(RocksDbWeight::get().reads(2))78 .saturating_add(RocksDbWeight::get().writes(1))79 }80}