Benchmark's successful origin api update (#13146)

* try successful origin unimplemented by default

* error as a default impl for try_successful_origin

* remove successful_origin func of EnsureOrigin trait

* default impl -> unimplemented!()

* update EnsureOriginWithArg

* fix EnsureOriginWithArg

* prefix unused arg with underscore

* use try_successful_origin instead successful_origin, map err to Weightless

* fix tests

* remove default impl

* unwrap for indirect origin dep

* replace unwrap by expect with a message

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Muharem Ismailov
2023-02-01 03:11:41 +01:00
committed by GitHub
parent a46203efb6
commit 3079a17c94
21 changed files with 402 additions and 243 deletions
@@ -20,7 +20,7 @@
#![cfg(feature = "runtime-benchmarks")]
use crate::{types::*, Pallet as FastUnstake, *};
use frame_benchmarking::v1::{benchmarks, whitelist_account};
use frame_benchmarking::v1::{benchmarks, whitelist_account, BenchmarkError};
use frame_support::{
assert_ok,
traits::{Currency, EnsureOrigin, Get, Hooks},
@@ -192,7 +192,8 @@ benchmarks! {
}
control {
let origin = <T as Config>::ControlOrigin::successful_origin();
let origin = <T as Config>::ControlOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
}
: _<T::RuntimeOrigin>(origin, T::MaxErasToCheckPerBlock::get())
verify {}