difftreelog
feature: add benchmarks for scheduler v2
in: master
3 files changed
pallets/scheduler-v2/src/benchmarking.rsdiffbeforeafterbothno changes
pallets/scheduler-v2/src/lib.rsdiffbeforeafterboth--- a/pallets/scheduler-v2/src/lib.rs
+++ b/pallets/scheduler-v2/src/lib.rs
@@ -143,6 +143,14 @@
}
}
+ /// Returns whether the image will require a lookup to be peeked.
+ pub fn lookup_needed(&self) -> bool {
+ match self {
+ Self::Inline(_) => false,
+ Self::PreimageLookup { .. } => true,
+ }
+ }
+
fn decode(mut data: &[u8]) -> Result<<T as Config>::Call, DispatchError> {
<T as Config>::Call::decode(&mut data)
.map_err(|_| <Error<T>>::ScheduledCallCorrupted.into())
@@ -153,6 +161,11 @@
fn drop(call: &ScheduledCall<T>);
fn peek(call: &ScheduledCall<T>) -> Result<(<T as pallet::Config>::Call, Option<u32>), DispatchError>;
+
+ /// Convert the given scheduled `call` value back into its original instance. If successful,
+ /// `drop` any data backing it. This will not break the realisability of independently
+ /// created instances of `ScheduledCall` which happen to have identical data.
+ fn realize(call: &ScheduledCall<T>) -> Result<(<T as pallet::Config>::Call, Option<u32>), DispatchError>;
}
impl<T: Config, PP: PreimageRecipient<T::Hash>> SchedulerPreimages<T> for PP {
@@ -175,6 +188,12 @@
},
}
}
+
+ fn realize(call: &ScheduledCall<T>) -> Result<(<T as pallet::Config>::Call, Option<u32>), DispatchError> {
+ let r = Self::peek(call)?;
+ Self::drop(call);
+ Ok(r)
+ }
}
pub type TaskName = [u8; 32];
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -42,6 +42,7 @@
'pallet-inflation/runtime-benchmarks',
'pallet-app-promotion/runtime-benchmarks',
'pallet-unique-scheduler/runtime-benchmarks',
+ 'pallet-unique-scheduler-v2/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',