mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
Short circuit Treasury::Spend benchmark for NeverEnsureOrigin (#11562)
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
82dbaafe5f
commit
f81e306cf5
@@ -66,14 +66,22 @@ fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::
|
||||
}
|
||||
|
||||
benchmarks_instance_pallet! {
|
||||
// This benchmark is short-circuited if `SpendOrigin` cannot provide
|
||||
// a successful origin, in which case `spend` is un-callable and can use weight=0.
|
||||
spend {
|
||||
let (_, value, beneficiary_lookup) = setup_proposal::<T, _>(SEED);
|
||||
let origin = T::SpendOrigin::successful_origin();
|
||||
let origin = T::SpendOrigin::try_successful_origin();
|
||||
let beneficiary = T::Lookup::lookup(beneficiary_lookup.clone()).unwrap();
|
||||
let call = Call::<T, I>::spend { amount: value, beneficiary: beneficiary_lookup };
|
||||
}: { call.dispatch_bypass_filter(origin)? }
|
||||
}: {
|
||||
if let Ok(origin) = origin.clone() {
|
||||
call.dispatch_bypass_filter(origin)?;
|
||||
}
|
||||
}
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::SpendApproved { proposal_index: 0, amount: value, beneficiary }.into())
|
||||
if origin.is_ok() {
|
||||
assert_last_event::<T, I>(Event::SpendApproved { proposal_index: 0, amount: value, beneficiary }.into())
|
||||
}
|
||||
}
|
||||
|
||||
propose_spend {
|
||||
|
||||
Reference in New Issue
Block a user