git.delta.rocks / unique-network / refs/commits / 95c1ed5151b9

difftreelog

Scheduler benchmarks fixed. Useless code in pallet was removed.

Dev2022-06-09parent: #c557492.patch.diff
in: master

4 files changed

modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -93,5 +93,9 @@
 bench-structure:
 	make _bench PALLET=structure
 
+.PHONY: bench-scheduler
+bench-scheduler:
+	make _bench PALLET=unq-scheduler	
+
 .PHONY: bench
-bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible
+bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -3,12 +3,13 @@
 //! Autogenerated weights for pallet_fungible
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2022-03-01, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2022-06-09, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
 
 // Executed Command:
 // target/release/unique-collator
 // benchmark
+// pallet
 // --pallet
 // pallet-fungible
 // --wasm-execution
@@ -47,16 +48,16 @@
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:1 w:1)
 	fn create_item() -> Weight {
-		(14_407_000 as Weight)
+		(40_678_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
 	}
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:4 w:4)
 	fn create_multiple_items_ex(b: u32, ) -> Weight {
-		(13_030_000 as Weight)
-			// Standard Error: 1_000
-			.saturating_add((3_779_000 as Weight).saturating_mul(b as Weight))
+		(13_036_000 as Weight)
+			// Standard Error: 9_000
+			.saturating_add((15_611_000 as Weight).saturating_mul(b as Weight))
 			.saturating_add(T::DbWeight::get().reads(1 as Weight))
 			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
 			.saturating_add(T::DbWeight::get().writes(1 as Weight))
@@ -65,28 +66,27 @@
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:1 w:1)
 	fn burn_item() -> Weight {
-		(15_565_000 as Weight)
+		(42_340_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
 	}
-
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer() -> Weight {
-		(17_713_000 as Weight)
+		(47_321_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
 	}
 	// Storage: Fungible Balance (r:1 w:0)
 	// Storage: Fungible Allowance (r:0 w:1)
 	fn approve() -> Weight {
-		(14_834_000 as Weight)
+		(38_385_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(1 as Weight))
 			.saturating_add(T::DbWeight::get().writes(1 as Weight))
 	}
 	// Storage: Fungible Allowance (r:1 w:1)
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer_from() -> Weight {
-		(25_189_000 as Weight)
+		(69_001_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(3 as Weight))
 			.saturating_add(T::DbWeight::get().writes(3 as Weight))
 	}
@@ -94,7 +94,7 @@
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:1 w:1)
 	fn burn_from() -> Weight {
-		(24_065_000 as Weight)
+		(63_996_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(3 as Weight))
 			.saturating_add(T::DbWeight::get().writes(3 as Weight))
 	}
@@ -105,16 +105,16 @@
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:1 w:1)
 	fn create_item() -> Weight {
-		(14_407_000 as Weight)
+		(40_678_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
 	}
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:4 w:4)
 	fn create_multiple_items_ex(b: u32, ) -> Weight {
-		(13_030_000 as Weight)
-			// Standard Error: 1_000
-			.saturating_add((3_779_000 as Weight).saturating_mul(b as Weight))
+		(13_036_000 as Weight)
+			// Standard Error: 9_000
+			.saturating_add((15_611_000 as Weight).saturating_mul(b as Weight))
 			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
 			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
 			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
@@ -123,28 +123,27 @@
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:1 w:1)
 	fn burn_item() -> Weight {
-		(15_565_000 as Weight)
+		(42_340_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
 	}
-
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer() -> Weight {
-		(17_713_000 as Weight)
+		(47_321_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
 	}
 	// Storage: Fungible Balance (r:1 w:0)
 	// Storage: Fungible Allowance (r:0 w:1)
 	fn approve() -> Weight {
-		(14_834_000 as Weight)
+		(38_385_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
 	}
 	// Storage: Fungible Allowance (r:1 w:1)
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer_from() -> Weight {
-		(25_189_000 as Weight)
+		(69_001_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(3 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(3 as Weight))
 	}
@@ -152,7 +151,7 @@
 	// Storage: Fungible TotalSupply (r:1 w:1)
 	// Storage: Fungible Balance (r:1 w:1)
 	fn burn_from() -> Weight {
-		(24_065_000 as Weight)
+		(63_996_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(3 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(3 as Weight))
 	}
modifiedpallets/scheduler/src/benchmarking.rsdiffbeforeafterboth
before · pallets/scheduler/src/benchmarking.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license18// This file is part of Substrate.1920// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// 	http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435//! Scheduler pallet benchmarking.3637#![cfg(feature = "runtime-benchmarks")]3839use super::*;40use sp_std::{vec, prelude::*};41use frame_system::RawOrigin;42use frame_support::{ensure, traits::OnInitialize};43use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};4445use crate::Module as Scheduler;46use frame_system::Pallet as System;4748const BLOCK_NUMBER: u32 = 2;4950// Add `n` named items to the schedule51fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {52	// Essentially a no-op call.53	let call = frame_system::Call::set_storage { items: vec![] };54	for i in 0..n {55		// Named schedule is strictly heavier than anonymous56		Scheduler::<T>::do_schedule_named(57			i.encode(),58			DispatchTime::At(when),59			// Add periodicity60			Some((T::BlockNumber::one(), 100)),61			// HARD_DEADLINE priority means it gets executed no matter what62			0,63			frame_system::RawOrigin::Root.into(),64			call.clone().into(),65		)?;66	}67	ensure!(68		Agenda::<T>::get(when).len() == n as usize,69		"didn't fill schedule"70	);71	Ok(())72}7374benchmarks! {75	schedule {76		let s in 0 .. T::MaxScheduledPerBlock::get();77		let when = BLOCK_NUMBER.into();78		let periodic = Some((T::BlockNumber::one(), 100));79		let priority = 0;80		// Essentially a no-op call.81		let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());8283		fill_schedule::<T>(when, s)?;84	}: _(RawOrigin::Root, when, periodic, priority, call)85	verify {86		ensure!(87			Agenda::<T>::get(when).len() == (s + 1) as usize,88			"didn't add to schedule"89		);90	}9192	cancel {93		let s in 1 .. T::MaxScheduledPerBlock::get();94		let when = BLOCK_NUMBER.into();9596		fill_schedule::<T>(when, s)?;97		assert_eq!(Agenda::<T>::get(when).len(), s as usize);98	}: _(RawOrigin::Root, when, 0)99	verify {100		ensure!(101			Lookup::<T>::get(0.encode()).is_none(),102			"didn't remove from lookup"103		);104		// Removed schedule is NONE105		ensure!(106			Agenda::<T>::get(when)[0].is_none(),107			"didn't remove from schedule"108		);109	}110111	schedule_named {112		let s in 0 .. T::MaxScheduledPerBlock::get();113		let id = s.encode();114		let when = BLOCK_NUMBER.into();115		let periodic = Some((T::BlockNumber::one(), 100));116		let priority = 0;117		// Essentially a no-op call.118		let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());119120		fill_schedule::<T>(when, s)?;121	}: _(RawOrigin::Root, id, when, periodic, priority, call)122	verify {123		ensure!(124			Agenda::<T>::get(when).len() == (s + 1) as usize,125			"didn't add to schedule"126		);127	}128129	cancel_named {130		let s in 1 .. T::MaxScheduledPerBlock::get();131		let when = BLOCK_NUMBER.into();132133		fill_schedule::<T>(when, s)?;134	}: _(RawOrigin::Root, 0.encode())135	verify {136		ensure!(137			Lookup::<T>::get(0.encode()).is_none(),138			"didn't remove from lookup"139		);140		// Removed schedule is NONE141		ensure!(142			Agenda::<T>::get(when)[0].is_none(),143			"didn't remove from schedule"144		);145	}146147	// TODO [#7141]: Make this more complex and flexible so it can be used in automation.148	#[extra]149	on_initialize {150		let s in 0 .. T::MaxScheduledPerBlock::get();151		let when = BLOCK_NUMBER.into();152		fill_schedule::<T>(when, s)?;153	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }154	verify {155		assert_eq!(System::<T>::event_count(), s);156		// Next block should have all the schedules again157		ensure!(158			Agenda::<T>::get(when + T::BlockNumber::one()).len() == s as usize,159			"didn't append schedule"160		);161	}162}163164impl_benchmark_test_suite!(Scheduler, crate::tests::new_test_ext(), crate::tests::Test,);
after · pallets/scheduler/src/benchmarking.rs
1// This file is part of Substrate.23// Copyright (C) 2020-2022 Parity Technologies (UK) Ltd.4// SPDX-License-Identifier: Apache-2.056// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// 	http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.1718//! Scheduler pallet benchmarking.1920use super::*;21use frame_benchmarking::benchmarks;22use frame_support::{23	ensure,24	traits::{OnInitialize, PreimageProvider, PreimageRecipient},25};26use frame_system::RawOrigin;27use sp_runtime::traits::Hash;28use sp_std::{prelude::*, vec};2930use crate::Pallet as Scheduler;31use frame_system::Pallet as System;3233const BLOCK_NUMBER: u32 = 2;3435/// Add `n` named items to the schedule.36///37/// For `resolved`:38/// - `None`: aborted (hash without preimage)39/// - `Some(true)`: hash resolves into call if possible, plain call otherwise40/// - `Some(false)`: plain call41fn fill_schedule<T: Config>(42	when: T::BlockNumber,43	n: u32,44	periodic: bool,45	named: bool,46	resolved: Option<bool>,47) -> Result<(), &'static str> {48	for i in 0..n {49		// Named schedule is strictly heavier than anonymous50		let (call, hash) = call_and_hash::<T>(i);51		let call_or_hash = match resolved {52			Some(true) => {53				T::PreimageProvider::note_preimage(call.encode().try_into().unwrap());54				if T::PreimageProvider::have_preimage(&hash) {55					CallOrHashOf::<T>::Hash(hash)56				} else {57					call.into()58				}59			},60			Some(false) => call.into(),61			None => CallOrHashOf::<T>::Hash(hash),62		};63		let period = match periodic {64			true => Some(((i + 100).into(), 100)),65			false => None,66		};67		let t = DispatchTime::At(when);68		let origin = frame_system::RawOrigin::Root.into();69		if named {70			Scheduler::<T>::do_schedule_named(i.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]),71			t, period, 0, origin, call_or_hash)?;72		} else {73			Scheduler::<T>::do_schedule(t, period, 0, origin, call_or_hash)?;74		}75	}76	ensure!(Agenda::<T>::get(when).len() == n as usize, "didn't fill schedule");77	Ok(())78}7980fn call_and_hash<T: Config>(i: u32) -> (<T as Config>::Call, T::Hash) {81	// Essentially a no-op call.82	let call: <T as Config>::Call = frame_system::Call::remark { remark: i.encode() }.into();83	let hash = T::Hashing::hash_of(&call);84	(call, hash)85}868788benchmarks! {89	on_initialize_periodic_named_resolved {90		let s in 1 .. T::MaxScheduledPerBlock::get();91		let when = BLOCK_NUMBER.into();92		fill_schedule::<T>(when, s, true, true, Some(true))?;93	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }94	verify {95		assert_eq!(System::<T>::event_count(), s * 2);96		for i in 0..s {97			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);98		}99	}100101	on_initialize_named_resolved {102		let s in 1 .. T::MaxScheduledPerBlock::get();103		let when = BLOCK_NUMBER.into();104		fill_schedule::<T>(when, s, false, true, Some(true))?;105	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }106	verify {107		assert_eq!(System::<T>::event_count(), s * 2);108		assert!(Agenda::<T>::iter().count() == 0);109	}110111	on_initialize_periodic_resolved {112		let s in 1 .. T::MaxScheduledPerBlock::get();113		let when = BLOCK_NUMBER.into();114		fill_schedule::<T>(when, s, true, false, Some(true))?;115	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }116	verify {117		assert_eq!(System::<T>::event_count(), s * 2);118		for i in 0..s {119			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);120		}121	}122123	on_initialize_resolved {124		let s in 1 .. T::MaxScheduledPerBlock::get();125		let when = BLOCK_NUMBER.into();126		fill_schedule::<T>(when, s, false, false, Some(true))?;127	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }128	verify {129		assert_eq!(System::<T>::event_count(), s * 2);130		assert!(Agenda::<T>::iter().count() == 0);131	}132133	on_initialize_named_aborted {134		let s in 1 .. T::MaxScheduledPerBlock::get();135		let when = BLOCK_NUMBER.into();136		fill_schedule::<T>(when, s, false, true, None)?;137	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }138	verify {139		assert_eq!(System::<T>::event_count(), 0);140		if let Some(delay) = T::NoPreimagePostponement::get() {141			assert_eq!(Agenda::<T>::get(when + delay).len(), s as usize);142		} else {143			assert!(Agenda::<T>::iter().count() == 0);144		}145	}146147	on_initialize_aborted {148		let s in 1 .. T::MaxScheduledPerBlock::get();149		let when = BLOCK_NUMBER.into();150		fill_schedule::<T>(when, s, false, false, None)?;151	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }152	verify {153		assert_eq!(System::<T>::event_count(), 0);154		if let Some(delay) = T::NoPreimagePostponement::get() {155			assert_eq!(Agenda::<T>::get(when + delay).len(), s as usize);156		} else {157			assert!(Agenda::<T>::iter().count() == 0);158		}159	}160161	on_initialize_periodic_named {162		let s in 1 .. T::MaxScheduledPerBlock::get();163		let when = BLOCK_NUMBER.into();164		fill_schedule::<T>(when, s, true, true, Some(false))?;165	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }166	verify {167		assert_eq!(System::<T>::event_count(), s);168		for i in 0..s {169			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);170		}171	}172173	on_initialize_periodic {174		let s in 1 .. T::MaxScheduledPerBlock::get();175		let when = BLOCK_NUMBER.into();176		fill_schedule::<T>(when, s, true, false, Some(false))?;177	}: { Scheduler::<T>::on_initialize(when); }178	verify {179		assert_eq!(System::<T>::event_count(), s);180		for i in 0..s {181			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);182		}183	}184185	on_initialize_named {186		let s in 1 .. T::MaxScheduledPerBlock::get();187		let when = BLOCK_NUMBER.into();188		fill_schedule::<T>(when, s, false, true, Some(false))?;189	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }190	verify {191		assert_eq!(System::<T>::event_count(), s);192		assert!(Agenda::<T>::iter().count() == 0);193	}194195	on_initialize {196		let s in 1 .. T::MaxScheduledPerBlock::get();197		let when = BLOCK_NUMBER.into();198		fill_schedule::<T>(when, s, false, false, Some(false))?;199	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }200	verify {201		assert_eq!(System::<T>::event_count(), s);202		assert!(Agenda::<T>::iter().count() == 0);203	}204205	schedule_named {206		let s in 0 .. T::MaxScheduledPerBlock::get();207		let id = s.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);208		let when = BLOCK_NUMBER.into();209		let periodic = Some((T::BlockNumber::one(), 100));210		let priority = 0;211		// Essentially a no-op call.212		let inner_call = frame_system::Call::set_storage { items: vec![] }.into();213		let call = Box::new(CallOrHashOf::<T>::Value(inner_call));214215		fill_schedule::<T>(when, s, true, true, Some(false))?;216	}: _(RawOrigin::Root, id, when, periodic, priority, call)217	verify {218		ensure!(219			Agenda::<T>::get(when).len() == (s + 1) as usize,220			"didn't add to schedule"221		);222	}223224	cancel_named {225		let s in 1 .. T::MaxScheduledPerBlock::get();226		let when = BLOCK_NUMBER.into();227		let id = 0.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);228229		fill_schedule::<T>(when, s, true, true, Some(false))?;230	}: _(RawOrigin::Root, id)231	verify {232		ensure!(233			Lookup::<T>::get(id).is_none(),234			"didn't remove from lookup"235		);236		// Removed schedule is NONE237		ensure!(238			Agenda::<T>::get(when)[0].is_none(),239			"didn't remove from schedule"240		);241	}242243	impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);244}
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -60,9 +60,8 @@
 // Ensure we're `no_std` when compiling for Wasm.
 #![cfg_attr(not(feature = "std"), no_std)]
 
-// FIXME
-// #[cfg(feature = "runtime-benchmarks")]
-// mod benchmarking;
+#[cfg(feature = "runtime-benchmarks")]
+mod benchmarking;
 
 pub mod weights;
 
@@ -639,66 +638,7 @@
 
 		Ok((when, index))
 	}
-
-	fn do_cancel(
-		origin: Option<T::PalletsOrigin>,
-		(when, index): TaskAddress<T::BlockNumber>,
-	) -> Result<(), DispatchError> {
-		let scheduled = Agenda::<T>::try_mutate(when, |agenda| {
-			agenda.get_mut(index as usize).map_or(
-				Ok(None),
-				|s| -> Result<Option<Scheduled<_, _, _, _>>, DispatchError> {
-					if let (Some(ref o), Some(ref s)) = (origin, s.borrow()) {
-						if matches!(
-							T::OriginPrivilegeCmp::cmp_privilege(o, &s.origin),
-							Some(Ordering::Less) | None
-						) {
-							return Err(BadOrigin.into());
-						}
-					};
-					Ok(s.take())
-				},
-			)
-		})?;
-		if let Some(s) = scheduled {
-			s.call.ensure_unrequested::<T::PreimageProvider>();
-			if let Some(id) = s.maybe_id {
-				Lookup::<T>::remove(id);
-			}
-			Self::deposit_event(Event::Canceled { when, index });
-			Ok(())
-		} else {
-			Err(Error::<T>::NotFound)?
-		}
-	}
-
-	fn do_reschedule(
-		(when, index): TaskAddress<T::BlockNumber>,
-		new_time: DispatchTime<T::BlockNumber>,
-	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
-		let new_time = Self::resolve_time(new_time)?;
-
-		if new_time == when {
-			return Err(Error::<T>::RescheduleNoChange.into());
-		}
 
-		Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {
-			let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;
-			let task = task.take().ok_or(Error::<T>::NotFound)?;
-			Agenda::<T>::append(new_time, Some(task));
-			Ok(())
-		})?;
-
-		let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;
-		Self::deposit_event(Event::Canceled { when, index });
-		Self::deposit_event(Event::Scheduled {
-			when: new_time,
-			index: new_index,
-		});
-
-		Ok((new_time, new_index))
-	}
-
 	fn do_schedule_named(
 		id: ScheduledId,
 		when: DispatchTime<T::BlockNumber>,
@@ -790,124 +730,3 @@
 			}
 		})
 	}
-
-	fn do_reschedule_named(
-		id: ScheduledId,
-		new_time: DispatchTime<T::BlockNumber>,
-	) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
-		let new_time = Self::resolve_time(new_time)?;
-
-		Lookup::<T>::try_mutate_exists(
-			id,
-			|lookup| -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
-				let (when, index) = lookup.ok_or(Error::<T>::NotFound)?;
-
-				if new_time == when {
-					return Err(Error::<T>::RescheduleNoChange.into());
-				}
-
-				Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {
-					let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;
-					let task = task.take().ok_or(Error::<T>::NotFound)?;
-					Agenda::<T>::append(new_time, Some(task));
-
-					Ok(())
-				})?;
-
-				let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;
-				Self::deposit_event(Event::Canceled { when, index });
-				Self::deposit_event(Event::Scheduled {
-					when: new_time,
-					index: new_index,
-				});
-
-				*lookup = Some((new_time, new_index));
-
-				Ok((new_time, new_index))
-			},
-		)
-	}
-}
-
-impl<T: Config> schedule::v2::Anon<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>
-	for Pallet<T>
-{
-	type Address = TaskAddress<T::BlockNumber>;
-	type Hash = T::Hash;
-
-	fn schedule(
-		when: DispatchTime<T::BlockNumber>,
-		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
-		priority: schedule::Priority,
-		origin: T::PalletsOrigin,
-		call: CallOrHashOf<T>,
-	) -> Result<Self::Address, DispatchError> {
-		Self::do_schedule(when, maybe_periodic, priority, origin, call)
-	}
-
-	fn cancel((when, index): Self::Address) -> Result<(), ()> {
-		Self::do_cancel(None, (when, index)).map_err(|_| ())
-	}
-
-	fn reschedule(
-		address: Self::Address,
-		when: DispatchTime<T::BlockNumber>,
-	) -> Result<Self::Address, DispatchError> {
-		Self::do_reschedule(address, when)
-	}
-
-	fn next_dispatch_time((when, index): Self::Address) -> Result<T::BlockNumber, ()> {
-		Agenda::<T>::get(when)
-			.get(index as usize)
-			.ok_or(())
-			.map(|_| when)
-	}
-}
-
-impl<T: Config> schedule::v2::Named<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>
-	for Pallet<T>
-{
-	type Address = TaskAddress<T::BlockNumber>;
-	type Hash = T::Hash;
-
-	fn schedule_named(
-		id: Vec<u8>,
-		when: DispatchTime<T::BlockNumber>,
-		maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
-		priority: schedule::Priority,
-		origin: T::PalletsOrigin,
-		call: CallOrHashOf<T>,
-	) -> Result<Self::Address, ()> {
-		let inner_id: ScheduledId = id
-			.try_into()
-			.unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
-		Self::do_schedule_named(inner_id, when, maybe_periodic, priority, origin, call)
-			.map_err(|_| ())
-	}
-
-	fn cancel_named(id: Vec<u8>) -> Result<(), ()> {
-		let inner_id: ScheduledId = id
-			.try_into()
-			.unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
-		Self::do_cancel_named(None, inner_id).map_err(|_| ())
-	}
-
-	fn reschedule_named(
-		id: Vec<u8>,
-		when: DispatchTime<T::BlockNumber>,
-	) -> Result<Self::Address, DispatchError> {
-		let inner_id: ScheduledId = id
-			.try_into()
-			.unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
-		Self::do_reschedule_named(inner_id, when)
-	}
-
-	fn next_dispatch_time(id: Vec<u8>) -> Result<T::BlockNumber, ()> {
-		let inner_id: ScheduledId = id
-			.try_into()
-			.unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
-		Lookup::<T>::get(inner_id)
-			.and_then(|(when, index)| Agenda::<T>::get(when).get(index as usize).map(|_| when))
-			.ok_or(())
-	}
-}