difftreelog
fix priority benchmarks
in: master
1 file changed
pallets/scheduler-v2/src/benchmarking.rsdiffbeforeafterboth42};42};43use frame_system::RawOrigin;43use frame_system::RawOrigin;44use sp_std::{prelude::*, vec};44use sp_std::{prelude::*, vec};45use sp_io::hashing::blake2_256;454646use crate::{Pallet as Scheduler, ScheduledCall, EncodedCall};47use crate::{Pallet as Scheduler, ScheduledCall, EncodedCall};47use frame_system::Call as SystemCall;48use frame_system::Call as SystemCall;259 let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);260 let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);260 let when = BLOCK_NUMBER.into();261 let when = BLOCK_NUMBER.into();261 let periodic = Some((T::BlockNumber::one(), 100));262 let periodic = Some((T::BlockNumber::one(), 100));262 let priority = 0;263 let priority = Some(0);263 // Essentially a no-op call.264 // Essentially a no-op call.264 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());265 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());265266297 let id = u32_to_name(s);298 let id = u32_to_name(s);298 let when = BLOCK_NUMBER.into();299 let when = BLOCK_NUMBER.into();299 let periodic = Some((T::BlockNumber::one(), 100));300 let periodic = Some((T::BlockNumber::one(), 100));300 let priority = 0;301 let priority = Some(0);301 // Essentially a no-op call.302 // Essentially a no-op call.302 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());303 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());303304328 );329 );329 }330 }330331331 // impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);332 change_named_priority {333 let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Root;334 let s in 1 .. T::MaxScheduledPerBlock::get();335 let when = BLOCK_NUMBER.into();336 let idx = s - 1;337 let id = u32_to_name(idx);338 let priority = 42;339 fill_schedule::<T>(when, s)?;340 }: _(origin, id, priority)341 verify {342 ensure!(343 Agenda::<T>::get(when)[idx as usize].clone().unwrap().priority == priority,344 "didn't change the priority"345 );346 }347348 impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);332}349}333350