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.rsdiffbeforeafterboth--- a/pallets/maintenance/src/weights.rs
+++ b/pallets/maintenance/src/weights.rs
@@ -35,6 +35,7 @@
pub trait WeightInfo {
fn enable() -> Weight;
fn disable() -> Weight;
+ fn execute_preimage() -> Weight;
}
/// Weights for pallet_maintenance using the Substrate node and recommended hardware.
@@ -50,6 +51,12 @@
Weight::from_ref_time(7_273_000)
.saturating_add(T::DbWeight::get().writes(1))
}
+ // Storage:
+ fn execute_preimage() -> Weight {
+ Weight::from_ref_time(7_273_000)
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
}
// For backwards compatibility and tests
@@ -64,4 +71,10 @@
Weight::from_ref_time(7_273_000)
.saturating_add(RocksDbWeight::get().writes(1))
}
+ // Storage:
+ fn execute_preimage() -> Weight {
+ Weight::from_ref_time(7_273_000)
+ .saturating_add(RocksDbWeight::get().reads(2))
+ .saturating_add(RocksDbWeight::get().writes(1))
+ }
}