difftreelog
Merge pull request #376 from UniqueNetwork/fix/scheduler-benchmarks
in: master
Fix/scheduler benchmarks
14 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5356,7 +5356,7 @@
"pallet-transaction-payment-rpc-runtime-api",
"pallet-treasury",
"pallet-unique",
- "pallet-unq-scheduler",
+ "pallet-unique-scheduler",
"pallet-xcm",
"parachain-info",
"parity-scale-codec 3.1.2",
@@ -6646,7 +6646,7 @@
]
[[package]]
-name = "pallet-unq-scheduler"
+name = "pallet-unique-scheduler"
version = "0.1.0"
dependencies = [
"frame-benchmarking",
@@ -8590,7 +8590,7 @@
"pallet-transaction-payment-rpc-runtime-api",
"pallet-treasury",
"pallet-unique",
- "pallet-unq-scheduler",
+ "pallet-unique-scheduler",
"pallet-xcm",
"parachain-info",
"parity-scale-codec 3.1.2",
@@ -12643,7 +12643,7 @@
"pallet-transaction-payment-rpc-runtime-api",
"pallet-treasury",
"pallet-unique",
- "pallet-unq-scheduler",
+ "pallet-unique-scheduler",
"pallet-xcm",
"parachain-info",
"parity-scale-codec 3.1.2",
@@ -12688,6 +12688,7 @@
"pallet-nonfungible",
"pallet-refungible",
"pallet-unique",
+ "pallet-unique-scheduler",
"parity-scale-codec 3.1.2",
"rmrk-rpc",
"scale-info",
Makefilediffbeforeafterboth--- 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
@@ -93,9 +101,13 @@
bench-structure:
make _bench PALLET=structure
+.PHONY: bench-scheduler
+bench-scheduler:
+ make _bench2 PALLET=unique-scheduler PALLET_DIR=scheduler
+
.PHONY: bench-rmrk-core
bench-rmrk-core:
make _bench PALLET=proxy-rmrk-core
.PHONY: bench
-bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-rmrk-core
+bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler bench-rmrk-core
pallets/scheduler/Cargo.tomldiffbeforeafterboth--- a/pallets/scheduler/Cargo.toml
+++ b/pallets/scheduler/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "pallet-unq-scheduler"
+name = "pallet-unique-scheduler"
version = "0.1.0"
authors = ["Unique Network <support@uniquenetwork.io>"]
edition = "2021"
pallets/scheduler/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/scheduler/src/benchmarking.rs
+++ b/pallets/scheduler/src/benchmarking.rs
@@ -34,35 +34,57 @@
//! Scheduler pallet benchmarking.
-#![cfg(feature = "runtime-benchmarks")]
-
use super::*;
-use sp_std::{vec, prelude::*};
+use frame_benchmarking::{benchmarks, account};
+use frame_support::{
+ ensure,
+ traits::{OnInitialize},
+};
use frame_system::RawOrigin;
-use frame_support::{ensure, traits::OnInitialize};
-use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
+use sp_runtime::traits::Hash;
+use sp_std::{prelude::*, vec};
-use crate::Module as Scheduler;
+use crate::Pallet as Scheduler;
use frame_system::Pallet as System;
+use frame_support::traits::Currency;
const BLOCK_NUMBER: u32 = 2;
-// Add `n` named items to the schedule
-fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {
- // Essentially a no-op call.
- let call = frame_system::Call::set_storage { items: vec![] };
+/// Add `n` named items to the schedule.
+///
+/// For `resolved`:
+/// - `None`: aborted (hash without preimage)
+/// - `Some(true)`: hash resolves into call if possible, plain call otherwise
+/// - `Some(false)`: plain call
+fn fill_schedule<T: Config>(
+ when: T::BlockNumber,
+ n: u32,
+ periodic: 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
- Scheduler::<T>::do_schedule_named(
- i.encode(),
- DispatchTime::At(when),
- // Add periodicity
- Some((T::BlockNumber::one(), 100)),
- // HARD_DEADLINE priority means it gets executed no matter what
- 0,
- frame_system::RawOrigin::Root.into(),
- call.clone().into(),
- )?;
+ let (call, hash) = call_and_hash::<T>(i);
+ let call_or_hash = match resolved {
+ Some(_) => call.into(),
+ None => CallOrHashOf::<T>::Hash(hash),
+ };
+ let period = match periodic {
+ true => Some(((i + 100).into(), 100)),
+ false => None,
+ };
+
+ 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,
@@ -71,54 +93,121 @@
Ok(())
}
+fn call_and_hash<T: Config>(i: u32) -> (<T as Config>::Call, T::Hash) {
+ // Essentially a no-op call.
+ let call: <T as Config>::Call = frame_system::Call::remark { remark: i.encode() }.into();
+ let hash = T::Hashing::hash_of(&call);
+ (call, hash)
+}
+
benchmarks! {
- schedule {
- let s in 0 .. T::MaxScheduledPerBlock::get();
+ on_initialize_periodic_named_resolved {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
let when = BLOCK_NUMBER.into();
- let periodic = Some((T::BlockNumber::one(), 100));
- let priority = 0;
- // Essentially a no-op call.
- let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());
+ fill_schedule::<T>(when, s, true, 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);
+ }
+ }
- fill_schedule::<T>(when, s)?;
- }: _(RawOrigin::Root, when, periodic, priority, call)
+ on_initialize_named_resolved {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
+ let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, false, Some(true))?;
+ }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
verify {
- ensure!(
- Agenda::<T>::get(when).len() == (s + 1) as usize,
- "didn't add to schedule"
- );
+ assert_eq!(System::<T>::event_count(), s);
+ assert!(Agenda::<T>::iter().count() == 0);
}
- cancel {
+ on_initialize_periodic {
let s in 1 .. T::MaxScheduledPerBlock::get();
let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, true, 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);
+ }
+ }
- fill_schedule::<T>(when, s)?;
- assert_eq!(Agenda::<T>::get(when).len(), s as usize);
- }: _(RawOrigin::Root, when, 0)
+ on_initialize_periodic_resolved {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
+ let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, true, Some(true))?;
+ }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
verify {
- ensure!(
- Lookup::<T>::get(0.encode()).is_none(),
- "didn't remove from lookup"
- );
- // Removed schedule is NONE
- ensure!(
- Agenda::<T>::get(when)[0].is_none(),
- "didn't remove from schedule"
- );
+ 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_aborted {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
+ let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, false, None)?;
+ }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
+ verify {
+ assert_eq!(System::<T>::event_count(), 0);
+ }
+
+ on_initialize_named_aborted {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
+ let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, false, Some(false))?;
+ }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
+ verify {
+ }
+
+ on_initialize_named {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
+ let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, false, None)?;
+ }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
+ verify {
+ assert_eq!(System::<T>::event_count(), 0);
+ }
+
+ on_initialize {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
+ let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, false, 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_resolved {
+ let s in 1 .. T::MaxScheduledPerBlock::get();
+ let when = BLOCK_NUMBER.into();
+ fill_schedule::<T>(when, s, false, Some(true))?;
+ }: { 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();
+ 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 call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());
-
- fill_schedule::<T>(when, s)?;
- }: _(RawOrigin::Root, id, when, periodic, priority, 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, Some(false))?;
+ }: _(origin, id, when, periodic, priority, call)
verify {
ensure!(
Agenda::<T>::get(when).len() == (s + 1) as usize,
@@ -127,14 +216,16 @@
}
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();
-
- fill_schedule::<T>(when, s)?;
- }: _(RawOrigin::Root, 0.encode())
+ let id = 0.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
+ fill_schedule::<T>(when, s, true, Some(false))?;
+ }: _(origin, id)
verify {
ensure!(
- Lookup::<T>::get(0.encode()).is_none(),
+ Lookup::<T>::get(id).is_none(),
"didn't remove from lookup"
);
// Removed schedule is NONE
@@ -144,21 +235,5 @@
);
}
- // TODO [#7141]: Make this more complex and flexible so it can be used in automation.
- #[extra]
- on_initialize {
- let s in 0 .. T::MaxScheduledPerBlock::get();
- let when = BLOCK_NUMBER.into();
- fill_schedule::<T>(when, s)?;
- }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
- verify {
- assert_eq!(System::<T>::event_count(), s);
- // Next block should have all the schedules again
- ensure!(
- Agenda::<T>::get(when + T::BlockNumber::one()).len() == s as usize,
- "didn't append schedule"
- );
- }
+ impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);
}
-
-impl_benchmark_test_suite!(Scheduler, crate::tests::new_test_ext(), crate::tests::Test,);
pallets/scheduler/src/lib.rsdiffbeforeafterboth--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -60,9 +60,8 @@
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
-// FIXME
-// #[cfg(feature = "runtime-benchmarks")]
-// mod benchmarking;
+#[cfg(feature = "runtime-benchmarks")]
+mod benchmarking;
pub mod weights;
@@ -159,11 +158,10 @@
Self::on_initialize_periodic(2) - Self::on_initialize_periodic(1)
}
(true, true, Some(false)) => {
- Self::on_initialize_periodic_named(2) - Self::on_initialize_periodic_named(1)
- }
- (false, false, Some(true)) => {
- Self::on_initialize_resolved(2) - Self::on_initialize_resolved(1)
+ Self::on_initialize_periodic_named_resolved(2)
+ - Self::on_initialize_periodic_named_resolved(1)
}
+ (false, false, Some(true)) => Self::on_initialize(2) - Self::on_initialize(1),
(false, true, Some(true)) => {
Self::on_initialize_named_resolved(2) - Self::on_initialize_named_resolved(1)
}
@@ -608,97 +606,8 @@
}
Ok(when)
- }
-
- fn do_schedule(
- when: DispatchTime<T::BlockNumber>,
- maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
- priority: schedule::Priority,
- origin: T::PalletsOrigin,
- call: CallOrHashOf<T>,
- ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
- let when = Self::resolve_time(when)?;
- call.ensure_requested::<T::PreimageProvider>();
-
- // sanitize maybe_periodic
- let maybe_periodic = maybe_periodic
- .filter(|p| p.1 > 1 && !p.0.is_zero())
- // Remove one from the number of repetitions since we will schedule one now.
- .map(|(p, c)| (p, c - 1));
- let s = Some(Scheduled {
- maybe_id: None,
- priority,
- call,
- maybe_periodic,
- origin,
- _phantom: PhantomData::<T::AccountId>::default(),
- });
- Agenda::<T>::append(when, s);
- let index = Agenda::<T>::decode_len(when).unwrap_or(1) as u32 - 1;
- Self::deposit_event(Event::Scheduled { when, index });
-
- Ok((when, index))
}
- fn do_cancel(
- origin: Option<T::PalletsOrigin>,
- (when, index): TaskAddress<T::BlockNumber>,
- ) -> Result<(), DispatchError> {
- let scheduled = Agenda::<T>::try_mutate(when, |agenda| {
- agenda.get_mut(index as usize).map_or(
- Ok(None),
- |s| -> Result<Option<Scheduled<_, _, _, _>>, DispatchError> {
- if let (Some(ref o), Some(ref s)) = (origin, s.borrow()) {
- if matches!(
- T::OriginPrivilegeCmp::cmp_privilege(o, &s.origin),
- Some(Ordering::Less) | None
- ) {
- return Err(BadOrigin.into());
- }
- };
- Ok(s.take())
- },
- )
- })?;
- if let Some(s) = scheduled {
- s.call.ensure_unrequested::<T::PreimageProvider>();
- if let Some(id) = s.maybe_id {
- Lookup::<T>::remove(id);
- }
- Self::deposit_event(Event::Canceled { when, index });
- Ok(())
- } else {
- Err(Error::<T>::NotFound)?
- }
- }
-
- fn do_reschedule(
- (when, index): TaskAddress<T::BlockNumber>,
- new_time: DispatchTime<T::BlockNumber>,
- ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
- let new_time = Self::resolve_time(new_time)?;
-
- if new_time == when {
- return Err(Error::<T>::RescheduleNoChange.into());
- }
-
- Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {
- let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;
- let task = task.take().ok_or(Error::<T>::NotFound)?;
- Agenda::<T>::append(new_time, Some(task));
- Ok(())
- })?;
-
- let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;
- Self::deposit_event(Event::Canceled { when, index });
- Self::deposit_event(Event::Scheduled {
- when: new_time,
- index: new_index,
- });
-
- Ok((new_time, new_index))
- }
-
fn do_schedule_named(
id: ScheduledId,
when: DispatchTime<T::BlockNumber>,
@@ -789,125 +698,5 @@
Err(Error::<T>::NotFound)?
}
})
- }
-
- fn do_reschedule_named(
- id: ScheduledId,
- new_time: DispatchTime<T::BlockNumber>,
- ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
- let new_time = Self::resolve_time(new_time)?;
-
- Lookup::<T>::try_mutate_exists(
- id,
- |lookup| -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
- let (when, index) = lookup.ok_or(Error::<T>::NotFound)?;
-
- if new_time == when {
- return Err(Error::<T>::RescheduleNoChange.into());
- }
-
- Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {
- let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;
- let task = task.take().ok_or(Error::<T>::NotFound)?;
- Agenda::<T>::append(new_time, Some(task));
-
- Ok(())
- })?;
-
- let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;
- Self::deposit_event(Event::Canceled { when, index });
- Self::deposit_event(Event::Scheduled {
- when: new_time,
- index: new_index,
- });
-
- *lookup = Some((new_time, new_index));
-
- Ok((new_time, new_index))
- },
- )
- }
-}
-
-impl<T: Config> schedule::v2::Anon<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>
- for Pallet<T>
-{
- type Address = TaskAddress<T::BlockNumber>;
- type Hash = T::Hash;
-
- fn schedule(
- when: DispatchTime<T::BlockNumber>,
- maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
- priority: schedule::Priority,
- origin: T::PalletsOrigin,
- call: CallOrHashOf<T>,
- ) -> Result<Self::Address, DispatchError> {
- Self::do_schedule(when, maybe_periodic, priority, origin, call)
- }
-
- fn cancel((when, index): Self::Address) -> Result<(), ()> {
- Self::do_cancel(None, (when, index)).map_err(|_| ())
- }
-
- fn reschedule(
- address: Self::Address,
- when: DispatchTime<T::BlockNumber>,
- ) -> Result<Self::Address, DispatchError> {
- Self::do_reschedule(address, when)
- }
-
- fn next_dispatch_time((when, index): Self::Address) -> Result<T::BlockNumber, ()> {
- Agenda::<T>::get(when)
- .get(index as usize)
- .ok_or(())
- .map(|_| when)
- }
-}
-
-impl<T: Config> schedule::v2::Named<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>
- for Pallet<T>
-{
- type Address = TaskAddress<T::BlockNumber>;
- type Hash = T::Hash;
-
- fn schedule_named(
- id: Vec<u8>,
- when: DispatchTime<T::BlockNumber>,
- maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
- priority: schedule::Priority,
- origin: T::PalletsOrigin,
- call: CallOrHashOf<T>,
- ) -> Result<Self::Address, ()> {
- let inner_id: ScheduledId = id
- .try_into()
- .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
- Self::do_schedule_named(inner_id, when, maybe_periodic, priority, origin, call)
- .map_err(|_| ())
- }
-
- fn cancel_named(id: Vec<u8>) -> Result<(), ()> {
- let inner_id: ScheduledId = id
- .try_into()
- .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
- Self::do_cancel_named(None, inner_id).map_err(|_| ())
- }
-
- fn reschedule_named(
- id: Vec<u8>,
- when: DispatchTime<T::BlockNumber>,
- ) -> Result<Self::Address, DispatchError> {
- let inner_id: ScheduledId = id
- .try_into()
- .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
- Self::do_reschedule_named(inner_id, when)
- }
-
- fn next_dispatch_time(id: Vec<u8>) -> Result<T::BlockNumber, ()> {
- let inner_id: ScheduledId = id
- .try_into()
- .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
- Lookup::<T>::get(inner_id)
- .and_then(|(when, index)| Agenda::<T>::get(when).get(index as usize).map(|_| when))
- .ok_or(())
}
}
pallets/scheduler/src/weights.rsdiffbeforeafterboth--- a/pallets/scheduler/src/weights.rs
+++ b/pallets/scheduler/src/weights.rs
@@ -1,213 +1,183 @@
-// This file is part of Substrate.
-
-// Copyright (C) 2022 Parity Technologies (UK) Ltd.
-// SPDX-License-Identifier: Apache-2.0
-
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
-//! Autogenerated weights for pallet_scheduler
+//! Autogenerated weights for pallet_unique_scheduler
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2022-01-31, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
-//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+//! DATE: 2022-06-09, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// ./target/production/substrate
+// target/release/unique-collator
// benchmark
-// --chain=dev
+// pallet
+// --pallet
+// pallet-unique-scheduler
+// --wasm-execution
+// compiled
+// --extrinsic
+// *
+// --template
+// .maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=20
-// --pallet=pallet_scheduler
-// --extrinsic=*
-// --execution=wasm
-// --wasm-execution=compiled
+// --repeat=200
// --heap-pages=4096
-// --output=./frame/scheduler/src/weights.rs
-// --template=.maintain/frame-weight-template.hbs
-// --header=HEADER-APACHE2
-// --raw
+// --output=./pallets/scheduler/src/weights.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
-/// Weight functions needed for pallet_scheduler.
+/// Weight functions needed for pallet_unique_scheduler.
pub trait WeightInfo {
fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight;
fn on_initialize_named_resolved(s: u32, ) -> Weight;
+ fn on_initialize_periodic(s: u32, ) -> Weight;
fn on_initialize_periodic_resolved(s: u32, ) -> Weight;
- fn on_initialize_resolved(s: u32, ) -> Weight;
+ fn on_initialize_aborted(s: u32, ) -> Weight;
fn on_initialize_named_aborted(s: u32, ) -> Weight;
- fn on_initialize_aborted(s: u32, ) -> Weight;
- fn on_initialize_periodic_named(s: u32, ) -> Weight;
- fn on_initialize_periodic(s: u32, ) -> Weight;
fn on_initialize_named(s: u32, ) -> Weight;
fn on_initialize(s: u32, ) -> Weight;
- fn schedule(s: u32, ) -> Weight;
- fn cancel(s: u32, ) -> Weight;
+ fn on_initialize_resolved(s: u32, ) -> Weight;
fn schedule_named(s: u32, ) -> Weight;
fn cancel_named(s: u32, ) -> Weight;
}
-/// Weights for pallet_scheduler using the Substrate node and recommended hardware.
+/// Weights for pallet_unique_scheduler using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
- (11_587_000 as Weight)
- // Standard Error: 17_000
- .saturating_add((17_428_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
- .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(s as Weight)))
+ (35_999_000 as Weight)
+ // Standard Error: 3_000
+ .saturating_add((32_234_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(4 as Weight))
+ .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:1 w:1)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_named_resolved(s: u32, ) -> Weight {
- (8_965_000 as Weight)
- // Standard Error: 11_000
- .saturating_add((13_410_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
- .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))
+ (34_874_000 as Weight)
+ // Standard Error: 2_000
+ .saturating_add((23_114_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
- fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
- (8_654_000 as Weight)
- // Standard Error: 17_000
- .saturating_add((14_990_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
- .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))
- }
- // Storage: Scheduler Agenda (r:1 w:1)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
- fn on_initialize_resolved(s: u32, ) -> Weight {
- (9_303_000 as Weight)
- // Standard Error: 10_000
- .saturating_add((12_244_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
+ // Storage: Scheduler Lookup (r:0 w:1)
+ fn on_initialize_periodic(s: u32, ) -> Weight {
+ (36_469_000 as Weight)
+ // Standard Error: 3_000
+ .saturating_add((32_202_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(4 as Weight))
+ .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:0)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
- fn on_initialize_named_aborted(s: u32, ) -> Weight {
- (7_506_000 as Weight)
+ fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
+ (35_352_000 as Weight)
// Standard Error: 3_000
- .saturating_add((5_208_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(2 as Weight))
+ .saturating_add((32_309_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
- .saturating_add(T::DbWeight::get().writes(2 as Weight))
- .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:0)
+ // Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_aborted(s: u32, ) -> Weight {
- (8_046_000 as Weight)
- // Standard Error: 3_000
- .saturating_add((2_914_000 as Weight).saturating_mul(s as Weight))
+ (11_267_000 as Weight)
+ // Standard Error: 1_000
+ .saturating_add((9_368_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
- .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
+ .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
- // Storage: Scheduler Agenda (r:2 w:2)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
- fn on_initialize_periodic_named(s: u32, ) -> Weight {
- (13_704_000 as Weight)
- // Standard Error: 4_000
- .saturating_add((8_186_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
- .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
- }
- // Storage: Scheduler Agenda (r:2 w:2)
- fn on_initialize_periodic(s: u32, ) -> Weight {
- (12_668_000 as Weight)
- // Standard Error: 5_000
- .saturating_add((5_868_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ fn on_initialize_named_aborted(s: u32, ) -> Weight {
+ (35_937_000 as Weight)
+ // Standard Error: 3_000
+ .saturating_add((23_037_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
- // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_named(s: u32, ) -> Weight {
- (13_946_000 as Weight)
- // Standard Error: 4_000
- .saturating_add((4_367_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ (10_338_000 as Weight)
+ // Standard Error: 2_000
+ .saturating_add((9_422_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(2 as Weight))
+ .saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
+ // Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize(s: u32, ) -> Weight {
- (13_151_000 as Weight)
- // Standard Error: 4_000
- .saturating_add((3_455_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ (37_448_000 as Weight)
+ // Standard Error: 7_000
+ .saturating_add((22_907_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:1 w:1)
- fn schedule(s: u32, ) -> Weight {
- (14_040_000 as Weight)
- // Standard Error: 1_000
- .saturating_add((89_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().writes(1 as Weight))
- }
- // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
- fn cancel(s: u32, ) -> Weight {
- (14_376_000 as Weight)
- // Standard Error: 1_000
- .saturating_add((576_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(T::DbWeight::get().reads(1 as Weight))
- .saturating_add(T::DbWeight::get().writes(2 as Weight))
+ fn on_initialize_resolved(s: u32, ) -> Weight {
+ (34_841_000 as Weight)
+ // Standard Error: 7_000
+ .saturating_add((22_966_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(T::DbWeight::get().reads(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
+ .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Lookup (r:1 w:1)
// Storage: Scheduler Agenda (r:1 w:1)
fn schedule_named(s: u32, ) -> Weight {
- (16_806_000 as Weight)
- // Standard Error: 1_000
- .saturating_add((102_000 as Weight).saturating_mul(s as Weight))
+ (33_845_000 as Weight)
+ // Standard Error: 0
+ .saturating_add((168_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Scheduler Lookup (r:1 w:1)
// Storage: Scheduler Agenda (r:1 w:1)
fn cancel_named(s: u32, ) -> Weight {
- (15_852_000 as Weight)
- // Standard Error: 2_000
- .saturating_add((590_000 as Weight).saturating_mul(s as Weight))
+ (31_169_000 as Weight)
+ // Standard Error: 1_000
+ .saturating_add((1_565_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -216,148 +186,134 @@
// For backwards compatibility and tests
impl WeightInfo for () {
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
- (11_587_000 as Weight)
- // Standard Error: 17_000
- .saturating_add((17_428_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(s as Weight)))
+ (35_999_000 as Weight)
+ // Standard Error: 3_000
+ .saturating_add((32_234_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4 as Weight))
+ .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:1 w:1)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_named_resolved(s: u32, ) -> Weight {
- (8_965_000 as Weight)
- // Standard Error: 11_000
- .saturating_add((13_410_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))
+ (34_874_000 as Weight)
+ // Standard Error: 2_000
+ .saturating_add((23_114_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
- fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
- (8_654_000 as Weight)
- // Standard Error: 17_000
- .saturating_add((14_990_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))
- }
- // Storage: Scheduler Agenda (r:1 w:1)
- // Storage: Preimage PreimageFor (r:1 w:1)
- // Storage: Preimage StatusFor (r:1 w:1)
- fn on_initialize_resolved(s: u32, ) -> Weight {
- (9_303_000 as Weight)
- // Standard Error: 10_000
- .saturating_add((12_244_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
+ // Storage: Scheduler Lookup (r:0 w:1)
+ fn on_initialize_periodic(s: u32, ) -> Weight {
+ (36_469_000 as Weight)
+ // Standard Error: 3_000
+ .saturating_add((32_202_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4 as Weight))
+ .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:0)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
- fn on_initialize_named_aborted(s: u32, ) -> Weight {
- (7_506_000 as Weight)
+ fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
+ (35_352_000 as Weight)
// Standard Error: 3_000
- .saturating_add((5_208_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(2 as Weight))
+ .saturating_add((32_309_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
- .saturating_add(RocksDbWeight::get().writes(2 as Weight))
- .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:2 w:2)
- // Storage: Preimage PreimageFor (r:1 w:0)
+ // Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_aborted(s: u32, ) -> Weight {
- (8_046_000 as Weight)
- // Standard Error: 3_000
- .saturating_add((2_914_000 as Weight).saturating_mul(s as Weight))
+ (11_267_000 as Weight)
+ // Standard Error: 1_000
+ .saturating_add((9_368_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
- .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
- // Storage: Scheduler Agenda (r:2 w:2)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
- fn on_initialize_periodic_named(s: u32, ) -> Weight {
- (13_704_000 as Weight)
- // Standard Error: 4_000
- .saturating_add((8_186_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
- }
- // Storage: Scheduler Agenda (r:2 w:2)
- fn on_initialize_periodic(s: u32, ) -> Weight {
- (12_668_000 as Weight)
- // Standard Error: 5_000
- .saturating_add((5_868_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ fn on_initialize_named_aborted(s: u32, ) -> Weight {
+ (35_937_000 as Weight)
+ // Standard Error: 3_000
+ .saturating_add((23_037_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
- // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
// Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize_named(s: u32, ) -> Weight {
- (13_946_000 as Weight)
- // Standard Error: 4_000
- .saturating_add((4_367_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ (10_338_000 as Weight)
+ // Standard Error: 2_000
+ .saturating_add((9_422_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(2 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
+ // Storage: Scheduler Lookup (r:0 w:1)
fn on_initialize(s: u32, ) -> Weight {
- (13_151_000 as Weight)
- // Standard Error: 4_000
- .saturating_add((3_455_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ (37_448_000 as Weight)
+ // Standard Error: 7_000
+ .saturating_add((22_907_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Agenda (r:1 w:1)
- fn schedule(s: u32, ) -> Weight {
- (14_040_000 as Weight)
- // Standard Error: 1_000
- .saturating_add((89_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes(1 as Weight))
- }
- // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: System AllExtrinsicsLen (r:1 w:1)
+ // Storage: System BlockWeight (r:1 w:1)
// Storage: Scheduler Lookup (r:0 w:1)
- fn cancel(s: u32, ) -> Weight {
- (14_376_000 as Weight)
- // Standard Error: 1_000
- .saturating_add((576_000 as Weight).saturating_mul(s as Weight))
- .saturating_add(RocksDbWeight::get().reads(1 as Weight))
- .saturating_add(RocksDbWeight::get().writes(2 as Weight))
+ fn on_initialize_resolved(s: u32, ) -> Weight {
+ (34_841_000 as Weight)
+ // Standard Error: 7_000
+ .saturating_add((22_966_000 as Weight).saturating_mul(s as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
// Storage: Scheduler Lookup (r:1 w:1)
// Storage: Scheduler Agenda (r:1 w:1)
fn schedule_named(s: u32, ) -> Weight {
- (16_806_000 as Weight)
- // Standard Error: 1_000
- .saturating_add((102_000 as Weight).saturating_mul(s as Weight))
+ (33_845_000 as Weight)
+ // Standard Error: 0
+ .saturating_add((168_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Scheduler Lookup (r:1 w:1)
// Storage: Scheduler Agenda (r:1 w:1)
fn cancel_named(s: u32, ) -> Weight {
- (15_852_000 as Weight)
- // Standard Error: 2_000
- .saturating_add((590_000 as Weight).saturating_mul(s as Weight))
+ (31_169_000 as Weight)
+ // Standard Error: 1_000
+ .saturating_add((1_565_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
runtime/common/Cargo.tomldiffbeforeafterboth89default-features = false89default-features = false90path = "../../pallets/refungible"90path = "../../pallets/refungible"9192[dependencies.pallet-unique-scheduler]93default-features = false94path = "../../pallets/scheduler"919592[dependencies.up-data-structs]96[dependencies.up-data-structs]93default-features = false97default-features = falseruntime/common/src/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -843,6 +843,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_unique_scheduler, Scheduler);
list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);
// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
@@ -887,6 +888,7 @@
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_unique_scheduler, Scheduler);
add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);
// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
runtime/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-unique-scheduler/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
@@ -93,7 +94,7 @@
'pallet-proxy-rmrk-core/std',
'pallet-proxy-rmrk-equip/std',
'pallet-unique/std',
- 'pallet-unq-scheduler/std',
+ 'pallet-unique-scheduler/std',
'pallet-charge-transaction/std',
'up-data-structs/std',
'sp-api/std',
@@ -412,7 +413,7 @@
pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
-pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -68,7 +68,7 @@
WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
},
};
-use pallet_unq_scheduler::DispatchCall;
+use pallet_unique_scheduler::DispatchCall;
use up_data_structs::{
CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
CollectionStats, RpcCollection,
@@ -969,7 +969,7 @@
}
pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>
+impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
where
<T as frame_system::Config>::Call: Member
@@ -979,13 +979,13 @@
+ From<frame_system::Call<Runtime>>,
SelfContainedSignedInfo: Send + Sync + 'static,
Call: From<<T as frame_system::Config>::Call>
- + From<<T as pallet_unq_scheduler::Config>::Call>
+ + From<<T as pallet_unique_scheduler::Config>::Call>
+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
{
fn dispatch_call(
signer: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
) -> Result<
Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
TransactionValidityError,
@@ -1011,7 +1011,7 @@
fn reserve_balance(
id: [u8; 16],
sponsor: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
count: u32,
) -> Result<(), DispatchError> {
let dispatch_info = call.get_dispatch_info();
@@ -1028,7 +1028,7 @@
fn pay_for_call(
id: [u8; 16],
sponsor: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
) -> Result<u128, DispatchError> {
let dispatch_info = call.get_dispatch_info();
let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
@@ -1069,7 +1069,7 @@
}
}
-impl pallet_unq_scheduler::Config for Runtime {
+impl pallet_unique_scheduler::Config for Runtime {
type Event = Event;
type Origin = Origin;
type Currency = Balances;
@@ -1158,7 +1158,7 @@
// Unique Pallets
Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
- Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+ Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
// free = 63
Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -37,6 +37,7 @@
'pallet-proxy-rmrk-equip/runtime-benchmarks',
'pallet-unique/runtime-benchmarks',
'pallet-inflation/runtime-benchmarks',
+ 'pallet-unique-scheduler/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
@@ -94,7 +95,7 @@
'pallet-proxy-rmrk-core/std',
'pallet-proxy-rmrk-equip/std',
'pallet-unique/std',
- 'pallet-unq-scheduler/std',
+ 'pallet-unique-scheduler/std',
'pallet-charge-transaction/std',
'up-data-structs/std',
'sp-api/std',
@@ -419,7 +420,7 @@
pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
-pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -68,7 +68,7 @@
WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
},
};
-use pallet_unq_scheduler::DispatchCall;
+use pallet_unique_scheduler::DispatchCall;
use up_data_structs::{
CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
CollectionStats, RpcCollection,
@@ -968,7 +968,7 @@
}
pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>
+impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
where
<T as frame_system::Config>::Call: Member
@@ -978,13 +978,13 @@
+ From<frame_system::Call<Runtime>>,
SelfContainedSignedInfo: Send + Sync + 'static,
Call: From<<T as frame_system::Config>::Call>
- + From<<T as pallet_unq_scheduler::Config>::Call>
+ + From<<T as pallet_unique_scheduler::Config>::Call>
+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
{
fn dispatch_call(
signer: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
) -> Result<
Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
TransactionValidityError,
@@ -1010,7 +1010,7 @@
fn reserve_balance(
id: [u8; 16],
sponsor: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
count: u32,
) -> Result<(), DispatchError> {
let dispatch_info = call.get_dispatch_info();
@@ -1027,7 +1027,7 @@
fn pay_for_call(
id: [u8; 16],
sponsor: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
) -> Result<u128, DispatchError> {
let dispatch_info = call.get_dispatch_info();
let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
@@ -1068,7 +1068,7 @@
}
}
-impl pallet_unq_scheduler::Config for Runtime {
+impl pallet_unique_scheduler::Config for Runtime {
type Event = Event;
type Origin = Origin;
type Currency = Balances;
@@ -1156,7 +1156,7 @@
// Unique Pallets
Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
- Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+ Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
// free = 63
Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -37,6 +37,7 @@
'pallet-proxy-rmrk-equip/runtime-benchmarks',
'pallet-unique/runtime-benchmarks',
'pallet-inflation/runtime-benchmarks',
+ 'pallet-unique-scheduler/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
@@ -95,7 +96,7 @@
'pallet-proxy-rmrk-core/std',
'pallet-proxy-rmrk-equip/std',
'pallet-unique/std',
- 'pallet-unq-scheduler/std',
+ 'pallet-unique-scheduler/std',
'pallet-charge-transaction/std',
'up-data-structs/std',
'sp-api/std',
@@ -412,7 +413,7 @@
pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
-pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -68,7 +68,7 @@
WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
},
};
-use pallet_unq_scheduler::DispatchCall;
+use pallet_unique_scheduler::DispatchCall;
use up_data_structs::{
CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
CollectionStats, RpcCollection,
@@ -967,7 +967,7 @@
}
pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>
+impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
where
<T as frame_system::Config>::Call: Member
@@ -977,13 +977,13 @@
+ From<frame_system::Call<Runtime>>,
SelfContainedSignedInfo: Send + Sync + 'static,
Call: From<<T as frame_system::Config>::Call>
- + From<<T as pallet_unq_scheduler::Config>::Call>
+ + From<<T as pallet_unique_scheduler::Config>::Call>
+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
{
fn dispatch_call(
signer: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
) -> Result<
Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
TransactionValidityError,
@@ -1009,7 +1009,7 @@
fn reserve_balance(
id: [u8; 16],
sponsor: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
count: u32,
) -> Result<(), DispatchError> {
let dispatch_info = call.get_dispatch_info();
@@ -1026,7 +1026,7 @@
fn pay_for_call(
id: [u8; 16],
sponsor: <T as frame_system::Config>::AccountId,
- call: <T as pallet_unq_scheduler::Config>::Call,
+ call: <T as pallet_unique_scheduler::Config>::Call,
) -> Result<u128, DispatchError> {
let dispatch_info = call.get_dispatch_info();
let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
@@ -1067,7 +1067,7 @@
}
}
-impl pallet_unq_scheduler::Config for Runtime {
+impl pallet_unique_scheduler::Config for Runtime {
type Event = Event;
type Origin = Origin;
type Currency = Balances;
@@ -1155,7 +1155,7 @@
// Unique Pallets
Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
- Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+ Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
// free = 63
Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,