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
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
2// This file is part of Unique Network.
3
4// Unique Network is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Unique Network is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
16
17// Original license
18// This file is part of Substrate.1// This file is part of Substrate.
192
20// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.3// Copyright (C) 2020-2022 Parity Technologies (UK) Ltd.
21// SPDX-License-Identifier: Apache-2.04// SPDX-License-Identifier: Apache-2.0
225
23// Licensed under the Apache License, Version 2.0 (the "License");6// Licensed under the Apache License, Version 2.0 (the "License");
3417
35//! Scheduler pallet benchmarking.18//! Scheduler pallet benchmarking.
36
37#![cfg(feature = "runtime-benchmarks")]
3819
39use super::*;20use super::*;
21use frame_benchmarking::benchmarks;
40use sp_std::{vec, prelude::*};22use frame_support::{
23 ensure,
24 traits::{OnInitialize, PreimageProvider, PreimageRecipient},
25};
41use frame_system::RawOrigin;26use frame_system::RawOrigin;
42use frame_support::{ensure, traits::OnInitialize};27use sp_runtime::traits::Hash;
43use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};28use sp_std::{prelude::*, vec};
4429
45use crate::Module as Scheduler;30use crate::Pallet as Scheduler;
46use frame_system::Pallet as System;31use frame_system::Pallet as System;
4732
48const BLOCK_NUMBER: u32 = 2;33const BLOCK_NUMBER: u32 = 2;
4934
50// Add `n` named items to the schedule35/// 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 otherwise
40/// - `Some(false)`: plain call
51fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {41fn fill_schedule<T: Config>(
52 // Essentially a no-op call.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 anonymous
50 let (call, hash) = call_and_hash::<T>(i);
53 let call = frame_system::Call::set_storage { items: vec![] };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();
54 for i in 0..n {69 if named {
55 // Named schedule is strictly heavier than anonymous
56 Scheduler::<T>::do_schedule_named(70 Scheduler::<T>::do_schedule_named(i.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]),
57 i.encode(),
58 DispatchTime::At(when),
59 // Add periodicity
60 Some((T::BlockNumber::one(), 100)),
61 // HARD_DEADLINE priority means it gets executed no matter what
62 0,71 t, period, 0, origin, call_or_hash)?;
63 frame_system::RawOrigin::Root.into(),
64 call.clone().into(),
65 )?;
66 }72 } else {
73 Scheduler::<T>::do_schedule(t, period, 0, origin, call_or_hash)?;
74 }
75 }
67 ensure!(76 ensure!(Agenda::<T>::get(when).len() == n as usize, "didn't fill schedule");
68 Agenda::<T>::get(when).len() == n as usize,
69 "didn't fill schedule"
70 );
71 Ok(())77 Ok(())
72}78}
79
80fn 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}
86
7387
74benchmarks! {88benchmarks! {
75 schedule {89 on_initialize_periodic_named_resolved {
76 let s in 0 .. T::MaxScheduledPerBlock::get();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 }
100
101 on_initialize_named_resolved {
102 let s in 1 .. T::MaxScheduledPerBlock::get();
77 let when = BLOCK_NUMBER.into();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 }
110
111 on_initialize_periodic_resolved {
78 let periodic = Some((T::BlockNumber::one(), 100));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 }
122
123 on_initialize_resolved {
124 let s in 1 .. T::MaxScheduledPerBlock::get();
79 let priority = 0;125 let when = BLOCK_NUMBER.into();
80 // Essentially a no-op call.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 }
132
133 on_initialize_named_aborted {
134 let s in 1 .. T::MaxScheduledPerBlock::get();
81 let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());135 let when = BLOCK_NUMBER.into();
82136 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 }
146
147 on_initialize_aborted {
148 let s in 1 .. T::MaxScheduledPerBlock::get();
149 let when = BLOCK_NUMBER.into();
83 fill_schedule::<T>(when, s)?;150 fill_schedule::<T>(when, s, false, false, None)?;
84 }: _(RawOrigin::Root, when, periodic, priority, call)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 }
160
161 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()); }
85 verify {166 verify {
86 ensure!(167 assert_eq!(System::<T>::event_count(), s);
168 for i in 0..s {
87 Agenda::<T>::get(when).len() == (s + 1) as usize,169 assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
88 "didn't add to schedule"170 }
89 );
90 }171 }
91172
92 cancel {173 on_initialize_periodic {
93 let s in 1 .. T::MaxScheduledPerBlock::get();174 let s in 1 .. T::MaxScheduledPerBlock::get();
94 let when = BLOCK_NUMBER.into();175 let when = BLOCK_NUMBER.into();
95
96 fill_schedule::<T>(when, s)?;176 fill_schedule::<T>(when, s, true, false, Some(false))?;
177 }: { Scheduler::<T>::on_initialize(when); }
178 verify {
97 assert_eq!(Agenda::<T>::get(when).len(), s as usize);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 }
184
185 on_initialize_named {
98 }: _(RawOrigin::Root, when, 0)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()); }
99 verify {190 verify {
100 ensure!(191 assert_eq!(System::<T>::event_count(), s);
192 assert!(Agenda::<T>::iter().count() == 0);
193 }
194
195 on_initialize {
101 Lookup::<T>::get(0.encode()).is_none(),196 let s in 1 .. T::MaxScheduledPerBlock::get();
102 "didn't remove from lookup"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 {
103 );201 assert_eq!(System::<T>::event_count(), s);
104 // Removed schedule is NONE
105 ensure!(202 assert!(Agenda::<T>::iter().count() == 0);
106 Agenda::<T>::get(when)[0].is_none(),203 }
107 "didn't remove from schedule"
108 );
109 }
110204
111 schedule_named {205 schedule_named {
112 let s in 0 .. T::MaxScheduledPerBlock::get();206 let s in 0 .. T::MaxScheduledPerBlock::get();
113 let id = s.encode();207 let id = s.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
114 let when = BLOCK_NUMBER.into();208 let when = BLOCK_NUMBER.into();
115 let periodic = Some((T::BlockNumber::one(), 100));209 let periodic = Some((T::BlockNumber::one(), 100));
116 let priority = 0;210 let priority = 0;
117 // Essentially a no-op call.211 // Essentially a no-op call.
118 let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());212 let inner_call = frame_system::Call::set_storage { items: vec![] }.into();
213 let call = Box::new(CallOrHashOf::<T>::Value(inner_call));
119214
120 fill_schedule::<T>(when, s)?;215 fill_schedule::<T>(when, s, true, true, Some(false))?;
121 }: _(RawOrigin::Root, id, when, periodic, priority, call)216 }: _(RawOrigin::Root, id, when, periodic, priority, call)
122 verify {217 verify {
123 ensure!(218 ensure!(
129 cancel_named {224 cancel_named {
130 let s in 1 .. T::MaxScheduledPerBlock::get();225 let s in 1 .. T::MaxScheduledPerBlock::get();
131 let when = BLOCK_NUMBER.into();226 let when = BLOCK_NUMBER.into();
227 let id = 0.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
132228
133 fill_schedule::<T>(when, s)?;229 fill_schedule::<T>(when, s, true, true, Some(false))?;
134 }: _(RawOrigin::Root, 0.encode())230 }: _(RawOrigin::Root, id)
135 verify {231 verify {
136 ensure!(232 ensure!(
137 Lookup::<T>::get(0.encode()).is_none(),233 Lookup::<T>::get(id).is_none(),
138 "didn't remove from lookup"234 "didn't remove from lookup"
139 );235 );
140 // Removed schedule is NONE236 // Removed schedule is NONE
144 );240 );
145 }241 }
146242
147 // 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()); }243 impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);
154 verify {
155 assert_eq!(System::<T>::event_count(), s);
156 // Next block should have all the schedules again
157 ensure!(
158 Agenda::<T>::get(when + T::BlockNumber::one()).len() == s as usize,
159 "didn't append schedule"
160 );
161 }
162}244}
163
164impl_benchmark_test_suite!(Scheduler, crate::tests::new_test_ext(), crate::tests::Test,);
165245
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(())
-	}
-}