difftreelog
fix cargo fmt
in: master
4 files changed
pallets/scheduler-v2/src/lib.rsdiffbeforeafterboth78use codec::{Codec, Decode, Encode, MaxEncodedLen};78use codec::{Codec, Decode, Encode, MaxEncodedLen};79use frame_support::{79use frame_support::{80 dispatch::{DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, Parameter, PostDispatchInfo},80 dispatch::{81 DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, Parameter, PostDispatchInfo,82 },81 traits::{83 traits::{82 schedule::{self, DispatchTime, LOWEST_PRIORITY},84 schedule::{self, DispatchTime, LOWEST_PRIORITY},320 type RuntimeCall: Parameter323 type RuntimeCall: Parameter321 + Dispatchable<RuntimeOrigin = <Self as Config>::RuntimeOrigin, PostInfo = PostDispatchInfo>324 + Dispatchable<325 RuntimeOrigin = <Self as Config>::RuntimeOrigin,326 PostInfo = PostDispatchInfo,322 + UnfilteredDispatchable<RuntimeOrigin = <Self as system::Config>::RuntimeOrigin>327 > + UnfilteredDispatchable<RuntimeOrigin = <Self as system::Config>::RuntimeOrigin>323 + GetDispatchInfo328 + GetDispatchInfo324 + From<system::Call<Self>>;329 + From<system::Call<Self>>;940 }945 }941946942 return Err((Unavailable, Some(task)));947 return Err((Unavailable, Some(task)));943 },948 }944 };949 };945950946 weight.check_accrue(T::WeightInfo::service_task(951 weight.check_accrue(T::WeightInfo::service_task(979 Err(Overweight) => {984 Err(Overweight) => {980 // Preserve Lookup -- the task will be postponed.985 // Preserve Lookup -- the task will be postponed.981 Err((Overweight, Some(task)))986 Err((Overweight, Some(task)))982 },987 }983 Ok(result) => {988 Ok(result) => {984 Self::deposit_event(Event::Dispatched {989 Self::deposit_event(Event::Dispatched {985 task: (when, agenda_index),990 task: (when, agenda_index),1011 });1018 });1012 }1019 }1013 }1020 }1014 },1021 }1015 _ => {1022 _ => {1016 if let Some(ref id) = task.maybe_id {1023 if let Some(ref id) = task.maybe_id {1017 Lookup::<T>::remove(id);1024 Lookup::<T>::remove(id);1018 }1025 }101910261020 T::Preimages::drop(&task.call)1027 T::Preimages::drop(&task.call)1021 },1028 }1022 }1029 }1023 Ok(())1030 Ok(())1024 }1031 }1056 let r = match ensured_origin {1063 let r = match ensured_origin {1057 Ok(ScheduledEnsureOriginSuccess::Root) => {1064 Ok(ScheduledEnsureOriginSuccess::Root) => {1058 Ok(call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()))1065 Ok(call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()))1059 },1066 }1060 Ok(ScheduledEnsureOriginSuccess::Signed(sender)) => {1067 Ok(ScheduledEnsureOriginSuccess::Signed(sender)) => {1061 // Execute transaction via chain default pipeline1068 // Execute transaction via chain default pipeline1062 // That means dispatch will be processed like any user's extrinsic e.g. transaction fees will be taken1069 // That means dispatch will be processed like any user's extrinsic e.g. transaction fees will be taken1063 T::CallExecutor::dispatch_call(Some(sender), call.clone())1070 T::CallExecutor::dispatch_call(Some(sender), call.clone())1064 },1071 }1065 Ok(ScheduledEnsureOriginSuccess::Unsigned) => {1072 Ok(ScheduledEnsureOriginSuccess::Unsigned) => {1066 // Unsigned version of the above1073 // Unsigned version of the above1067 T::CallExecutor::dispatch_call(None, call.clone())1074 T::CallExecutor::dispatch_call(None, call.clone())pallets/scheduler-v2/src/mock.rsdiffbeforeafterboth40use frame_support::{40use frame_support::{41 ord_parameter_types, parameter_types,41 ord_parameter_types, parameter_types,42 traits::{42 traits::{ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnFinalize, OnInitialize},43 ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnFinalize, OnInitialize,44 },45 weights::constants::RocksDbWeight,43 weights::constants::RocksDbWeight,46};44};pallets/scheduler-v2/src/tests.rsdiffbeforeafterboth48 new_test_ext().execute_with(|| {48 new_test_ext().execute_with(|| {49 let call =49 let call = RuntimeCall::Logger(LoggerCall::log {50 RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_ref_time(10) });50 i: 42,51 weight: Weight::from_ref_time(10),52 });51 assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(&call));53 assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(54 &call71 run_to_block(2);75 run_to_block(2);72 let call =76 let call = RuntimeCall::Logger(LoggerCall::log {73 RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_ref_time(10) });77 i: 42,78 weight: Weight::from_ref_time(10),79 });74 assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(&call));80 assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(81 &call95 run_to_block(2);103 run_to_block(2);96 let call =104 let call = RuntimeCall::Logger(LoggerCall::log {97 RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_ref_time(10) });105 i: 42,106 weight: Weight::from_ref_time(10),107 });98 assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(&call));108 assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(109 &call243 new_test_ext().execute_with(|| {261 new_test_ext().execute_with(|| {244 let call = RuntimeCall::Logger(LoggerCall::log { i: 42, weight: max_weight / 3 * 2 });262 let call = RuntimeCall::Logger(LoggerCall::log {263 i: 42,264 weight: max_weight / 3 * 2,265 });245 assert_ok!(Scheduler::do_schedule(266 assert_ok!(Scheduler::do_schedule(246 DispatchTime::At(4),267 DispatchTime::At(4),251 ));272 ));252 let call = RuntimeCall::Logger(LoggerCall::log { i: 69, weight: max_weight / 3 * 2 });273 let call = RuntimeCall::Logger(LoggerCall::log {274 i: 69,275 weight: max_weight / 3 * 2,276 });253 assert_ok!(Scheduler::do_schedule(277 assert_ok!(Scheduler::do_schedule(254 DispatchTime::At(4),278 DispatchTime::At(4),272 new_test_ext().execute_with(|| {296 new_test_ext().execute_with(|| {273 let call = RuntimeCall::Logger(LoggerCall::log { i: 42, weight: max_weight });297 let call = RuntimeCall::Logger(LoggerCall::log {298 i: 42,299 weight: max_weight,300 });274 assert_ok!(Scheduler::do_schedule(301 assert_ok!(Scheduler::do_schedule(275 DispatchTime::At(4),302 DispatchTime::At(4),300 new_test_ext().execute_with(|| {331 new_test_ext().execute_with(|| {301 let call = RuntimeCall::Logger(LoggerCall::log { i: 42, weight: (max_weight / 3) * 2 });332 let call = RuntimeCall::Logger(LoggerCall::log {333 i: 42,334 weight: (max_weight / 3) * 2,335 });302 let call = <ScheduledCall<Test>>::new(call).unwrap();336 let call = <ScheduledCall<Test>>::new(call).unwrap();303337340 new_test_ext().execute_with(|| {378 new_test_ext().execute_with(|| {341 let call = RuntimeCall::Logger(LoggerCall::log { i: 42, weight: max_weight / 3 });379 let call = RuntimeCall::Logger(LoggerCall::log {380 i: 42,381 weight: max_weight / 3,382 });342 assert_ok!(Scheduler::do_schedule(383 assert_ok!(Scheduler::do_schedule(343 DispatchTime::At(4),384 DispatchTime::At(4),348 ));389 ));349 let call = RuntimeCall::Logger(LoggerCall::log { i: 69, weight: max_weight / 3 });390 let call = RuntimeCall::Logger(LoggerCall::log {391 i: 69,392 weight: max_weight / 3,393 });350 assert_ok!(Scheduler::do_schedule(394 assert_ok!(Scheduler::do_schedule(351 DispatchTime::At(4),395 DispatchTime::At(4),365 let max_weight: Weight = <Test as Config>::MaximumWeight::get();409 let max_weight: Weight = <Test as Config>::MaximumWeight::get();366 let call = RuntimeCall::Logger(LoggerCall::log { i: 42, weight: max_weight / 5 * 2 });410 let call = RuntimeCall::Logger(LoggerCall::log {411 i: 42,412 weight: max_weight / 5 * 2,413 });367 assert_ok!(Scheduler::do_schedule(414 assert_ok!(Scheduler::do_schedule(368 DispatchTime::At(4),415 DispatchTime::At(4),373 ));420 ));374 let call = RuntimeCall::Logger(LoggerCall::log { i: 69, weight: max_weight / 5 * 2 });421 let call = RuntimeCall::Logger(LoggerCall::log {422 i: 69,423 weight: max_weight / 5 * 2,424 });375 assert_ok!(Scheduler::do_schedule(425 assert_ok!(Scheduler::do_schedule(376 DispatchTime::At(4),426 DispatchTime::At(4),381 ));431 ));382 let call = RuntimeCall::Logger(LoggerCall::log { i: 2600, weight: max_weight / 5 * 4 });432 let call = RuntimeCall::Logger(LoggerCall::log {433 i: 2600,434 weight: max_weight / 5 * 4,435 });383 assert_ok!(Scheduler::do_schedule(436 assert_ok!(Scheduler::do_schedule(384 DispatchTime::At(4),437 DispatchTime::At(4),676 new_test_ext().execute_with(|| {775 new_test_ext().execute_with(|| {677 let call =776 let call = RuntimeCall::Logger(LoggerCall::log {678 RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_ref_time(10) });777 i: 42,778 weight: Weight::from_ref_time(10),779 });679780680 // Schedule both calls.781 // Schedule both calls.709 new_test_ext().execute_with(|| {810 new_test_ext().execute_with(|| {710 let call =811 let call = RuntimeCall::Logger(LoggerCall::log {711 RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_ref_time(10) });812 i: 42,813 weight: Weight::from_ref_time(10),814 });712 let call = <ScheduledCall<Test>>::new(call).unwrap();815 let call = <ScheduledCall<Test>>::new(call).unwrap();713816744 new_test_ext().execute_with(|| {843 new_test_ext().execute_with(|| {745 let call =844 let call = RuntimeCall::Logger(LoggerCall::log {746 RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_ref_time(10) });845 i: 42,846 weight: Weight::from_ref_time(10),847 });747 let call = <ScheduledCall<Test>>::new(call).unwrap();848 let call = <ScheduledCall<Test>>::new(call).unwrap();748 let mut addrs = Vec::<_>::default();849 let mut addrs = Vec::<_>::default();runtime/common/scheduler.rsdiffbeforeafterbothno syntactic changes