git.delta.rocks / unique-network / refs/commits / 4161c8ea6c50

difftreelog

refactor drop legacy unique scheduler

Yaroslav Bolyukin2023-10-02parent: #bce2cc1.patch.diff
in: master

9 files changed

deletedpallets/scheduler-v2/Cargo.tomldiffbeforeafterboth
--- a/pallets/scheduler-v2/Cargo.toml
+++ /dev/null
@@ -1,45 +0,0 @@
-[package]
-authors = ["Unique Network <support@uniquenetwork.io>"]
-description = "Unique Scheduler pallet"
-edition = "2021"
-homepage = "https://unique.network"
-license = "GPLv3"
-name = "pallet-unique-scheduler-v2"
-readme = "README.md"
-repository = "https://github.com/UniqueNetwork/unique-chain"
-version = "0.1.0"
-
-[dependencies]
-# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.
-codec = { workspace = true, package = "parity-scale-codec" }
-
-frame-benchmarking = { workspace = true, optional = true }
-frame-support = { workspace = true }
-frame-system = { workspace = true }
-log = { workspace = true }
-scale-info = { workspace = true }
-sp-core = { workspace = true }
-sp-io = { workspace = true }
-sp-runtime = { workspace = true }
-sp-std = { workspace = true }
-
-[dev-dependencies]
-pallet-preimage = { workspace = true }
-substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
-
-[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-core/std",
-	"sp-io/std",
-	"sp-runtime/std",
-	"sp-std/std",
-]
-try-runtime = ["frame-support/try-runtime"]
deletedpallets/scheduler-v2/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/benchmarking.rs
+++ /dev/null
@@ -1,374 +0,0 @@
-// 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) 2020-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 pallet benchmarking.
-
-use super::*;
-use frame_benchmarking::{account, benchmarks};
-use frame_support::{
-	ensure,
-	traits::{schedule::Priority, PreimageRecipient},
-};
-use frame_system::RawOrigin;
-use sp_std::{prelude::*, vec};
-use sp_io::hashing::blake2_256;
-
-use crate::{Pallet as Scheduler, ScheduledCall, EncodedCall};
-use frame_system::Call as SystemCall;
-
-const SEED: u32 = 0;
-
-const BLOCK_NUMBER: u32 = 2;
-
-/// Add `n` items to the schedule.
-///
-/// For `resolved`:
-/// - `
-/// - `None`: aborted (hash without preimage)
-/// - `Some(true)`: hash resolves into call if possible, plain call otherwise
-/// - `Some(false)`: plain call
-fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {
-	let t = DispatchTime::At(when);
-	let origin: <T as Config>::PalletsOrigin = frame_system::RawOrigin::Root.into();
-	for i in 0..n {
-		let call = make_call::<T>(None);
-		let period = Some(((i + 100).into(), 100));
-		let name = u32_to_name(i);
-		Scheduler::<T>::do_schedule_named(name, t, period, 0, origin.clone(), call)?;
-	}
-	ensure!(
-		Agenda::<T>::get(when).agenda.len() == n as usize,
-		"didn't fill schedule"
-	);
-	Ok(())
-}
-
-/// Generate a name for a scheduled task from an unsigned integer.
-fn u32_to_name(i: u32) -> TaskName {
-	i.using_encoded(blake2_256)
-}
-
-/// A utility for creating simple scheduled tasks.
-///
-/// # Arguments
-/// * `periodic` - makes the task periodic.
-///     Sets the task's period and repetition count to `100`.
-/// * `named` - gives a name to the task: `u32_to_name(0)`.
-/// * `signed` - determines the origin of the task.
-///     If true, it will have the Signed origin. Otherwise it will have the Root origin.
-///     See [`make_origin`] for details.
-/// * maybe_lookup_len - sets optional lookup length. It is used to benchmark task fetching from the `Preimages` store.
-/// * priority - the task's priority.
-fn make_task<T: Config>(
-	periodic: bool,
-	named: bool,
-	signed: bool,
-	maybe_lookup_len: Option<u32>,
-	priority: Priority,
-) -> ScheduledOf<T> {
-	let call = make_call::<T>(maybe_lookup_len);
-	let maybe_periodic = match periodic {
-		true => Some((100u32.into(), 100)),
-		false => None,
-	};
-	let maybe_id = match named {
-		true => Some(u32_to_name(0)),
-		false => None,
-	};
-	let origin = make_origin::<T>(signed);
-	Scheduled {
-		maybe_id,
-		priority,
-		call,
-		maybe_periodic,
-		origin,
-		_phantom: PhantomData,
-	}
-}
-
-/// Creates a `SystemCall::remark` scheduled call with a given `len` in bytes.
-/// Returns `None` if the call is too large to encode.
-fn bounded<T: Config>(len: u32) -> Option<ScheduledCall<T>> {
-	let call = <<T as Config>::RuntimeCall>::from(SystemCall::remark {
-		remark: vec![0; len as usize],
-	});
-	ScheduledCall::new(call).ok()
-}
-
-/// Creates a scheduled call and maximizes its size.
-///
-/// If the `maybe_lookup_len` is not supplied, the task will create the maximal `Inline` scheduled call.
-///
-/// Otherwise, the function will take the length value from the `maybe_lookup_len`
-/// and find a minimal length value that ensures that the scheduled call will require a Preimage lookup.
-fn make_call<T: Config>(maybe_lookup_len: Option<u32>) -> ScheduledCall<T> {
-	let bound = EncodedCall::bound() as u32;
-	let mut len = match maybe_lookup_len {
-		Some(len) => {
-			len.clamp(
-				bound,
-				<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get() - 2,
-			) - 3
-		}
-		None => bound.saturating_sub(4),
-	};
-
-	loop {
-		let c = match bounded::<T>(len) {
-			Some(x) => x,
-			None => {
-				len -= 1;
-				continue;
-			}
-		};
-		if c.lookup_needed() == maybe_lookup_len.is_some() {
-			break c;
-		}
-		if maybe_lookup_len.is_some() {
-			len += 1;
-		} else if len > 0 {
-			len -= 1;
-		} else {
-			break c;
-		}
-	}
-}
-
-/// Creates an origin for a scheduled call.
-///
-/// If `signed` is true, it creates the Signed origin from a default account `account("origin", 0, SEED)`.
-/// Otherwise, it creates the Root origin.
-fn make_origin<T: Config>(signed: bool) -> <T as Config>::PalletsOrigin {
-	match signed {
-		true => frame_system::RawOrigin::Signed(account("origin", 0, SEED)).into(),
-		false => frame_system::RawOrigin::Root.into(),
-	}
-}
-
-/// Creates a dummy `WeightCounter` with the maximum possible weight limit.
-fn dummy_counter() -> WeightCounter {
-	WeightCounter {
-		used: Weight::zero(),
-		limit: Weight::MAX,
-	}
-}
-
-benchmarks! {
-	// `service_agendas` when no work is done.
-	// (multiple agendas - scheduled tasks in several blocks)
-	service_agendas_base {
-		let now = T::BlockNumber::from(BLOCK_NUMBER);
-		IncompleteSince::<T>::put(now - One::one());
-	}: {
-		Scheduler::<T>::service_agendas(&mut dummy_counter(), now, 0);
-	} verify {
-		assert_eq!(IncompleteSince::<T>::get(), Some(now - One::one()));
-	}
-
-	// `service_agenda` when no work is done.
-	// (only one agenda - scheduled tasks in a single block)
-	service_agenda_base {
-		let now = BLOCK_NUMBER.into();
-		let s in 0 .. T::MaxScheduledPerBlock::get();
-		fill_schedule::<T>(now, s)?;
-		let mut executed = 0;
-	}: {
-		Scheduler::<T>::service_agenda(&mut dummy_counter(), &mut executed, now, now, 0);
-	} verify {
-		assert_eq!(executed, 0);
-	}
-
-	// `service_task` when the task is a non-periodic, non-named, non-fetched call which is not
-	// dispatched (e.g. due to being overweight).
-	service_task_base {
-		let now = BLOCK_NUMBER.into();
-		let task = make_task::<T>(false, false, false, None, 0);
-		// prevent any tasks from actually being executed as we only want the surrounding weight.
-		let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };
-	}: {
-		let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);
-	} verify {
-		//assert_eq!(result, Ok(()));
-	}
-
-	// TODO uncomment if we will use the Preimages
-	// // `service_task` when the task is a non-periodic, non-named, fetched call (with a known
-	// // preimage length) and which is not dispatched (e.g. due to being overweight).
-	// service_task_fetched {
-	// 	let s in (EncodedCall::bound() as u32) .. (<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get());
-	// 	let now = BLOCK_NUMBER.into();
-	// 	let task = make_task::<T>(false, false, false, Some(s), 0);
-	// 	// prevent any tasks from actually being executed as we only want the surrounding weight.
-	// 	let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };
-	// }: {
-	// 	let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);
-	// } verify {
-	// }
-
-	// `service_task` when the task is a non-periodic, named, non-fetched call which is not
-	// dispatched (e.g. due to being overweight).
-	service_task_named {
-		let now = BLOCK_NUMBER.into();
-		let task = make_task::<T>(false, true, false, None, 0);
-		// prevent any tasks from actually being executed as we only want the surrounding weight.
-		let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };
-	}: {
-		let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);
-	} verify {
-	}
-
-	// `service_task` when the task is a periodic, non-named, non-fetched call which is not
-	// dispatched (e.g. due to being overweight).
-	service_task_periodic {
-		let now = BLOCK_NUMBER.into();
-		let task = make_task::<T>(true, false, false, None, 0);
-		// prevent any tasks from actually being executed as we only want the surrounding weight.
-		let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };
-	}: {
-		let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);
-	} verify {
-	}
-
-	// `execute_dispatch` when the origin is `Signed`, not counting the dispatable's weight.
-	execute_dispatch_signed {
-		let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::MAX };
-		let origin = make_origin::<T>(true);
-		let call = T::Preimages::realize(&make_call::<T>(None)).unwrap().0;
-	}: {
-		assert!(Scheduler::<T>::execute_dispatch(&mut counter, origin, call).is_ok());
-	}
-	verify {
-	}
-
-	// `execute_dispatch` when the origin is not `Signed`, not counting the dispatable's weight.
-	execute_dispatch_unsigned {
-		let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::MAX };
-		let origin = make_origin::<T>(false);
-		let call = T::Preimages::realize(&make_call::<T>(None)).unwrap().0;
-	}: {
-		assert!(Scheduler::<T>::execute_dispatch(&mut counter, origin, call).is_ok());
-	}
-	verify {
-	}
-
-	schedule {
-		let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);
-		let when = BLOCK_NUMBER.into();
-		let periodic = Some((T::BlockNumber::one(), 100));
-		let priority = Some(0);
-		// Essentially a no-op call.
-		let call = Box::new(SystemCall::set_storage { items: vec![] }.into());
-
-		fill_schedule::<T>(when, s)?;
-	}: _(RawOrigin::Root, when, periodic, priority, call)
-	verify {
-		ensure!(
-			Agenda::<T>::get(when).agenda.len() == (s + 1) as usize,
-			"didn't add to schedule"
-		);
-	}
-
-	cancel {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-
-		fill_schedule::<T>(when, s)?;
-		assert_eq!(Agenda::<T>::get(when).agenda.len(), s as usize);
-	}: _(RawOrigin::Root, when, 0)
-	verify {
-		ensure!(
-			Lookup::<T>::get(u32_to_name(0)).is_none(),
-			"didn't remove from lookup"
-		);
-		// Removed schedule is NONE
-		ensure!(
-			Agenda::<T>::get(when).agenda[0].is_none(),
-			"didn't remove from schedule"
-		);
-	}
-
-	schedule_named {
-		let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);
-		let id = u32_to_name(s);
-		let when = BLOCK_NUMBER.into();
-		let periodic = Some((T::BlockNumber::one(), 100));
-		let priority = Some(0);
-		// Essentially a no-op call.
-		let call = Box::new(SystemCall::set_storage { items: vec![] }.into());
-
-		fill_schedule::<T>(when, s)?;
-	}: _(RawOrigin::Root, id, when, periodic, priority, call)
-	verify {
-		ensure!(
-			Agenda::<T>::get(when).agenda.len() == (s + 1) as usize,
-			"didn't add to schedule"
-		);
-	}
-
-	cancel_named {
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-
-		fill_schedule::<T>(when, s)?;
-	}: _(RawOrigin::Root, u32_to_name(0))
-	verify {
-		ensure!(
-			Lookup::<T>::get(u32_to_name(0)).is_none(),
-			"didn't remove from lookup"
-		);
-		// Removed schedule is NONE
-		ensure!(
-			Agenda::<T>::get(when).agenda[0].is_none(),
-			"didn't remove from schedule"
-		);
-	}
-
-	change_named_priority {
-		let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Root;
-		let s in 1 .. T::MaxScheduledPerBlock::get();
-		let when = BLOCK_NUMBER.into();
-		let idx = s - 1;
-		let id = u32_to_name(idx);
-		let priority = 42;
-		fill_schedule::<T>(when, s)?;
-	}: _(origin, id, priority)
-	verify {
-		ensure!(
-			Agenda::<T>::get(when).agenda[idx as usize].clone().unwrap().priority == priority,
-			"didn't change the priority"
-		);
-	}
-
-	impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);
-}
deletedpallets/scheduler-v2/src/lib.rsdiffbeforeafterboth

no changes

deletedpallets/scheduler-v2/src/mock.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/mock.rs
+++ /dev/null
@@ -1,292 +0,0 @@
-// 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 test environment.
-#![allow(deprecated)]
-
-use super::*;
-
-use crate as scheduler;
-use frame_support::{
-	ord_parameter_types, parameter_types,
-	traits::{ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnFinalize, OnInitialize},
-	weights::constants::RocksDbWeight,
-};
-use frame_system::{EnsureRoot, RawOrigin};
-use sp_core::H256;
-use sp_runtime::{
-	testing::Header,
-	traits::{BlakeTwo256, IdentityLookup},
-	Perbill,
-};
-
-// Logger module to track execution.
-#[frame_support::pallet]
-pub mod logger {
-	use super::{OriginCaller, OriginTrait};
-	use frame_support::{pallet_prelude::*, parameter_types};
-	use frame_system::pallet_prelude::*;
-
-	parameter_types! {
-		static Log: Vec<(OriginCaller, u32)> = Vec::new();
-	}
-	pub fn log() -> Vec<(OriginCaller, u32)> {
-		Log::get().clone()
-	}
-
-	#[pallet::pallet]
-	pub struct Pallet<T>(PhantomData<T>);
-
-	#[pallet::hooks]
-	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
-
-	#[pallet::config]
-	pub trait Config: frame_system::Config {
-		type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
-	}
-
-	#[pallet::event]
-	#[pallet::generate_deposit(pub(super) fn deposit_event)]
-	pub enum Event<T: Config> {
-		Logged(u32, Weight),
-	}
-
-	#[pallet::call]
-	impl<T: Config> Pallet<T>
-	where
-		<T as frame_system::Config>::RuntimeOrigin: OriginTrait<PalletsOrigin = OriginCaller>,
-	{
-		#[pallet::call_index(0)]
-		#[pallet::weight(*weight)]
-		pub fn log(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {
-			Self::deposit_event(Event::Logged(i, weight));
-			Log::mutate(|log| {
-				log.push((origin.caller().clone(), i));
-			});
-			Ok(())
-		}
-
-		#[pallet::call_index(1)]
-		#[pallet::weight(*weight)]
-		pub fn log_without_filter(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {
-			Self::deposit_event(Event::Logged(i, weight));
-			Log::mutate(|log| {
-				log.push((origin.caller().clone(), i));
-			});
-			Ok(())
-		}
-	}
-}
-
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
-type Block = frame_system::mocking::MockBlock<Test>;
-
-frame_support::construct_runtime!(
-	pub enum Test where
-		Block = Block,
-		NodeBlock = Block,
-		UncheckedExtrinsic = UncheckedExtrinsic,
-	{
-		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-		Logger: logger::{Pallet, Call, Event<T>},
-		Scheduler: scheduler::{Pallet, Call, Storage, Event<T>},
-	}
-);
-
-// Scheduler must dispatch with root and no filter, this tests base filter is indeed not used.
-pub struct BaseFilter;
-impl Contains<RuntimeCall> for BaseFilter {
-	fn contains(call: &RuntimeCall) -> bool {
-		!matches!(call, RuntimeCall::Logger(LoggerCall::log { .. }))
-	}
-}
-
-parameter_types! {
-	pub BlockWeights: frame_system::limits::BlockWeights =
-		frame_system::limits::BlockWeights::simple_max(
-			Weight::from_ref_time(2_000_000_000_000).set_proof_size(u64::MAX)
-		);
-}
-impl system::Config for Test {
-	type BaseCallFilter = BaseFilter;
-	type BlockWeights = BlockWeights;
-	type BlockLength = ();
-	type DbWeight = RocksDbWeight;
-	type RuntimeOrigin = RuntimeOrigin;
-	type RuntimeCall = RuntimeCall;
-	type Index = u64;
-	type BlockNumber = u64;
-	type Hash = H256;
-	type Hashing = BlakeTwo256;
-	type AccountId = u64;
-	type Lookup = IdentityLookup<Self::AccountId>;
-	type Header = Header;
-	type RuntimeEvent = RuntimeEvent;
-	type BlockHashCount = ConstU64<250>;
-	type Version = ();
-	type PalletInfo = PalletInfo;
-	type AccountData = ();
-	type OnNewAccount = ();
-	type OnKilledAccount = ();
-	type SystemWeightInfo = ();
-	type SS58Prefix = ();
-	type OnSetCode = ();
-	type MaxConsumers = ConstU32<16>;
-}
-impl logger::Config for Test {
-	type RuntimeEvent = RuntimeEvent;
-}
-ord_parameter_types! {
-	pub const One: u64 = 1;
-}
-
-pub struct TestWeightInfo;
-impl WeightInfo for TestWeightInfo {
-	fn service_agendas_base() -> Weight {
-		Weight::from_ref_time(0b0000_0001)
-	}
-	fn service_agenda_base(i: u32) -> Weight {
-		Weight::from_ref_time((i << 8) as u64 + 0b0000_0010)
-	}
-	fn service_task_base() -> Weight {
-		Weight::from_ref_time(0b0000_0100)
-	}
-	fn service_task_periodic() -> Weight {
-		Weight::from_ref_time(0b0000_1100)
-	}
-	fn service_task_named() -> Weight {
-		Weight::from_ref_time(0b0001_0100)
-	}
-	// fn service_task_fetched(s: u32) -> Weight {
-	// 	Weight::from_ref_time((s << 8) as u64 + 0b0010_0100)
-	// }
-	fn execute_dispatch_signed() -> Weight {
-		Weight::from_ref_time(0b0100_0000)
-	}
-	fn execute_dispatch_unsigned() -> Weight {
-		Weight::from_ref_time(0b1000_0000)
-	}
-	fn schedule(_s: u32) -> Weight {
-		Weight::from_ref_time(50)
-	}
-	fn cancel(_s: u32) -> Weight {
-		Weight::from_ref_time(50)
-	}
-	fn schedule_named(_s: u32) -> Weight {
-		Weight::from_ref_time(50)
-	}
-	fn cancel_named(_s: u32) -> Weight {
-		Weight::from_ref_time(50)
-	}
-	fn change_named_priority(_s: u32) -> Weight {
-		Weight::from_ref_time(50)
-	}
-}
-parameter_types! {
-	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
-		BlockWeights::get().max_block;
-}
-
-pub struct EnsureSignedOneOrRoot;
-impl<O: Into<Result<RawOrigin<u64>, O>> + From<RawOrigin<u64>>> EnsureOrigin<O>
-	for EnsureSignedOneOrRoot
-{
-	type Success = ScheduledEnsureOriginSuccess<u64>;
-	fn try_origin(o: O) -> Result<Self::Success, O> {
-		o.into().and_then(|o| match o {
-			RawOrigin::Root => Ok(ScheduledEnsureOriginSuccess::Root),
-			RawOrigin::Signed(1) => Ok(ScheduledEnsureOriginSuccess::Signed(1)),
-			r => Err(O::from(r)),
-		})
-	}
-	#[cfg(feature = "runtime-benchmarks")]
-	fn try_successful_origin() -> Result<O, ()> {
-		Ok(O::from(RawOrigin::Root))
-	}
-}
-
-pub struct Executor;
-impl DispatchCall<Test, sp_core::H160> for Executor {
-	fn dispatch_call(
-		signer: Option<u64>,
-		function: RuntimeCall,
-	) -> Result<
-		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
-		TransactionValidityError,
-	> {
-		let origin = match signer {
-			Some(who) => RuntimeOrigin::signed(who),
-			None => RuntimeOrigin::none(),
-		};
-		Ok(function.dispatch(origin))
-	}
-}
-
-impl Config for Test {
-	type RuntimeEvent = RuntimeEvent;
-	type RuntimeOrigin = RuntimeOrigin;
-	type PalletsOrigin = OriginCaller;
-	type RuntimeCall = RuntimeCall;
-	type MaximumWeight = MaximumSchedulerWeight;
-	type ScheduleOrigin = EnsureSignedOneOrRoot;
-	type MaxScheduledPerBlock = ConstU32<10>;
-	type WeightInfo = TestWeightInfo;
-	type OriginPrivilegeCmp = EqualPrivilegeOnly;
-	type Preimages = ();
-	type PrioritySetOrigin = EnsureRoot<u64>;
-	type CallExecutor = Executor;
-}
-
-pub type LoggerCall = logger::Call<Test>;
-
-pub type SystemCall = frame_system::Call<Test>;
-
-pub fn new_test_ext() -> sp_io::TestExternalities {
-	let t = system::GenesisConfig::default()
-		.build_storage::<Test>()
-		.unwrap();
-	t.into()
-}
-
-pub fn run_to_block(n: u64) {
-	while System::block_number() < n {
-		Scheduler::on_finalize(System::block_number());
-		System::set_block_number(System::block_number() + 1);
-		Scheduler::on_initialize(System::block_number());
-	}
-}
-
-pub fn root() -> OriginCaller {
-	system::RawOrigin::Root.into()
-}
deletedpallets/scheduler-v2/src/tests.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/tests.rs
+++ /dev/null
@@ -1,901 +0,0 @@
-// 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 tests.
-#![allow(deprecated)]
-
-use super::*;
-use crate::mock::{
-	logger, new_test_ext, root, run_to_block, LoggerCall, RuntimeCall, Scheduler, Test, *,
-};
-use frame_support::{
-	assert_noop, assert_ok,
-	traits::{Contains, OnInitialize},
-	assert_err,
-};
-
-#[test]
-fn basic_scheduling_works() {
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		});
-		assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(
-			&call
-		));
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		run_to_block(3);
-		assert!(logger::log().is_empty());
-		run_to_block(4);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-		run_to_block(100);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-	});
-}
-
-#[test]
-fn schedule_after_works() {
-	new_test_ext().execute_with(|| {
-		run_to_block(2);
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		});
-		assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(
-			&call
-		));
-		// This will schedule the call 3 blocks after the next block... so block 3 + 3 = 6
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::After(3),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		run_to_block(5);
-		assert!(logger::log().is_empty());
-		run_to_block(6);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-		run_to_block(100);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-	});
-}
-
-#[test]
-fn schedule_after_zero_works() {
-	new_test_ext().execute_with(|| {
-		run_to_block(2);
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		});
-		assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(
-			&call
-		));
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::After(0),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		// Will trigger on the next block.
-		run_to_block(3);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-		run_to_block(100);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-	});
-}
-
-#[test]
-fn periodic_scheduling_works() {
-	new_test_ext().execute_with(|| {
-		// at #4, every 3 blocks, 3 times.
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			Some((3, 3)),
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(RuntimeCall::Logger(logger::Call::log {
-				i: 42,
-				weight: Weight::from_ref_time(10)
-			}))
-			.unwrap()
-		));
-		run_to_block(3);
-		assert!(logger::log().is_empty());
-		run_to_block(4);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-		run_to_block(6);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-		run_to_block(7);
-		assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);
-		run_to_block(9);
-		assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 42u32)]);
-		run_to_block(10);
-		assert_eq!(
-			logger::log(),
-			vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]
-		);
-		run_to_block(100);
-		assert_eq!(
-			logger::log(),
-			vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]
-		);
-	});
-}
-
-#[test]
-fn cancel_named_scheduling_works_with_normal_cancel() {
-	new_test_ext().execute_with(|| {
-		// at #4.
-		Scheduler::do_schedule_named(
-			[1u8; 32],
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(RuntimeCall::Logger(LoggerCall::log {
-				i: 69,
-				weight: Weight::from_ref_time(10),
-			}))
-			.unwrap(),
-		)
-		.unwrap();
-		let i = Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(RuntimeCall::Logger(LoggerCall::log {
-				i: 42,
-				weight: Weight::from_ref_time(10),
-			}))
-			.unwrap(),
-		)
-		.unwrap();
-		run_to_block(3);
-		assert!(logger::log().is_empty());
-		assert_ok!(Scheduler::do_cancel_named(None, [1u8; 32]));
-		assert_ok!(Scheduler::do_cancel(None, i));
-		run_to_block(100);
-		assert!(logger::log().is_empty());
-	});
-}
-
-#[test]
-fn cancel_named_periodic_scheduling_works() {
-	new_test_ext().execute_with(|| {
-		// at #4, every 3 blocks, 3 times.
-		Scheduler::do_schedule_named(
-			[1u8; 32],
-			DispatchTime::At(4),
-			Some((3, 3)),
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(RuntimeCall::Logger(LoggerCall::log {
-				i: 42,
-				weight: Weight::from_ref_time(10),
-			}))
-			.unwrap(),
-		)
-		.unwrap();
-		// same id results in error.
-		assert!(Scheduler::do_schedule_named(
-			[1u8; 32],
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(RuntimeCall::Logger(LoggerCall::log {
-				i: 69,
-				weight: Weight::from_ref_time(10)
-			}))
-			.unwrap(),
-		)
-		.is_err());
-		// different id is ok.
-		Scheduler::do_schedule_named(
-			[2u8; 32],
-			DispatchTime::At(8),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(RuntimeCall::Logger(LoggerCall::log {
-				i: 69,
-				weight: Weight::from_ref_time(10),
-			}))
-			.unwrap(),
-		)
-		.unwrap();
-		run_to_block(3);
-		assert!(logger::log().is_empty());
-		run_to_block(4);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-		run_to_block(6);
-		assert_ok!(Scheduler::do_cancel_named(None, [1u8; 32]));
-		run_to_block(100);
-		assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);
-	});
-}
-
-#[test]
-fn scheduler_respects_weight_limits() {
-	let max_weight: Weight = <Test as Config>::MaximumWeight::get();
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: max_weight / 3 * 2,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: max_weight / 3 * 2,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		// 69 and 42 do not fit together
-		run_to_block(4);
-		assert_eq!(logger::log(), vec![(root(), 42u32)]);
-		run_to_block(5);
-		assert_eq!(logger::log(), vec![(root(), 42u32), (root(), 69u32)]);
-	});
-}
-
-/// Permanently overweight calls are not deleted but also not executed.
-#[test]
-fn scheduler_does_not_delete_permanently_overweight_call() {
-	let max_weight: Weight = <Test as Config>::MaximumWeight::get();
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: max_weight,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		// Never executes.
-		run_to_block(100);
-		assert_eq!(logger::log(), vec![]);
-
-		// Assert the `PermanentlyOverweight` event.
-		assert_eq!(
-			System::events().last().unwrap().event,
-			crate::Event::PermanentlyOverweight {
-				task: (4, 0),
-				id: None
-			}
-			.into(),
-		);
-		// The call is still in the agenda.
-		assert!(Agenda::<Test>::get(4).agenda[0].is_some());
-	});
-}
-
-#[test]
-fn scheduler_periodic_tasks_always_find_place() {
-	let max_weight: Weight = <Test as Config>::MaximumWeight::get();
-	let max_per_block = <Test as Config>::MaxScheduledPerBlock::get();
-
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: (max_weight / 3) * 2,
-		});
-		let call = <ScheduledCall<Test>>::new(call).unwrap();
-
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			Some((4, u32::MAX)),
-			127,
-			root(),
-			call.clone(),
-		));
-		// Executes 5 times till block 20.
-		run_to_block(20);
-		assert_eq!(logger::log().len(), 5);
-
-		// Block 28 will already be full.
-		for _ in 0..max_per_block {
-			assert_ok!(Scheduler::do_schedule(
-				DispatchTime::At(28),
-				None,
-				120,
-				root(),
-				call.clone(),
-			));
-		}
-
-		run_to_block(24);
-		assert_eq!(logger::log().len(), 6);
-
-		// The periodic task should be postponed
-		assert_eq!(<Agenda<Test>>::get(29).agenda.len(), 1);
-
-		run_to_block(27); // will call on_initialize(28)
-		assert_eq!(logger::log().len(), 6);
-
-		run_to_block(28); // will call on_initialize(29)
-		assert_eq!(logger::log().len(), 7);
-	});
-}
-
-#[test]
-fn scheduler_respects_priority_ordering() {
-	let max_weight: Weight = <Test as Config>::MaximumWeight::get();
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: max_weight / 3,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			1,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: max_weight / 3,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			0,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		run_to_block(4);
-		assert_eq!(logger::log(), vec![(root(), 69u32), (root(), 42u32)]);
-	});
-}
-
-#[test]
-fn scheduler_respects_priority_ordering_with_soft_deadlines() {
-	new_test_ext().execute_with(|| {
-		let max_weight: Weight = <Test as Config>::MaximumWeight::get();
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: max_weight / 5 * 2,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			255,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: max_weight / 5 * 2,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 2600,
-			weight: max_weight / 5 * 4,
-		});
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			126,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-
-		// 2600 does not fit with 69 or 42, but has higher priority, so will go through
-		run_to_block(4);
-		assert_eq!(logger::log(), vec![(root(), 2600u32)]);
-		// 69 and 42 fit together
-		run_to_block(5);
-		assert_eq!(
-			logger::log(),
-			vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32)]
-		);
-	});
-}
-
-#[test]
-fn on_initialize_weight_is_correct() {
-	new_test_ext().execute_with(|| {
-		let call_weight = Weight::from_ref_time(25);
-
-		// Named
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 3,
-			weight: call_weight + Weight::from_ref_time(1),
-		});
-		assert_ok!(Scheduler::do_schedule_named(
-			[1u8; 32],
-			DispatchTime::At(3),
-			None,
-			255,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: call_weight + Weight::from_ref_time(2),
-		});
-		// Anon Periodic
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(2),
-			Some((1000, 3)),
-			128,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: call_weight + Weight::from_ref_time(3),
-		});
-		// Anon
-		assert_ok!(Scheduler::do_schedule(
-			DispatchTime::At(2),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-		// Named Periodic
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 2600,
-			weight: call_weight + Weight::from_ref_time(4),
-		});
-		assert_ok!(Scheduler::do_schedule_named(
-			[2u8; 32],
-			DispatchTime::At(1),
-			Some((1000, 3)),
-			126,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		));
-
-		// Will include the named periodic only
-		assert_eq!(
-			Scheduler::on_initialize(1),
-			TestWeightInfo::service_agendas_base()
-				+ TestWeightInfo::service_agenda_base(1)
-				+ <MarginalWeightInfo<Test>>::service_task(None, true, true)
-				+ TestWeightInfo::execute_dispatch_unsigned()
-				+ call_weight + Weight::from_ref_time(4)
-		);
-		assert_eq!(IncompleteSince::<Test>::get(), None);
-		assert_eq!(logger::log(), vec![(root(), 2600u32)]);
-
-		// Will include anon and anon periodic
-		assert_eq!(
-			Scheduler::on_initialize(2),
-			TestWeightInfo::service_agendas_base()
-				+ TestWeightInfo::service_agenda_base(2)
-				+ <MarginalWeightInfo<Test>>::service_task(None, false, true)
-				+ TestWeightInfo::execute_dispatch_unsigned()
-				+ call_weight + Weight::from_ref_time(3)
-				+ <MarginalWeightInfo<Test>>::service_task(None, false, false)
-				+ TestWeightInfo::execute_dispatch_unsigned()
-				+ call_weight + Weight::from_ref_time(2)
-		);
-		assert_eq!(IncompleteSince::<Test>::get(), None);
-		assert_eq!(
-			logger::log(),
-			vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32)]
-		);
-
-		// Will include named only
-		assert_eq!(
-			Scheduler::on_initialize(3),
-			TestWeightInfo::service_agendas_base()
-				+ TestWeightInfo::service_agenda_base(1)
-				+ <MarginalWeightInfo<Test>>::service_task(None, true, false)
-				+ TestWeightInfo::execute_dispatch_unsigned()
-				+ call_weight + Weight::from_ref_time(1)
-		);
-		assert_eq!(IncompleteSince::<Test>::get(), None);
-		assert_eq!(
-			logger::log(),
-			vec![
-				(root(), 2600u32),
-				(root(), 69u32),
-				(root(), 42u32),
-				(root(), 3u32)
-			]
-		);
-
-		// Will contain none
-		let actual_weight = Scheduler::on_initialize(4);
-		assert_eq!(
-			actual_weight,
-			TestWeightInfo::service_agendas_base() + TestWeightInfo::service_agenda_base(0)
-		);
-	});
-}
-
-#[test]
-fn root_calls_works() {
-	new_test_ext().execute_with(|| {
-		let call = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: Weight::from_ref_time(10),
-		}));
-		let call2 = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		}));
-		assert_ok!(Scheduler::schedule_named(
-			RuntimeOrigin::root(),
-			[1u8; 32],
-			4,
-			None,
-			Some(127),
-			call,
-		));
-		assert_ok!(Scheduler::schedule(
-			RuntimeOrigin::root(),
-			4,
-			None,
-			Some(127),
-			call2
-		));
-		run_to_block(3);
-		// Scheduled calls are in the agenda.
-		assert_eq!(Agenda::<Test>::get(4).agenda.len(), 2);
-		assert!(logger::log().is_empty());
-		assert_ok!(Scheduler::cancel_named(RuntimeOrigin::root(), [1u8; 32]));
-		assert_ok!(Scheduler::cancel(RuntimeOrigin::root(), 4, 1));
-		// Scheduled calls are made NONE, so should not effect state
-		run_to_block(100);
-		assert!(logger::log().is_empty());
-	});
-}
-
-#[test]
-fn fails_to_schedule_task_in_the_past() {
-	new_test_ext().execute_with(|| {
-		run_to_block(3);
-
-		let call1 = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: Weight::from_ref_time(10),
-		}));
-		let call2 = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		}));
-		let call3 = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		}));
-
-		assert_noop!(
-			Scheduler::schedule_named(RuntimeOrigin::root(), [1u8; 32], 2, None, Some(127), call1),
-			Error::<Test>::TargetBlockNumberInPast,
-		);
-
-		assert_noop!(
-			Scheduler::schedule(RuntimeOrigin::root(), 2, None, Some(127), call2),
-			Error::<Test>::TargetBlockNumberInPast,
-		);
-
-		assert_noop!(
-			Scheduler::schedule(RuntimeOrigin::root(), 3, None, Some(127), call3),
-			Error::<Test>::TargetBlockNumberInPast,
-		);
-	});
-}
-
-#[test]
-fn should_use_origin() {
-	new_test_ext().execute_with(|| {
-		let call = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: Weight::from_ref_time(10),
-		}));
-		let call2 = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		}));
-		assert_ok!(Scheduler::schedule_named(
-			system::RawOrigin::Signed(1).into(),
-			[1u8; 32],
-			4,
-			None,
-			None,
-			call,
-		));
-		assert_ok!(Scheduler::schedule(
-			system::RawOrigin::Signed(1).into(),
-			4,
-			None,
-			None,
-			call2,
-		));
-		run_to_block(3);
-		// Scheduled calls are in the agenda.
-		assert_eq!(Agenda::<Test>::get(4).agenda.len(), 2);
-		assert!(logger::log().is_empty());
-		assert_ok!(Scheduler::cancel_named(
-			system::RawOrigin::Signed(1).into(),
-			[1u8; 32]
-		));
-		assert_ok!(Scheduler::cancel(system::RawOrigin::Signed(1).into(), 4, 1));
-		// Scheduled calls are made NONE, so should not effect state
-		run_to_block(100);
-		assert!(logger::log().is_empty());
-	});
-}
-
-#[test]
-fn should_check_origin() {
-	new_test_ext().execute_with(|| {
-		let call = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 69,
-			weight: Weight::from_ref_time(10),
-		}));
-		let call2 = Box::new(RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		}));
-		assert_noop!(
-			Scheduler::schedule_named(
-				system::RawOrigin::Signed(2).into(),
-				[1u8; 32],
-				4,
-				None,
-				None,
-				call
-			),
-			BadOrigin
-		);
-		assert_noop!(
-			Scheduler::schedule(system::RawOrigin::Signed(2).into(), 4, None, None, call2),
-			BadOrigin
-		);
-	});
-}
-
-#[test]
-fn should_check_origin_for_cancel() {
-	new_test_ext().execute_with(|| {
-		let call = Box::new(RuntimeCall::Logger(LoggerCall::log_without_filter {
-			i: 69,
-			weight: Weight::from_ref_time(10),
-		}));
-		let call2 = Box::new(RuntimeCall::Logger(LoggerCall::log_without_filter {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		}));
-		assert_ok!(Scheduler::schedule_named(
-			system::RawOrigin::Signed(1).into(),
-			[1u8; 32],
-			4,
-			None,
-			None,
-			call,
-		));
-		assert_ok!(Scheduler::schedule(
-			system::RawOrigin::Signed(1).into(),
-			4,
-			None,
-			None,
-			call2,
-		));
-		run_to_block(3);
-		// Scheduled calls are in the agenda.
-		assert_eq!(Agenda::<Test>::get(4).agenda.len(), 2);
-		assert!(logger::log().is_empty());
-		assert_noop!(
-			Scheduler::cancel_named(system::RawOrigin::Signed(2).into(), [1u8; 32]),
-			BadOrigin
-		);
-		assert_noop!(
-			Scheduler::cancel(system::RawOrigin::Signed(2).into(), 4, 1),
-			BadOrigin
-		);
-		assert_noop!(
-			Scheduler::cancel_named(system::RawOrigin::Root.into(), [1u8; 32]),
-			BadOrigin
-		);
-		assert_noop!(
-			Scheduler::cancel(system::RawOrigin::Root.into(), 4, 1),
-			BadOrigin
-		);
-		run_to_block(5);
-		assert_eq!(
-			logger::log(),
-			vec![
-				(system::RawOrigin::Signed(1).into(), 69u32),
-				(system::RawOrigin::Signed(1).into(), 42u32)
-			]
-		);
-	});
-}
-
-/// Cancelling a call and then scheduling a second call for the same
-/// block results in different addresses.
-#[test]
-fn schedule_does_not_resuse_addr() {
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		});
-
-		// Schedule both calls.
-		let addr_1 = Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call.clone()).unwrap(),
-		)
-		.unwrap();
-		// Cancel the call.
-		assert_ok!(Scheduler::do_cancel(None, addr_1));
-		let addr_2 = Scheduler::do_schedule(
-			DispatchTime::At(4),
-			None,
-			127,
-			root(),
-			<ScheduledCall<Test>>::new(call).unwrap(),
-		)
-		.unwrap();
-
-		// Should not re-use the address.
-		assert!(addr_1 != addr_2);
-	});
-}
-
-#[test]
-fn schedule_agenda_overflows() {
-	let max: u32 = <Test as Config>::MaxScheduledPerBlock::get();
-
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		});
-		let call = <ScheduledCall<Test>>::new(call).unwrap();
-
-		// Schedule the maximal number allowed per block.
-		for _ in 0..max {
-			Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call.clone()).unwrap();
-		}
-
-		// One more time and it errors.
-		assert_noop!(
-			Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call,),
-			<Error<Test>>::AgendaIsExhausted,
-		);
-
-		run_to_block(4);
-		// All scheduled calls are executed.
-		assert_eq!(logger::log().len() as u32, max);
-	});
-}
-
-/// Cancelling and scheduling does not overflow the agenda but fills holes.
-#[test]
-fn cancel_and_schedule_fills_holes() {
-	let max: u32 = <Test as Config>::MaxScheduledPerBlock::get();
-	assert!(
-		max > 3,
-		"This test only makes sense for MaxScheduledPerBlock > 3"
-	);
-
-	new_test_ext().execute_with(|| {
-		let call = RuntimeCall::Logger(LoggerCall::log {
-			i: 42,
-			weight: Weight::from_ref_time(10),
-		});
-		let call = <ScheduledCall<Test>>::new(call).unwrap();
-		let mut addrs = Vec::<_>::default();
-
-		// Schedule the maximal number allowed per block.
-		for _ in 0..max {
-			addrs.push(
-				Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call.clone())
-					.unwrap(),
-			);
-		}
-		// Cancel three of them.
-		for addr in addrs.into_iter().take(3) {
-			Scheduler::do_cancel(None, addr).unwrap();
-		}
-		// Schedule three new ones.
-		for i in 0..3 {
-			let (_block, index) =
-				Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call.clone())
-					.unwrap();
-			assert_eq!(i, index);
-		}
-
-		run_to_block(4);
-		// Maximum number of calls are executed.
-		assert_eq!(logger::log().len() as u32, max);
-	});
-}
-
-#[test]
-fn cannot_schedule_too_big_tasks() {
-	new_test_ext().execute_with(|| {
-		let call = Box::new(<<Test as Config>::RuntimeCall>::from(SystemCall::remark {
-			remark: vec![0; EncodedCall::bound() - 4],
-		}));
-
-		assert_ok!(Scheduler::schedule(
-			RuntimeOrigin::root(),
-			4,
-			None,
-			Some(127),
-			call
-		));
-
-		let call = Box::new(<<Test as Config>::RuntimeCall>::from(SystemCall::remark {
-			remark: vec![0; EncodedCall::bound() - 3],
-		}));
-
-		assert_err!(
-			Scheduler::schedule(RuntimeOrigin::root(), 4, None, Some(127), call),
-			<Error<Test>>::TooBigScheduledCall
-		);
-	});
-}
deletedpallets/scheduler-v2/src/weights.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/weights.rs
+++ /dev/null
@@ -1,234 +0,0 @@
-// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
-
-//! Autogenerated weights for pallet_unique_scheduler_v2
-//!
-//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2022-10-28, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
-
-// Executed Command:
-// target/release/unique-collator
-// benchmark
-// pallet
-// --pallet
-// pallet-unique-scheduler-v2
-// --wasm-execution
-// compiled
-// --extrinsic
-// *
-// --template
-// .maintain/frame-weight-template.hbs
-// --steps=50
-// --repeat=80
-// --heap-pages=4096
-// --output=./pallets/scheduler-v2/src/weights.rs
-
-#![cfg_attr(rustfmt, rustfmt_skip)]
-#![allow(unused_parens)]
-#![allow(unused_imports)]
-#![allow(missing_docs)]
-#![allow(clippy::unnecessary_cast)]
-
-use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
-use sp_std::marker::PhantomData;
-
-/// Weight functions needed for pallet_unique_scheduler_v2.
-pub trait WeightInfo {
-	fn service_agendas_base() -> Weight;
-	fn service_agenda_base(s: u32, ) -> Weight;
-	fn service_task_base() -> 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;
-	fn change_named_priority(s: u32, ) -> Weight;
-}
-
-/// Weights for pallet_unique_scheduler_v2 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(5_253_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)
-	fn service_agenda_base(s: u32, ) -> Weight {
-		Weight::from_ref_time(3_858_000 as u64)
-			// Standard Error: 2_617
-			.saturating_add(Weight::from_ref_time(579_704 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: System LastRuntimeUpgrade (r:1 w:0)
-	fn service_task_base() -> Weight {
-		Weight::from_ref_time(10_536_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-	}
-	// Storage: System LastRuntimeUpgrade (r:1 w:0)
-	// Storage: Scheduler Lookup (r:0 w:1)
-	fn service_task_named() -> Weight {
-		Weight::from_ref_time(12_018_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-			.saturating_add(T::DbWeight::get().writes(1 as u64))
-	}
-	// Storage: System LastRuntimeUpgrade (r:1 w:0)
-	fn service_task_periodic() -> Weight {
-		Weight::from_ref_time(10_669_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-	}
-	// Storage: System Account (r:1 w:1)
-	// Storage: System AllExtrinsicsLen (r:1 w:1)
-	// Storage: System BlockWeight (r:1 w:1)
-	// Storage: Configuration WeightToFeeCoefficientOverride (r:1 w:0)
-	// Storage: TransactionPayment NextFeeMultiplier (r:1 w:0)
-	fn execute_dispatch_signed() -> Weight {
-		Weight::from_ref_time(36_083_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(5 as u64))
-			.saturating_add(T::DbWeight::get().writes(3 as u64))
-	}
-	fn execute_dispatch_unsigned() -> Weight {
-		Weight::from_ref_time(4_386_000 as u64)
-	}
-	// Storage: Scheduler Agenda (r:1 w:1)
-	fn schedule(s: u32, ) -> Weight {
-		Weight::from_ref_time(17_257_000 as u64)
-			// Standard Error: 2_791
-			.saturating_add(Weight::from_ref_time(574_832 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)
-	fn cancel(s: u32, ) -> Weight {
-		Weight::from_ref_time(19_803_000 as u64)
-			// Standard Error: 1_177
-			.saturating_add(Weight::from_ref_time(475_027 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)
-	fn schedule_named(s: u32, ) -> Weight {
-		Weight::from_ref_time(18_746_000 as u64)
-			// Standard Error: 2_997
-			.saturating_add(Weight::from_ref_time(635_697 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)
-	fn cancel_named(s: u32, ) -> Weight {
-		Weight::from_ref_time(20_983_000 as u64)
-			// Standard Error: 1_850
-			.saturating_add(Weight::from_ref_time(518_812 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:0)
-	// Storage: Scheduler Agenda (r:1 w:1)
-	fn change_named_priority(s: u32, ) -> Weight {
-		Weight::from_ref_time(21_591_000 as u64)
-			// Standard Error: 4_187
-			.saturating_add(Weight::from_ref_time(531_231 as u64).saturating_mul(s as u64))
-			.saturating_add(T::DbWeight::get().reads(2 as u64))
-			.saturating_add(T::DbWeight::get().writes(1 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(5_253_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)
-	fn service_agenda_base(s: u32, ) -> Weight {
-		Weight::from_ref_time(3_858_000 as u64)
-			// Standard Error: 2_617
-			.saturating_add(Weight::from_ref_time(579_704 as u64).saturating_mul(s as u64))
-			.saturating_add(RocksDbWeight::get().reads(1 as u64))
-			.saturating_add(RocksDbWeight::get().writes(1 as u64))
-	}
-	// Storage: System LastRuntimeUpgrade (r:1 w:0)
-	fn service_task_base() -> Weight {
-		Weight::from_ref_time(10_536_000 as u64)
-			.saturating_add(RocksDbWeight::get().reads(1 as u64))
-	}
-	// Storage: System LastRuntimeUpgrade (r:1 w:0)
-	// Storage: Scheduler Lookup (r:0 w:1)
-	fn service_task_named() -> Weight {
-		Weight::from_ref_time(12_018_000 as u64)
-			.saturating_add(RocksDbWeight::get().reads(1 as u64))
-			.saturating_add(RocksDbWeight::get().writes(1 as u64))
-	}
-	// Storage: System LastRuntimeUpgrade (r:1 w:0)
-	fn service_task_periodic() -> Weight {
-		Weight::from_ref_time(10_669_000 as u64)
-			.saturating_add(RocksDbWeight::get().reads(1 as u64))
-	}
-	// Storage: System Account (r:1 w:1)
-	// Storage: System AllExtrinsicsLen (r:1 w:1)
-	// Storage: System BlockWeight (r:1 w:1)
-	// Storage: Configuration WeightToFeeCoefficientOverride (r:1 w:0)
-	// Storage: TransactionPayment NextFeeMultiplier (r:1 w:0)
-	fn execute_dispatch_signed() -> Weight {
-		Weight::from_ref_time(36_083_000 as u64)
-			.saturating_add(RocksDbWeight::get().reads(5 as u64))
-			.saturating_add(RocksDbWeight::get().writes(3 as u64))
-	}
-	fn execute_dispatch_unsigned() -> Weight {
-		Weight::from_ref_time(4_386_000 as u64)
-	}
-	// Storage: Scheduler Agenda (r:1 w:1)
-	fn schedule(s: u32, ) -> Weight {
-		Weight::from_ref_time(17_257_000 as u64)
-			// Standard Error: 2_791
-			.saturating_add(Weight::from_ref_time(574_832 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)
-	fn cancel(s: u32, ) -> Weight {
-		Weight::from_ref_time(19_803_000 as u64)
-			// Standard Error: 1_177
-			.saturating_add(Weight::from_ref_time(475_027 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)
-	fn schedule_named(s: u32, ) -> Weight {
-		Weight::from_ref_time(18_746_000 as u64)
-			// Standard Error: 2_997
-			.saturating_add(Weight::from_ref_time(635_697 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)
-	fn cancel_named(s: u32, ) -> Weight {
-		Weight::from_ref_time(20_983_000 as u64)
-			// Standard Error: 1_850
-			.saturating_add(Weight::from_ref_time(518_812 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:0)
-	// Storage: Scheduler Agenda (r:1 w:1)
-	fn change_named_priority(s: u32, ) -> Weight {
-		Weight::from_ref_time(21_591_000 as u64)
-			// Standard Error: 4_187
-			.saturating_add(Weight::from_ref_time(531_231 as u64).saturating_mul(s as u64))
-			.saturating_add(RocksDbWeight::get().reads(2 as u64))
-			.saturating_add(RocksDbWeight::get().writes(1 as u64))
-	}
-}
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -329,7 +329,6 @@
 pallet-refungible = { workspace = true }
 pallet-structure = { workspace = true }
 pallet-unique = { workspace = true }
-pallet-unique-scheduler-v2 = { workspace = true }
 precompile-utils-macro = { workspace = true }
 scale-info = { workspace = true }
 up-common = { workspace = true }
modifiedtest-pallets/utils/Cargo.tomldiffbeforeafterboth
--- a/test-pallets/utils/Cargo.toml
+++ b/test-pallets/utils/Cargo.toml
@@ -12,8 +12,6 @@
 frame-support = { workspace = true }
 frame-system = { workspace = true }
 scale-info = { workspace = true }
-# pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
-pallet-unique-scheduler-v2 = { workspace = true }
 sp-std = { workspace = true }
 
 [features]
@@ -22,7 +20,6 @@
 	"codec/std",
 	"frame-support/std",
 	"frame-system/std",
-	"pallet-unique-scheduler-v2/std",
 	"scale-info/std",
 	"sp-std/std",
 ]
modifiedtest-pallets/utils/src/lib.rsdiffbeforeafterboth
--- a/test-pallets/utils/src/lib.rs
+++ b/test-pallets/utils/src/lib.rs
@@ -29,7 +29,6 @@
 	};
 	use frame_system::pallet_prelude::*;
 	use sp_std::vec::Vec;
-	// use pallet_unique_scheduler_v2::{TaskName, Pallet as SchedulerPallet};
 
 	#[pallet::config]
 	pub trait Config: frame_system::Config /*+ pallet_unique_scheduler_v2::Config*/ {