git.delta.rocks / unique-network / refs/commits / 3151280b2e6d

difftreelog

Merge pull request #376 from UniqueNetwork/fix/scheduler-benchmarks

kozyrevdev2022-06-10parents: #030f1f6 #35be72c.patch.diff
in: master
Fix/scheduler benchmarks

14 files changed

modifiedCargo.lockdiffbeforeafterboth
5356 "pallet-transaction-payment-rpc-runtime-api",5356 "pallet-transaction-payment-rpc-runtime-api",
5357 "pallet-treasury",5357 "pallet-treasury",
5358 "pallet-unique",5358 "pallet-unique",
5359 "pallet-unq-scheduler",5359 "pallet-unique-scheduler",
5360 "pallet-xcm",5360 "pallet-xcm",
5361 "parachain-info",5361 "parachain-info",
5362 "parity-scale-codec 3.1.2",5362 "parity-scale-codec 3.1.2",
6646]6646]
66476647
6648[[package]]6648[[package]]
6649name = "pallet-unq-scheduler"6649name = "pallet-unique-scheduler"
6650version = "0.1.0"6650version = "0.1.0"
6651dependencies = [6651dependencies = [
6652 "frame-benchmarking",6652 "frame-benchmarking",
8590 "pallet-transaction-payment-rpc-runtime-api",8590 "pallet-transaction-payment-rpc-runtime-api",
8591 "pallet-treasury",8591 "pallet-treasury",
8592 "pallet-unique",8592 "pallet-unique",
8593 "pallet-unq-scheduler",8593 "pallet-unique-scheduler",
8594 "pallet-xcm",8594 "pallet-xcm",
8595 "parachain-info",8595 "parachain-info",
8596 "parity-scale-codec 3.1.2",8596 "parity-scale-codec 3.1.2",
12643 "pallet-transaction-payment-rpc-runtime-api",12643 "pallet-transaction-payment-rpc-runtime-api",
12644 "pallet-treasury",12644 "pallet-treasury",
12645 "pallet-unique",12645 "pallet-unique",
12646 "pallet-unq-scheduler",12646 "pallet-unique-scheduler",
12647 "pallet-xcm",12647 "pallet-xcm",
12648 "parachain-info",12648 "parachain-info",
12649 "parity-scale-codec 3.1.2",12649 "parity-scale-codec 3.1.2",
12688 "pallet-nonfungible",12688 "pallet-nonfungible",
12689 "pallet-refungible",12689 "pallet-refungible",
12690 "pallet-unique",12690 "pallet-unique",
12691 "pallet-unique-scheduler",
12691 "parity-scale-codec 3.1.2",12692 "parity-scale-codec 3.1.2",
12692 "rmrk-rpc",12693 "rmrk-rpc",
12693 "scale-info",12694 "scale-info",
modifiedMakefilediffbeforeafterboth
65 --template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \65 --template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \
66 --output=./pallets/$(PALLET)/src/weights.rs66 --output=./pallets/$(PALLET)/src/weights.rs
67
68.PHONY: _bench2
69_bench2:
70 cargo run --release --features runtime-benchmarks,unique-runtime -- \
71 benchmark pallet --pallet pallet-$(PALLET) \
72 --wasm-execution compiled --extrinsic '*' \
73 --template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \
74 --output=./pallets/$(PALLET_DIR)/src/weights.rs
6775
68.PHONY: bench-evm-migration76.PHONY: bench-evm-migration
69bench-evm-migration:77bench-evm-migration:
93bench-structure:101bench-structure:
94 make _bench PALLET=structure102 make _bench PALLET=structure
103
104.PHONY: bench-scheduler
105bench-scheduler:
106 make _bench2 PALLET=unique-scheduler PALLET_DIR=scheduler
95107
96.PHONY: bench-rmrk-core108.PHONY: bench-rmrk-core
97bench-rmrk-core:109bench-rmrk-core:
98 make _bench PALLET=proxy-rmrk-core110 make _bench PALLET=proxy-rmrk-core
99111
100.PHONY: bench112.PHONY: bench
101bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-rmrk-core113bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler bench-rmrk-core
102114
modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-unq-scheduler"2name = "pallet-unique-scheduler"
3version = "0.1.0"3version = "0.1.0"
4authors = ["Unique Network <support@uniquenetwork.io>"]4authors = ["Unique Network <support@uniquenetwork.io>"]
5edition = "2021"5edition = "2021"
modifiedpallets/scheduler/src/benchmarking.rsdiffbeforeafterboth
3434
35//! Scheduler pallet benchmarking.35//! Scheduler pallet benchmarking.
36
37#![cfg(feature = "runtime-benchmarks")]
3836
39use super::*;37use super::*;
38use frame_benchmarking::{benchmarks, account};
40use sp_std::{vec, prelude::*};39use frame_support::{
40 ensure,
41 traits::{OnInitialize},
42};
41use frame_system::RawOrigin;43use frame_system::RawOrigin;
42use frame_support::{ensure, traits::OnInitialize};44use sp_runtime::traits::Hash;
43use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};45use sp_std::{prelude::*, vec};
4446
45use crate::Module as Scheduler;47use crate::Pallet as Scheduler;
46use frame_system::Pallet as System;48use frame_system::Pallet as System;
49use frame_support::traits::Currency;
4750
48const BLOCK_NUMBER: u32 = 2;51const BLOCK_NUMBER: u32 = 2;
4952
50// Add `n` named items to the schedule53/// Add `n` named items to the schedule.
54///
55/// For `resolved`:
56/// - `None`: aborted (hash without preimage)
57/// - `Some(true)`: hash resolves into call if possible, plain call otherwise
58/// - `Some(false)`: plain call
51fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {59fn fill_schedule<T: Config>(
52 // Essentially a no-op call.60 when: T::BlockNumber,
61 n: u32,
62 periodic: bool,
63 resolved: Option<bool>,
64) -> Result<(), &'static str> {
65 let t = DispatchTime::At(when);
66 let caller = account("user", 0, 1);
67
68 // Give the sender account max funds for transfer (their account will never reasonably be killed).
53 let call = frame_system::Call::set_storage { items: vec![] };69 T::Currency::make_free_balance_be(&caller, T::Currency::minimum_balance());
70
54 for i in 0..n {71 for i in 0..n {
55 // Named schedule is strictly heavier than anonymous72 let (call, hash) = call_and_hash::<T>(i);
56 Scheduler::<T>::do_schedule_named(73 let call_or_hash = match resolved {
57 i.encode(),74 Some(_) => call.into(),
58 DispatchTime::At(when),75 None => CallOrHashOf::<T>::Hash(hash),
59 // Add periodicity76 };
77 let period = match periodic {
78 true => Some(((i + 100).into(), 100)),
79 false => None,
80 };
81
82 let slice_id: [u8; 4] = i.encode().try_into().unwrap();
83 let mut id: [u8; 16] = [0; 16];
60 Some((T::BlockNumber::one(), 100)),84 id[..4].clone_from_slice(&slice_id);
61 // HARD_DEADLINE priority means it gets executed no matter what85
62 0,
63 frame_system::RawOrigin::Root.into(),86 let origin = frame_system::RawOrigin::Signed(caller.clone()).into();
64 call.clone().into(),87 Scheduler::<T>::do_schedule_named(id, t, period, 0, origin, call_or_hash)?;
65 )?;
66 }88 }
67 ensure!(89 ensure!(
68 Agenda::<T>::get(when).len() == n as usize,90 Agenda::<T>::get(when).len() == n as usize,
71 Ok(())93 Ok(())
72}94}
95
96fn call_and_hash<T: Config>(i: u32) -> (<T as Config>::Call, T::Hash) {
97 // Essentially a no-op call.
98 let call: <T as Config>::Call = frame_system::Call::remark { remark: i.encode() }.into();
99 let hash = T::Hashing::hash_of(&call);
100 (call, hash)
101}
73102
74benchmarks! {103benchmarks! {
75 schedule {104 on_initialize_periodic_named_resolved {
76 let s in 0 .. T::MaxScheduledPerBlock::get();105 let s in 1 .. T::MaxScheduledPerBlock::get();
77 let when = BLOCK_NUMBER.into();106 let when = BLOCK_NUMBER.into();
78 let periodic = Some((T::BlockNumber::one(), 100));107 fill_schedule::<T>(when, s, true, Some(true))?;
108 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
109 verify {
110 assert_eq!(System::<T>::event_count(), s);
111 for i in 0..s {
112 assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
113 }
114 }
115
116 on_initialize_named_resolved {
79 let priority = 0;117 let s in 1 .. T::MaxScheduledPerBlock::get();
80 // Essentially a no-op call.
81 let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());118 let when = BLOCK_NUMBER.into();
82119 fill_schedule::<T>(when, s, false, Some(true))?;
120 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
121 verify {
122 assert_eq!(System::<T>::event_count(), s);
123 assert!(Agenda::<T>::iter().count() == 0);
124 }
125
126 on_initialize_periodic {
127 let s in 1 .. T::MaxScheduledPerBlock::get();
128 let when = BLOCK_NUMBER.into();
83 fill_schedule::<T>(when, s)?;129 fill_schedule::<T>(when, s, true, Some(false))?;
84 }: _(RawOrigin::Root, when, periodic, priority, call)130 }: { Scheduler::<T>::on_initialize(when); }
85 verify {131 verify {
86 ensure!(132 assert_eq!(System::<T>::event_count(), s);
133 for i in 0..s {
87 Agenda::<T>::get(when).len() == (s + 1) as usize,134 assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
88 "didn't add to schedule"135 }
89 );
90 }136 }
91137
92 cancel {138 on_initialize_periodic_resolved {
93 let s in 1 .. T::MaxScheduledPerBlock::get();139 let s in 1 .. T::MaxScheduledPerBlock::get();
94 let when = BLOCK_NUMBER.into();140 let when = BLOCK_NUMBER.into();
95
96 fill_schedule::<T>(when, s)?;141 fill_schedule::<T>(when, s, true, Some(true))?;
142 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
143 verify {
97 assert_eq!(Agenda::<T>::get(when).len(), s as usize);144 assert_eq!(System::<T>::event_count(), s );
145 for i in 0..s {
146 assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
147 }
148 }
149
150 on_initialize_aborted {
151 let s in 1 .. T::MaxScheduledPerBlock::get();
152 let when = BLOCK_NUMBER.into();
153 fill_schedule::<T>(when, s, false, None)?;
98 }: _(RawOrigin::Root, when, 0)154 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
155 verify {
156 assert_eq!(System::<T>::event_count(), 0);
157 }
158
159 on_initialize_named_aborted {
160 let s in 1 .. T::MaxScheduledPerBlock::get();
161 let when = BLOCK_NUMBER.into();
162 fill_schedule::<T>(when, s, false, Some(false))?;
163 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
99 verify {164 verify {
165 }
166
167 on_initialize_named {
168 let s in 1 .. T::MaxScheduledPerBlock::get();
169 let when = BLOCK_NUMBER.into();
170 fill_schedule::<T>(when, s, false, None)?;
171 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
172 verify {
100 ensure!(173 assert_eq!(System::<T>::event_count(), 0);
174 }
175
176 on_initialize {
101 Lookup::<T>::get(0.encode()).is_none(),177 let s in 1 .. T::MaxScheduledPerBlock::get();
102 "didn't remove from lookup"178 let when = BLOCK_NUMBER.into();
179 fill_schedule::<T>(when, s, false, Some(false))?;
180 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
181 verify {
103 );182 assert_eq!(System::<T>::event_count(), s);
104 // Removed schedule is NONE
105 ensure!(183 assert!(Agenda::<T>::iter().count() == 0);
184 }
185
186 on_initialize_resolved {
106 Agenda::<T>::get(when)[0].is_none(),187 let s in 1 .. T::MaxScheduledPerBlock::get();
107 "didn't remove from schedule"188 let when = BLOCK_NUMBER.into();
189 fill_schedule::<T>(when, s, false, Some(true))?;
190 }: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
191 verify {
108 );192 assert_eq!(System::<T>::event_count(), s);
109 }193 assert!(Agenda::<T>::iter().count() == 0);
194 }
110195
111 schedule_named {196 schedule_named {
197 let caller: T::AccountId = account("user", 0, 1);
198 let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Signed(caller.clone());
112 let s in 0 .. T::MaxScheduledPerBlock::get();199 let s in 0 .. T::MaxScheduledPerBlock::get();
113 let id = s.encode();200 let slice_id: [u8; 4] = s.encode().try_into().unwrap();
201 let mut id: [u8; 16] = [0; 16];
202 id[..4].clone_from_slice(&slice_id);
114 let when = BLOCK_NUMBER.into();203 let when = BLOCK_NUMBER.into();
115 let periodic = Some((T::BlockNumber::one(), 100));204 let periodic = Some((T::BlockNumber::one(), 100));
116 let priority = 0;205 let priority = 0;
117 // Essentially a no-op call.206 // Essentially a no-op call.
118 let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());207 let inner_call = frame_system::Call::set_storage { items: vec![] }.into();
119208 let call = Box::new(CallOrHashOf::<T>::Value(inner_call));
120 fill_schedule::<T>(when, s)?;209 fill_schedule::<T>(when, s, true, Some(false))?;
121 }: _(RawOrigin::Root, id, when, periodic, priority, call)210 }: _(origin, id, when, periodic, priority, call)
122 verify {211 verify {
123 ensure!(212 ensure!(
124 Agenda::<T>::get(when).len() == (s + 1) as usize,213 Agenda::<T>::get(when).len() == (s + 1) as usize,
127 }216 }
128217
129 cancel_named {218 cancel_named {
219 let caller: T::AccountId = account("user", 0, 1);
220 let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Signed(caller.clone());
130 let s in 1 .. T::MaxScheduledPerBlock::get();221 let s in 1 .. T::MaxScheduledPerBlock::get();
131 let when = BLOCK_NUMBER.into();222 let when = BLOCK_NUMBER.into();
132223 let id = 0.encode().try_into().unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
133 fill_schedule::<T>(when, s)?;224 fill_schedule::<T>(when, s, true, Some(false))?;
134 }: _(RawOrigin::Root, 0.encode())225 }: _(origin, id)
135 verify {226 verify {
136 ensure!(227 ensure!(
137 Lookup::<T>::get(0.encode()).is_none(),228 Lookup::<T>::get(id).is_none(),
138 "didn't remove from lookup"229 "didn't remove from lookup"
139 );230 );
140 // Removed schedule is NONE231 // Removed schedule is NONE
144 );235 );
145 }236 }
146237
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()); }238 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}239}
163
164impl_benchmark_test_suite!(Scheduler, crate::tests::new_test_ext(), crate::tests::Test,);
165240
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
60// Ensure we're `no_std` when compiling for Wasm.60// Ensure we're `no_std` when compiling for Wasm.
61#![cfg_attr(not(feature = "std"), no_std)]61#![cfg_attr(not(feature = "std"), no_std)]
6262
63// FIXME
64// #[cfg(feature = "runtime-benchmarks")]63#[cfg(feature = "runtime-benchmarks")]
65// mod benchmarking;64mod benchmarking;
6665
67pub mod weights;66pub mod weights;
6867
159 Self::on_initialize_periodic(2) - Self::on_initialize_periodic(1)158 Self::on_initialize_periodic(2) - Self::on_initialize_periodic(1)
160 }159 }
161 (true, true, Some(false)) => {160 (true, true, Some(false)) => {
162 Self::on_initialize_periodic_named(2) - Self::on_initialize_periodic_named(1)161 Self::on_initialize_periodic_named_resolved(2)
162 - Self::on_initialize_periodic_named_resolved(1)
163 }163 }
164 (false, false, Some(true)) => {164 (false, false, Some(true)) => Self::on_initialize(2) - Self::on_initialize(1),
165 Self::on_initialize_resolved(2) - Self::on_initialize_resolved(1)
166 }
167 (false, true, Some(true)) => {165 (false, true, Some(true)) => {
168 Self::on_initialize_named_resolved(2) - Self::on_initialize_named_resolved(1)166 Self::on_initialize_named_resolved(2) - Self::on_initialize_named_resolved(1)
169 }167 }
610 Ok(when)608 Ok(when)
611 }609 }
612610
613 fn do_schedule(
614 when: DispatchTime<T::BlockNumber>,
615 maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
616 priority: schedule::Priority,
617 origin: T::PalletsOrigin,
618 call: CallOrHashOf<T>,
619 ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
620 let when = Self::resolve_time(when)?;
621 call.ensure_requested::<T::PreimageProvider>();
622
623 // sanitize maybe_periodic
624 let maybe_periodic = maybe_periodic
625 .filter(|p| p.1 > 1 && !p.0.is_zero())
626 // Remove one from the number of repetitions since we will schedule one now.
627 .map(|(p, c)| (p, c - 1));
628 let s = Some(Scheduled {
629 maybe_id: None,
630 priority,
631 call,
632 maybe_periodic,
633 origin,
634 _phantom: PhantomData::<T::AccountId>::default(),
635 });
636 Agenda::<T>::append(when, s);
637 let index = Agenda::<T>::decode_len(when).unwrap_or(1) as u32 - 1;
638 Self::deposit_event(Event::Scheduled { when, index });
639
640 Ok((when, index))
641 }
642
643 fn do_cancel(
644 origin: Option<T::PalletsOrigin>,
645 (when, index): TaskAddress<T::BlockNumber>,
646 ) -> Result<(), DispatchError> {
647 let scheduled = Agenda::<T>::try_mutate(when, |agenda| {
648 agenda.get_mut(index as usize).map_or(
649 Ok(None),
650 |s| -> Result<Option<Scheduled<_, _, _, _>>, DispatchError> {
651 if let (Some(ref o), Some(ref s)) = (origin, s.borrow()) {
652 if matches!(
653 T::OriginPrivilegeCmp::cmp_privilege(o, &s.origin),
654 Some(Ordering::Less) | None
655 ) {
656 return Err(BadOrigin.into());
657 }
658 };
659 Ok(s.take())
660 },
661 )
662 })?;
663 if let Some(s) = scheduled {
664 s.call.ensure_unrequested::<T::PreimageProvider>();
665 if let Some(id) = s.maybe_id {
666 Lookup::<T>::remove(id);
667 }
668 Self::deposit_event(Event::Canceled { when, index });
669 Ok(())
670 } else {
671 Err(Error::<T>::NotFound)?
672 }
673 }
674
675 fn do_reschedule(
676 (when, index): TaskAddress<T::BlockNumber>,
677 new_time: DispatchTime<T::BlockNumber>,
678 ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
679 let new_time = Self::resolve_time(new_time)?;
680
681 if new_time == when {
682 return Err(Error::<T>::RescheduleNoChange.into());
683 }
684
685 Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {
686 let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;
687 let task = task.take().ok_or(Error::<T>::NotFound)?;
688 Agenda::<T>::append(new_time, Some(task));
689 Ok(())
690 })?;
691
692 let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;
693 Self::deposit_event(Event::Canceled { when, index });
694 Self::deposit_event(Event::Scheduled {
695 when: new_time,
696 index: new_index,
697 });
698
699 Ok((new_time, new_index))
700 }
701
702 fn do_schedule_named(611 fn do_schedule_named(
703 id: ScheduledId,612 id: ScheduledId,
789 Err(Error::<T>::NotFound)?698 Err(Error::<T>::NotFound)?
790 }699 }
791 })700 })
792 }
793
794 fn do_reschedule_named(
795 id: ScheduledId,
796 new_time: DispatchTime<T::BlockNumber>,
797 ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
798 let new_time = Self::resolve_time(new_time)?;
799
800 Lookup::<T>::try_mutate_exists(
801 id,
802 |lookup| -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
803 let (when, index) = lookup.ok_or(Error::<T>::NotFound)?;
804
805 if new_time == when {
806 return Err(Error::<T>::RescheduleNoChange.into());
807 }
808
809 Agenda::<T>::try_mutate(when, |agenda| -> DispatchResult {
810 let task = agenda.get_mut(index as usize).ok_or(Error::<T>::NotFound)?;
811 let task = task.take().ok_or(Error::<T>::NotFound)?;
812 Agenda::<T>::append(new_time, Some(task));
813
814 Ok(())
815 })?;
816
817 let new_index = Agenda::<T>::decode_len(new_time).unwrap_or(1) as u32 - 1;
818 Self::deposit_event(Event::Canceled { when, index });
819 Self::deposit_event(Event::Scheduled {
820 when: new_time,
821 index: new_index,
822 });
823
824 *lookup = Some((new_time, new_index));
825
826 Ok((new_time, new_index))
827 },
828 )
829 }
830}
831
832impl<T: Config> schedule::v2::Anon<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>
833 for Pallet<T>
834{
835 type Address = TaskAddress<T::BlockNumber>;
836 type Hash = T::Hash;
837
838 fn schedule(
839 when: DispatchTime<T::BlockNumber>,
840 maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
841 priority: schedule::Priority,
842 origin: T::PalletsOrigin,
843 call: CallOrHashOf<T>,
844 ) -> Result<Self::Address, DispatchError> {
845 Self::do_schedule(when, maybe_periodic, priority, origin, call)
846 }
847
848 fn cancel((when, index): Self::Address) -> Result<(), ()> {
849 Self::do_cancel(None, (when, index)).map_err(|_| ())
850 }
851
852 fn reschedule(
853 address: Self::Address,
854 when: DispatchTime<T::BlockNumber>,
855 ) -> Result<Self::Address, DispatchError> {
856 Self::do_reschedule(address, when)
857 }
858
859 fn next_dispatch_time((when, index): Self::Address) -> Result<T::BlockNumber, ()> {
860 Agenda::<T>::get(when)
861 .get(index as usize)
862 .ok_or(())
863 .map(|_| when)
864 }
865}
866
867impl<T: Config> schedule::v2::Named<T::BlockNumber, <T as Config>::Call, T::PalletsOrigin>
868 for Pallet<T>
869{
870 type Address = TaskAddress<T::BlockNumber>;
871 type Hash = T::Hash;
872
873 fn schedule_named(
874 id: Vec<u8>,
875 when: DispatchTime<T::BlockNumber>,
876 maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
877 priority: schedule::Priority,
878 origin: T::PalletsOrigin,
879 call: CallOrHashOf<T>,
880 ) -> Result<Self::Address, ()> {
881 let inner_id: ScheduledId = id
882 .try_into()
883 .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
884 Self::do_schedule_named(inner_id, when, maybe_periodic, priority, origin, call)
885 .map_err(|_| ())
886 }
887
888 fn cancel_named(id: Vec<u8>) -> Result<(), ()> {
889 let inner_id: ScheduledId = id
890 .try_into()
891 .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
892 Self::do_cancel_named(None, inner_id).map_err(|_| ())
893 }
894
895 fn reschedule_named(
896 id: Vec<u8>,
897 when: DispatchTime<T::BlockNumber>,
898 ) -> Result<Self::Address, DispatchError> {
899 let inner_id: ScheduledId = id
900 .try_into()
901 .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
902 Self::do_reschedule_named(inner_id, when)
903 }
904
905 fn next_dispatch_time(id: Vec<u8>) -> Result<T::BlockNumber, ()> {
906 let inner_id: ScheduledId = id
907 .try_into()
908 .unwrap_or([0; MAX_TASK_ID_LENGTH_IN_BYTES as usize]);
909 Lookup::<T>::get(inner_id)
910 .and_then(|(when, index)| Agenda::<T>::get(when).get(index as usize).map(|_| when))
911 .ok_or(())
912 }701 }
913}702}
914703
modifiedpallets/scheduler/src/weights.rsdiffbeforeafterboth
1// This file is part of Substrate.1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
22
3// Copyright (C) 2022 Parity Technologies (UK) Ltd.3//! Autogenerated weights for pallet_unique_scheduler
4// SPDX-License-Identifier: Apache-2.0
5
6// 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 at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// 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 and
16// limitations under the License.
17
18//! Autogenerated weights for pallet_scheduler
19//!4//!
20//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
21//! DATE: 2022-01-31, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2022-06-09, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`
22//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 10247//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
238
24// Executed Command:9// Executed Command:
25// ./target/production/substrate10// target/release/unique-collator
26// benchmark11// benchmark
27// --chain=dev12// pallet
13// --pallet
14// pallet-unique-scheduler
15// --wasm-execution
16// compiled
17// --extrinsic
18// *
19// --template
20// .maintain/frame-weight-template.hbs
28// --steps=5021// --steps=50
29// --repeat=2022// --repeat=200
30// --pallet=pallet_scheduler
31// --extrinsic=*
32// --execution=wasm
33// --wasm-execution=compiled
34// --heap-pages=409623// --heap-pages=4096
35// --output=./frame/scheduler/src/weights.rs24// --output=./pallets/scheduler/src/weights.rs
36// --template=.maintain/frame-weight-template.hbs
37// --header=HEADER-APACHE2
38// --raw
3925
40#![cfg_attr(rustfmt, rustfmt_skip)]26#![cfg_attr(rustfmt, rustfmt_skip)]
41#![allow(unused_parens)]27#![allow(unused_parens)]
42#![allow(unused_imports)]28#![allow(unused_imports)]
29#![allow(clippy::unnecessary_cast)]
4330
44use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};31use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
45use sp_std::marker::PhantomData;32use sp_std::marker::PhantomData;
4633
47/// Weight functions needed for pallet_scheduler.34/// Weight functions needed for pallet_unique_scheduler.
48pub trait WeightInfo {35pub trait WeightInfo {
49 fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight;36 fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight;
50 fn on_initialize_named_resolved(s: u32, ) -> Weight;37 fn on_initialize_named_resolved(s: u32, ) -> Weight;
38 fn on_initialize_periodic(s: u32, ) -> Weight;
51 fn on_initialize_periodic_resolved(s: u32, ) -> Weight;39 fn on_initialize_periodic_resolved(s: u32, ) -> Weight;
52 fn on_initialize_resolved(s: u32, ) -> Weight;
53 fn on_initialize_named_aborted(s: u32, ) -> Weight;
54 fn on_initialize_aborted(s: u32, ) -> Weight;40 fn on_initialize_aborted(s: u32, ) -> Weight;
55 fn on_initialize_periodic_named(s: u32, ) -> Weight;41 fn on_initialize_named_aborted(s: u32, ) -> Weight;
56 fn on_initialize_periodic(s: u32, ) -> Weight;
57 fn on_initialize_named(s: u32, ) -> Weight;42 fn on_initialize_named(s: u32, ) -> Weight;
58 fn on_initialize(s: u32, ) -> Weight;43 fn on_initialize(s: u32, ) -> Weight;
59 fn schedule(s: u32, ) -> Weight;44 fn on_initialize_resolved(s: u32, ) -> Weight;
60 fn cancel(s: u32, ) -> Weight;
61 fn schedule_named(s: u32, ) -> Weight;45 fn schedule_named(s: u32, ) -> Weight;
62 fn cancel_named(s: u32, ) -> Weight;46 fn cancel_named(s: u32, ) -> Weight;
63}47}
6448
65/// Weights for pallet_scheduler using the Substrate node and recommended hardware.49/// Weights for pallet_unique_scheduler using the Substrate node and recommended hardware.
66pub struct SubstrateWeight<T>(PhantomData<T>);50pub struct SubstrateWeight<T>(PhantomData<T>);
67impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {51impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
68 // Storage: Scheduler Agenda (r:2 w:2)52 // Storage: Scheduler Agenda (r:2 w:2)
69 // Storage: Preimage PreimageFor (r:1 w:1)53 // Storage: System Account (r:1 w:1)
70 // Storage: Preimage StatusFor (r:1 w:1)54 // Storage: System AllExtrinsicsLen (r:1 w:1)
55 // Storage: System BlockWeight (r:1 w:1)
71 // Storage: Scheduler Lookup (r:0 w:1)56 // Storage: Scheduler Lookup (r:0 w:1)
72 fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {57 fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
73 (11_587_000 as Weight)58 (35_999_000 as Weight)
74 // Standard Error: 17_00059 // Standard Error: 3_000
75 .saturating_add((17_428_000 as Weight).saturating_mul(s as Weight))60 .saturating_add((32_234_000 as Weight).saturating_mul(s as Weight))
76 .saturating_add(T::DbWeight::get().reads(1 as Weight))61 .saturating_add(T::DbWeight::get().reads(4 as Weight))
77 .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))62 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
78 .saturating_add(T::DbWeight::get().writes(1 as Weight))63 .saturating_add(T::DbWeight::get().writes(4 as Weight))
79 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(s as Weight)))64 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
80 }65 }
81 // Storage: Scheduler Agenda (r:1 w:1)66 // Storage: Scheduler Agenda (r:1 w:1)
82 // Storage: Preimage PreimageFor (r:1 w:1)67 // Storage: System Account (r:1 w:1)
83 // Storage: Preimage StatusFor (r:1 w:1)68 // Storage: System AllExtrinsicsLen (r:1 w:1)
69 // Storage: System BlockWeight (r:1 w:1)
84 // Storage: Scheduler Lookup (r:0 w:1)70 // Storage: Scheduler Lookup (r:0 w:1)
85 fn on_initialize_named_resolved(s: u32, ) -> Weight {71 fn on_initialize_named_resolved(s: u32, ) -> Weight {
86 (8_965_000 as Weight)72 (34_874_000 as Weight)
87 // Standard Error: 11_00073 // Standard Error: 2_000
88 .saturating_add((13_410_000 as Weight).saturating_mul(s as Weight))74 .saturating_add((23_114_000 as Weight).saturating_mul(s as Weight))
89 .saturating_add(T::DbWeight::get().reads(1 as Weight))75 .saturating_add(T::DbWeight::get().reads(4 as Weight))
90 .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))76 .saturating_add(T::DbWeight::get().writes(4 as Weight))
91 .saturating_add(T::DbWeight::get().writes(1 as Weight))
92 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))77 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
93 }78 }
94 // Storage: Scheduler Agenda (r:2 w:2)79 // Storage: Scheduler Agenda (r:2 w:2)
95 // Storage: Preimage PreimageFor (r:1 w:1)80 // Storage: System Account (r:1 w:1)
96 // Storage: Preimage StatusFor (r:1 w:1)81 // Storage: System AllExtrinsicsLen (r:1 w:1)
97 fn on_initialize_periodic_resolved(s: u32, ) -> Weight {82 // Storage: System BlockWeight (r:1 w:1)
98 (8_654_000 as Weight)
99 // Standard Error: 17_000
100 .saturating_add((14_990_000 as Weight).saturating_mul(s as Weight))
101 .saturating_add(T::DbWeight::get().reads(1 as Weight))
102 .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
103 .saturating_add(T::DbWeight::get().writes(1 as Weight))
104 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))
105 }
106 // Storage: Scheduler Agenda (r:1 w:1)
107 // Storage: Preimage PreimageFor (r:1 w:1)83 // Storage: Scheduler Lookup (r:0 w:1)
108 // Storage: Preimage StatusFor (r:1 w:1)84 fn on_initialize_periodic(s: u32, ) -> Weight {
109 fn on_initialize_resolved(s: u32, ) -> Weight {
110 (9_303_000 as Weight)85 (36_469_000 as Weight)
111 // Standard Error: 10_00086 // Standard Error: 3_000
112 .saturating_add((12_244_000 as Weight).saturating_mul(s as Weight))87 .saturating_add((32_202_000 as Weight).saturating_mul(s as Weight))
113 .saturating_add(T::DbWeight::get().reads(1 as Weight))88 .saturating_add(T::DbWeight::get().reads(4 as Weight))
114 .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))89 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
115 .saturating_add(T::DbWeight::get().writes(1 as Weight))90 .saturating_add(T::DbWeight::get().writes(4 as Weight))
116 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))91 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
117 }92 }
118 // Storage: Scheduler Agenda (r:2 w:2)93 // Storage: Scheduler Agenda (r:2 w:2)
119 // Storage: Preimage PreimageFor (r:1 w:0)94 // Storage: System Account (r:1 w:1)
95 // Storage: System AllExtrinsicsLen (r:1 w:1)
96 // Storage: System BlockWeight (r:1 w:1)
120 // Storage: Scheduler Lookup (r:0 w:1)97 // Storage: Scheduler Lookup (r:0 w:1)
121 fn on_initialize_named_aborted(s: u32, ) -> Weight {98 fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
122 (7_506_000 as Weight)99 (35_352_000 as Weight)
123 // Standard Error: 3_000100 // Standard Error: 3_000
124 .saturating_add((5_208_000 as Weight).saturating_mul(s as Weight))101 .saturating_add((32_309_000 as Weight).saturating_mul(s as Weight))
125 .saturating_add(T::DbWeight::get().reads(2 as Weight))102 .saturating_add(T::DbWeight::get().reads(4 as Weight))
126 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))103 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
127 .saturating_add(T::DbWeight::get().writes(2 as Weight))104 .saturating_add(T::DbWeight::get().writes(4 as Weight))
128 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))105 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
129 }106 }
130 // Storage: Scheduler Agenda (r:2 w:2)107 // Storage: Scheduler Agenda (r:2 w:2)
131 // Storage: Preimage PreimageFor (r:1 w:0)108 // Storage: Scheduler Lookup (r:0 w:1)
132 fn on_initialize_aborted(s: u32, ) -> Weight {109 fn on_initialize_aborted(s: u32, ) -> Weight {
133 (8_046_000 as Weight)110 (11_267_000 as Weight)
134 // Standard Error: 3_000111 // Standard Error: 1_000
135 .saturating_add((2_914_000 as Weight).saturating_mul(s as Weight))112 .saturating_add((9_368_000 as Weight).saturating_mul(s as Weight))
136 .saturating_add(T::DbWeight::get().reads(2 as Weight))113 .saturating_add(T::DbWeight::get().reads(2 as Weight))
137 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
138 .saturating_add(T::DbWeight::get().writes(2 as Weight))114 .saturating_add(T::DbWeight::get().writes(2 as Weight))
115 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
139 }116 }
140 // Storage: Scheduler Agenda (r:2 w:2)117 // Storage: Scheduler Agenda (r:1 w:1)
118 // Storage: System Account (r:1 w:1)
119 // Storage: System AllExtrinsicsLen (r:1 w:1)
120 // Storage: System BlockWeight (r:1 w:1)
141 // Storage: Scheduler Lookup (r:0 w:1)121 // Storage: Scheduler Lookup (r:0 w:1)
142 fn on_initialize_periodic_named(s: u32, ) -> Weight {122 fn on_initialize_named_aborted(s: u32, ) -> Weight {
143 (13_704_000 as Weight)123 (35_937_000 as Weight)
144 // Standard Error: 4_000124 // Standard Error: 3_000
145 .saturating_add((8_186_000 as Weight).saturating_mul(s as Weight))125 .saturating_add((23_037_000 as Weight).saturating_mul(s as Weight))
146 .saturating_add(T::DbWeight::get().reads(1 as Weight))126 .saturating_add(T::DbWeight::get().reads(4 as Weight))
147 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))127 .saturating_add(T::DbWeight::get().writes(4 as Weight))
148 .saturating_add(T::DbWeight::get().writes(1 as Weight))
149 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
150 }
151 // Storage: Scheduler Agenda (r:2 w:2)
152 fn on_initialize_periodic(s: u32, ) -> Weight {
153 (12_668_000 as Weight)
154 // Standard Error: 5_000
155 .saturating_add((5_868_000 as Weight).saturating_mul(s as Weight))
156 .saturating_add(T::DbWeight::get().reads(1 as Weight))
157 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
158 .saturating_add(T::DbWeight::get().writes(1 as Weight))
159 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))128 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
160 }129 }
161 // Storage: Scheduler Agenda (r:1 w:1)130 // Storage: Scheduler Agenda (r:2 w:2)
162 // Storage: Scheduler Lookup (r:0 w:1)131 // Storage: Scheduler Lookup (r:0 w:1)
163 fn on_initialize_named(s: u32, ) -> Weight {132 fn on_initialize_named(s: u32, ) -> Weight {
164 (13_946_000 as Weight)133 (10_338_000 as Weight)
165 // Standard Error: 4_000134 // Standard Error: 2_000
166 .saturating_add((4_367_000 as Weight).saturating_mul(s as Weight))135 .saturating_add((9_422_000 as Weight).saturating_mul(s as Weight))
167 .saturating_add(T::DbWeight::get().reads(1 as Weight))136 .saturating_add(T::DbWeight::get().reads(2 as Weight))
168 .saturating_add(T::DbWeight::get().writes(1 as Weight))137 .saturating_add(T::DbWeight::get().writes(2 as Weight))
169 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))138 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
170 }139 }
171 // Storage: Scheduler Agenda (r:1 w:1)140 // Storage: Scheduler Agenda (r:1 w:1)
141 // Storage: System Account (r:1 w:1)
142 // Storage: System AllExtrinsicsLen (r:1 w:1)
143 // Storage: System BlockWeight (r:1 w:1)
144 // Storage: Scheduler Lookup (r:0 w:1)
172 fn on_initialize(s: u32, ) -> Weight {145 fn on_initialize(s: u32, ) -> Weight {
173 (13_151_000 as Weight)146 (37_448_000 as Weight)
174 // Standard Error: 4_000147 // Standard Error: 7_000
175 .saturating_add((3_455_000 as Weight).saturating_mul(s as Weight))148 .saturating_add((22_907_000 as Weight).saturating_mul(s as Weight))
176 .saturating_add(T::DbWeight::get().reads(1 as Weight))149 .saturating_add(T::DbWeight::get().reads(4 as Weight))
177 .saturating_add(T::DbWeight::get().writes(1 as Weight))150 .saturating_add(T::DbWeight::get().writes(4 as Weight))
151 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
178 }152 }
179 // Storage: Scheduler Agenda (r:1 w:1)153 // Storage: Scheduler Agenda (r:1 w:1)
180 fn schedule(s: u32, ) -> Weight {154 // Storage: System Account (r:1 w:1)
181 (14_040_000 as Weight)
182 // Standard Error: 1_000155 // Storage: System AllExtrinsicsLen (r:1 w:1)
183 .saturating_add((89_000 as Weight).saturating_mul(s as Weight))
184 .saturating_add(T::DbWeight::get().reads(1 as Weight))
185 .saturating_add(T::DbWeight::get().writes(1 as Weight))
186 }
187 // Storage: Scheduler Agenda (r:1 w:1)156 // Storage: System BlockWeight (r:1 w:1)
188 // Storage: Scheduler Lookup (r:0 w:1)157 // Storage: Scheduler Lookup (r:0 w:1)
189 fn cancel(s: u32, ) -> Weight {158 fn on_initialize_resolved(s: u32, ) -> Weight {
190 (14_376_000 as Weight)159 (34_841_000 as Weight)
191 // Standard Error: 1_000160 // Standard Error: 7_000
192 .saturating_add((576_000 as Weight).saturating_mul(s as Weight))161 .saturating_add((22_966_000 as Weight).saturating_mul(s as Weight))
193 .saturating_add(T::DbWeight::get().reads(1 as Weight))162 .saturating_add(T::DbWeight::get().reads(4 as Weight))
194 .saturating_add(T::DbWeight::get().writes(2 as Weight))163 .saturating_add(T::DbWeight::get().writes(4 as Weight))
164 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
195 }165 }
196 // Storage: Scheduler Lookup (r:1 w:1)166 // Storage: Scheduler Lookup (r:1 w:1)
197 // Storage: Scheduler Agenda (r:1 w:1)167 // Storage: Scheduler Agenda (r:1 w:1)
198 fn schedule_named(s: u32, ) -> Weight {168 fn schedule_named(s: u32, ) -> Weight {
199 (16_806_000 as Weight)169 (33_845_000 as Weight)
200 // Standard Error: 1_000170 // Standard Error: 0
201 .saturating_add((102_000 as Weight).saturating_mul(s as Weight))171 .saturating_add((168_000 as Weight).saturating_mul(s as Weight))
202 .saturating_add(T::DbWeight::get().reads(2 as Weight))172 .saturating_add(T::DbWeight::get().reads(2 as Weight))
203 .saturating_add(T::DbWeight::get().writes(2 as Weight))173 .saturating_add(T::DbWeight::get().writes(2 as Weight))
204 }174 }
205 // Storage: Scheduler Lookup (r:1 w:1)175 // Storage: Scheduler Lookup (r:1 w:1)
206 // Storage: Scheduler Agenda (r:1 w:1)176 // Storage: Scheduler Agenda (r:1 w:1)
207 fn cancel_named(s: u32, ) -> Weight {177 fn cancel_named(s: u32, ) -> Weight {
208 (15_852_000 as Weight)178 (31_169_000 as Weight)
209 // Standard Error: 2_000179 // Standard Error: 1_000
210 .saturating_add((590_000 as Weight).saturating_mul(s as Weight))180 .saturating_add((1_565_000 as Weight).saturating_mul(s as Weight))
211 .saturating_add(T::DbWeight::get().reads(2 as Weight))181 .saturating_add(T::DbWeight::get().reads(2 as Weight))
212 .saturating_add(T::DbWeight::get().writes(2 as Weight))182 .saturating_add(T::DbWeight::get().writes(2 as Weight))
213 }183 }
216// For backwards compatibility and tests186// For backwards compatibility and tests
217impl WeightInfo for () {187impl WeightInfo for () {
218 // Storage: Scheduler Agenda (r:2 w:2)188 // Storage: Scheduler Agenda (r:2 w:2)
219 // Storage: Preimage PreimageFor (r:1 w:1)189 // Storage: System Account (r:1 w:1)
220 // Storage: Preimage StatusFor (r:1 w:1)190 // Storage: System AllExtrinsicsLen (r:1 w:1)
191 // Storage: System BlockWeight (r:1 w:1)
221 // Storage: Scheduler Lookup (r:0 w:1)192 // Storage: Scheduler Lookup (r:0 w:1)
222 fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {193 fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
223 (11_587_000 as Weight)194 (35_999_000 as Weight)
224 // Standard Error: 17_000195 // Standard Error: 3_000
225 .saturating_add((17_428_000 as Weight).saturating_mul(s as Weight))196 .saturating_add((32_234_000 as Weight).saturating_mul(s as Weight))
226 .saturating_add(RocksDbWeight::get().reads(1 as Weight))197 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
227 .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))198 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
228 .saturating_add(RocksDbWeight::get().writes(1 as Weight))199 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
229 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(s as Weight)))200 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
230 }201 }
231 // Storage: Scheduler Agenda (r:1 w:1)202 // Storage: Scheduler Agenda (r:1 w:1)
232 // Storage: Preimage PreimageFor (r:1 w:1)203 // Storage: System Account (r:1 w:1)
233 // Storage: Preimage StatusFor (r:1 w:1)204 // Storage: System AllExtrinsicsLen (r:1 w:1)
205 // Storage: System BlockWeight (r:1 w:1)
234 // Storage: Scheduler Lookup (r:0 w:1)206 // Storage: Scheduler Lookup (r:0 w:1)
235 fn on_initialize_named_resolved(s: u32, ) -> Weight {207 fn on_initialize_named_resolved(s: u32, ) -> Weight {
236 (8_965_000 as Weight)208 (34_874_000 as Weight)
237 // Standard Error: 11_000209 // Standard Error: 2_000
238 .saturating_add((13_410_000 as Weight).saturating_mul(s as Weight))210 .saturating_add((23_114_000 as Weight).saturating_mul(s as Weight))
239 .saturating_add(RocksDbWeight::get().reads(1 as Weight))211 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
240 .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))212 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
241 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
242 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))213 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
243 }214 }
244 // Storage: Scheduler Agenda (r:2 w:2)215 // Storage: Scheduler Agenda (r:2 w:2)
245 // Storage: Preimage PreimageFor (r:1 w:1)216 // Storage: System Account (r:1 w:1)
246 // Storage: Preimage StatusFor (r:1 w:1)217 // Storage: System AllExtrinsicsLen (r:1 w:1)
247 fn on_initialize_periodic_resolved(s: u32, ) -> Weight {218 // Storage: System BlockWeight (r:1 w:1)
248 (8_654_000 as Weight)
249 // Standard Error: 17_000
250 .saturating_add((14_990_000 as Weight).saturating_mul(s as Weight))
251 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
252 .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(s as Weight)))
253 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
254 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(s as Weight)))
255 }
256 // Storage: Scheduler Agenda (r:1 w:1)
257 // Storage: Preimage PreimageFor (r:1 w:1)219 // Storage: Scheduler Lookup (r:0 w:1)
258 // Storage: Preimage StatusFor (r:1 w:1)220 fn on_initialize_periodic(s: u32, ) -> Weight {
259 fn on_initialize_resolved(s: u32, ) -> Weight {
260 (9_303_000 as Weight)221 (36_469_000 as Weight)
261 // Standard Error: 10_000222 // Standard Error: 3_000
262 .saturating_add((12_244_000 as Weight).saturating_mul(s as Weight))223 .saturating_add((32_202_000 as Weight).saturating_mul(s as Weight))
263 .saturating_add(RocksDbWeight::get().reads(1 as Weight))224 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
264 .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))225 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
265 .saturating_add(RocksDbWeight::get().writes(1 as Weight))226 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
266 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))227 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
267 }228 }
268 // Storage: Scheduler Agenda (r:2 w:2)229 // Storage: Scheduler Agenda (r:2 w:2)
269 // Storage: Preimage PreimageFor (r:1 w:0)230 // Storage: System Account (r:1 w:1)
231 // Storage: System AllExtrinsicsLen (r:1 w:1)
232 // Storage: System BlockWeight (r:1 w:1)
270 // Storage: Scheduler Lookup (r:0 w:1)233 // Storage: Scheduler Lookup (r:0 w:1)
271 fn on_initialize_named_aborted(s: u32, ) -> Weight {234 fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
272 (7_506_000 as Weight)235 (35_352_000 as Weight)
273 // Standard Error: 3_000236 // Standard Error: 3_000
274 .saturating_add((5_208_000 as Weight).saturating_mul(s as Weight))237 .saturating_add((32_309_000 as Weight).saturating_mul(s as Weight))
275 .saturating_add(RocksDbWeight::get().reads(2 as Weight))238 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
276 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))239 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
277 .saturating_add(RocksDbWeight::get().writes(2 as Weight))240 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
278 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))241 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
279 }242 }
280 // Storage: Scheduler Agenda (r:2 w:2)243 // Storage: Scheduler Agenda (r:2 w:2)
281 // Storage: Preimage PreimageFor (r:1 w:0)244 // Storage: Scheduler Lookup (r:0 w:1)
282 fn on_initialize_aborted(s: u32, ) -> Weight {245 fn on_initialize_aborted(s: u32, ) -> Weight {
283 (8_046_000 as Weight)246 (11_267_000 as Weight)
284 // Standard Error: 3_000247 // Standard Error: 1_000
285 .saturating_add((2_914_000 as Weight).saturating_mul(s as Weight))248 .saturating_add((9_368_000 as Weight).saturating_mul(s as Weight))
286 .saturating_add(RocksDbWeight::get().reads(2 as Weight))249 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
287 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
288 .saturating_add(RocksDbWeight::get().writes(2 as Weight))250 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
251 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
289 }252 }
290 // Storage: Scheduler Agenda (r:2 w:2)253 // Storage: Scheduler Agenda (r:1 w:1)
254 // Storage: System Account (r:1 w:1)
255 // Storage: System AllExtrinsicsLen (r:1 w:1)
256 // Storage: System BlockWeight (r:1 w:1)
291 // Storage: Scheduler Lookup (r:0 w:1)257 // Storage: Scheduler Lookup (r:0 w:1)
292 fn on_initialize_periodic_named(s: u32, ) -> Weight {258 fn on_initialize_named_aborted(s: u32, ) -> Weight {
293 (13_704_000 as Weight)259 (35_937_000 as Weight)
294 // Standard Error: 4_000260 // Standard Error: 3_000
295 .saturating_add((8_186_000 as Weight).saturating_mul(s as Weight))261 .saturating_add((23_037_000 as Weight).saturating_mul(s as Weight))
296 .saturating_add(RocksDbWeight::get().reads(1 as Weight))262 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
297 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))263 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
298 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
299 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
300 }
301 // Storage: Scheduler Agenda (r:2 w:2)
302 fn on_initialize_periodic(s: u32, ) -> Weight {
303 (12_668_000 as Weight)
304 // Standard Error: 5_000
305 .saturating_add((5_868_000 as Weight).saturating_mul(s as Weight))
306 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
307 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
308 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
309 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))264 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
310 }265 }
311 // Storage: Scheduler Agenda (r:1 w:1)266 // Storage: Scheduler Agenda (r:2 w:2)
312 // Storage: Scheduler Lookup (r:0 w:1)267 // Storage: Scheduler Lookup (r:0 w:1)
313 fn on_initialize_named(s: u32, ) -> Weight {268 fn on_initialize_named(s: u32, ) -> Weight {
314 (13_946_000 as Weight)269 (10_338_000 as Weight)
315 // Standard Error: 4_000270 // Standard Error: 2_000
316 .saturating_add((4_367_000 as Weight).saturating_mul(s as Weight))271 .saturating_add((9_422_000 as Weight).saturating_mul(s as Weight))
317 .saturating_add(RocksDbWeight::get().reads(1 as Weight))272 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
318 .saturating_add(RocksDbWeight::get().writes(1 as Weight))273 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
319 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))274 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
320 }275 }
321 // Storage: Scheduler Agenda (r:1 w:1)276 // Storage: Scheduler Agenda (r:1 w:1)
277 // Storage: System Account (r:1 w:1)
278 // Storage: System AllExtrinsicsLen (r:1 w:1)
279 // Storage: System BlockWeight (r:1 w:1)
280 // Storage: Scheduler Lookup (r:0 w:1)
322 fn on_initialize(s: u32, ) -> Weight {281 fn on_initialize(s: u32, ) -> Weight {
323 (13_151_000 as Weight)282 (37_448_000 as Weight)
324 // Standard Error: 4_000283 // Standard Error: 7_000
325 .saturating_add((3_455_000 as Weight).saturating_mul(s as Weight))284 .saturating_add((22_907_000 as Weight).saturating_mul(s as Weight))
326 .saturating_add(RocksDbWeight::get().reads(1 as Weight))285 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
327 .saturating_add(RocksDbWeight::get().writes(1 as Weight))286 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
287 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
328 }288 }
329 // Storage: Scheduler Agenda (r:1 w:1)289 // Storage: Scheduler Agenda (r:1 w:1)
330 fn schedule(s: u32, ) -> Weight {290 // Storage: System Account (r:1 w:1)
331 (14_040_000 as Weight)
332 // Standard Error: 1_000291 // Storage: System AllExtrinsicsLen (r:1 w:1)
333 .saturating_add((89_000 as Weight).saturating_mul(s as Weight))
334 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
335 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
336 }
337 // Storage: Scheduler Agenda (r:1 w:1)292 // Storage: System BlockWeight (r:1 w:1)
338 // Storage: Scheduler Lookup (r:0 w:1)293 // Storage: Scheduler Lookup (r:0 w:1)
339 fn cancel(s: u32, ) -> Weight {294 fn on_initialize_resolved(s: u32, ) -> Weight {
340 (14_376_000 as Weight)295 (34_841_000 as Weight)
341 // Standard Error: 1_000296 // Standard Error: 7_000
342 .saturating_add((576_000 as Weight).saturating_mul(s as Weight))297 .saturating_add((22_966_000 as Weight).saturating_mul(s as Weight))
343 .saturating_add(RocksDbWeight::get().reads(1 as Weight))298 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
344 .saturating_add(RocksDbWeight::get().writes(2 as Weight))299 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
300 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
345 }301 }
346 // Storage: Scheduler Lookup (r:1 w:1)302 // Storage: Scheduler Lookup (r:1 w:1)
347 // Storage: Scheduler Agenda (r:1 w:1)303 // Storage: Scheduler Agenda (r:1 w:1)
348 fn schedule_named(s: u32, ) -> Weight {304 fn schedule_named(s: u32, ) -> Weight {
349 (16_806_000 as Weight)305 (33_845_000 as Weight)
350 // Standard Error: 1_000306 // Standard Error: 0
351 .saturating_add((102_000 as Weight).saturating_mul(s as Weight))307 .saturating_add((168_000 as Weight).saturating_mul(s as Weight))
352 .saturating_add(RocksDbWeight::get().reads(2 as Weight))308 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
353 .saturating_add(RocksDbWeight::get().writes(2 as Weight))309 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
354 }310 }
355 // Storage: Scheduler Lookup (r:1 w:1)311 // Storage: Scheduler Lookup (r:1 w:1)
356 // Storage: Scheduler Agenda (r:1 w:1)312 // Storage: Scheduler Agenda (r:1 w:1)
357 fn cancel_named(s: u32, ) -> Weight {313 fn cancel_named(s: u32, ) -> Weight {
358 (15_852_000 as Weight)314 (31_169_000 as Weight)
359 // Standard Error: 2_000315 // Standard Error: 1_000
360 .saturating_add((590_000 as Weight).saturating_mul(s as Weight))316 .saturating_add((1_565_000 as Weight).saturating_mul(s as Weight))
361 .saturating_add(RocksDbWeight::get().reads(2 as Weight))317 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
362 .saturating_add(RocksDbWeight::get().writes(2 as Weight))318 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
363 }319 }
modifiedruntime/common/Cargo.tomldiffbeforeafterboth
89default-features = false89default-features = false
90path = "../../pallets/refungible"90path = "../../pallets/refungible"
91
92[dependencies.pallet-unique-scheduler]
93default-features = false
94path = "../../pallets/scheduler"
9195
92[dependencies.up-data-structs]96[dependencies.up-data-structs]
93default-features = false97default-features = false
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
843 list_benchmark!(list, extra, pallet_fungible, Fungible);843 list_benchmark!(list, extra, pallet_fungible, Fungible);
844 list_benchmark!(list, extra, pallet_refungible, Refungible);844 list_benchmark!(list, extra, pallet_refungible, Refungible);
845 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);845 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
846 list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);
846 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);847 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);
847 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);848 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
848849
887 add_benchmark!(params, batches, pallet_fungible, Fungible);888 add_benchmark!(params, batches, pallet_fungible, Fungible);
888 add_benchmark!(params, batches, pallet_refungible, Refungible);889 add_benchmark!(params, batches, pallet_refungible, Refungible);
889 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);890 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
891 add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);
890 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);892 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);
891 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);893 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
892894
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
36 'pallet-proxy-rmrk-core/runtime-benchmarks',36 'pallet-proxy-rmrk-core/runtime-benchmarks',
37 'pallet-unique/runtime-benchmarks',37 'pallet-unique/runtime-benchmarks',
38 'pallet-inflation/runtime-benchmarks',38 'pallet-inflation/runtime-benchmarks',
39 'pallet-unique-scheduler/runtime-benchmarks',
39 'pallet-xcm/runtime-benchmarks',40 'pallet-xcm/runtime-benchmarks',
40 'sp-runtime/runtime-benchmarks',41 'sp-runtime/runtime-benchmarks',
41 'xcm-builder/runtime-benchmarks',42 'xcm-builder/runtime-benchmarks',
93 'pallet-proxy-rmrk-core/std',94 'pallet-proxy-rmrk-core/std',
94 'pallet-proxy-rmrk-equip/std',95 'pallet-proxy-rmrk-equip/std',
95 'pallet-unique/std',96 'pallet-unique/std',
96 'pallet-unq-scheduler/std',97 'pallet-unique-scheduler/std',
97 'pallet-charge-transaction/std',98 'pallet-charge-transaction/std',
98 'up-data-structs/std',99 'up-data-structs/std',
99 'sp-api/std',100 'sp-api/std',
412pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }413pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
413pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }414pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
414pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }415pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
415pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }416pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
416# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }417# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
417pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }418pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
418pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }419pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
68 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,68 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
69 },69 },
70};70};
71use pallet_unq_scheduler::DispatchCall;71use pallet_unique_scheduler::DispatchCall;
72use up_data_structs::{72use up_data_structs::{
73 CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,73 CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
74 CollectionStats, RpcCollection,74 CollectionStats, RpcCollection,
969}969}
970970
971pub struct SchedulerPaymentExecutor;971pub struct SchedulerPaymentExecutor;
972impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>972impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
973 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor973 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
974where974where
975 <T as frame_system::Config>::Call: Member975 <T as frame_system::Config>::Call: Member
979 + From<frame_system::Call<Runtime>>,979 + From<frame_system::Call<Runtime>>,
980 SelfContainedSignedInfo: Send + Sync + 'static,980 SelfContainedSignedInfo: Send + Sync + 'static,
981 Call: From<<T as frame_system::Config>::Call>981 Call: From<<T as frame_system::Config>::Call>
982 + From<<T as pallet_unq_scheduler::Config>::Call>982 + From<<T as pallet_unique_scheduler::Config>::Call>
983 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,983 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
984 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,984 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
985{985{
986 fn dispatch_call(986 fn dispatch_call(
987 signer: <T as frame_system::Config>::AccountId,987 signer: <T as frame_system::Config>::AccountId,
988 call: <T as pallet_unq_scheduler::Config>::Call,988 call: <T as pallet_unique_scheduler::Config>::Call,
989 ) -> Result<989 ) -> Result<
990 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,990 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
991 TransactionValidityError,991 TransactionValidityError,
1011 fn reserve_balance(1011 fn reserve_balance(
1012 id: [u8; 16],1012 id: [u8; 16],
1013 sponsor: <T as frame_system::Config>::AccountId,1013 sponsor: <T as frame_system::Config>::AccountId,
1014 call: <T as pallet_unq_scheduler::Config>::Call,1014 call: <T as pallet_unique_scheduler::Config>::Call,
1015 count: u32,1015 count: u32,
1016 ) -> Result<(), DispatchError> {1016 ) -> Result<(), DispatchError> {
1017 let dispatch_info = call.get_dispatch_info();1017 let dispatch_info = call.get_dispatch_info();
1028 fn pay_for_call(1028 fn pay_for_call(
1029 id: [u8; 16],1029 id: [u8; 16],
1030 sponsor: <T as frame_system::Config>::AccountId,1030 sponsor: <T as frame_system::Config>::AccountId,
1031 call: <T as pallet_unq_scheduler::Config>::Call,1031 call: <T as pallet_unique_scheduler::Config>::Call,
1032 ) -> Result<u128, DispatchError> {1032 ) -> Result<u128, DispatchError> {
1033 let dispatch_info = call.get_dispatch_info();1033 let dispatch_info = call.get_dispatch_info();
1034 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1034 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
1069 }1069 }
1070}1070}
10711071
1072impl pallet_unq_scheduler::Config for Runtime {1072impl pallet_unique_scheduler::Config for Runtime {
1073 type Event = Event;1073 type Event = Event;
1074 type Origin = Origin;1074 type Origin = Origin;
1075 type Currency = Balances;1075 type Currency = Balances;
1158 // Unique Pallets1158 // Unique Pallets
1159 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1159 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
1160 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1160 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
1161 Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1161 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
1162 // free = 631162 // free = 63
1163 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1163 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
1164 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1164 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
37 'pallet-proxy-rmrk-equip/runtime-benchmarks',37 'pallet-proxy-rmrk-equip/runtime-benchmarks',
38 'pallet-unique/runtime-benchmarks',38 'pallet-unique/runtime-benchmarks',
39 'pallet-inflation/runtime-benchmarks',39 'pallet-inflation/runtime-benchmarks',
40 'pallet-unique-scheduler/runtime-benchmarks',
40 'pallet-xcm/runtime-benchmarks',41 'pallet-xcm/runtime-benchmarks',
41 'sp-runtime/runtime-benchmarks',42 'sp-runtime/runtime-benchmarks',
42 'xcm-builder/runtime-benchmarks',43 'xcm-builder/runtime-benchmarks',
94 'pallet-proxy-rmrk-core/std',95 'pallet-proxy-rmrk-core/std',
95 'pallet-proxy-rmrk-equip/std',96 'pallet-proxy-rmrk-equip/std',
96 'pallet-unique/std',97 'pallet-unique/std',
97 'pallet-unq-scheduler/std',98 'pallet-unique-scheduler/std',
98 'pallet-charge-transaction/std',99 'pallet-charge-transaction/std',
99 'up-data-structs/std',100 'up-data-structs/std',
100 'sp-api/std',101 'sp-api/std',
419pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }420pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
420pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }421pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
421pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }422pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
422pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }423pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
423# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }424# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
424pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }425pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
425pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }426pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
68 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,68 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
69 },69 },
70};70};
71use pallet_unq_scheduler::DispatchCall;71use pallet_unique_scheduler::DispatchCall;
72use up_data_structs::{72use up_data_structs::{
73 CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,73 CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
74 CollectionStats, RpcCollection,74 CollectionStats, RpcCollection,
968}968}
969969
970pub struct SchedulerPaymentExecutor;970pub struct SchedulerPaymentExecutor;
971impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>971impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
972 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor972 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
973where973where
974 <T as frame_system::Config>::Call: Member974 <T as frame_system::Config>::Call: Member
978 + From<frame_system::Call<Runtime>>,978 + From<frame_system::Call<Runtime>>,
979 SelfContainedSignedInfo: Send + Sync + 'static,979 SelfContainedSignedInfo: Send + Sync + 'static,
980 Call: From<<T as frame_system::Config>::Call>980 Call: From<<T as frame_system::Config>::Call>
981 + From<<T as pallet_unq_scheduler::Config>::Call>981 + From<<T as pallet_unique_scheduler::Config>::Call>
982 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,982 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
983 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,983 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
984{984{
985 fn dispatch_call(985 fn dispatch_call(
986 signer: <T as frame_system::Config>::AccountId,986 signer: <T as frame_system::Config>::AccountId,
987 call: <T as pallet_unq_scheduler::Config>::Call,987 call: <T as pallet_unique_scheduler::Config>::Call,
988 ) -> Result<988 ) -> Result<
989 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,989 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
990 TransactionValidityError,990 TransactionValidityError,
1010 fn reserve_balance(1010 fn reserve_balance(
1011 id: [u8; 16],1011 id: [u8; 16],
1012 sponsor: <T as frame_system::Config>::AccountId,1012 sponsor: <T as frame_system::Config>::AccountId,
1013 call: <T as pallet_unq_scheduler::Config>::Call,1013 call: <T as pallet_unique_scheduler::Config>::Call,
1014 count: u32,1014 count: u32,
1015 ) -> Result<(), DispatchError> {1015 ) -> Result<(), DispatchError> {
1016 let dispatch_info = call.get_dispatch_info();1016 let dispatch_info = call.get_dispatch_info();
1027 fn pay_for_call(1027 fn pay_for_call(
1028 id: [u8; 16],1028 id: [u8; 16],
1029 sponsor: <T as frame_system::Config>::AccountId,1029 sponsor: <T as frame_system::Config>::AccountId,
1030 call: <T as pallet_unq_scheduler::Config>::Call,1030 call: <T as pallet_unique_scheduler::Config>::Call,
1031 ) -> Result<u128, DispatchError> {1031 ) -> Result<u128, DispatchError> {
1032 let dispatch_info = call.get_dispatch_info();1032 let dispatch_info = call.get_dispatch_info();
1033 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1033 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
1068 }1068 }
1069}1069}
10701070
1071impl pallet_unq_scheduler::Config for Runtime {1071impl pallet_unique_scheduler::Config for Runtime {
1072 type Event = Event;1072 type Event = Event;
1073 type Origin = Origin;1073 type Origin = Origin;
1074 type Currency = Balances;1074 type Currency = Balances;
1156 // Unique Pallets1156 // Unique Pallets
1157 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1157 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
1158 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1158 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
1159 Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1159 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
1160 // free = 631160 // free = 63
1161 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1161 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
1162 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1162 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
37 'pallet-proxy-rmrk-equip/runtime-benchmarks',37 'pallet-proxy-rmrk-equip/runtime-benchmarks',
38 'pallet-unique/runtime-benchmarks',38 'pallet-unique/runtime-benchmarks',
39 'pallet-inflation/runtime-benchmarks',39 'pallet-inflation/runtime-benchmarks',
40 'pallet-unique-scheduler/runtime-benchmarks',
40 'pallet-xcm/runtime-benchmarks',41 'pallet-xcm/runtime-benchmarks',
41 'sp-runtime/runtime-benchmarks',42 'sp-runtime/runtime-benchmarks',
42 'xcm-builder/runtime-benchmarks',43 'xcm-builder/runtime-benchmarks',
95 'pallet-proxy-rmrk-core/std',96 'pallet-proxy-rmrk-core/std',
96 'pallet-proxy-rmrk-equip/std',97 'pallet-proxy-rmrk-equip/std',
97 'pallet-unique/std',98 'pallet-unique/std',
98 'pallet-unq-scheduler/std',99 'pallet-unique-scheduler/std',
99 'pallet-charge-transaction/std',100 'pallet-charge-transaction/std',
100 'up-data-structs/std',101 'up-data-structs/std',
101 'sp-api/std',102 'sp-api/std',
412pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }413pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
413pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }414pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
414pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }415pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
415pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }416pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
416# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }417# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
417pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }418pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
418pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }419pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
68 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,68 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
69 },69 },
70};70};
71use pallet_unq_scheduler::DispatchCall;71use pallet_unique_scheduler::DispatchCall;
72use up_data_structs::{72use up_data_structs::{
73 CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,73 CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
74 CollectionStats, RpcCollection,74 CollectionStats, RpcCollection,
967}967}
968968
969pub struct SchedulerPaymentExecutor;969pub struct SchedulerPaymentExecutor;
970impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>970impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
971 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor971 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
972where972where
973 <T as frame_system::Config>::Call: Member973 <T as frame_system::Config>::Call: Member
977 + From<frame_system::Call<Runtime>>,977 + From<frame_system::Call<Runtime>>,
978 SelfContainedSignedInfo: Send + Sync + 'static,978 SelfContainedSignedInfo: Send + Sync + 'static,
979 Call: From<<T as frame_system::Config>::Call>979 Call: From<<T as frame_system::Config>::Call>
980 + From<<T as pallet_unq_scheduler::Config>::Call>980 + From<<T as pallet_unique_scheduler::Config>::Call>
981 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,981 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
982 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,982 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
983{983{
984 fn dispatch_call(984 fn dispatch_call(
985 signer: <T as frame_system::Config>::AccountId,985 signer: <T as frame_system::Config>::AccountId,
986 call: <T as pallet_unq_scheduler::Config>::Call,986 call: <T as pallet_unique_scheduler::Config>::Call,
987 ) -> Result<987 ) -> Result<
988 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,988 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
989 TransactionValidityError,989 TransactionValidityError,
1009 fn reserve_balance(1009 fn reserve_balance(
1010 id: [u8; 16],1010 id: [u8; 16],
1011 sponsor: <T as frame_system::Config>::AccountId,1011 sponsor: <T as frame_system::Config>::AccountId,
1012 call: <T as pallet_unq_scheduler::Config>::Call,1012 call: <T as pallet_unique_scheduler::Config>::Call,
1013 count: u32,1013 count: u32,
1014 ) -> Result<(), DispatchError> {1014 ) -> Result<(), DispatchError> {
1015 let dispatch_info = call.get_dispatch_info();1015 let dispatch_info = call.get_dispatch_info();
1026 fn pay_for_call(1026 fn pay_for_call(
1027 id: [u8; 16],1027 id: [u8; 16],
1028 sponsor: <T as frame_system::Config>::AccountId,1028 sponsor: <T as frame_system::Config>::AccountId,
1029 call: <T as pallet_unq_scheduler::Config>::Call,1029 call: <T as pallet_unique_scheduler::Config>::Call,
1030 ) -> Result<u128, DispatchError> {1030 ) -> Result<u128, DispatchError> {
1031 let dispatch_info = call.get_dispatch_info();1031 let dispatch_info = call.get_dispatch_info();
1032 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1032 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
1067 }1067 }
1068}1068}
10691069
1070impl pallet_unq_scheduler::Config for Runtime {1070impl pallet_unique_scheduler::Config for Runtime {
1071 type Event = Event;1071 type Event = Event;
1072 type Origin = Origin;1072 type Origin = Origin;
1073 type Currency = Balances;1073 type Currency = Balances;
1155 // Unique Pallets1155 // Unique Pallets
1156 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1156 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
1157 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1157 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
1158 Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1158 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
1159 // free = 631159 // free = 63
1160 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1160 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
1161 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1161 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,