Introduce EnsureOrigin::try_successul_origin (#11558)

* Introduce `EnsureOrigin::try_successul_origin`

* Formatting

* Fixes

* Add Morph

* Fixes

* Formatting
This commit is contained in:
Gavin Wood
2022-05-31 19:12:07 +01:00
committed by GitHub
parent adf0773f9d
commit 9107ae41fd
6 changed files with 221 additions and 97 deletions
+3 -3
View File
@@ -1272,9 +1272,9 @@ impl<T: Config> EnsureOrigin<T::Origin> for EnsureFounder<T> {
}
#[cfg(feature = "runtime-benchmarks")]
fn successful_origin() -> T::Origin {
let founder = Founder::<T>::get().expect("society founder should exist");
T::Origin::from(frame_system::RawOrigin::Signed(founder))
fn try_successful_origin() -> Result<T::Origin, ()> {
let founder = Founder::<T>::get().ok_or(())?;
Ok(T::Origin::from(frame_system::RawOrigin::Signed(founder)))
}
}