difftreelog
feat(maintenance) new weight + benchmark
in: master
2 files changed
pallets/maintenance/src/benchmarking.rsdiffbeforeafterboth18use crate::{Pallet as Maintenance, Config};18use crate::{Pallet as Maintenance, Config};191920use frame_benchmarking::benchmarks;20use frame_benchmarking::benchmarks;21use frame_system::RawOrigin;21use frame_system::{Call as RuntimeCall, RawOrigin};22use frame_support::ensure;22use frame_support::{ensure, traits::StorePreimage};23use codec::Encode;24use sp_std::vec;232524benchmarks! {26benchmarks! {25 enable {27 enable {35 ensure!(!<Enabled<T>>::get(), "didn't disable the MM");37 ensure!(!<Enabled<T>>::get(), "didn't disable the MM");36 }38 }3940 execute_preimage {41 let call_hash = RuntimeCall::<T>::set_storage { items: vec![] }.encode();42 let hash = T::Preimages::note(call_hash.into())?;43 }: _(RawOrigin::Root, hash)44 verify {45 }37}46}3847pallets/maintenance/src/weights.rsdiffbeforeafterboth35pub trait WeightInfo {35pub trait WeightInfo {36 fn enable() -> Weight;36 fn enable() -> Weight;37 fn disable() -> Weight;37 fn disable() -> Weight;38 fn execute_preimage() -> Weight;38}39}394040/// Weights for pallet_maintenance using the Substrate node and recommended hardware.41/// Weights for pallet_maintenance using the Substrate node and recommended hardware.50 Weight::from_ref_time(7_273_000)51 Weight::from_ref_time(7_273_000)51 .saturating_add(T::DbWeight::get().writes(1))52 .saturating_add(T::DbWeight::get().writes(1))52 }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 }53}60}546155// For backwards compatibility and tests62// For backwards compatibility and tests64 Weight::from_ref_time(7_273_000)71 Weight::from_ref_time(7_273_000)65 .saturating_add(RocksDbWeight::get().writes(1))72 .saturating_add(RocksDbWeight::get().writes(1))66 }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 }67}80}6881