git.delta.rocks / unique-network / refs/commits / 90587283b7f1

difftreelog

fix cargo fmt

Daniel Shiposha2022-10-25parent: #829f2bc.patch.diff
in: master

4 files changed

modifiedpallets/scheduler-v2/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/lib.rs
+++ b/pallets/scheduler-v2/src/lib.rs
@@ -77,13 +77,16 @@
 
 use codec::{Codec, Decode, Encode, MaxEncodedLen};
 use frame_support::{
-	dispatch::{DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, Parameter, PostDispatchInfo},
+	dispatch::{
+		DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, Parameter, PostDispatchInfo,
+	},
 	traits::{
 		schedule::{self, DispatchTime, LOWEST_PRIORITY},
 		EnsureOrigin, Get, IsType, OriginTrait, PrivilegeCmp, StorageVersion, PreimageRecipient,
 		ConstU32, UnfilteredDispatchable,
 	},
-	weights::Weight, unsigned::TransactionValidityError,
+	weights::Weight,
+	unsigned::TransactionValidityError,
 };
 
 use frame_system::{self as system};
@@ -318,8 +321,10 @@
 
 		/// The aggregated call type.
 		type RuntimeCall: Parameter
-			+ Dispatchable<RuntimeOrigin = <Self as Config>::RuntimeOrigin, PostInfo = PostDispatchInfo>
-			+ UnfilteredDispatchable<RuntimeOrigin = <Self as system::Config>::RuntimeOrigin>
+			+ Dispatchable<
+				RuntimeOrigin = <Self as Config>::RuntimeOrigin,
+				PostInfo = PostDispatchInfo,
+			> + UnfilteredDispatchable<RuntimeOrigin = <Self as system::Config>::RuntimeOrigin>
 			+ GetDispatchInfo
 			+ From<system::Call<Self>>;
 
@@ -940,7 +945,7 @@
 				}
 
 				return Err((Unavailable, Some(task)));
-			},
+			}
 		};
 
 		weight.check_accrue(T::WeightInfo::service_task(
@@ -979,7 +984,7 @@
 			Err(Overweight) => {
 				// Preserve Lookup -- the task will be postponed.
 				Err((Overweight, Some(task)))
-			},
+			}
 			Ok(result) => {
 				Self::deposit_event(Event::Dispatched {
 					task: (when, agenda_index),
@@ -987,7 +992,9 @@
 					result,
 				});
 
-				let is_canceled = task.maybe_id.as_ref()
+				let is_canceled = task
+					.maybe_id
+					.as_ref()
 					.map(|id| !Lookup::<T>::contains_key(id))
 					.unwrap_or(false);
 
@@ -1011,14 +1018,14 @@
 								});
 							}
 						}
-					},
+					}
 					_ => {
 						if let Some(ref id) = task.maybe_id {
 							Lookup::<T>::remove(id);
 						}
 
 						T::Preimages::drop(&task.call)
-					},
+					}
 				}
 				Ok(())
 			}
@@ -1056,12 +1063,12 @@
 		let r = match ensured_origin {
 			Ok(ScheduledEnsureOriginSuccess::Root) => {
 				Ok(call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()))
-			},
+			}
 			Ok(ScheduledEnsureOriginSuccess::Signed(sender)) => {
 				// Execute transaction via chain default pipeline
 				// That means dispatch will be processed like any user's extrinsic e.g. transaction fees will be taken
 				T::CallExecutor::dispatch_call(Some(sender), call.clone())
-			},
+			}
 			Ok(ScheduledEnsureOriginSuccess::Unsigned) => {
 				// Unsigned version of the above
 				T::CallExecutor::dispatch_call(None, call.clone())
modifiedpallets/scheduler-v2/src/mock.rsdiffbeforeafterboth
before · pallets/scheduler-v2/src/mock.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 license:18// This file is part of Substrate.1920// Copyright (C) 2017-2022 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 test environment.3637use super::*;3839use crate as scheduler;40use frame_support::{41	ord_parameter_types, parameter_types,42	traits::{43		ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnFinalize, OnInitialize,44	},45	weights::constants::RocksDbWeight,46};47use frame_system::{EnsureRoot, RawOrigin};48use sp_core::H256;49use sp_runtime::{50	testing::Header,51	traits::{BlakeTwo256, IdentityLookup},52	Perbill,53};5455// Logger module to track execution.56#[frame_support::pallet]57pub mod logger {58	use super::{OriginCaller, OriginTrait};59	use frame_support::{pallet_prelude::*, parameter_types};60	use frame_system::pallet_prelude::*;6162	parameter_types! {63		static Log: Vec<(OriginCaller, u32)> = Vec::new();64	}65	pub fn log() -> Vec<(OriginCaller, u32)> {66		Log::get().clone()67	}6869	#[pallet::pallet]70	#[pallet::generate_store(pub(super) trait Store)]71	pub struct Pallet<T>(PhantomData<T>);7273	#[pallet::hooks]74	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}7576	#[pallet::config]77	pub trait Config: frame_system::Config {78		type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;79	}8081	#[pallet::event]82	#[pallet::generate_deposit(pub(super) fn deposit_event)]83	pub enum Event<T: Config> {84		Logged(u32, Weight),85	}8687	#[pallet::call]88	impl<T: Config> Pallet<T>89	where90		<T as frame_system::Config>::RuntimeOrigin: OriginTrait<PalletsOrigin = OriginCaller>,91	{92		#[pallet::weight(*weight)]93		pub fn log(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {94			Self::deposit_event(Event::Logged(i, weight));95			Log::mutate(|log| {96				log.push((origin.caller().clone(), i));97			});98			Ok(())99		}100101		#[pallet::weight(*weight)]102		pub fn log_without_filter(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {103			Self::deposit_event(Event::Logged(i, weight));104			Log::mutate(|log| {105				log.push((origin.caller().clone(), i));106			});107			Ok(())108		}109	}110}111112type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;113type Block = frame_system::mocking::MockBlock<Test>;114115frame_support::construct_runtime!(116	pub enum Test where117		Block = Block,118		NodeBlock = Block,119		UncheckedExtrinsic = UncheckedExtrinsic,120	{121		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},122		Logger: logger::{Pallet, Call, Event<T>},123		Scheduler: scheduler::{Pallet, Call, Storage, Event<T>},124	}125);126127// Scheduler must dispatch with root and no filter, this tests base filter is indeed not used.128pub struct BaseFilter;129impl Contains<RuntimeCall> for BaseFilter {130	fn contains(call: &RuntimeCall) -> bool {131		!matches!(call, RuntimeCall::Logger(LoggerCall::log { .. }))132	}133}134135parameter_types! {136	pub BlockWeights: frame_system::limits::BlockWeights =137		frame_system::limits::BlockWeights::simple_max(138			Weight::from_ref_time(2_000_000_000_000)139            // .set_proof_size(u64::MAX),140		);141}142impl system::Config for Test {143	type BaseCallFilter = BaseFilter;144	type BlockWeights = BlockWeights;145	type BlockLength = ();146	type DbWeight = RocksDbWeight;147	type RuntimeOrigin = RuntimeOrigin;148	type RuntimeCall = RuntimeCall;149	type Index = u64;150	type BlockNumber = u64;151	type Hash = H256;152	type Hashing = BlakeTwo256;153	type AccountId = u64;154	type Lookup = IdentityLookup<Self::AccountId>;155	type Header = Header;156	type RuntimeEvent = RuntimeEvent;157	type BlockHashCount = ConstU64<250>;158	type Version = ();159	type PalletInfo = PalletInfo;160	type AccountData = ();161	type OnNewAccount = ();162	type OnKilledAccount = ();163	type SystemWeightInfo = ();164	type SS58Prefix = ();165	type OnSetCode = ();166	type MaxConsumers = ConstU32<16>;167}168impl logger::Config for Test {169	type RuntimeEvent = RuntimeEvent;170}171ord_parameter_types! {172	pub const One: u64 = 1;173}174175pub struct TestWeightInfo;176impl WeightInfo for TestWeightInfo {177	fn service_agendas_base() -> Weight {178		Weight::from_ref_time(0b0000_0001)179	}180	fn service_agenda_base(i: u32) -> Weight {181		Weight::from_ref_time((i << 8) as u64 + 0b0000_0010)182	}183	fn service_task_base() -> Weight {184		Weight::from_ref_time(0b0000_0100)185	}186	fn service_task_periodic() -> Weight {187		Weight::from_ref_time(0b0000_1100)188	}189	fn service_task_named() -> Weight {190		Weight::from_ref_time(0b0001_0100)191	}192	fn service_task_fetched(s: u32) -> Weight {193		Weight::from_ref_time((s << 8) as u64 + 0b0010_0100)194	}195	fn execute_dispatch_signed() -> Weight {196		Weight::from_ref_time(0b0100_0000)197	}198	fn execute_dispatch_unsigned() -> Weight {199		Weight::from_ref_time(0b1000_0000)200	}201	fn schedule(_s: u32) -> Weight {202		Weight::from_ref_time(50)203	}204	fn cancel(_s: u32) -> Weight {205		Weight::from_ref_time(50)206	}207	fn schedule_named(_s: u32) -> Weight {208		Weight::from_ref_time(50)209	}210	fn cancel_named(_s: u32) -> Weight {211		Weight::from_ref_time(50)212	}213    fn change_named_priority(_s: u32, ) -> Weight {214        Weight::from_ref_time(50)215    }216}217parameter_types! {218	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *219		BlockWeights::get().max_block;220}221222pub struct EnsureSignedOneOrRoot;223impl<O: Into<Result<RawOrigin<u64>, O>> + From<RawOrigin<u64>>>224	EnsureOrigin<O> for EnsureSignedOneOrRoot225{226	type Success = ScheduledEnsureOriginSuccess<u64>;227	fn try_origin(o: O) -> Result<Self::Success, O> {228		o.into().and_then(|o| match o {229			RawOrigin::Root => Ok(ScheduledEnsureOriginSuccess::Root),230			RawOrigin::Signed(1) => Ok(ScheduledEnsureOriginSuccess::Signed(1)),231			r => Err(O::from(r)),232		})233	}234}235236pub struct Executor;237impl DispatchCall<Test, sp_core::H160> for Executor {238    fn dispatch_call(239        signer: Option<u64>,240        function: RuntimeCall,241    ) -> Result<242        Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,243        TransactionValidityError,244    > {245        let origin = match signer {246            Some(who) => RuntimeOrigin::signed(who),247            None => RuntimeOrigin::none(),248        };249        Ok(function.dispatch(origin))250    }251}252253impl Config for Test {254	type RuntimeEvent = RuntimeEvent;255	type RuntimeOrigin = RuntimeOrigin;256	type PalletsOrigin = OriginCaller;257	type RuntimeCall = RuntimeCall;258	type MaximumWeight = MaximumSchedulerWeight;259	type ScheduleOrigin = EnsureSignedOneOrRoot;260	type MaxScheduledPerBlock = ConstU32<10>;261	type WeightInfo = TestWeightInfo;262	type OriginPrivilegeCmp = EqualPrivilegeOnly;263	type Preimages = ();264    type PrioritySetOrigin = EnsureRoot<u64>;265    type CallExecutor = Executor;266}267268pub type LoggerCall = logger::Call<Test>;269270pub fn new_test_ext() -> sp_io::TestExternalities {271	let t = system::GenesisConfig::default().build_storage::<Test>().unwrap();272	t.into()273}274275pub fn run_to_block(n: u64) {276	while System::block_number() < n {277		Scheduler::on_finalize(System::block_number());278		System::set_block_number(System::block_number() + 1);279		Scheduler::on_initialize(System::block_number());280	}281}282283pub fn root() -> OriginCaller {284	system::RawOrigin::Root.into()285}
after · pallets/scheduler-v2/src/mock.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 license:18// This file is part of Substrate.1920// Copyright (C) 2017-2022 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 test environment.3637use super::*;3839use crate as scheduler;40use frame_support::{41	ord_parameter_types, parameter_types,42	traits::{ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnFinalize, OnInitialize},43	weights::constants::RocksDbWeight,44};45use frame_system::{EnsureRoot, RawOrigin};46use sp_core::H256;47use sp_runtime::{48	testing::Header,49	traits::{BlakeTwo256, IdentityLookup},50	Perbill,51};5253// Logger module to track execution.54#[frame_support::pallet]55pub mod logger {56	use super::{OriginCaller, OriginTrait};57	use frame_support::{pallet_prelude::*, parameter_types};58	use frame_system::pallet_prelude::*;5960	parameter_types! {61		static Log: Vec<(OriginCaller, u32)> = Vec::new();62	}63	pub fn log() -> Vec<(OriginCaller, u32)> {64		Log::get().clone()65	}6667	#[pallet::pallet]68	#[pallet::generate_store(pub(super) trait Store)]69	pub struct Pallet<T>(PhantomData<T>);7071	#[pallet::hooks]72	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}7374	#[pallet::config]75	pub trait Config: frame_system::Config {76		type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;77	}7879	#[pallet::event]80	#[pallet::generate_deposit(pub(super) fn deposit_event)]81	pub enum Event<T: Config> {82		Logged(u32, Weight),83	}8485	#[pallet::call]86	impl<T: Config> Pallet<T>87	where88		<T as frame_system::Config>::RuntimeOrigin: OriginTrait<PalletsOrigin = OriginCaller>,89	{90		#[pallet::weight(*weight)]91		pub fn log(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {92			Self::deposit_event(Event::Logged(i, weight));93			Log::mutate(|log| {94				log.push((origin.caller().clone(), i));95			});96			Ok(())97		}9899		#[pallet::weight(*weight)]100		pub fn log_without_filter(origin: OriginFor<T>, i: u32, weight: Weight) -> DispatchResult {101			Self::deposit_event(Event::Logged(i, weight));102			Log::mutate(|log| {103				log.push((origin.caller().clone(), i));104			});105			Ok(())106		}107	}108}109110type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;111type Block = frame_system::mocking::MockBlock<Test>;112113frame_support::construct_runtime!(114	pub enum Test where115		Block = Block,116		NodeBlock = Block,117		UncheckedExtrinsic = UncheckedExtrinsic,118	{119		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},120		Logger: logger::{Pallet, Call, Event<T>},121		Scheduler: scheduler::{Pallet, Call, Storage, Event<T>},122	}123);124125// Scheduler must dispatch with root and no filter, this tests base filter is indeed not used.126pub struct BaseFilter;127impl Contains<RuntimeCall> for BaseFilter {128	fn contains(call: &RuntimeCall) -> bool {129		!matches!(call, RuntimeCall::Logger(LoggerCall::log { .. }))130	}131}132133parameter_types! {134	pub BlockWeights: frame_system::limits::BlockWeights =135		frame_system::limits::BlockWeights::simple_max(136			Weight::from_ref_time(2_000_000_000_000)137			// .set_proof_size(u64::MAX),138		);139}140impl system::Config for Test {141	type BaseCallFilter = BaseFilter;142	type BlockWeights = BlockWeights;143	type BlockLength = ();144	type DbWeight = RocksDbWeight;145	type RuntimeOrigin = RuntimeOrigin;146	type RuntimeCall = RuntimeCall;147	type Index = u64;148	type BlockNumber = u64;149	type Hash = H256;150	type Hashing = BlakeTwo256;151	type AccountId = u64;152	type Lookup = IdentityLookup<Self::AccountId>;153	type Header = Header;154	type RuntimeEvent = RuntimeEvent;155	type BlockHashCount = ConstU64<250>;156	type Version = ();157	type PalletInfo = PalletInfo;158	type AccountData = ();159	type OnNewAccount = ();160	type OnKilledAccount = ();161	type SystemWeightInfo = ();162	type SS58Prefix = ();163	type OnSetCode = ();164	type MaxConsumers = ConstU32<16>;165}166impl logger::Config for Test {167	type RuntimeEvent = RuntimeEvent;168}169ord_parameter_types! {170	pub const One: u64 = 1;171}172173pub struct TestWeightInfo;174impl WeightInfo for TestWeightInfo {175	fn service_agendas_base() -> Weight {176		Weight::from_ref_time(0b0000_0001)177	}178	fn service_agenda_base(i: u32) -> Weight {179		Weight::from_ref_time((i << 8) as u64 + 0b0000_0010)180	}181	fn service_task_base() -> Weight {182		Weight::from_ref_time(0b0000_0100)183	}184	fn service_task_periodic() -> Weight {185		Weight::from_ref_time(0b0000_1100)186	}187	fn service_task_named() -> Weight {188		Weight::from_ref_time(0b0001_0100)189	}190	fn service_task_fetched(s: u32) -> Weight {191		Weight::from_ref_time((s << 8) as u64 + 0b0010_0100)192	}193	fn execute_dispatch_signed() -> Weight {194		Weight::from_ref_time(0b0100_0000)195	}196	fn execute_dispatch_unsigned() -> Weight {197		Weight::from_ref_time(0b1000_0000)198	}199	fn schedule(_s: u32) -> Weight {200		Weight::from_ref_time(50)201	}202	fn cancel(_s: u32) -> Weight {203		Weight::from_ref_time(50)204	}205	fn schedule_named(_s: u32) -> Weight {206		Weight::from_ref_time(50)207	}208	fn cancel_named(_s: u32) -> Weight {209		Weight::from_ref_time(50)210	}211	fn change_named_priority(_s: u32) -> Weight {212		Weight::from_ref_time(50)213	}214}215parameter_types! {216	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *217		BlockWeights::get().max_block;218}219220pub struct EnsureSignedOneOrRoot;221impl<O: Into<Result<RawOrigin<u64>, O>> + From<RawOrigin<u64>>> EnsureOrigin<O>222	for EnsureSignedOneOrRoot223{224	type Success = ScheduledEnsureOriginSuccess<u64>;225	fn try_origin(o: O) -> Result<Self::Success, O> {226		o.into().and_then(|o| match o {227			RawOrigin::Root => Ok(ScheduledEnsureOriginSuccess::Root),228			RawOrigin::Signed(1) => Ok(ScheduledEnsureOriginSuccess::Signed(1)),229			r => Err(O::from(r)),230		})231	}232}233234pub struct Executor;235impl DispatchCall<Test, sp_core::H160> for Executor {236	fn dispatch_call(237		signer: Option<u64>,238		function: RuntimeCall,239	) -> Result<240		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,241		TransactionValidityError,242	> {243		let origin = match signer {244			Some(who) => RuntimeOrigin::signed(who),245			None => RuntimeOrigin::none(),246		};247		Ok(function.dispatch(origin))248	}249}250251impl Config for Test {252	type RuntimeEvent = RuntimeEvent;253	type RuntimeOrigin = RuntimeOrigin;254	type PalletsOrigin = OriginCaller;255	type RuntimeCall = RuntimeCall;256	type MaximumWeight = MaximumSchedulerWeight;257	type ScheduleOrigin = EnsureSignedOneOrRoot;258	type MaxScheduledPerBlock = ConstU32<10>;259	type WeightInfo = TestWeightInfo;260	type OriginPrivilegeCmp = EqualPrivilegeOnly;261	type Preimages = ();262	type PrioritySetOrigin = EnsureRoot<u64>;263	type CallExecutor = Executor;264}265266pub type LoggerCall = logger::Call<Test>;267268pub fn new_test_ext() -> sp_io::TestExternalities {269	let t = system::GenesisConfig::default()270		.build_storage::<Test>()271		.unwrap();272	t.into()273}274275pub fn run_to_block(n: u64) {276	while System::block_number() < n {277		Scheduler::on_finalize(System::block_number());278		System::set_block_number(System::block_number() + 1);279		Scheduler::on_initialize(System::block_number());280	}281}282283pub fn root() -> OriginCaller {284	system::RawOrigin::Root.into()285}
modifiedpallets/scheduler-v2/src/tests.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/tests.rs
+++ b/pallets/scheduler-v2/src/tests.rs
@@ -46,15 +46,19 @@
 #[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));
+		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(),
+			<ScheduledCall<Test>>::new(call).unwrap(),
 		));
 		run_to_block(3);
 		assert!(logger::log().is_empty());
@@ -69,9 +73,13 @@
 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));
+		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),
@@ -93,9 +101,13 @@
 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));
+		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,
@@ -120,7 +132,7 @@
 			Some((3, 3)),
 			127,
 			root(),
-            <ScheduledCall<Test>>::new(RuntimeCall::Logger(logger::Call::log {
+			<ScheduledCall<Test>>::new(RuntimeCall::Logger(logger::Call::log {
 				i: 42,
 				weight: Weight::from_ref_time(10)
 			}))
@@ -137,9 +149,15 @@
 		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)]);
+		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)]);
+		assert_eq!(
+			logger::log(),
+			vec![(root(), 42u32), (root(), 42u32), (root(), 42u32)]
+		);
 	});
 }
 
@@ -241,7 +259,10 @@
 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 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 42,
+			weight: max_weight / 3 * 2,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -249,7 +270,10 @@
 			root(),
 			<ScheduledCall<Test>>::new(call).unwrap(),
 		));
-		let call = RuntimeCall::Logger(LoggerCall::log { i: 69, weight: max_weight / 3 * 2 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 69,
+			weight: max_weight / 3 * 2,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -270,7 +294,10 @@
 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 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 42,
+			weight: max_weight,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -285,7 +312,11 @@
 		// Assert the `PermanentlyOverweight` event.
 		assert_eq!(
 			System::events().last().unwrap().event,
-			crate::Event::PermanentlyOverweight { task: (4, 0), id: None }.into(),
+			crate::Event::PermanentlyOverweight {
+				task: (4, 0),
+				id: None
+			}
+			.into(),
 		);
 		// The call is still in the agenda.
 		assert!(Agenda::<Test>::get(4)[0].is_some());
@@ -298,7 +329,10 @@
 	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 = RuntimeCall::Logger(LoggerCall::log {
+			i: 42,
+			weight: (max_weight / 3) * 2,
+		});
 		let call = <ScheduledCall<Test>>::new(call).unwrap();
 
 		assert_ok!(Scheduler::do_schedule(
@@ -329,7 +363,11 @@
 
 		assert_eq!(
 			System::events().last().unwrap().event,
-			crate::Event::PeriodicFailed { task: (24, 0), id: None }.into(),
+			crate::Event::PeriodicFailed {
+				task: (24, 0),
+				id: None
+			}
+			.into(),
 		);
 	});
 }
@@ -338,7 +376,10 @@
 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 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 42,
+			weight: max_weight / 3,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -346,7 +387,10 @@
 			root(),
 			<ScheduledCall<Test>>::new(call).unwrap(),
 		));
-		let call = RuntimeCall::Logger(LoggerCall::log { i: 69, weight: max_weight / 3 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 69,
+			weight: max_weight / 3,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -363,7 +407,10 @@
 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 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 42,
+			weight: max_weight / 5 * 2,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -371,7 +418,10 @@
 			root(),
 			<ScheduledCall<Test>>::new(call).unwrap(),
 		));
-		let call = RuntimeCall::Logger(LoggerCall::log { i: 69, weight: max_weight / 5 * 2 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 69,
+			weight: max_weight / 5 * 2,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -379,7 +429,10 @@
 			root(),
 			<ScheduledCall<Test>>::new(call).unwrap(),
 		));
-		let call = RuntimeCall::Logger(LoggerCall::log { i: 2600, weight: max_weight / 5 * 4 });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 2600,
+			weight: max_weight / 5 * 4,
+		});
 		assert_ok!(Scheduler::do_schedule(
 			DispatchTime::At(4),
 			None,
@@ -393,7 +446,10 @@
 		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)]);
+		assert_eq!(
+			logger::log(),
+			vec![(root(), 2600u32), (root(), 69u32), (root(), 42u32)]
+		);
 	});
 }
 
@@ -456,11 +512,11 @@
 		// Will include the named periodic only
 		assert_eq!(
 			Scheduler::on_initialize(1),
-			TestWeightInfo::service_agendas_base() +
-				TestWeightInfo::service_agenda_base(1) +
-				<TestWeightInfo as MarginalWeightInfo>::service_task(None, true, true) +
-				TestWeightInfo::execute_dispatch_unsigned() +
-				call_weight + Weight::from_ref_time(4)
+			TestWeightInfo::service_agendas_base()
+				+ TestWeightInfo::service_agenda_base(1)
+				+ <TestWeightInfo as MarginalWeightInfo>::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)]);
@@ -468,31 +524,39 @@
 		// Will include anon and anon periodic
 		assert_eq!(
 			Scheduler::on_initialize(2),
-			TestWeightInfo::service_agendas_base() +
-				TestWeightInfo::service_agenda_base(2) +
-				<TestWeightInfo as MarginalWeightInfo>::service_task(None, false, true) +
-				TestWeightInfo::execute_dispatch_unsigned() +
-				call_weight + Weight::from_ref_time(3) +
-				<TestWeightInfo as MarginalWeightInfo>::service_task(None, false, false) +
-				TestWeightInfo::execute_dispatch_unsigned() +
-				call_weight + Weight::from_ref_time(2)
+			TestWeightInfo::service_agendas_base()
+				+ TestWeightInfo::service_agenda_base(2)
+				+ <TestWeightInfo as MarginalWeightInfo>::service_task(None, false, true)
+				+ TestWeightInfo::execute_dispatch_unsigned()
+				+ call_weight + Weight::from_ref_time(3)
+				+ <TestWeightInfo as MarginalWeightInfo>::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)]);
+		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) +
-				<TestWeightInfo as MarginalWeightInfo>::service_task(None, true, false) +
-				TestWeightInfo::execute_dispatch_unsigned() +
-				call_weight + Weight::from_ref_time(1)
+			TestWeightInfo::service_agendas_base()
+				+ TestWeightInfo::service_agenda_base(1)
+				+ <TestWeightInfo as MarginalWeightInfo>::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)]
+			vec![
+				(root(), 2600u32),
+				(root(), 69u32),
+				(root(), 42u32),
+				(root(), 3u32)
+			]
 		);
 
 		// Will contain none
@@ -515,10 +579,21 @@
 			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));
+		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).len(), 2);
@@ -585,12 +660,21 @@
 			None,
 			call,
 		));
-		assert_ok!(Scheduler::schedule(system::RawOrigin::Signed(1).into(), 4, None, None, call2,));
+		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).len(), 2);
 		assert!(logger::log().is_empty());
-		assert_ok!(Scheduler::cancel_named(system::RawOrigin::Signed(1).into(), [1u8; 32]));
+		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);
@@ -646,7 +730,13 @@
 			None,
 			call,
 		));
-		assert_ok!(Scheduler::schedule(system::RawOrigin::Signed(1).into(), 4, None, None, call2,));
+		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).len(), 2);
@@ -655,9 +745,18 @@
 			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);
+		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(),
@@ -674,8 +773,10 @@
 #[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) });
+		let call = RuntimeCall::Logger(LoggerCall::log {
+			i: 42,
+			weight: Weight::from_ref_time(10),
+		});
 
 		// Schedule both calls.
 		let addr_1 = Scheduler::do_schedule(
@@ -707,20 +808,15 @@
 	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 = 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();
+			Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call.clone()).unwrap();
 		}
 
 		// One more time and it errors.
@@ -739,25 +835,24 @@
 #[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");
+	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 = 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(),
+				Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call.clone())
+					.unwrap(),
 			);
 		}
 		// Cancel three of them.
@@ -766,14 +861,9 @@
 		}
 		// Schedule three new ones.
 		for i in 0..3 {
-			let (_block, index) = Scheduler::do_schedule(
-				DispatchTime::At(4),
-				None,
-				127,
-				root(),
-				call.clone(),
-			)
-			.unwrap();
+			let (_block, index) =
+				Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), call.clone())
+					.unwrap();
 			assert_eq!(i, index);
 		}
 
modifiedruntime/common/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/scheduler.rs
+++ b/runtime/common/scheduler.rs
@@ -105,7 +105,6 @@
 	}
 }
 
-
 // impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
 // 	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
 // where