difftreelog
feat scheduler v2 draft
in: master
7 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5390,6 +5390,7 @@
"pallet-treasury",
"pallet-unique",
"pallet-unique-scheduler",
+ "pallet-unique-scheduler-v2",
"pallet-xcm",
"parachain-info",
"parity-scale-codec 3.2.1",
@@ -6870,6 +6871,24 @@
]
[[package]]
+name = "pallet-unique-scheduler-v2"
+version = "0.1.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "log",
+ "pallet-preimage",
+ "parity-scale-codec 3.2.1",
+ "scale-info",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "substrate-test-utils",
+]
+
+[[package]]
name = "pallet-utility"
version = "4.0.0-dev"
source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d"
pallets/scheduler-v2/Cargo.tomldiffbeforeafterboth--- /dev/null
+++ b/pallets/scheduler-v2/Cargo.toml
@@ -0,0 +1,48 @@
+[package]
+name = "pallet-unique-scheduler-v2"
+version = "0.1.0"
+authors = ["Unique Network <support@uniquenetwork.io>"]
+edition = "2021"
+license = "GPLv3"
+homepage = "https://unique.network"
+repository = "https://github.com/UniqueNetwork/unique-chain"
+description = "Unique Scheduler pallet"
+readme = "README.md"
+
+[dependencies]
+codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
+log = { version = "0.4.17", default-features = false }
+scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
+frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+
+[dev-dependencies]
+pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
+
+[features]
+default = ["std"]
+runtime-benchmarks = [
+ "frame-benchmarking",
+ "frame-support/runtime-benchmarks",
+ "frame-system/runtime-benchmarks",
+]
+std = [
+ "codec/std",
+ "frame-benchmarking?/std",
+ "frame-support/std",
+ "frame-system/std",
+ "log/std",
+ "scale-info/std",
+ "sp-io/std",
+ "sp-runtime/std",
+ "sp-std/std",
+ "sp-core/std",
+]
+try-runtime = ["frame-support/try-runtime"]
pallets/scheduler-v2/src/lib.rsdiffbeforeafterbothno content
pallets/scheduler-v2/src/weights.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/scheduler-v2/src/weights.rs
@@ -0,0 +1,249 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+// Original license:
+// 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.
+
+//! Autogenerated weights for pallet_scheduler
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-10-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+
+// Executed Command:
+// /home/benchbot/cargo_target_dir/production/substrate
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --pallet=pallet_scheduler
+// --chain=dev
+// --output=./frame/scheduler/src/weights.rs
+// --template=./.maintain/frame-weight-template.hbs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for pallet_scheduler.
+pub trait WeightInfo {
+ fn service_agendas_base() -> Weight;
+ fn service_agenda_base(s: u32, ) -> Weight;
+ fn service_task_base() -> Weight;
+ fn service_task_fetched(s: u32, ) -> Weight;
+ fn service_task_named() -> Weight;
+ fn service_task_periodic() -> Weight;
+ fn execute_dispatch_signed() -> Weight;
+ fn execute_dispatch_unsigned() -> 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.
+pub struct SubstrateWeight<T>(PhantomData<T>);
+impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+ // Storage: Scheduler IncompleteSince (r:1 w:1)
+ fn service_agendas_base() -> Weight {
+ Weight::from_ref_time(4_992_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[0, 512]`.
+ fn service_agenda_base(s: u32, ) -> Weight {
+ Weight::from_ref_time(4_320_000 as u64)
+ // Standard Error: 619
+ .saturating_add(Weight::from_ref_time(336_713 as u64).saturating_mul(s as u64))
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ fn service_task_base() -> Weight {
+ Weight::from_ref_time(10_864_000 as u64)
+ }
+ // Storage: Preimage PreimageFor (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ /// The range of component `s` is `[128, 4194304]`.
+ fn service_task_fetched(s: u32, ) -> Weight {
+ Weight::from_ref_time(24_586_000 as u64)
+ // Standard Error: 1
+ .saturating_add(Weight::from_ref_time(1_138 as u64).saturating_mul(s as u64))
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Scheduler Lookup (r:0 w:1)
+ fn service_task_named() -> Weight {
+ Weight::from_ref_time(13_127_000 as u64)
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ fn service_task_periodic() -> Weight {
+ Weight::from_ref_time(11_053_000 as u64)
+ }
+ fn execute_dispatch_signed() -> Weight {
+ Weight::from_ref_time(4_158_000 as u64)
+ }
+ fn execute_dispatch_unsigned() -> Weight {
+ Weight::from_ref_time(4_104_000 as u64)
+ }
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[0, 511]`.
+ fn schedule(s: u32, ) -> Weight {
+ Weight::from_ref_time(20_074_000 as u64)
+ // Standard Error: 765
+ .saturating_add(Weight::from_ref_time(343_285 as u64).saturating_mul(s as u64))
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: Scheduler Lookup (r:0 w:1)
+ /// The range of component `s` is `[1, 512]`.
+ fn cancel(s: u32, ) -> Weight {
+ Weight::from_ref_time(21_509_000 as u64)
+ // Standard Error: 708
+ .saturating_add(Weight::from_ref_time(323_013 as u64).saturating_mul(s as u64))
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Scheduler Lookup (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[0, 511]`.
+ fn schedule_named(s: u32, ) -> Weight {
+ Weight::from_ref_time(22_427_000 as u64)
+ // Standard Error: 850
+ .saturating_add(Weight::from_ref_time(357_265 as u64).saturating_mul(s as u64))
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Scheduler Lookup (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[1, 512]`.
+ fn cancel_named(s: u32, ) -> Weight {
+ Weight::from_ref_time(22_875_000 as u64)
+ // Standard Error: 693
+ .saturating_add(Weight::from_ref_time(336_643 as u64).saturating_mul(s as u64))
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ // Storage: Scheduler IncompleteSince (r:1 w:1)
+ fn service_agendas_base() -> Weight {
+ Weight::from_ref_time(4_992_000 as u64)
+ .saturating_add(RocksDbWeight::get().reads(1 as u64))
+ .saturating_add(RocksDbWeight::get().writes(1 as u64))
+ }
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[0, 512]`.
+ fn service_agenda_base(s: u32, ) -> Weight {
+ Weight::from_ref_time(4_320_000 as u64)
+ // Standard Error: 619
+ .saturating_add(Weight::from_ref_time(336_713 as u64).saturating_mul(s as u64))
+ .saturating_add(RocksDbWeight::get().reads(1 as u64))
+ .saturating_add(RocksDbWeight::get().writes(1 as u64))
+ }
+ fn service_task_base() -> Weight {
+ Weight::from_ref_time(10_864_000 as u64)
+ }
+ // Storage: Preimage PreimageFor (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ /// The range of component `s` is `[128, 4194304]`.
+ fn service_task_fetched(s: u32, ) -> Weight {
+ Weight::from_ref_time(24_586_000 as u64)
+ // Standard Error: 1
+ .saturating_add(Weight::from_ref_time(1_138 as u64).saturating_mul(s as u64))
+ .saturating_add(RocksDbWeight::get().reads(2 as u64))
+ .saturating_add(RocksDbWeight::get().writes(2 as u64))
+ }
+ // Storage: Scheduler Lookup (r:0 w:1)
+ fn service_task_named() -> Weight {
+ Weight::from_ref_time(13_127_000 as u64)
+ .saturating_add(RocksDbWeight::get().writes(1 as u64))
+ }
+ fn service_task_periodic() -> Weight {
+ Weight::from_ref_time(11_053_000 as u64)
+ }
+ fn execute_dispatch_signed() -> Weight {
+ Weight::from_ref_time(4_158_000 as u64)
+ }
+ fn execute_dispatch_unsigned() -> Weight {
+ Weight::from_ref_time(4_104_000 as u64)
+ }
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[0, 511]`.
+ fn schedule(s: u32, ) -> Weight {
+ Weight::from_ref_time(20_074_000 as u64)
+ // Standard Error: 765
+ .saturating_add(Weight::from_ref_time(343_285 as u64).saturating_mul(s as u64))
+ .saturating_add(RocksDbWeight::get().reads(1 as u64))
+ .saturating_add(RocksDbWeight::get().writes(1 as u64))
+ }
+ // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: Scheduler Lookup (r:0 w:1)
+ /// The range of component `s` is `[1, 512]`.
+ fn cancel(s: u32, ) -> Weight {
+ Weight::from_ref_time(21_509_000 as u64)
+ // Standard Error: 708
+ .saturating_add(Weight::from_ref_time(323_013 as u64).saturating_mul(s as u64))
+ .saturating_add(RocksDbWeight::get().reads(1 as u64))
+ .saturating_add(RocksDbWeight::get().writes(2 as u64))
+ }
+ // Storage: Scheduler Lookup (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[0, 511]`.
+ fn schedule_named(s: u32, ) -> Weight {
+ Weight::from_ref_time(22_427_000 as u64)
+ // Standard Error: 850
+ .saturating_add(Weight::from_ref_time(357_265 as u64).saturating_mul(s as u64))
+ .saturating_add(RocksDbWeight::get().reads(2 as u64))
+ .saturating_add(RocksDbWeight::get().writes(2 as u64))
+ }
+ // Storage: Scheduler Lookup (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ /// The range of component `s` is `[1, 512]`.
+ fn cancel_named(s: u32, ) -> Weight {
+ Weight::from_ref_time(22_875_000 as u64)
+ // Standard Error: 693
+ .saturating_add(Weight::from_ref_time(336_643 as u64).saturating_mul(s as u64))
+ .saturating_add(RocksDbWeight::get().reads(2 as u64))
+ .saturating_add(RocksDbWeight::get().writes(2 as u64))
+ }
+}
runtime/common/config/pallets/scheduler.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/scheduler.rs
+++ b/runtime/common/config/pallets/scheduler.rs
@@ -86,3 +86,16 @@
type PreimageProvider = ();
type NoPreimagePostponement = NoPreimagePostponement;
}
+
+impl pallet_unique_scheduler_v2::Config for Runtime {
+ type Event = Event;
+ type Origin = Origin;
+ type PalletsOrigin = OriginCaller;
+ type Call = Call;
+ type MaximumWeight = MaximumSchedulerWeight;
+ type ScheduleOrigin = EnsureSignedOrRoot<AccountId>;
+ type OriginPrivilegeCmp = EqualOrRootOnly;
+ type MaxScheduledPerBlock = MaxScheduledPerBlock;
+ type WeightInfo = ();
+ type Preimages = ();
+}
runtime/common/construct_runtime/mod.rsdiffbeforeafterboth--- a/runtime/common/construct_runtime/mod.rs
+++ b/runtime/common/construct_runtime/mod.rs
@@ -97,6 +97,9 @@
Maintenance: pallet_maintenance::{Pallet, Call, Storage, Event<T>} = 154,
#[runtimes(opal)]
+ SchedulerV2: pallet_unique_scheduler_v2::{Pallet, Call, Storage, Event<T>} = 154,
+
+ #[runtimes(opal)]
TestUtils: pallet_test_utils = 255,
}
}
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -143,6 +143,7 @@
'pallet-proxy-rmrk-equip/std',
'pallet-unique/std',
'pallet-unique-scheduler/std',
+ 'pallet-unique-scheduler-v2/std',
'pallet-charge-transaction/std',
'up-data-structs/std',
'sp-api/std',
@@ -476,6 +477,7 @@
pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.30", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
+pallet-unique-scheduler-v2 = { path = '../../pallets/scheduler-v2', default-features = false }
pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }