BREAKING: Rename Origin (#12258)

* BREAKING: Rename Origin

* more renaming

* a bit more renaming

* fix

* more fixing

* fix in frame_support

* even more fixes

* fix

* small fix

* ...

* update .stderr

* docs

* update docs

* update docs

* docs
This commit is contained in:
Sergej Sakac
2022-09-21 00:13:09 +02:00
committed by GitHub
parent 986d20b352
commit e4b6f4a66d
221 changed files with 5233 additions and 4200 deletions
+7 -7
View File
@@ -421,10 +421,10 @@ pub mod pallet {
type MaxLockDuration: Get<Self::BlockNumber>;
/// The origin that is allowed to call `found`.
type FounderSetOrigin: EnsureOrigin<Self::Origin>;
type FounderSetOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// The origin that is allowed to make suspension judgements.
type SuspensionJudgementOrigin: EnsureOrigin<Self::Origin>;
type SuspensionJudgementOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// The number of blocks between membership challenges.
#[pallet::constant]
@@ -1268,19 +1268,19 @@ pub mod pallet {
/// Simple ensure origin struct to filter for the founder account.
pub struct EnsureFounder<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> EnsureOrigin<T::Origin> for EnsureFounder<T> {
impl<T: Config> EnsureOrigin<T::RuntimeOrigin> for EnsureFounder<T> {
type Success = T::AccountId;
fn try_origin(o: T::Origin) -> Result<Self::Success, T::Origin> {
fn try_origin(o: T::RuntimeOrigin) -> Result<Self::Success, T::RuntimeOrigin> {
o.into().and_then(|o| match (o, Founder::<T>::get()) {
(frame_system::RawOrigin::Signed(ref who), Some(ref f)) if who == f => Ok(who.clone()),
(r, _) => Err(T::Origin::from(r)),
(r, _) => Err(T::RuntimeOrigin::from(r)),
})
}
#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin() -> Result<T::Origin, ()> {
fn try_successful_origin() -> Result<T::RuntimeOrigin, ()> {
let founder = Founder::<T>::get().ok_or(())?;
Ok(T::Origin::from(frame_system::RawOrigin::Signed(founder)))
Ok(T::RuntimeOrigin::from(frame_system::RawOrigin::Signed(founder)))
}
}