From 28ac5b8847c0ee24346e5fe5e6bc8b6890f9b79b Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 09 Jun 2022 17:29:55 +0000 Subject: [PATCH] Benchmark completed --- --- 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 --- 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, ) -> 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::(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::::Hash(hash) - } else { - call.into() - } - } - Some(false) => call.into(), + Some(_) => call.into(), None => CallOrHashOf::::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::::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::::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::::do_schedule_named( + id, + t, + period, + 0, + origin, + call_or_hash, + )?; } ensure!( Agenda::::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::(when, s, true, true, Some(true))?; + fill_schedule::(when, s, true, Some(true))?; }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } verify { - assert_eq!(System::::event_count(), s * 2); + assert_eq!(System::::event_count(), s); for i in 0..s { assert_eq!(Agenda::::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::(when, s, false, true, Some(true))?; + fill_schedule::(when, s, false, Some(true))?; }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } verify { - assert_eq!(System::::event_count(), s * 2); + assert_eq!(System::::event_count(), s); assert!(Agenda::::iter().count() == 0); } on_initialize_periodic_resolved { let s in 1 .. T::MaxScheduledPerBlock::get(); let when = BLOCK_NUMBER.into(); - fill_schedule::(when, s, true, false, Some(true))?; + fill_schedule::(when, s, true, Some(true))?; }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } verify { - assert_eq!(System::::event_count(), s * 2); + assert_eq!(System::::event_count(), s ); for i in 0..s { assert_eq!(Agenda::::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::(when, s, false, false, Some(true))?; - }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } - verify { - assert_eq!(System::::event_count(), s * 2); - assert!(Agenda::::iter().count() == 0); - } - - on_initialize_named_aborted { - let s in 1 .. T::MaxScheduledPerBlock::get(); - let when = BLOCK_NUMBER.into(); - fill_schedule::(when, s, false, true, None)?; - }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } - verify { - assert_eq!(System::::event_count(), 0); - if let Some(delay) = T::NoPreimagePostponement::get() { - assert_eq!(Agenda::::get(when + delay).len(), s as usize); - } else { - assert!(Agenda::::iter().count() == 0); - } - } - - on_initialize_aborted { - let s in 1 .. T::MaxScheduledPerBlock::get(); - let when = BLOCK_NUMBER.into(); - fill_schedule::(when, s, false, false, None)?; - }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } - verify { - assert_eq!(System::::event_count(), 0); - if let Some(delay) = T::NoPreimagePostponement::get() { - assert_eq!(Agenda::::get(when + delay).len(), s as usize); - } else { - assert!(Agenda::::iter().count() == 0); - } - } - - on_initialize_periodic_named { - let s in 1 .. T::MaxScheduledPerBlock::get(); - let when = BLOCK_NUMBER.into(); - fill_schedule::(when, s, true, true, Some(false))?; + fill_schedule::(when, s, false, Some(true))?; }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } - verify { - assert_eq!(System::::event_count(), s); - for i in 0..s { - assert_eq!(Agenda::::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::(when, s, true, false, Some(false))?; - }: { Scheduler::::on_initialize(when); } verify { assert_eq!(System::::event_count(), s); - for i in 0..s { - assert_eq!(Agenda::::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::(when, s, false, true, Some(false))?; - }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } - verify { - assert_eq!(System::::event_count(), s); assert!(Agenda::::iter().count() == 0); } - on_initialize { - let s in 1 .. T::MaxScheduledPerBlock::get(); - let when = BLOCK_NUMBER.into(); - fill_schedule::(when, s, false, false, Some(false))?; - }: { Scheduler::::on_initialize(BLOCK_NUMBER.into()); } - verify { - assert_eq!(System::::event_count(), s); - assert!(Agenda::::iter().count() == 0); - } - schedule_named { + let caller: T::AccountId = account("user", 0, 1); + let origin: RawOrigin = 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::::Value(inner_call)); - - fill_schedule::(when, s, true, true, Some(false))?; - }: _(RawOrigin::Root, id, when, periodic, priority, call) + fill_schedule::(when, s, true, Some(false))?; + }: _(origin, id, when, periodic, priority, call) verify { ensure!( Agenda::::get(when).len() == (s + 1) as usize, @@ -249,12 +176,13 @@ } cancel_named { + let caller: T::AccountId = account("user", 0, 1); + let origin: RawOrigin = 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::(when, s, true, true, Some(false))?; - }: _(RawOrigin::Root, id) + fill_schedule::(when, s, true, Some(false))?; + }: _(origin, id) verify { ensure!( Lookup::::get(id).is_none(), --- a/pallets/scheduler/src/weights.rs +++ b/pallets/scheduler/src/weights.rs @@ -1,213 +1,118 @@ -// This file is part of Substrate. +// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs -// 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. - -//! Autogenerated weights for pallet_scheduler +//! Autogenerated weights for pallet_unq_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-unq-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_unq_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_resolved(s: u32, ) -> Weight; fn on_initialize_resolved(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 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_unq_scheduler using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // 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))) + (39_822_000 as Weight) + // Standard Error: 4_000 + .saturating_add((31_823_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))) - } - // 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)) - .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_named_aborted(s: u32, ) -> Weight { - (7_506_000 as Weight) + (36_019_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(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add((22_660_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:0) - 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)) - .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)) - } - // Storage: Scheduler Agenda (r:2 w:2) + // 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)) + fn on_initialize_periodic_resolved(s: u32, ) -> Weight { + (36_613_000 as Weight) + // Standard Error: 3_000 + .saturating_add((31_895_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(1 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) - 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)) - .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_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)) + fn on_initialize_resolved(s: u32, ) -> Weight { + (36_252_000 as Weight) + // Standard Error: 3_000 + .saturating_add((22_662_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 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)) } - // 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: 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)) - } // 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)) + (34_561_000 as Weight) + // Standard Error: 0 + .saturating_add((161_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)) + (30_932_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_537_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 +121,74 @@ // 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))) + (39_822_000 as Weight) + // Standard Error: 4_000 + .saturating_add((31_823_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))) - } - // 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)) - .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_named_aborted(s: u32, ) -> Weight { - (7_506_000 as Weight) + (36_019_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(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add((22_660_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:0) - fn on_initialize_aborted(s: u32, ) -> Weight { - (8_046_000 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_resolved(s: u32, ) -> Weight { + (36_613_000 as Weight) // Standard Error: 3_000 - .saturating_add((2_914_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add((31_895_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)) - } - // Storage: Scheduler Agenda (r:2 w:2) - // 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(4 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)) - .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_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)) + fn on_initialize_resolved(s: u32, ) -> Weight { + (36_252_000 as Weight) + // Standard Error: 3_000 + .saturating_add((22_662_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 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)) - } - // 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: 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)) } // 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)) + (34_561_000 as Weight) + // Standard Error: 0 + .saturating_add((161_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)) + (30_932_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_537_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } --- 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" --- 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()) } --- 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', --- 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', --- 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', -- gitstuff