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.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/scheduler-v2/src/lib.rs
@@ -0,0 +1,894 @@
+// 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) 2017-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.
+
+//! # Scheduler
+//! A Pallet for scheduling dispatches.
+//!
+//! - [`Config`]
+//! - [`Call`]
+//! - [`Pallet`]
+//!
+//! ## Overview
+//!
+//! This Pallet exposes capabilities for scheduling dispatches to occur at a
+//! specified block number or at a specified period. These scheduled dispatches
+//! may be named or anonymous and may be canceled.
+//!
+//! **NOTE:** The scheduled calls will be dispatched with the default filter
+//! for the origin: namely `frame_system::Config::BaseCallFilter` for all origin
+//! except root which will get no filter. And not the filter contained in origin
+//! use to call `fn schedule`.
+//!
+//! If a call is scheduled using proxy or whatever mecanism which adds filter,
+//! then those filter will not be used when dispatching the schedule call.
+//!
+//! ## Interface
+//!
+//! ### Dispatchable Functions
+//!
+//! * `schedule` - schedule a dispatch, which may be periodic, to occur at a specified block and
+//! with a specified priority.
+//! * `cancel` - cancel a scheduled dispatch, specified by block number and index.
+//! * `schedule_named` - augments the `schedule` interface with an additional `Vec<u8>` parameter
+//! that can be used for identification.
+//! * `cancel_named` - the named complement to the cancel function.
+
+// Ensure we're `no_std` when compiling for Wasm.
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg(feature = "runtime-benchmarks")]
+mod benchmarking;
+#[cfg(test)]
+mod mock;
+#[cfg(test)]
+mod tests;
+pub mod weights;
+
+use codec::{Codec, Decode, Encode, MaxEncodedLen};
+use frame_support::{
+ dispatch::{
+ DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, Parameter, RawOrigin,
+ },
+ ensure,
+ traits::{
+ schedule::{self, DispatchTime},
+ EnsureOrigin, Get, IsType, OriginTrait,
+ PalletInfoAccess, PrivilegeCmp, StorageVersion,
+ PreimageProvider, PreimageRecipient, ConstU32,
+ },
+ weights::Weight,
+};
+
+use frame_system::{self as system};
+use scale_info::TypeInfo;
+use sp_io::hashing::blake2_256;
+use sp_runtime::{
+ traits::{BadOrigin, One, Saturating, Zero, Hash},
+ BoundedVec, RuntimeDebug,
+};
+use sp_std::{borrow::Borrow, cmp::Ordering, marker::PhantomData, prelude::*};
+pub use weights::WeightInfo;
+
+pub use pallet::*;
+
+/// Just a simple index for naming period tasks.
+pub type PeriodicIndex = u32;
+/// The location of a scheduled task that can be used to remove it.
+pub type TaskAddress<BlockNumber> = (BlockNumber, u32);
+
+pub type EncodedCall = BoundedVec<u8, ConstU32<128>>;
+
+#[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
+#[scale_info(skip_type_params(T))]
+pub enum ScheduledCall<T: Config> {
+ Inline(EncodedCall),
+ PreimageLookup {
+ hash: T::Hash,
+ unbounded_len: u32,
+ },
+}
+
+impl<T: Config> ScheduledCall<T> {
+ pub fn new(call: <T as Config>::Call) -> Result<Self, DispatchError> {
+ let encoded = call.encode();
+ let len = encoded.len();
+
+ match EncodedCall::try_from(encoded.clone()) {
+ Ok(bounded) => Ok(Self::Inline(bounded)),
+ Err(_) => {
+ let hash = <T as system::Config>::Hashing::hash_of(&encoded);
+ <T as Config>::Preimages::note_preimage(encoded.try_into().map_err(|_| <Error<T>>::TooBigScheduledCall)?);
+
+ Ok(Self::PreimageLookup { hash, unbounded_len: len as u32 })
+ }
+ }
+ }
+
+ /// The maximum length of the lookup that is needed to peek `Self`.
+ pub fn lookup_len(&self) -> Option<u32> {
+ match self {
+ Self::Inline(..) => None,
+ Self::PreimageLookup { unbounded_len, .. } => Some(*unbounded_len),
+ }
+ }
+
+ fn decode(mut data: &[u8]) -> Result<<T as Config>::Call, DispatchError> {
+ <T as Config>::Call::decode(&mut data)
+ .map_err(|_| <Error<T>>::ScheduledCallCorrupted.into())
+ }
+}
+
+pub trait SchedulerPreimages<T: Config>: PreimageRecipient<T::Hash> {
+ fn drop(call: &ScheduledCall<T>);
+
+ fn peek(call: &ScheduledCall<T>) -> Result<(<T as pallet::Config>::Call, Option<u32>), DispatchError>;
+}
+
+impl<T: Config, PP: PreimageRecipient<T::Hash>> SchedulerPreimages<T> for PP {
+ fn drop(call: &ScheduledCall<T>) {
+ match call {
+ ScheduledCall::Inline(_) => {},
+ ScheduledCall::PreimageLookup { hash, .. } => Self::unrequest_preimage(hash),
+ }
+ }
+
+ fn peek(call: &ScheduledCall<T>) -> Result<(<T as pallet::Config>::Call, Option<u32>), DispatchError> {
+ match call {
+ ScheduledCall::Inline(data) => Ok((ScheduledCall::<T>::decode(data)?, None)),
+ ScheduledCall::PreimageLookup { hash, unbounded_len } => {
+ let (preimage, len) = Self::get_preimage(hash)
+ .ok_or(<Error<T>>::PreimageNotFound)
+ .map(|preimage| (preimage, *unbounded_len))?;
+
+ Ok((ScheduledCall::<T>::decode(preimage.as_slice())?, Some(len)))
+ },
+ }
+ }
+}
+
+pub type TaskName = [u8; 32];
+
+/// Information regarding an item to be executed in the future.
+#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))]
+#[derive(Clone, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)]
+pub struct Scheduled<Name, Call, BlockNumber, PalletsOrigin, AccountId> {
+ /// The unique identity for this task, if there is one.
+ maybe_id: Option<Name>,
+
+ /// This task's priority.
+ priority: schedule::Priority,
+
+ /// The call to be dispatched.
+ call: Call,
+
+ /// If the call is periodic, then this points to the information concerning that.
+ maybe_periodic: Option<schedule::Period<BlockNumber>>,
+
+ /// The origin with which to dispatch the call.
+ origin: PalletsOrigin,
+ _phantom: PhantomData<AccountId>,
+}
+
+pub type ScheduledOf<T> = Scheduled<
+ TaskName,
+ ScheduledCall<T>,
+ <T as frame_system::Config>::BlockNumber,
+ <T as Config>::PalletsOrigin,
+ <T as frame_system::Config>::AccountId,
+>;
+
+struct WeightCounter {
+ used: Weight,
+ limit: Weight,
+}
+
+impl WeightCounter {
+ fn check_accrue(&mut self, w: Weight) -> bool {
+ let test = self.used.saturating_add(w);
+ if test > self.limit {
+ false
+ } else {
+ self.used = test;
+ true
+ }
+ }
+
+ fn can_accrue(&mut self, w: Weight) -> bool {
+ self.used.saturating_add(w) <= self.limit
+ }
+}
+
+pub(crate) trait MarginalWeightInfo: WeightInfo {
+ fn service_task(maybe_lookup_len: Option<usize>, named: bool, periodic: bool) -> Weight {
+ let base = Self::service_task_base();
+ let mut total = match maybe_lookup_len {
+ None => base,
+ Some(l) => Self::service_task_fetched(l as u32),
+ };
+ if named {
+ total.saturating_accrue(Self::service_task_named().saturating_sub(base));
+ }
+ if periodic {
+ total.saturating_accrue(Self::service_task_periodic().saturating_sub(base));
+ }
+ total
+ }
+}
+
+impl<T: WeightInfo> MarginalWeightInfo for T {}
+
+#[frame_support::pallet]
+pub mod pallet {
+ use super::*;
+ use frame_support::{dispatch::PostDispatchInfo, pallet_prelude::*};
+ use system::pallet_prelude::*;
+
+ /// The current storage version.
+ const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);
+
+ #[pallet::pallet]
+ #[pallet::generate_store(pub(super) trait Store)]
+ #[pallet::storage_version(STORAGE_VERSION)]
+ pub struct Pallet<T>(_);
+
+ #[pallet::config]
+ pub trait Config: frame_system::Config {
+ type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
+
+ /// The aggregated origin which the dispatch will take.
+ type Origin: OriginTrait<PalletsOrigin = Self::PalletsOrigin>
+ + From<Self::PalletsOrigin>
+ + IsType<<Self as system::Config>::Origin>
+ + Clone;
+
+ /// The caller origin, overarching type of all pallets origins.
+ type PalletsOrigin: From<system::RawOrigin<Self::AccountId>>
+ + Codec
+ + Clone
+ + Eq
+ + TypeInfo
+ + MaxEncodedLen;
+
+ /// The aggregated call type.
+ type Call: Parameter
+ + Dispatchable<
+ Origin = <Self as Config>::Origin,
+ PostInfo = PostDispatchInfo,
+ > + GetDispatchInfo
+ + From<system::Call<Self>>;
+
+ /// The maximum weight that may be scheduled per block for any dispatchables.
+ #[pallet::constant]
+ type MaximumWeight: Get<Weight>;
+
+ /// Required origin to schedule or cancel calls.
+ type ScheduleOrigin: EnsureOrigin<<Self as system::Config>::Origin>;
+
+ /// Compare the privileges of origins.
+ ///
+ /// This will be used when canceling a task, to ensure that the origin that tries
+ /// to cancel has greater or equal privileges as the origin that created the scheduled task.
+ ///
+ /// For simplicity the [`EqualPrivilegeOnly`](frame_support::traits::EqualPrivilegeOnly) can
+ /// be used. This will only check if two given origins are equal.
+ type OriginPrivilegeCmp: PrivilegeCmp<Self::PalletsOrigin>;
+
+ /// The maximum number of scheduled calls in the queue for a single block.
+ #[pallet::constant]
+ type MaxScheduledPerBlock: Get<u32>;
+
+ /// Weight information for extrinsics in this pallet.
+ type WeightInfo: WeightInfo;
+
+ /// The preimage provider with which we look up call hashes to get the call.
+ type Preimages: SchedulerPreimages<Self>;
+ }
+
+ #[pallet::storage]
+ pub type IncompleteSince<T: Config> = StorageValue<_, T::BlockNumber>;
+
+ /// Items to be executed, indexed by the block number that they should be executed on.
+ #[pallet::storage]
+ pub type Agenda<T: Config> = StorageMap<
+ _,
+ Twox64Concat,
+ T::BlockNumber,
+ BoundedVec<Option<ScheduledOf<T>>, T::MaxScheduledPerBlock>,
+ ValueQuery,
+ >;
+
+ /// Lookup from a name to the block number and index of the task.
+ #[pallet::storage]
+ pub(crate) type Lookup<T: Config> =
+ StorageMap<_, Twox64Concat, TaskName, TaskAddress<T::BlockNumber>>;
+
+ /// Events type.
+ #[pallet::event]
+ #[pallet::generate_deposit(pub(super) fn deposit_event)]
+ pub enum Event<T: Config> {
+ /// Scheduled some task.
+ Scheduled { when: T::BlockNumber, index: u32 },
+ /// Canceled some task.
+ Canceled { when: T::BlockNumber, index: u32 },
+ /// Dispatched some task.
+ Dispatched {
+ task: TaskAddress<T::BlockNumber>,
+ id: Option<[u8; 32]>,
+ result: DispatchResult,
+ },
+ /// The call for the provided hash was not found so the task has been aborted.
+ CallUnavailable { task: TaskAddress<T::BlockNumber>, id: Option<[u8; 32]> },
+ /// The given task was unable to be renewed since the agenda is full at that block.
+ PeriodicFailed { task: TaskAddress<T::BlockNumber>, id: Option<[u8; 32]> },
+ /// The given task can never be executed since it is overweight.
+ PermanentlyOverweight { task: TaskAddress<T::BlockNumber>, id: Option<[u8; 32]> },
+ }
+
+ #[pallet::error]
+ pub enum Error<T> {
+ /// Failed to schedule a call
+ FailedToSchedule,
+ /// There is no place for a new task in the agenda
+ AgendaIsExhausted,
+ /// Scheduled call is corrupted
+ ScheduledCallCorrupted,
+ /// Scheduled call preimage is not found
+ PreimageNotFound,
+ /// Scheduled call is too big
+ TooBigScheduledCall,
+ /// Cannot find the scheduled call.
+ NotFound,
+ /// Given target block number is in the past.
+ TargetBlockNumberInPast,
+ /// Reschedule failed because it does not change scheduled time.
+ RescheduleNoChange,
+ /// Attempt to use a non-named function on a named task.
+ Named,
+ }
+
+ #[pallet::hooks]
+ impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
+ /// Execute the scheduled calls
+ fn on_initialize(now: T::BlockNumber) -> Weight {
+ let mut weight_counter =
+ WeightCounter { used: Weight::zero(), limit: T::MaximumWeight::get() };
+ Self::service_agendas(&mut weight_counter, now, u32::max_value());
+ weight_counter.used
+ }
+ }
+
+ #[pallet::call]
+ impl<T: Config> Pallet<T> {
+ /// Anonymously schedule a task.
+ #[pallet::weight(<T as Config>::WeightInfo::schedule(T::MaxScheduledPerBlock::get()))]
+ pub fn schedule(
+ origin: OriginFor<T>,
+ when: T::BlockNumber,
+ maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
+ priority: schedule::Priority,
+ call: Box<<T as Config>::Call>,
+ ) -> DispatchResult {
+ T::ScheduleOrigin::ensure_origin(origin.clone())?;
+ let origin = <T as Config>::Origin::from(origin);
+ Self::do_schedule(
+ DispatchTime::At(when),
+ maybe_periodic,
+ priority,
+ origin.caller().clone(),
+ <ScheduledCall<T>>::new(*call)?,
+ )?;
+ Ok(())
+ }
+
+ /// Cancel an anonymously scheduled task.
+ #[pallet::weight(<T as Config>::WeightInfo::cancel(T::MaxScheduledPerBlock::get()))]
+ pub fn cancel(origin: OriginFor<T>, when: T::BlockNumber, index: u32) -> DispatchResult {
+ T::ScheduleOrigin::ensure_origin(origin.clone())?;
+ let origin = <T as Config>::Origin::from(origin);
+ Self::do_cancel(Some(origin.caller().clone()), (when, index))?;
+ Ok(())
+ }
+
+ /// Schedule a named task.
+ #[pallet::weight(<T as Config>::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get()))]
+ pub fn schedule_named(
+ origin: OriginFor<T>,
+ id: TaskName,
+ when: T::BlockNumber,
+ maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
+ priority: schedule::Priority,
+ call: Box<<T as Config>::Call>,
+ ) -> DispatchResult {
+ T::ScheduleOrigin::ensure_origin(origin.clone())?;
+ let origin = <T as Config>::Origin::from(origin);
+ Self::do_schedule_named(
+ id,
+ DispatchTime::At(when),
+ maybe_periodic,
+ priority,
+ origin.caller().clone(),
+ <ScheduledCall<T>>::new(*call)?,
+ )?;
+ Ok(())
+ }
+
+ /// Cancel a named scheduled task.
+ #[pallet::weight(<T as Config>::WeightInfo::cancel_named(T::MaxScheduledPerBlock::get()))]
+ pub fn cancel_named(origin: OriginFor<T>, id: TaskName) -> DispatchResult {
+ T::ScheduleOrigin::ensure_origin(origin.clone())?;
+ let origin = <T as Config>::Origin::from(origin);
+ Self::do_cancel_named(Some(origin.caller().clone()), id)?;
+ Ok(())
+ }
+
+ /// Anonymously schedule a task after a delay.
+ ///
+ /// # <weight>
+ /// Same as [`schedule`].
+ /// # </weight>
+ #[pallet::weight(<T as Config>::WeightInfo::schedule(T::MaxScheduledPerBlock::get()))]
+ pub fn schedule_after(
+ origin: OriginFor<T>,
+ after: T::BlockNumber,
+ maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
+ priority: schedule::Priority,
+ call: Box<<T as Config>::Call>,
+ ) -> DispatchResult {
+ T::ScheduleOrigin::ensure_origin(origin.clone())?;
+ let origin = <T as Config>::Origin::from(origin);
+ Self::do_schedule(
+ DispatchTime::After(after),
+ maybe_periodic,
+ priority,
+ origin.caller().clone(),
+ <ScheduledCall<T>>::new(*call)?,
+ )?;
+ Ok(())
+ }
+
+ /// Schedule a named task after a delay.
+ ///
+ /// # <weight>
+ /// Same as [`schedule_named`](Self::schedule_named).
+ /// # </weight>
+ #[pallet::weight(<T as Config>::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get()))]
+ pub fn schedule_named_after(
+ origin: OriginFor<T>,
+ id: TaskName,
+ after: T::BlockNumber,
+ maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
+ priority: schedule::Priority,
+ call: Box<<T as Config>::Call>,
+ ) -> DispatchResult {
+ T::ScheduleOrigin::ensure_origin(origin.clone())?;
+ let origin = <T as Config>::Origin::from(origin);
+ Self::do_schedule_named(
+ id,
+ DispatchTime::After(after),
+ maybe_periodic,
+ priority,
+ origin.caller().clone(),
+ <ScheduledCall<T>>::new(*call)?,
+ )?;
+ Ok(())
+ }
+ }
+}
+
+impl<T: Config> Pallet<T> {
+ fn resolve_time(when: DispatchTime<T::BlockNumber>) -> Result<T::BlockNumber, DispatchError> {
+ let now = frame_system::Pallet::<T>::block_number();
+
+ let when = match when {
+ DispatchTime::At(x) => x,
+ // The current block has already completed it's scheduled tasks, so
+ // Schedule the task at lest one block after this current block.
+ DispatchTime::After(x) => now.saturating_add(x).saturating_add(One::one()),
+ };
+
+ if when <= now {
+ return Err(Error::<T>::TargetBlockNumberInPast.into())
+ }
+
+ Ok(when)
+ }
+
+ fn place_task(
+ when: T::BlockNumber,
+ what: ScheduledOf<T>,
+ ) -> Result<TaskAddress<T::BlockNumber>, (DispatchError, ScheduledOf<T>)> {
+ let maybe_name = what.maybe_id;
+ let index = Self::push_to_agenda(when, what)?;
+ let address = (when, index);
+ if let Some(name) = maybe_name {
+ Lookup::<T>::insert(name, address)
+ }
+ Self::deposit_event(Event::Scheduled { when: address.0, index: address.1 });
+ Ok(address)
+ }
+
+ fn push_to_agenda(
+ when: T::BlockNumber,
+ what: ScheduledOf<T>,
+ ) -> Result<u32, (DispatchError, ScheduledOf<T>)> {
+ let mut agenda = Agenda::<T>::get(when);
+ let index = if (agenda.len() as u32) < T::MaxScheduledPerBlock::get() {
+ // will always succeed due to the above check.
+ let _ = agenda.try_push(Some(what));
+ agenda.len() as u32 - 1
+ } else {
+ if let Some(hole_index) = agenda.iter().position(|i| i.is_none()) {
+ agenda[hole_index] = Some(what);
+ hole_index as u32
+ } else {
+ return Err((<Error<T>>::AgendaIsExhausted.into(), what))
+ }
+ };
+ Agenda::<T>::insert(when, agenda);
+ Ok(index)
+ }
+
+ fn do_schedule(
+ when: DispatchTime<T::BlockNumber>,
+ maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
+ priority: schedule::Priority,
+ origin: T::PalletsOrigin,
+ call: ScheduledCall<T>,
+ ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
+ let when = Self::resolve_time(when)?;
+
+ // 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 task = Scheduled {
+ maybe_id: None,
+ priority,
+ call,
+ maybe_periodic,
+ origin,
+ _phantom: PhantomData,
+ };
+ Self::place_task(when, task).map_err(|x| x.0)
+ }
+
+ 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 {
+ T::Preimages::drop(&s.call);
+
+ if let Some(id) = s.maybe_id {
+ Lookup::<T>::remove(id);
+ }
+ Self::deposit_event(Event::Canceled { when, index });
+ Ok(())
+ } else {
+ return Err(Error::<T>::NotFound.into())
+ }
+ }
+
+ fn do_schedule_named(
+ id: TaskName,
+ when: DispatchTime<T::BlockNumber>,
+ maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
+ priority: schedule::Priority,
+ origin: T::PalletsOrigin,
+ call: ScheduledCall<T>,
+ ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
+ // ensure id it is unique
+ if Lookup::<T>::contains_key(&id) {
+ return Err(Error::<T>::FailedToSchedule.into())
+ }
+
+ let when = Self::resolve_time(when)?;
+
+ // 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 task = Scheduled {
+ maybe_id: Some(id),
+ priority,
+ call,
+ maybe_periodic,
+ origin,
+ _phantom: Default::default(),
+ };
+ Self::place_task(when, task).map_err(|x| x.0)
+ }
+
+ fn do_cancel_named(origin: Option<T::PalletsOrigin>, id: TaskName) -> DispatchResult {
+ Lookup::<T>::try_mutate_exists(id, |lookup| -> DispatchResult {
+ if let Some((when, index)) = lookup.take() {
+ let i = index as usize;
+ Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {
+ if let Some(s) = agenda.get_mut(i) {
+ 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())
+ }
+ T::Preimages::drop(&s.call);
+ }
+ *s = None;
+ }
+ Ok(())
+ })?;
+ Self::deposit_event(Event::Canceled { when, index });
+ Ok(())
+ } else {
+ return Err(Error::<T>::NotFound.into())
+ }
+ })
+ }
+}
+
+enum ServiceTaskError {
+ /// Could not be executed due to missing preimage.
+ Unavailable,
+ /// Could not be executed due to weight limitations.
+ Overweight,
+}
+use ServiceTaskError::*;
+
+impl<T: Config> Pallet<T> {
+ /// Service up to `max` agendas queue starting from earliest incompletely executed agenda.
+ fn service_agendas(weight: &mut WeightCounter, now: T::BlockNumber, max: u32) {
+ if !weight.check_accrue(T::WeightInfo::service_agendas_base()) {
+ return
+ }
+
+ let mut incomplete_since = now + One::one();
+ let mut when = IncompleteSince::<T>::take().unwrap_or(now);
+ let mut executed = 0;
+
+ let max_items = T::MaxScheduledPerBlock::get();
+ let mut count_down = max;
+ let service_agenda_base_weight = T::WeightInfo::service_agenda_base(max_items);
+ while count_down > 0 && when <= now && weight.can_accrue(service_agenda_base_weight) {
+ if !Self::service_agenda(weight, &mut executed, now, when, u32::max_value()) {
+ incomplete_since = incomplete_since.min(when);
+ }
+ when.saturating_inc();
+ count_down.saturating_dec();
+ }
+ incomplete_since = incomplete_since.min(when);
+ if incomplete_since <= now {
+ IncompleteSince::<T>::put(incomplete_since);
+ }
+ }
+
+ /// Returns `true` if the agenda was fully completed, `false` if it should be revisited at a
+ /// later block.
+ fn service_agenda(
+ weight: &mut WeightCounter,
+ executed: &mut u32,
+ now: T::BlockNumber,
+ when: T::BlockNumber,
+ max: u32,
+ ) -> bool {
+ let mut agenda = Agenda::<T>::get(when);
+ let mut ordered = agenda
+ .iter()
+ .enumerate()
+ .filter_map(|(index, maybe_item)| {
+ maybe_item.as_ref().map(|item| (index as u32, item.priority))
+ })
+ .collect::<Vec<_>>();
+ ordered.sort_by_key(|k| k.1);
+ let within_limit =
+ weight.check_accrue(T::WeightInfo::service_agenda_base(ordered.len() as u32));
+ debug_assert!(within_limit, "weight limit should have been checked in advance");
+
+ // Items which we know can be executed and have postponed for execution in a later block.
+ let mut postponed = (ordered.len() as u32).saturating_sub(max);
+ // Items which we don't know can ever be executed.
+ let mut dropped = 0;
+
+ for (agenda_index, _) in ordered.into_iter().take(max as usize) {
+ let task = match agenda[agenda_index as usize].take() {
+ None => continue,
+ Some(t) => t,
+ };
+ let base_weight = T::WeightInfo::service_task(
+ task.call.lookup_len().map(|x| x as usize),
+ task.maybe_id.is_some(),
+ task.maybe_periodic.is_some(),
+ );
+ if !weight.can_accrue(base_weight) {
+ postponed += 1;
+ break
+ }
+ let result = Self::service_task(weight, now, when, agenda_index, *executed == 0, task);
+ agenda[agenda_index as usize] = match result {
+ Err((Unavailable, slot)) => {
+ dropped += 1;
+ slot
+ },
+ Err((Overweight, slot)) => {
+ postponed += 1;
+ slot
+ },
+ Ok(()) => {
+ *executed += 1;
+ None
+ },
+ };
+ }
+ if postponed > 0 || dropped > 0 {
+ Agenda::<T>::insert(when, agenda);
+ } else {
+ Agenda::<T>::remove(when);
+ }
+ postponed == 0
+ }
+
+ /// Service (i.e. execute) the given task, being careful not to overflow the `weight` counter.
+ ///
+ /// This involves:
+ /// - removing and potentially replacing the `Lookup` entry for the task.
+ /// - realizing the task's call which can include a preimage lookup.
+ /// - Rescheduling the task for execution in a later agenda if periodic.
+ fn service_task(
+ weight: &mut WeightCounter,
+ now: T::BlockNumber,
+ when: T::BlockNumber,
+ agenda_index: u32,
+ is_first: bool,
+ mut task: ScheduledOf<T>,
+ ) -> Result<(), (ServiceTaskError, Option<ScheduledOf<T>>)> {
+ if let Some(ref id) = task.maybe_id {
+ Lookup::<T>::remove(id);
+ }
+
+ let (call, lookup_len) = match T::Preimages::peek(&task.call) {
+ Ok(c) => c,
+ Err(_) => return Err((Unavailable, Some(task))),
+ };
+
+ weight.check_accrue(T::WeightInfo::service_task(
+ lookup_len.map(|x| x as usize),
+ task.maybe_id.is_some(),
+ task.maybe_periodic.is_some(),
+ ));
+
+ match Self::execute_dispatch(weight, task.origin.clone(), call) {
+ Err(Unavailable) => {
+ debug_assert!(false, "Checked to exist with `peek`");
+ Self::deposit_event(Event::CallUnavailable {
+ task: (when, agenda_index),
+ id: task.maybe_id,
+ });
+ Err((Unavailable, Some(task)))
+ },
+ Err(Overweight) if is_first => {
+ T::Preimages::drop(&task.call);
+ Self::deposit_event(Event::PermanentlyOverweight {
+ task: (when, agenda_index),
+ id: task.maybe_id,
+ });
+ Err((Unavailable, Some(task)))
+ },
+ Err(Overweight) => Err((Overweight, Some(task))),
+ Ok(result) => {
+ Self::deposit_event(Event::Dispatched {
+ task: (when, agenda_index),
+ id: task.maybe_id,
+ result,
+ });
+ if let &Some((period, count)) = &task.maybe_periodic {
+ if count > 1 {
+ task.maybe_periodic = Some((period, count - 1));
+ } else {
+ task.maybe_periodic = None;
+ }
+ let wake = now.saturating_add(period);
+ match Self::place_task(wake, task) {
+ Ok(_) => {},
+ Err((_, task)) => {
+ // TODO: Leave task in storage somewhere for it to be rescheduled
+ // manually.
+ T::Preimages::drop(&task.call);
+ Self::deposit_event(Event::PeriodicFailed {
+ task: (when, agenda_index),
+ id: task.maybe_id,
+ });
+ },
+ }
+ } else {
+ T::Preimages::drop(&task.call);
+ }
+ Ok(())
+ },
+ }
+ }
+
+ /// Make a dispatch to the given `call` from the given `origin`, ensuring that the `weight`
+ /// counter does not exceed its limit and that it is counted accurately (e.g. accounted using
+ /// post info if available).
+ ///
+ /// NOTE: Only the weight for this function will be counted (origin lookup, dispatch and the
+ /// call itself).
+ fn execute_dispatch(
+ weight: &mut WeightCounter,
+ origin: T::PalletsOrigin,
+ call: <T as Config>::Call,
+ ) -> Result<DispatchResult, ServiceTaskError> {
+ let dispatch_origin: <T as Config>::Origin = origin.into();
+ let base_weight = match dispatch_origin.clone().as_signed() {
+ Some(_) => T::WeightInfo::execute_dispatch_signed(),
+ _ => T::WeightInfo::execute_dispatch_unsigned(),
+ };
+ let call_weight = call.get_dispatch_info().weight;
+ // We only allow a scheduled call if it cannot push the weight past the limit.
+ let max_weight = base_weight.saturating_add(call_weight);
+
+ if !weight.can_accrue(max_weight) {
+ return Err(Overweight)
+ }
+
+ let (maybe_actual_call_weight, result) = match call.dispatch(dispatch_origin) {
+ Ok(post_info) => (post_info.actual_weight, Ok(())),
+ Err(error_and_info) =>
+ (error_and_info.post_info.actual_weight, Err(error_and_info.error)),
+ };
+ let call_weight = maybe_actual_call_weight.unwrap_or(call_weight);
+ weight.check_accrue(base_weight);
+ weight.check_accrue(call_weight);
+ Ok(result)
+ }
+}
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.tomldiffbeforeafterboth1################################################################################2# Package34cargo-features = ["workspace-inheritance"]56[package]7authors = ['Unique Network <support@uniquenetwork.io>']8build = 'build.rs'9description = 'Opal Runtime'10edition = '2021'11homepage = 'https://unique.network'12license = 'GPLv3'13name = 'opal-runtime'14repository = 'https://github.com/UniqueNetwork/unique-chain'15version = "0.9.30"1617[package.metadata.docs.rs]18targets = ['x86_64-unknown-linux-gnu']1920[features]21default = ['std', 'opal-runtime']22runtime-benchmarks = [23 'hex-literal',24 'frame-benchmarking',25 'frame-support/runtime-benchmarks',26 'frame-system-benchmarking',27 'frame-system/runtime-benchmarks',28 'pallet-ethereum/runtime-benchmarks',29 'pallet-evm-migration/runtime-benchmarks',30 'pallet-evm-coder-substrate/runtime-benchmarks',31 'pallet-balances/runtime-benchmarks',32 'pallet-timestamp/runtime-benchmarks',33 'pallet-common/runtime-benchmarks',34 'pallet-structure/runtime-benchmarks',35 'pallet-fungible/runtime-benchmarks',36 'pallet-refungible/runtime-benchmarks',37 'pallet-nonfungible/runtime-benchmarks',38 'pallet-proxy-rmrk-core/runtime-benchmarks',39 'pallet-proxy-rmrk-equip/runtime-benchmarks',40 'pallet-foreign-assets/runtime-benchmarks',41 'pallet-unique/runtime-benchmarks',42 'pallet-inflation/runtime-benchmarks',43 'pallet-app-promotion/runtime-benchmarks',44 'pallet-unique-scheduler/runtime-benchmarks',45 'pallet-xcm/runtime-benchmarks',46 'sp-runtime/runtime-benchmarks',47 'xcm-builder/runtime-benchmarks',48 'pallet-maintenance/runtime-benchmarks',49]50try-runtime = [51 'frame-try-runtime',52 'frame-executive/try-runtime',53 'frame-support/try-runtime',54 'frame-system/try-runtime',55 'cumulus-pallet-parachain-system/try-runtime',56 'parachain-info/try-runtime',57 'pallet-aura/try-runtime',58 'cumulus-pallet-aura-ext/try-runtime',59 'pallet-balances/try-runtime',60 'pallet-randomness-collective-flip/try-runtime',61 'pallet-timestamp/try-runtime',62 'pallet-transaction-payment/try-runtime',63 'pallet-treasury/try-runtime',64 'pallet-sudo/try-runtime',65 'orml-vesting/try-runtime',66 'orml-xtokens/try-runtime',67 'orml-tokens/try-runtime',68 'cumulus-pallet-xcmp-queue/try-runtime',69 'pallet-xcm/try-runtime',70 'cumulus-pallet-xcm/try-runtime',71 'cumulus-pallet-dmp-queue/try-runtime',72 'pallet-inflation/try-runtime',73 'pallet-unique/try-runtime',74 'pallet-unique-scheduler/try-runtime',75 'pallet-configuration/try-runtime',76 'pallet-charge-transaction/try-runtime',77 'pallet-common/try-runtime',78 'pallet-fungible/try-runtime',79 'pallet-refungible/try-runtime',80 'pallet-nonfungible/try-runtime',81 'pallet-structure/try-runtime',82 'pallet-proxy-rmrk-core/try-runtime',83 'pallet-proxy-rmrk-equip/try-runtime',84 'pallet-app-promotion/try-runtime',85 'pallet-foreign-assets/try-runtime',86 'pallet-evm/try-runtime',87 'pallet-ethereum/try-runtime',88 'pallet-evm-coder-substrate/try-runtime',89 'pallet-evm-contract-helpers/try-runtime',90 'pallet-evm-transaction-payment/try-runtime',91 'pallet-evm-migration/try-runtime',92 'pallet-maintenance/try-runtime',93 'pallet-test-utils?/try-runtime',94]95std = [96 'codec/std',97 'cumulus-pallet-aura-ext/std',98 'cumulus-pallet-parachain-system/std',99 'cumulus-pallet-xcm/std',100 'cumulus-pallet-xcmp-queue/std',101 'cumulus-primitives-core/std',102 'cumulus-primitives-utility/std',103 'frame-try-runtime/std',104 'frame-executive/std',105 'frame-support/std',106 'frame-system/std',107 'frame-system-rpc-runtime-api/std',108 'pallet-aura/std',109 'pallet-balances/std',110 # 'pallet-contracts/std',111 # 'pallet-contracts-primitives/std',112 # 'pallet-contracts-rpc-runtime-api/std',113 # 'pallet-contract-helpers/std',114 'pallet-randomness-collective-flip/std',115 'pallet-sudo/std',116 'pallet-timestamp/std',117 'pallet-transaction-payment/std',118 'pallet-transaction-payment-rpc-runtime-api/std',119 'pallet-treasury/std',120 'pallet-evm/std',121 'pallet-evm-migration/std',122 'pallet-evm-contract-helpers/std',123 'pallet-evm-transaction-payment/std',124 'pallet-evm-coder-substrate/std',125 'pallet-ethereum/std',126 'pallet-base-fee/std',127 'fp-rpc/std',128 'up-rpc/std',129 'app-promotion-rpc/std',130 'fp-evm-mapping/std',131 'fp-self-contained/std',132 'parachain-info/std',133 'serde',134 'pallet-inflation/std',135 'pallet-configuration/std',136 'pallet-app-promotion/std',137 'pallet-common/std',138 'pallet-structure/std',139 'pallet-fungible/std',140 'pallet-refungible/std',141 'pallet-nonfungible/std',142 'pallet-proxy-rmrk-core/std',143 'pallet-proxy-rmrk-equip/std',144 'pallet-unique/std',145 'pallet-unique-scheduler/std',146 'pallet-charge-transaction/std',147 'up-data-structs/std',148 'sp-api/std',149 'sp-block-builder/std',150 "sp-consensus-aura/std",151 'sp-core/std',152 'sp-inherents/std',153 'sp-io/std',154 'sp-offchain/std',155 'sp-runtime/std',156 'sp-session/std',157 'sp-std/std',158 'sp-transaction-pool/std',159 'sp-version/std',160 'xcm/std',161 'xcm-builder/std',162 'xcm-executor/std',163 'up-common/std',164 'rmrk-rpc/std',165 'evm-coder/std',166 'up-sponsorship/std',167168 "orml-vesting/std",169 "orml-tokens/std",170 "orml-xtokens/std",171 "orml-traits/std",172 "pallet-foreign-assets/std",173174 'pallet-maintenance/std',175 'pallet-test-utils?/std',176]177limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']178opal-runtime = ['refungible', 'scheduler', 'rmrk', 'app-promotion', 'foreign-assets', 'pallet-test-utils']179180refungible = []181scheduler = []182rmrk = []183foreign-assets = []184app-promotion = []185186################################################################################187# Substrate Dependencies188189[dependencies.codec]190default-features = false191features = ['derive']192package = 'parity-scale-codec'193version = '3.1.2'194195[dependencies.frame-benchmarking]196default-features = false197git = "https://github.com/paritytech/substrate"198optional = true199branch = "polkadot-v0.9.30"200201[dependencies.frame-try-runtime]202default-features = false203git = "https://github.com/paritytech/substrate"204optional = true205branch = "polkadot-v0.9.30"206207[dependencies.frame-executive]208default-features = false209git = "https://github.com/paritytech/substrate"210branch = "polkadot-v0.9.30"211212[dependencies.frame-support]213default-features = false214git = "https://github.com/paritytech/substrate"215branch = "polkadot-v0.9.30"216217[dependencies.frame-system]218default-features = false219git = "https://github.com/paritytech/substrate"220branch = "polkadot-v0.9.30"221222[dependencies.frame-system-benchmarking]223default-features = false224git = "https://github.com/paritytech/substrate"225optional = true226branch = "polkadot-v0.9.30"227228[dependencies.frame-system-rpc-runtime-api]229default-features = false230git = "https://github.com/paritytech/substrate"231branch = "polkadot-v0.9.30"232233[dependencies.hex-literal]234optional = true235version = '0.3.3'236237[dependencies.serde]238default-features = false239features = ['derive']240optional = true241version = '1.0.130'242243[dependencies.pallet-aura]244default-features = false245git = "https://github.com/paritytech/substrate"246branch = "polkadot-v0.9.30"247248[dependencies.pallet-balances]249default-features = false250git = "https://github.com/paritytech/substrate"251branch = "polkadot-v0.9.30"252253# Contracts specific packages254# [dependencies.pallet-contracts]255# git = 'https://github.com/paritytech/substrate'256# default-features = false257# branch = 'master'258# version = '4.0.0-dev'259260# [dependencies.pallet-contracts-primitives]261# git = 'https://github.com/paritytech/substrate'262# default-features = false263# branch = 'master'264# version = '4.0.0-dev'265266# [dependencies.pallet-contracts-rpc-runtime-api]267# git = 'https://github.com/paritytech/substrate'268# default-features = false269# branch = 'master'270# version = '4.0.0-dev'271272[dependencies.pallet-randomness-collective-flip]273default-features = false274git = "https://github.com/paritytech/substrate"275branch = "polkadot-v0.9.30"276277[dependencies.pallet-sudo]278default-features = false279git = "https://github.com/paritytech/substrate"280branch = "polkadot-v0.9.30"281282[dependencies.pallet-timestamp]283default-features = false284git = "https://github.com/paritytech/substrate"285branch = "polkadot-v0.9.30"286287[dependencies.pallet-transaction-payment]288default-features = false289git = "https://github.com/paritytech/substrate"290branch = "polkadot-v0.9.30"291292[dependencies.pallet-transaction-payment-rpc-runtime-api]293default-features = false294git = "https://github.com/paritytech/substrate"295branch = "polkadot-v0.9.30"296297[dependencies.pallet-treasury]298default-features = false299git = "https://github.com/paritytech/substrate"300branch = "polkadot-v0.9.30"301302[dependencies.sp-arithmetic]303default-features = false304git = "https://github.com/paritytech/substrate"305branch = "polkadot-v0.9.30"306307[dependencies.sp-api]308default-features = false309git = "https://github.com/paritytech/substrate"310branch = "polkadot-v0.9.30"311312[dependencies.sp-block-builder]313default-features = false314git = "https://github.com/paritytech/substrate"315branch = "polkadot-v0.9.30"316317[dependencies.sp-core]318default-features = false319git = "https://github.com/paritytech/substrate"320branch = "polkadot-v0.9.30"321322[dependencies.sp-consensus-aura]323default-features = false324git = "https://github.com/paritytech/substrate"325branch = "polkadot-v0.9.30"326327[dependencies.sp-inherents]328default-features = false329git = "https://github.com/paritytech/substrate"330branch = "polkadot-v0.9.30"331332[dependencies.sp-io]333default-features = false334git = "https://github.com/paritytech/substrate"335branch = "polkadot-v0.9.30"336337[dependencies.sp-offchain]338default-features = false339git = "https://github.com/paritytech/substrate"340branch = "polkadot-v0.9.30"341342[dependencies.sp-runtime]343default-features = false344git = "https://github.com/paritytech/substrate"345branch = "polkadot-v0.9.30"346347[dependencies.sp-session]348default-features = false349git = "https://github.com/paritytech/substrate"350branch = "polkadot-v0.9.30"351352[dependencies.sp-std]353default-features = false354git = "https://github.com/paritytech/substrate"355branch = "polkadot-v0.9.30"356357[dependencies.sp-transaction-pool]358default-features = false359git = "https://github.com/paritytech/substrate"360branch = "polkadot-v0.9.30"361362[dependencies.sp-version]363default-features = false364git = "https://github.com/paritytech/substrate"365branch = "polkadot-v0.9.30"366367[dependencies.smallvec]368version = '1.6.1'369370################################################################################371# Cumulus dependencies372373[dependencies.parachain-info]374default-features = false375git = "https://github.com/paritytech/cumulus"376branch = "polkadot-v0.9.30"377378[dependencies.cumulus-pallet-aura-ext]379git = "https://github.com/paritytech/cumulus"380branch = "polkadot-v0.9.30"381default-features = false382383[dependencies.cumulus-pallet-parachain-system]384git = "https://github.com/paritytech/cumulus"385branch = "polkadot-v0.9.30"386default-features = false387388[dependencies.cumulus-primitives-core]389git = "https://github.com/paritytech/cumulus"390branch = "polkadot-v0.9.30"391default-features = false392393[dependencies.cumulus-pallet-xcm]394git = "https://github.com/paritytech/cumulus"395branch = "polkadot-v0.9.30"396default-features = false397398[dependencies.cumulus-pallet-dmp-queue]399git = "https://github.com/paritytech/cumulus"400branch = "polkadot-v0.9.30"401default-features = false402403[dependencies.cumulus-pallet-xcmp-queue]404git = "https://github.com/paritytech/cumulus"405branch = "polkadot-v0.9.30"406default-features = false407408[dependencies.cumulus-primitives-utility]409git = "https://github.com/paritytech/cumulus"410branch = "polkadot-v0.9.30"411default-features = false412413[dependencies.cumulus-primitives-timestamp]414git = "https://github.com/paritytech/cumulus"415branch = "polkadot-v0.9.30"416default-features = false417418################################################################################419# Polkadot dependencies420421[dependencies.polkadot-parachain]422git = "https://github.com/paritytech/polkadot"423branch = "release-v0.9.30"424default-features = false425426[dependencies.xcm]427git = "https://github.com/paritytech/polkadot"428branch = "release-v0.9.30"429default-features = false430431[dependencies.xcm-builder]432git = "https://github.com/paritytech/polkadot"433branch = "release-v0.9.30"434default-features = false435436[dependencies.xcm-executor]437git = "https://github.com/paritytech/polkadot"438branch = "release-v0.9.30"439default-features = false440441[dependencies.pallet-xcm]442git = "https://github.com/paritytech/polkadot"443branch = "release-v0.9.30"444default-features = false445446################################################################################447# local dependencies448449[dependencies]450orml-vesting.workspace = true451orml-xtokens.workspace = true452orml-tokens.workspace = true453orml-traits.workspace = true454455log = { version = "0.4.16", default-features = false }456up-common = { path = "../../primitives/common", default-features = false }457scale-info = { version = "2.0.1", default-features = false, features = [458 "derive",459] }460derivative = "2.2.0"461pallet-unique = { path = '../../pallets/unique', default-features = false }462up-rpc = { path = "../../primitives/rpc", default-features = false }463app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }464rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }465fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }466pallet-inflation = { path = '../../pallets/inflation', default-features = false }467pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }468up-data-structs = { path = '../../primitives/data-structs', default-features = false }469pallet-configuration = { default-features = false, path = "../../pallets/configuration" }470pallet-common = { default-features = false, path = "../../pallets/common" }471pallet-structure = { default-features = false, path = "../../pallets/structure" }472pallet-fungible = { default-features = false, path = "../../pallets/fungible" }473pallet-refungible = { default-features = false, path = "../../pallets/refungible" }474pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }475pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }476pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }477pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }478pallet-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" }479pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }480pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }481pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }482pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }483pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }484pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }485pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }486fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }487fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }488evm-coder = { default-features = false, path = '../../crates/evm-coder' }489up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.30' }490pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }491pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }492493################################################################################494# Test dependencies495496pallet-test-utils = { optional = true, default-features = false, path = "../../test-pallets/utils" }497498################################################################################499# Other Dependencies500501impl-trait-for-tuples = "0.2.2"502503################################################################################504# Dev Dependencies505506[dev-dependencies.logtest]507version = "2.0.0"508509################################################################################510# Build Dependencies511512[build-dependencies.substrate-wasm-builder]513git = "https://github.com/paritytech/substrate"514branch = "polkadot-v0.9.30"1################################################################################2# Package34cargo-features = ["workspace-inheritance"]56[package]7authors = ['Unique Network <support@uniquenetwork.io>']8build = 'build.rs'9description = 'Opal Runtime'10edition = '2021'11homepage = 'https://unique.network'12license = 'GPLv3'13name = 'opal-runtime'14repository = 'https://github.com/UniqueNetwork/unique-chain'15version = "0.9.30"1617[package.metadata.docs.rs]18targets = ['x86_64-unknown-linux-gnu']1920[features]21default = ['std', 'opal-runtime']22runtime-benchmarks = [23 'hex-literal',24 'frame-benchmarking',25 'frame-support/runtime-benchmarks',26 'frame-system-benchmarking',27 'frame-system/runtime-benchmarks',28 'pallet-ethereum/runtime-benchmarks',29 'pallet-evm-migration/runtime-benchmarks',30 'pallet-evm-coder-substrate/runtime-benchmarks',31 'pallet-balances/runtime-benchmarks',32 'pallet-timestamp/runtime-benchmarks',33 'pallet-common/runtime-benchmarks',34 'pallet-structure/runtime-benchmarks',35 'pallet-fungible/runtime-benchmarks',36 'pallet-refungible/runtime-benchmarks',37 'pallet-nonfungible/runtime-benchmarks',38 'pallet-proxy-rmrk-core/runtime-benchmarks',39 'pallet-proxy-rmrk-equip/runtime-benchmarks',40 'pallet-foreign-assets/runtime-benchmarks',41 'pallet-unique/runtime-benchmarks',42 'pallet-inflation/runtime-benchmarks',43 'pallet-app-promotion/runtime-benchmarks',44 'pallet-unique-scheduler/runtime-benchmarks',45 'pallet-xcm/runtime-benchmarks',46 'sp-runtime/runtime-benchmarks',47 'xcm-builder/runtime-benchmarks',48 'pallet-maintenance/runtime-benchmarks',49]50try-runtime = [51 'frame-try-runtime',52 'frame-executive/try-runtime',53 'frame-support/try-runtime',54 'frame-system/try-runtime',55 'cumulus-pallet-parachain-system/try-runtime',56 'parachain-info/try-runtime',57 'pallet-aura/try-runtime',58 'cumulus-pallet-aura-ext/try-runtime',59 'pallet-balances/try-runtime',60 'pallet-randomness-collective-flip/try-runtime',61 'pallet-timestamp/try-runtime',62 'pallet-transaction-payment/try-runtime',63 'pallet-treasury/try-runtime',64 'pallet-sudo/try-runtime',65 'orml-vesting/try-runtime',66 'orml-xtokens/try-runtime',67 'orml-tokens/try-runtime',68 'cumulus-pallet-xcmp-queue/try-runtime',69 'pallet-xcm/try-runtime',70 'cumulus-pallet-xcm/try-runtime',71 'cumulus-pallet-dmp-queue/try-runtime',72 'pallet-inflation/try-runtime',73 'pallet-unique/try-runtime',74 'pallet-unique-scheduler/try-runtime',75 'pallet-configuration/try-runtime',76 'pallet-charge-transaction/try-runtime',77 'pallet-common/try-runtime',78 'pallet-fungible/try-runtime',79 'pallet-refungible/try-runtime',80 'pallet-nonfungible/try-runtime',81 'pallet-structure/try-runtime',82 'pallet-proxy-rmrk-core/try-runtime',83 'pallet-proxy-rmrk-equip/try-runtime',84 'pallet-app-promotion/try-runtime',85 'pallet-foreign-assets/try-runtime',86 'pallet-evm/try-runtime',87 'pallet-ethereum/try-runtime',88 'pallet-evm-coder-substrate/try-runtime',89 'pallet-evm-contract-helpers/try-runtime',90 'pallet-evm-transaction-payment/try-runtime',91 'pallet-evm-migration/try-runtime',92 'pallet-maintenance/try-runtime',93 'pallet-test-utils?/try-runtime',94]95std = [96 'codec/std',97 'cumulus-pallet-aura-ext/std',98 'cumulus-pallet-parachain-system/std',99 'cumulus-pallet-xcm/std',100 'cumulus-pallet-xcmp-queue/std',101 'cumulus-primitives-core/std',102 'cumulus-primitives-utility/std',103 'frame-try-runtime/std',104 'frame-executive/std',105 'frame-support/std',106 'frame-system/std',107 'frame-system-rpc-runtime-api/std',108 'pallet-aura/std',109 'pallet-balances/std',110 # 'pallet-contracts/std',111 # 'pallet-contracts-primitives/std',112 # 'pallet-contracts-rpc-runtime-api/std',113 # 'pallet-contract-helpers/std',114 'pallet-randomness-collective-flip/std',115 'pallet-sudo/std',116 'pallet-timestamp/std',117 'pallet-transaction-payment/std',118 'pallet-transaction-payment-rpc-runtime-api/std',119 'pallet-treasury/std',120 'pallet-evm/std',121 'pallet-evm-migration/std',122 'pallet-evm-contract-helpers/std',123 'pallet-evm-transaction-payment/std',124 'pallet-evm-coder-substrate/std',125 'pallet-ethereum/std',126 'pallet-base-fee/std',127 'fp-rpc/std',128 'up-rpc/std',129 'app-promotion-rpc/std',130 'fp-evm-mapping/std',131 'fp-self-contained/std',132 'parachain-info/std',133 'serde',134 'pallet-inflation/std',135 'pallet-configuration/std',136 'pallet-app-promotion/std',137 'pallet-common/std',138 'pallet-structure/std',139 'pallet-fungible/std',140 'pallet-refungible/std',141 'pallet-nonfungible/std',142 'pallet-proxy-rmrk-core/std',143 'pallet-proxy-rmrk-equip/std',144 'pallet-unique/std',145 'pallet-unique-scheduler/std',146 'pallet-unique-scheduler-v2/std',147 'pallet-charge-transaction/std',148 'up-data-structs/std',149 'sp-api/std',150 'sp-block-builder/std',151 "sp-consensus-aura/std",152 'sp-core/std',153 'sp-inherents/std',154 'sp-io/std',155 'sp-offchain/std',156 'sp-runtime/std',157 'sp-session/std',158 'sp-std/std',159 'sp-transaction-pool/std',160 'sp-version/std',161 'xcm/std',162 'xcm-builder/std',163 'xcm-executor/std',164 'up-common/std',165 'rmrk-rpc/std',166 'evm-coder/std',167 'up-sponsorship/std',168169 "orml-vesting/std",170 "orml-tokens/std",171 "orml-xtokens/std",172 "orml-traits/std",173 "pallet-foreign-assets/std",174175 'pallet-maintenance/std',176 'pallet-test-utils?/std',177]178limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']179opal-runtime = ['refungible', 'scheduler', 'rmrk', 'app-promotion', 'foreign-assets', 'pallet-test-utils']180181refungible = []182scheduler = []183rmrk = []184foreign-assets = []185app-promotion = []186187################################################################################188# Substrate Dependencies189190[dependencies.codec]191default-features = false192features = ['derive']193package = 'parity-scale-codec'194version = '3.1.2'195196[dependencies.frame-benchmarking]197default-features = false198git = "https://github.com/paritytech/substrate"199optional = true200branch = "polkadot-v0.9.30"201202[dependencies.frame-try-runtime]203default-features = false204git = "https://github.com/paritytech/substrate"205optional = true206branch = "polkadot-v0.9.30"207208[dependencies.frame-executive]209default-features = false210git = "https://github.com/paritytech/substrate"211branch = "polkadot-v0.9.30"212213[dependencies.frame-support]214default-features = false215git = "https://github.com/paritytech/substrate"216branch = "polkadot-v0.9.30"217218[dependencies.frame-system]219default-features = false220git = "https://github.com/paritytech/substrate"221branch = "polkadot-v0.9.30"222223[dependencies.frame-system-benchmarking]224default-features = false225git = "https://github.com/paritytech/substrate"226optional = true227branch = "polkadot-v0.9.30"228229[dependencies.frame-system-rpc-runtime-api]230default-features = false231git = "https://github.com/paritytech/substrate"232branch = "polkadot-v0.9.30"233234[dependencies.hex-literal]235optional = true236version = '0.3.3'237238[dependencies.serde]239default-features = false240features = ['derive']241optional = true242version = '1.0.130'243244[dependencies.pallet-aura]245default-features = false246git = "https://github.com/paritytech/substrate"247branch = "polkadot-v0.9.30"248249[dependencies.pallet-balances]250default-features = false251git = "https://github.com/paritytech/substrate"252branch = "polkadot-v0.9.30"253254# Contracts specific packages255# [dependencies.pallet-contracts]256# git = 'https://github.com/paritytech/substrate'257# default-features = false258# branch = 'master'259# version = '4.0.0-dev'260261# [dependencies.pallet-contracts-primitives]262# git = 'https://github.com/paritytech/substrate'263# default-features = false264# branch = 'master'265# version = '4.0.0-dev'266267# [dependencies.pallet-contracts-rpc-runtime-api]268# git = 'https://github.com/paritytech/substrate'269# default-features = false270# branch = 'master'271# version = '4.0.0-dev'272273[dependencies.pallet-randomness-collective-flip]274default-features = false275git = "https://github.com/paritytech/substrate"276branch = "polkadot-v0.9.30"277278[dependencies.pallet-sudo]279default-features = false280git = "https://github.com/paritytech/substrate"281branch = "polkadot-v0.9.30"282283[dependencies.pallet-timestamp]284default-features = false285git = "https://github.com/paritytech/substrate"286branch = "polkadot-v0.9.30"287288[dependencies.pallet-transaction-payment]289default-features = false290git = "https://github.com/paritytech/substrate"291branch = "polkadot-v0.9.30"292293[dependencies.pallet-transaction-payment-rpc-runtime-api]294default-features = false295git = "https://github.com/paritytech/substrate"296branch = "polkadot-v0.9.30"297298[dependencies.pallet-treasury]299default-features = false300git = "https://github.com/paritytech/substrate"301branch = "polkadot-v0.9.30"302303[dependencies.sp-arithmetic]304default-features = false305git = "https://github.com/paritytech/substrate"306branch = "polkadot-v0.9.30"307308[dependencies.sp-api]309default-features = false310git = "https://github.com/paritytech/substrate"311branch = "polkadot-v0.9.30"312313[dependencies.sp-block-builder]314default-features = false315git = "https://github.com/paritytech/substrate"316branch = "polkadot-v0.9.30"317318[dependencies.sp-core]319default-features = false320git = "https://github.com/paritytech/substrate"321branch = "polkadot-v0.9.30"322323[dependencies.sp-consensus-aura]324default-features = false325git = "https://github.com/paritytech/substrate"326branch = "polkadot-v0.9.30"327328[dependencies.sp-inherents]329default-features = false330git = "https://github.com/paritytech/substrate"331branch = "polkadot-v0.9.30"332333[dependencies.sp-io]334default-features = false335git = "https://github.com/paritytech/substrate"336branch = "polkadot-v0.9.30"337338[dependencies.sp-offchain]339default-features = false340git = "https://github.com/paritytech/substrate"341branch = "polkadot-v0.9.30"342343[dependencies.sp-runtime]344default-features = false345git = "https://github.com/paritytech/substrate"346branch = "polkadot-v0.9.30"347348[dependencies.sp-session]349default-features = false350git = "https://github.com/paritytech/substrate"351branch = "polkadot-v0.9.30"352353[dependencies.sp-std]354default-features = false355git = "https://github.com/paritytech/substrate"356branch = "polkadot-v0.9.30"357358[dependencies.sp-transaction-pool]359default-features = false360git = "https://github.com/paritytech/substrate"361branch = "polkadot-v0.9.30"362363[dependencies.sp-version]364default-features = false365git = "https://github.com/paritytech/substrate"366branch = "polkadot-v0.9.30"367368[dependencies.smallvec]369version = '1.6.1'370371################################################################################372# Cumulus dependencies373374[dependencies.parachain-info]375default-features = false376git = "https://github.com/paritytech/cumulus"377branch = "polkadot-v0.9.30"378379[dependencies.cumulus-pallet-aura-ext]380git = "https://github.com/paritytech/cumulus"381branch = "polkadot-v0.9.30"382default-features = false383384[dependencies.cumulus-pallet-parachain-system]385git = "https://github.com/paritytech/cumulus"386branch = "polkadot-v0.9.30"387default-features = false388389[dependencies.cumulus-primitives-core]390git = "https://github.com/paritytech/cumulus"391branch = "polkadot-v0.9.30"392default-features = false393394[dependencies.cumulus-pallet-xcm]395git = "https://github.com/paritytech/cumulus"396branch = "polkadot-v0.9.30"397default-features = false398399[dependencies.cumulus-pallet-dmp-queue]400git = "https://github.com/paritytech/cumulus"401branch = "polkadot-v0.9.30"402default-features = false403404[dependencies.cumulus-pallet-xcmp-queue]405git = "https://github.com/paritytech/cumulus"406branch = "polkadot-v0.9.30"407default-features = false408409[dependencies.cumulus-primitives-utility]410git = "https://github.com/paritytech/cumulus"411branch = "polkadot-v0.9.30"412default-features = false413414[dependencies.cumulus-primitives-timestamp]415git = "https://github.com/paritytech/cumulus"416branch = "polkadot-v0.9.30"417default-features = false418419################################################################################420# Polkadot dependencies421422[dependencies.polkadot-parachain]423git = "https://github.com/paritytech/polkadot"424branch = "release-v0.9.30"425default-features = false426427[dependencies.xcm]428git = "https://github.com/paritytech/polkadot"429branch = "release-v0.9.30"430default-features = false431432[dependencies.xcm-builder]433git = "https://github.com/paritytech/polkadot"434branch = "release-v0.9.30"435default-features = false436437[dependencies.xcm-executor]438git = "https://github.com/paritytech/polkadot"439branch = "release-v0.9.30"440default-features = false441442[dependencies.pallet-xcm]443git = "https://github.com/paritytech/polkadot"444branch = "release-v0.9.30"445default-features = false446447################################################################################448# local dependencies449450[dependencies]451orml-vesting.workspace = true452orml-xtokens.workspace = true453orml-tokens.workspace = true454orml-traits.workspace = true455456log = { version = "0.4.16", default-features = false }457up-common = { path = "../../primitives/common", default-features = false }458scale-info = { version = "2.0.1", default-features = false, features = [459 "derive",460] }461derivative = "2.2.0"462pallet-unique = { path = '../../pallets/unique', default-features = false }463up-rpc = { path = "../../primitives/rpc", default-features = false }464app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }465rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }466fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }467pallet-inflation = { path = '../../pallets/inflation', default-features = false }468pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }469up-data-structs = { path = '../../primitives/data-structs', default-features = false }470pallet-configuration = { default-features = false, path = "../../pallets/configuration" }471pallet-common = { default-features = false, path = "../../pallets/common" }472pallet-structure = { default-features = false, path = "../../pallets/structure" }473pallet-fungible = { default-features = false, path = "../../pallets/fungible" }474pallet-refungible = { default-features = false, path = "../../pallets/refungible" }475pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }476pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }477pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }478pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }479pallet-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" }480pallet-unique-scheduler-v2 = { path = '../../pallets/scheduler-v2', default-features = false }481pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }482pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }483pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }484pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }485pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }486pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }487pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }488fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }489fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30" }490evm-coder = { default-features = false, path = '../../crates/evm-coder' }491up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.30' }492pallet-foreign-assets = { default-features = false, path = "../../pallets/foreign-assets" }493pallet-maintenance = { default-features = false, path = "../../pallets/maintenance" }494495################################################################################496# Test dependencies497498pallet-test-utils = { optional = true, default-features = false, path = "../../test-pallets/utils" }499500################################################################################501# Other Dependencies502503impl-trait-for-tuples = "0.2.2"504505################################################################################506# Dev Dependencies507508[dev-dependencies.logtest]509version = "2.0.0"510511################################################################################512# Build Dependencies513514[build-dependencies.substrate-wasm-builder]515git = "https://github.com/paritytech/substrate"516branch = "polkadot-v0.9.30"