git.delta.rocks / unique-network / refs/commits / 12cebb765284

difftreelog

feat(maintenance) new weight + benchmark

Fahrrader2023-02-21parent: #e7f049d.patch.diff
in: master

2 files changed

modifiedpallets/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 {
+	}
 }
modifiedpallets/maintenance/src/weights.rsdiffbeforeafterboth
35pub 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}
3940
40/// 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}
5461
55// For backwards compatibility and tests62// For backwards compatibility and tests
64 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