difftreelog
refactor(scheduler) id restricted to 16 bytes [CORE-245]
in: master
1 file changed
pallets/scheduler/src/lib.rsdiffbeforeafterboth76use up_sponsorship::SponsorshipHandler;76use up_sponsorship::SponsorshipHandler;77use scale_info::TypeInfo;77use scale_info::TypeInfo;7879pub const MAX_TASK_ID_LENGTH_IN_BYTES: u32 = 16;788079/// Our pallet's configuration trait. All our types and constants go in here. If the81/// Our pallet's configuration trait. All our types and constants go in here. If the80/// pallet is dependent on specific other pallets, then their configuration traits82/// pallet is dependent on specific other pallets, then their configuration traits569 origin: T::PalletsOrigin,571 origin: T::PalletsOrigin,570 call: <T as Config>::Call,572 call: <T as Config>::Call,571 ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {573 ) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {572 // ensure id it is unique574 // ensure id length does not exceed expectations & is unique573 if Lookup::<T>::contains_key(&id) {575 if id.len() > MAX_TASK_ID_LENGTH_IN_BYTES.try_into().unwrap()576 || Lookup::<T>::contains_key(&id)577 {574 return Err(Error::<T>::FailedToSchedule.into());578 return Err(Error::<T>::FailedToSchedule.into());575 }579 }792 }796 }793797794 type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;798 type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;799 // todo check current cumulus implementation, add changes accordingly, do something with signedExtra and (un)checked extrinsic (integral to Scheduler?)800 // todo to include pallet in runtime, not only uncomment but also (implement?) trait795 type Block = frame_system::mocking::MockBlock<Test>;801 type Block = frame_system::mocking::MockBlock<Test>;796802797 frame_support::construct_runtime!(803 frame_support::construct_runtime!(