git.delta.rocks / unique-network / refs/commits / 28ac5b8847c0

difftreelog

Benchmark completed

Dev2022-06-09parent: #1ec9cce.patch.diff
in: master

8 files changed

modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,14 @@
 	--template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \
 	--output=./pallets/$(PALLET)/src/weights.rs
 
+.PHONY: _bench2
+_bench2:
+	cargo run --release --features runtime-benchmarks,unique-runtime -- \
+	benchmark pallet --pallet pallet-$(PALLET) \
+	--wasm-execution compiled --extrinsic '*' \
+	--template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \
+	--output=./pallets/$(PALLET_DIR)/src/weights.rs
+
 .PHONY: bench-evm-migration
 bench-evm-migration:
 	make _bench PALLET=evm-migration
@@ -95,7 +103,7 @@
 
 .PHONY: bench-scheduler
 bench-scheduler:
-	make _bench PALLET=unq-scheduler	
+	make _bench2 PALLET=unq-scheduler PALLET_DIR=scheduler
 
 .PHONY: bench
 bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler
modifiedpallets/scheduler/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/benchmarking.rs
+++ b/pallets/scheduler/src/benchmarking.rs
@@ -35,10 +35,10 @@
 //! Scheduler pallet benchmarking.
 
 use super::*;
-use frame_benchmarking::benchmarks;
+use frame_benchmarking::{benchmarks, account};
 use frame_support::{
 	ensure,
-	traits::{OnInitialize, PreimageProvider, PreimageRecipient},
+	traits::{OnInitialize},
 };
 use frame_system::RawOrigin;
 use sp_runtime::traits::Hash;
@@ -46,6 +46,7 @@
 
 use crate::Pallet as Scheduler;
 use frame_system::Pallet as System;
+use frame_support::traits::Currency;
 
 const BLOCK_NUMBER: u32 = 2;
 
@@ -59,44 +60,39 @@
 	when: T::BlockNumber,
 	n: u32,
 	periodic: bool,
-	named: bool,
 	resolved: Option<bool>,
 ) -> Result<(), &'static str> {
+
+	let t = DispatchTime::At(when);
+	let caller = account("user", 0, 1);
+	
+	// Give the sender account max funds for transfer (their account will never reasonably be killed).
+	T::Currency::make_free_balance_be(&caller, T::Currency::minimum_balance());
+
 	for i in 0..n {
-		// Named schedule is strictly heavier than anonymous
 		let (call, hash) = call_and_hash::<T>(i);
 		let call_or_hash = match resolved {
-			Some(true) => {
-				T::PreimageProvider::note_preimage(call.encode().try_into().unwrap());
-				if T::PreimageProvider::have_preimage(&hash) {
-					CallOrHashOf::<T>::Hash(hash)
-				} else {
-					call.into()
-				}
-			}
-			Some(false) => call.into(),
+			Some(_) => call.into(),
 			None => CallOrHashOf::<T>::Hash(hash),
 		};
 		let period = match periodic {
 			true => Some(((i + 100).into(), 100)),
 			false => None,
 		};
-		let t = DispatchTime::At(when);
-		let origin = frame_system::RawOrigin::Root.into();
-		if named {
-			Scheduler::<T>::do_schedule_named(
-				i.encode()
-					.try_into()
-					.unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]),
-				t,
-				period,
-				0,
-				origin,
-				call_or_hash,
-			)?;
-		} else {
-			Scheduler::<T>::do_schedule(t, period, 0, origin, call_or_hash)?;
-		}
+
+		let slice_id: [u8; 4] = i.encode().try_into().unwrap();
+		let mut id: [u8; 16] =  [0; 16];
+		id[..4].clone_from_slice(&slice_id);
+
+		let origin = frame_system::RawOrigin::Signed(caller.clone()).into();
+		Scheduler::<T>::do_schedule_named(
+			id,
+			t,
+			period,
+			0,
+			origin,
+			call_or_hash,
+		)?;
 	}
 	ensure!(
 		Agenda::<T>::get(when).len() == n as usize,
@@ -116,10 +112,10 @@
 	on_initialize_periodic_named_resolved {
 		let s in 1 .. T::MaxScheduledPerBlock::get();
 		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, true, true, Some(true))?;
+		fill_schedule::<T>(when, s, true, Some(true))?;
 	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
 	verify {
-		assert_eq!(System::<T>::event_count(), s * 2);
+		assert_eq!(System::<T>::event_count(), s);
 		for i in 0..s {
 			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
 		}
@@ -128,20 +124,20 @@
 	on_initialize_named_resolved {
 		let s in 1 .. T::MaxScheduledPerBlock::get();
 		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, false, true, Some(true))?;
+		fill_schedule::<T>(when, s, false, Some(true))?;
 	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
 	verify {
-		assert_eq!(System::<T>::event_count(), s * 2);
+		assert_eq!(System::<T>::event_count(), s);
 		assert!(Agenda::<T>::iter().count() == 0);
 	}
 
 	on_initialize_periodic_resolved {
 		let s in 1 .. T::MaxScheduledPerBlock::get();
 		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, true, false, Some(true))?;
+		fill_schedule::<T>(when, s, true, Some(true))?;
 	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
 	verify {
-		assert_eq!(System::<T>::event_count(), s * 2);
+		assert_eq!(System::<T>::event_count(), s );
 		for i in 0..s {
 			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
 		}
@@ -150,97 +146,28 @@
 	on_initialize_resolved {
 		let s in 1 .. T::MaxScheduledPerBlock::get();
 		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, false, false, Some(true))?;
-	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
-	verify {
-		assert_eq!(System::<T>::event_count(), s * 2);
-		assert!(Agenda::<T>::iter().count() == 0);
-	}
-
-	on_initialize_named_aborted {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, false, true, None)?;
-	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
-	verify {
-		assert_eq!(System::<T>::event_count(), 0);
-		if let Some(delay) = T::NoPreimagePostponement::get() {
-			assert_eq!(Agenda::<T>::get(when + delay).len(), s as usize);
-		} else {
-			assert!(Agenda::<T>::iter().count() == 0);
-		}
-	}
-
-	on_initialize_aborted {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, false, false, None)?;
-	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
-	verify {
-		assert_eq!(System::<T>::event_count(), 0);
-		if let Some(delay) = T::NoPreimagePostponement::get() {
-			assert_eq!(Agenda::<T>::get(when + delay).len(), s as usize);
-		} else {
-			assert!(Agenda::<T>::iter().count() == 0);
-		}
-	}
-
-	on_initialize_periodic_named {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, true, true, Some(false))?;
+		fill_schedule::<T>(when, s, false, Some(true))?;
 	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
-	verify {
-		assert_eq!(System::<T>::event_count(), s);
-		for i in 0..s {
-			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
-		}
-	}
-
-	on_initialize_periodic {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, true, false, Some(false))?;
-	}: { Scheduler::<T>::on_initialize(when); }
 	verify {
 		assert_eq!(System::<T>::event_count(), s);
-		for i in 0..s {
-			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
-		}
-	}
-
-	on_initialize_named {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, false, true, Some(false))?;
-	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
-	verify {
-		assert_eq!(System::<T>::event_count(), s);
 		assert!(Agenda::<T>::iter().count() == 0);
 	}
 
-	on_initialize {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-		fill_schedule::<T>(when, s, false, false, Some(false))?;
-	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
-	verify {
-		assert_eq!(System::<T>::event_count(), s);
-		assert!(Agenda::<T>::iter().count() == 0);
-	}
-
 	schedule_named {
+		let caller: T::AccountId = account("user", 0, 1);
+		let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Signed(caller.clone());
 		let s in 0 .. T::MaxScheduledPerBlock::get();
-		let id = s.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
+		let slice_id: [u8; 4] = s.encode().try_into().unwrap();
+		let mut id: [u8; 16] =  [0; 16];
+		id[..4].clone_from_slice(&slice_id);
 		let when = BLOCK_NUMBER.into();
 		let periodic = Some((T::BlockNumber::one(), 100));
 		let priority = 0;
 		// Essentially a no-op call.
 		let inner_call = frame_system::Call::set_storage { items: vec![] }.into();
 		let call = Box::new(CallOrHashOf::<T>::Value(inner_call));
-
-		fill_schedule::<T>(when, s, true, true, Some(false))?;
-	}: _(RawOrigin::Root, id, when, periodic, priority, call)
+		fill_schedule::<T>(when, s, true, Some(false))?;
+	}: _(origin, id, when, periodic, priority, call)
 	verify {
 		ensure!(
 			Agenda::<T>::get(when).len() == (s + 1) as usize,
@@ -249,12 +176,13 @@
 	}
 
 	cancel_named {
+		let caller: T::AccountId = account("user", 0, 1);
+		let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Signed(caller.clone());
 		let s in 1 .. T::MaxScheduledPerBlock::get();
 		let when = BLOCK_NUMBER.into();
 		let id = 0.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
-
-		fill_schedule::<T>(when, s, true, true, Some(false))?;
-	}: _(RawOrigin::Root, id)
+		fill_schedule::<T>(when, s, true, Some(false))?;
+	}: _(origin, id)
 	verify {
 		ensure!(
 			Lookup::<T>::get(id).is_none(),
modifiedpallets/scheduler/src/weights.rsdiffbeforeafterboth
before · pallets/scheduler/src/weights.rs
1// This file is part of Substrate.23// Copyright (C) 2022 Parity Technologies (UK) Ltd.4// SPDX-License-Identifier: Apache-2.056// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.1718//! Autogenerated weights for pallet_scheduler19//!20//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev21//! DATE: 2022-01-31, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`22//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 10242324// Executed Command:25// ./target/production/substrate26// benchmark27// --chain=dev28// --steps=5029// --repeat=2030// --pallet=pallet_scheduler31// --extrinsic=*32// --execution=wasm33// --wasm-execution=compiled34// --heap-pages=409635// --output=./frame/scheduler/src/weights.rs36// --template=.maintain/frame-weight-template.hbs37// --header=HEADER-APACHE238// --raw3940#![cfg_attr(rustfmt, rustfmt_skip)]41#![allow(unused_parens)]42#![allow(unused_imports)]4344use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};45use sp_std::marker::PhantomData;4647/// Weight functions needed for pallet_scheduler.48pub trait WeightInfo {49	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight;50	fn on_initialize_named_resolved(s: u32, ) -> Weight;51	fn on_initialize_periodic_resolved(s: u32, ) -> Weight;52	fn on_initialize_resolved(s: u32, ) -> Weight;53	fn on_initialize_named_aborted(s: u32, ) -> Weight;54	fn on_initialize_aborted(s: u32, ) -> Weight;55	fn on_initialize_periodic_named(s: u32, ) -> Weight;56	fn on_initialize_periodic(s: u32, ) -> Weight;57	fn on_initialize_named(s: u32, ) -> Weight;58	fn on_initialize(s: u32, ) -> Weight;59	fn schedule(s: u32, ) -> Weight;60	fn cancel(s: u32, ) -> Weight;61	fn schedule_named(s: u32, ) -> Weight;62	fn cancel_named(s: u32, ) -> Weight;63}6465/// Weights for pallet_scheduler using the Substrate node and recommended hardware.66pub struct SubstrateWeight<T>(PhantomData<T>);67impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {68	// Storage: Scheduler Agenda (r:2 w:2)69	// Storage: Preimage PreimageFor (r:1 w:1)70	// Storage: Preimage StatusFor (r:1 w:1)71	// Storage: Scheduler Lookup (r:0 w:1)72	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {73		(11_587_000 as Weight)74			// Standard Error: 17_00075			.saturating_add((17_428_000 as Weight).saturating_mul(s as Weight))76			.saturating_add(T::DbWeight::get().reads(1 as Weight))77			.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))78			.saturating_add(T::DbWeight::get().writes(1 as Weight))79			.saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(s as Weight)))80	}81	// Storage: Scheduler Agenda (r:1 w:1)82	// Storage: Preimage PreimageFor (r:1 w:1)83	// Storage: Preimage StatusFor (r:1 w:1)84	// Storage: Scheduler Lookup (r:0 w:1)85	fn on_initialize_named_resolved(s: u32, ) -> Weight {86		(8_965_000 as Weight)87			// Standard Error: 11_00088			.saturating_add((13_410_000 as Weight).saturating_mul(s as Weight))89			.saturating_add(T::DbWeight::get().reads(1 as Weight))90			.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))91			.saturating_add(T::DbWeight::get().writes(1 as Weight))92			.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))93	}94	// Storage: Scheduler Agenda (r:2 w:2)95	// Storage: Preimage PreimageFor (r:1 w:1)96	// Storage: Preimage StatusFor (r:1 w:1)97	fn on_initialize_periodic_resolved(s: u32, ) -> Weight {98		(8_654_000 as Weight)99			// Standard Error: 17_000100			.saturating_add((14_990_000 as Weight).saturating_mul(s as Weight))101			.saturating_add(T::DbWeight::get().reads(1 as Weight))102			.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))103			.saturating_add(T::DbWeight::get().writes(1 as Weight))104			.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))105	}106	// Storage: Scheduler Agenda (r:1 w:1)107	// Storage: Preimage PreimageFor (r:1 w:1)108	// Storage: Preimage StatusFor (r:1 w:1)109	fn on_initialize_resolved(s: u32, ) -> Weight {110		(9_303_000 as Weight)111			// Standard Error: 10_000112			.saturating_add((12_244_000 as Weight).saturating_mul(s as Weight))113			.saturating_add(T::DbWeight::get().reads(1 as Weight))114			.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))115			.saturating_add(T::DbWeight::get().writes(1 as Weight))116			.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))117	}118	// Storage: Scheduler Agenda (r:2 w:2)119	// Storage: Preimage PreimageFor (r:1 w:0)120	// Storage: Scheduler Lookup (r:0 w:1)121	fn on_initialize_named_aborted(s: u32, ) -> Weight {122		(7_506_000 as Weight)123			// Standard Error: 3_000124			.saturating_add((5_208_000 as Weight).saturating_mul(s as Weight))125			.saturating_add(T::DbWeight::get().reads(2 as Weight))126			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))127			.saturating_add(T::DbWeight::get().writes(2 as Weight))128			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))129	}130	// Storage: Scheduler Agenda (r:2 w:2)131	// Storage: Preimage PreimageFor (r:1 w:0)132	fn on_initialize_aborted(s: u32, ) -> Weight {133		(8_046_000 as Weight)134			// Standard Error: 3_000135			.saturating_add((2_914_000 as Weight).saturating_mul(s as Weight))136			.saturating_add(T::DbWeight::get().reads(2 as Weight))137			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))138			.saturating_add(T::DbWeight::get().writes(2 as Weight))139	}140	// Storage: Scheduler Agenda (r:2 w:2)141	// Storage: Scheduler Lookup (r:0 w:1)142	fn on_initialize_periodic_named(s: u32, ) -> Weight {143		(13_704_000 as Weight)144			// Standard Error: 4_000145			.saturating_add((8_186_000 as Weight).saturating_mul(s as Weight))146			.saturating_add(T::DbWeight::get().reads(1 as Weight))147			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))148			.saturating_add(T::DbWeight::get().writes(1 as Weight))149			.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))150	}151	// Storage: Scheduler Agenda (r:2 w:2)152	fn on_initialize_periodic(s: u32, ) -> Weight {153		(12_668_000 as Weight)154			// Standard Error: 5_000155			.saturating_add((5_868_000 as Weight).saturating_mul(s as Weight))156			.saturating_add(T::DbWeight::get().reads(1 as Weight))157			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))158			.saturating_add(T::DbWeight::get().writes(1 as Weight))159			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))160	}161	// Storage: Scheduler Agenda (r:1 w:1)162	// Storage: Scheduler Lookup (r:0 w:1)163	fn on_initialize_named(s: u32, ) -> Weight {164		(13_946_000 as Weight)165			// Standard Error: 4_000166			.saturating_add((4_367_000 as Weight).saturating_mul(s as Weight))167			.saturating_add(T::DbWeight::get().reads(1 as Weight))168			.saturating_add(T::DbWeight::get().writes(1 as Weight))169			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))170	}171	// Storage: Scheduler Agenda (r:1 w:1)172	fn on_initialize(s: u32, ) -> Weight {173		(13_151_000 as Weight)174			// Standard Error: 4_000175			.saturating_add((3_455_000 as Weight).saturating_mul(s as Weight))176			.saturating_add(T::DbWeight::get().reads(1 as Weight))177			.saturating_add(T::DbWeight::get().writes(1 as Weight))178	}179	// Storage: Scheduler Agenda (r:1 w:1)180	fn schedule(s: u32, ) -> Weight {181		(14_040_000 as Weight)182			// Standard Error: 1_000183			.saturating_add((89_000 as Weight).saturating_mul(s as Weight))184			.saturating_add(T::DbWeight::get().reads(1 as Weight))185			.saturating_add(T::DbWeight::get().writes(1 as Weight))186	}187	// Storage: Scheduler Agenda (r:1 w:1)188	// Storage: Scheduler Lookup (r:0 w:1)189	fn cancel(s: u32, ) -> Weight {190		(14_376_000 as Weight)191			// Standard Error: 1_000192			.saturating_add((576_000 as Weight).saturating_mul(s as Weight))193			.saturating_add(T::DbWeight::get().reads(1 as Weight))194			.saturating_add(T::DbWeight::get().writes(2 as Weight))195	}196	// Storage: Scheduler Lookup (r:1 w:1)197	// Storage: Scheduler Agenda (r:1 w:1)198	fn schedule_named(s: u32, ) -> Weight {199		(16_806_000 as Weight)200			// Standard Error: 1_000201			.saturating_add((102_000 as Weight).saturating_mul(s as Weight))202			.saturating_add(T::DbWeight::get().reads(2 as Weight))203			.saturating_add(T::DbWeight::get().writes(2 as Weight))204	}205	// Storage: Scheduler Lookup (r:1 w:1)206	// Storage: Scheduler Agenda (r:1 w:1)207	fn cancel_named(s: u32, ) -> Weight {208		(15_852_000 as Weight)209			// Standard Error: 2_000210			.saturating_add((590_000 as Weight).saturating_mul(s as Weight))211			.saturating_add(T::DbWeight::get().reads(2 as Weight))212			.saturating_add(T::DbWeight::get().writes(2 as Weight))213	}214}215216// For backwards compatibility and tests217impl WeightInfo for () {218	// Storage: Scheduler Agenda (r:2 w:2)219	// Storage: Preimage PreimageFor (r:1 w:1)220	// Storage: Preimage StatusFor (r:1 w:1)221	// Storage: Scheduler Lookup (r:0 w:1)222	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {223		(11_587_000 as Weight)224			// Standard Error: 17_000225			.saturating_add((17_428_000 as Weight).saturating_mul(s as Weight))226			.saturating_add(RocksDbWeight::get().reads(1 as Weight))227			.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))228			.saturating_add(RocksDbWeight::get().writes(1 as Weight))229			.saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(s as Weight)))230	}231	// Storage: Scheduler Agenda (r:1 w:1)232	// Storage: Preimage PreimageFor (r:1 w:1)233	// Storage: Preimage StatusFor (r:1 w:1)234	// Storage: Scheduler Lookup (r:0 w:1)235	fn on_initialize_named_resolved(s: u32, ) -> Weight {236		(8_965_000 as Weight)237			// Standard Error: 11_000238			.saturating_add((13_410_000 as Weight).saturating_mul(s as Weight))239			.saturating_add(RocksDbWeight::get().reads(1 as Weight))240			.saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))241			.saturating_add(RocksDbWeight::get().writes(1 as Weight))242			.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))243	}244	// Storage: Scheduler Agenda (r:2 w:2)245	// Storage: Preimage PreimageFor (r:1 w:1)246	// Storage: Preimage StatusFor (r:1 w:1)247	fn on_initialize_periodic_resolved(s: u32, ) -> Weight {248		(8_654_000 as Weight)249			// Standard Error: 17_000250			.saturating_add((14_990_000 as Weight).saturating_mul(s as Weight))251			.saturating_add(RocksDbWeight::get().reads(1 as Weight))252			.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))253			.saturating_add(RocksDbWeight::get().writes(1 as Weight))254			.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))255	}256	// Storage: Scheduler Agenda (r:1 w:1)257	// Storage: Preimage PreimageFor (r:1 w:1)258	// Storage: Preimage StatusFor (r:1 w:1)259	fn on_initialize_resolved(s: u32, ) -> Weight {260		(9_303_000 as Weight)261			// Standard Error: 10_000262			.saturating_add((12_244_000 as Weight).saturating_mul(s as Weight))263			.saturating_add(RocksDbWeight::get().reads(1 as Weight))264			.saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))265			.saturating_add(RocksDbWeight::get().writes(1 as Weight))266			.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))267	}268	// Storage: Scheduler Agenda (r:2 w:2)269	// Storage: Preimage PreimageFor (r:1 w:0)270	// Storage: Scheduler Lookup (r:0 w:1)271	fn on_initialize_named_aborted(s: u32, ) -> Weight {272		(7_506_000 as Weight)273			// Standard Error: 3_000274			.saturating_add((5_208_000 as Weight).saturating_mul(s as Weight))275			.saturating_add(RocksDbWeight::get().reads(2 as Weight))276			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))277			.saturating_add(RocksDbWeight::get().writes(2 as Weight))278			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))279	}280	// Storage: Scheduler Agenda (r:2 w:2)281	// Storage: Preimage PreimageFor (r:1 w:0)282	fn on_initialize_aborted(s: u32, ) -> Weight {283		(8_046_000 as Weight)284			// Standard Error: 3_000285			.saturating_add((2_914_000 as Weight).saturating_mul(s as Weight))286			.saturating_add(RocksDbWeight::get().reads(2 as Weight))287			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))288			.saturating_add(RocksDbWeight::get().writes(2 as Weight))289	}290	// Storage: Scheduler Agenda (r:2 w:2)291	// Storage: Scheduler Lookup (r:0 w:1)292	fn on_initialize_periodic_named(s: u32, ) -> Weight {293		(13_704_000 as Weight)294			// Standard Error: 4_000295			.saturating_add((8_186_000 as Weight).saturating_mul(s as Weight))296			.saturating_add(RocksDbWeight::get().reads(1 as Weight))297			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))298			.saturating_add(RocksDbWeight::get().writes(1 as Weight))299			.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))300	}301	// Storage: Scheduler Agenda (r:2 w:2)302	fn on_initialize_periodic(s: u32, ) -> Weight {303		(12_668_000 as Weight)304			// Standard Error: 5_000305			.saturating_add((5_868_000 as Weight).saturating_mul(s as Weight))306			.saturating_add(RocksDbWeight::get().reads(1 as Weight))307			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))308			.saturating_add(RocksDbWeight::get().writes(1 as Weight))309			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))310	}311	// Storage: Scheduler Agenda (r:1 w:1)312	// Storage: Scheduler Lookup (r:0 w:1)313	fn on_initialize_named(s: u32, ) -> Weight {314		(13_946_000 as Weight)315			// Standard Error: 4_000316			.saturating_add((4_367_000 as Weight).saturating_mul(s as Weight))317			.saturating_add(RocksDbWeight::get().reads(1 as Weight))318			.saturating_add(RocksDbWeight::get().writes(1 as Weight))319			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))320	}321	// Storage: Scheduler Agenda (r:1 w:1)322	fn on_initialize(s: u32, ) -> Weight {323		(13_151_000 as Weight)324			// Standard Error: 4_000325			.saturating_add((3_455_000 as Weight).saturating_mul(s as Weight))326			.saturating_add(RocksDbWeight::get().reads(1 as Weight))327			.saturating_add(RocksDbWeight::get().writes(1 as Weight))328	}329	// Storage: Scheduler Agenda (r:1 w:1)330	fn schedule(s: u32, ) -> Weight {331		(14_040_000 as Weight)332			// Standard Error: 1_000333			.saturating_add((89_000 as Weight).saturating_mul(s as Weight))334			.saturating_add(RocksDbWeight::get().reads(1 as Weight))335			.saturating_add(RocksDbWeight::get().writes(1 as Weight))336	}337	// Storage: Scheduler Agenda (r:1 w:1)338	// Storage: Scheduler Lookup (r:0 w:1)339	fn cancel(s: u32, ) -> Weight {340		(14_376_000 as Weight)341			// Standard Error: 1_000342			.saturating_add((576_000 as Weight).saturating_mul(s as Weight))343			.saturating_add(RocksDbWeight::get().reads(1 as Weight))344			.saturating_add(RocksDbWeight::get().writes(2 as Weight))345	}346	// Storage: Scheduler Lookup (r:1 w:1)347	// Storage: Scheduler Agenda (r:1 w:1)348	fn schedule_named(s: u32, ) -> Weight {349		(16_806_000 as Weight)350			// Standard Error: 1_000351			.saturating_add((102_000 as Weight).saturating_mul(s as Weight))352			.saturating_add(RocksDbWeight::get().reads(2 as Weight))353			.saturating_add(RocksDbWeight::get().writes(2 as Weight))354	}355	// Storage: Scheduler Lookup (r:1 w:1)356	// Storage: Scheduler Agenda (r:1 w:1)357	fn cancel_named(s: u32, ) -> Weight {358		(15_852_000 as Weight)359			// Standard Error: 2_000360			.saturating_add((590_000 as Weight).saturating_mul(s as Weight))361			.saturating_add(RocksDbWeight::get().reads(2 as Weight))362			.saturating_add(RocksDbWeight::get().writes(2 as Weight))363	}364}
after · pallets/scheduler/src/weights.rs
1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_unq_scheduler4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-06-09, STEPS: `50`, REPEAT: 200, 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-unq-scheduler15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=20023// --heap-pages=409624// --output=./pallets/scheduler/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_unq_scheduler.35pub trait WeightInfo {36	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight;37	fn on_initialize_named_resolved(s: u32, ) -> Weight;38	fn on_initialize_periodic_resolved(s: u32, ) -> Weight;39	fn on_initialize_resolved(s: u32, ) -> Weight;40	fn schedule_named(s: u32, ) -> Weight;41	fn cancel_named(s: u32, ) -> Weight;42}4344/// Weights for pallet_unq_scheduler using the Substrate node and recommended hardware.45pub struct SubstrateWeight<T>(PhantomData<T>);46impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {47	// Storage: Scheduler Agenda (r:2 w:2)48	// Storage: System Account (r:1 w:1)49	// Storage: System AllExtrinsicsLen (r:1 w:1)50	// Storage: System BlockWeight (r:1 w:1)51	// Storage: Scheduler Lookup (r:0 w:1)52	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {53		(39_822_000 as Weight)54			// Standard Error: 4_00055			.saturating_add((31_823_000 as Weight).saturating_mul(s as Weight))56			.saturating_add(T::DbWeight::get().reads(4 as Weight))57			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))58			.saturating_add(T::DbWeight::get().writes(4 as Weight))59			.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))60	}61	// Storage: Scheduler Agenda (r:1 w:1)62	// Storage: System Account (r:1 w:1)63	// Storage: System AllExtrinsicsLen (r:1 w:1)64	// Storage: System BlockWeight (r:1 w:1)65	// Storage: Scheduler Lookup (r:0 w:1)66	fn on_initialize_named_resolved(s: u32, ) -> Weight {67		(36_019_000 as Weight)68			// Standard Error: 3_00069			.saturating_add((22_660_000 as Weight).saturating_mul(s as Weight))70			.saturating_add(T::DbWeight::get().reads(4 as Weight))71			.saturating_add(T::DbWeight::get().writes(4 as Weight))72			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))73	}74	// Storage: Scheduler Agenda (r:2 w:2)75	// Storage: System Account (r:1 w:1)76	// Storage: System AllExtrinsicsLen (r:1 w:1)77	// Storage: System BlockWeight (r:1 w:1)78	// Storage: Scheduler Lookup (r:0 w:1)79	fn on_initialize_periodic_resolved(s: u32, ) -> Weight {80		(36_613_000 as Weight)81			// Standard Error: 3_00082			.saturating_add((31_895_000 as Weight).saturating_mul(s as Weight))83			.saturating_add(T::DbWeight::get().reads(4 as Weight))84			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))85			.saturating_add(T::DbWeight::get().writes(4 as Weight))86			.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))87	}88	// Storage: Scheduler Agenda (r:1 w:1)89	// Storage: System Account (r:1 w:1)90	// Storage: System AllExtrinsicsLen (r:1 w:1)91	// Storage: System BlockWeight (r:1 w:1)92	// Storage: Scheduler Lookup (r:0 w:1)93	fn on_initialize_resolved(s: u32, ) -> Weight {94		(36_252_000 as Weight)95			// Standard Error: 3_00096			.saturating_add((22_662_000 as Weight).saturating_mul(s as Weight))97			.saturating_add(T::DbWeight::get().reads(4 as Weight))98			.saturating_add(T::DbWeight::get().writes(4 as Weight))99			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))100	}101	// Storage: Scheduler Lookup (r:1 w:1)102	// Storage: Scheduler Agenda (r:1 w:1)103	fn schedule_named(s: u32, ) -> Weight {104		(34_561_000 as Weight)105			// Standard Error: 0106			.saturating_add((161_000 as Weight).saturating_mul(s as Weight))107			.saturating_add(T::DbWeight::get().reads(2 as Weight))108			.saturating_add(T::DbWeight::get().writes(2 as Weight))109	}110	// Storage: Scheduler Lookup (r:1 w:1)111	// Storage: Scheduler Agenda (r:1 w:1)112	fn cancel_named(s: u32, ) -> Weight {113		(30_932_000 as Weight)114			// Standard Error: 1_000115			.saturating_add((1_537_000 as Weight).saturating_mul(s as Weight))116			.saturating_add(T::DbWeight::get().reads(2 as Weight))117			.saturating_add(T::DbWeight::get().writes(2 as Weight))118	}119}120121// For backwards compatibility and tests122impl WeightInfo for () {123	// Storage: Scheduler Agenda (r:2 w:2)124	// Storage: System Account (r:1 w:1)125	// Storage: System AllExtrinsicsLen (r:1 w:1)126	// Storage: System BlockWeight (r:1 w:1)127	// Storage: Scheduler Lookup (r:0 w:1)128	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {129		(39_822_000 as Weight)130			// Standard Error: 4_000131			.saturating_add((31_823_000 as Weight).saturating_mul(s as Weight))132			.saturating_add(RocksDbWeight::get().reads(4 as Weight))133			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))134			.saturating_add(RocksDbWeight::get().writes(4 as Weight))135			.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))136	}137	// Storage: Scheduler Agenda (r:1 w:1)138	// Storage: System Account (r:1 w:1)139	// Storage: System AllExtrinsicsLen (r:1 w:1)140	// Storage: System BlockWeight (r:1 w:1)141	// Storage: Scheduler Lookup (r:0 w:1)142	fn on_initialize_named_resolved(s: u32, ) -> Weight {143		(36_019_000 as Weight)144			// Standard Error: 3_000145			.saturating_add((22_660_000 as Weight).saturating_mul(s as Weight))146			.saturating_add(RocksDbWeight::get().reads(4 as Weight))147			.saturating_add(RocksDbWeight::get().writes(4 as Weight))148			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))149	}150	// Storage: Scheduler Agenda (r:2 w:2)151	// Storage: System Account (r:1 w:1)152	// Storage: System AllExtrinsicsLen (r:1 w:1)153	// Storage: System BlockWeight (r:1 w:1)154	// Storage: Scheduler Lookup (r:0 w:1)155	fn on_initialize_periodic_resolved(s: u32, ) -> Weight {156		(36_613_000 as Weight)157			// Standard Error: 3_000158			.saturating_add((31_895_000 as Weight).saturating_mul(s as Weight))159			.saturating_add(RocksDbWeight::get().reads(4 as Weight))160			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))161			.saturating_add(RocksDbWeight::get().writes(4 as Weight))162			.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))163	}164	// Storage: Scheduler Agenda (r:1 w:1)165	// Storage: System Account (r:1 w:1)166	// Storage: System AllExtrinsicsLen (r:1 w:1)167	// Storage: System BlockWeight (r:1 w:1)168	// Storage: Scheduler Lookup (r:0 w:1)169	fn on_initialize_resolved(s: u32, ) -> Weight {170		(36_252_000 as Weight)171			// Standard Error: 3_000172			.saturating_add((22_662_000 as Weight).saturating_mul(s as Weight))173			.saturating_add(RocksDbWeight::get().reads(4 as Weight))174			.saturating_add(RocksDbWeight::get().writes(4 as Weight))175			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))176	}177	// Storage: Scheduler Lookup (r:1 w:1)178	// Storage: Scheduler Agenda (r:1 w:1)179	fn schedule_named(s: u32, ) -> Weight {180		(34_561_000 as Weight)181			// Standard Error: 0182			.saturating_add((161_000 as Weight).saturating_mul(s as Weight))183			.saturating_add(RocksDbWeight::get().reads(2 as Weight))184			.saturating_add(RocksDbWeight::get().writes(2 as Weight))185	}186	// Storage: Scheduler Lookup (r:1 w:1)187	// Storage: Scheduler Agenda (r:1 w:1)188	fn cancel_named(s: u32, ) -> Weight {189		(30_932_000 as Weight)190			// Standard Error: 1_000191			.saturating_add((1_537_000 as Weight).saturating_mul(s as Weight))192			.saturating_add(RocksDbWeight::get().reads(2 as Weight))193			.saturating_add(RocksDbWeight::get().writes(2 as Weight))194	}195}
modifiedruntime/common/Cargo.tomldiffbeforeafterboth
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -89,6 +89,10 @@
 default-features = false
 path = "../../pallets/refungible"
 
+[dependencies.pallet-unq-scheduler]
+default-features = false
+path = "../../pallets/scheduler"
+
 [dependencies.up-data-structs]
 default-features = false
 path = "../../primitives/data-structs"
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -774,6 +774,7 @@
                     list_benchmark!(list, extra, pallet_fungible, Fungible);
                     list_benchmark!(list, extra, pallet_refungible, Refungible);
                     list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
+                    list_benchmark!(list, extra, pallet_unq_scheduler, Scheduler);
                     // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
 
                     let storage_info = AllPalletsReversedWithSystemFirst::storage_info();
@@ -817,6 +818,8 @@
                     add_benchmark!(params, batches, pallet_fungible, Fungible);
                     add_benchmark!(params, batches, pallet_refungible, Refungible);
                     add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
+                    add_benchmark!(params, batches, pallet_unq_scheduler, Scheduler);
+
                     // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
 
                     if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -36,6 +36,7 @@
     'pallet-proxy-rmrk-core/runtime-benchmarks',
     'pallet-unique/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
+    'pallet-unq-scheduler/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -36,6 +36,7 @@
     'pallet-proxy-rmrk-core/runtime-benchmarks',
     'pallet-unique/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
+    'pallet-unq-scheduler/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -36,6 +36,7 @@
     'pallet-proxy-rmrk-core/runtime-benchmarks',
     'pallet-unique/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
+    'pallet-unq-scheduler/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',