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
+17 -14
View File
@@ -202,17 +202,19 @@ pub mod pallet {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The aggregated origin which the dispatch will take.
type Origin: OriginTrait<PalletsOrigin = Self::PalletsOrigin>
type RuntimeOrigin: OriginTrait<PalletsOrigin = Self::PalletsOrigin>
+ From<Self::PalletsOrigin>
+ IsType<<Self as system::Config>::Origin>;
+ IsType<<Self as system::Config>::RuntimeOrigin>;
/// The caller origin, overarching type of all pallets origins.
type PalletsOrigin: From<system::RawOrigin<Self::AccountId>> + Codec + Clone + Eq + TypeInfo;
/// The aggregated call type.
type RuntimeCall: Parameter
+ Dispatchable<Origin = <Self as Config>::Origin, PostInfo = PostDispatchInfo>
+ GetDispatchInfo
+ Dispatchable<
RuntimeOrigin = <Self as Config>::RuntimeOrigin,
PostInfo = PostDispatchInfo,
> + GetDispatchInfo
+ From<system::Call<Self>>;
/// The maximum weight that may be scheduled per block for any dispatchables of less
@@ -221,7 +223,7 @@ pub mod pallet {
type MaximumWeight: Get<Weight>;
/// Required origin to schedule or cancel calls.
type ScheduleOrigin: EnsureOrigin<<Self as system::Config>::Origin>;
type ScheduleOrigin: EnsureOrigin<<Self as system::Config>::RuntimeOrigin>;
/// Compare the privileges of origins.
///
@@ -354,9 +356,10 @@ pub mod pallet {
let periodic = s.maybe_periodic.is_some();
let call_weight = call.get_dispatch_info().weight;
let mut item_weight = T::WeightInfo::item(periodic, named, Some(resolved));
let origin =
<<T as Config>::Origin as From<T::PalletsOrigin>>::from(s.origin.clone())
.into();
let origin = <<T as Config>::RuntimeOrigin as From<T::PalletsOrigin>>::from(
s.origin.clone(),
)
.into();
if ensure_signed(origin).is_ok() {
// Weights of Signed dispatches expect their signing account to be whitelisted.
item_weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1));
@@ -431,7 +434,7 @@ pub mod pallet {
call: Box<CallOrHashOf<T>>,
) -> DispatchResult {
T::ScheduleOrigin::ensure_origin(origin.clone())?;
let origin = <T as Config>::Origin::from(origin);
let origin = <T as Config>::RuntimeOrigin::from(origin);
Self::do_schedule(
DispatchTime::At(when),
maybe_periodic,
@@ -446,7 +449,7 @@ pub mod pallet {
#[pallet::weight(<T as Config>::WeightInfo::cancel(T::MaxScheduledPerBlock::get()))]
pub fn cancel(origin: OriginFor<T>, when: T::BlockNumber, index: u32) -> DispatchResult {
T::ScheduleOrigin::ensure_origin(origin.clone())?;
let origin = <T as Config>::Origin::from(origin);
let origin = <T as Config>::RuntimeOrigin::from(origin);
Self::do_cancel(Some(origin.caller().clone()), (when, index))?;
Ok(())
}
@@ -462,7 +465,7 @@ pub mod pallet {
call: Box<CallOrHashOf<T>>,
) -> DispatchResult {
T::ScheduleOrigin::ensure_origin(origin.clone())?;
let origin = <T as Config>::Origin::from(origin);
let origin = <T as Config>::RuntimeOrigin::from(origin);
Self::do_schedule_named(
id,
DispatchTime::At(when),
@@ -478,7 +481,7 @@ pub mod pallet {
#[pallet::weight(<T as Config>::WeightInfo::cancel_named(T::MaxScheduledPerBlock::get()))]
pub fn cancel_named(origin: OriginFor<T>, id: Vec<u8>) -> DispatchResult {
T::ScheduleOrigin::ensure_origin(origin.clone())?;
let origin = <T as Config>::Origin::from(origin);
let origin = <T as Config>::RuntimeOrigin::from(origin);
Self::do_cancel_named(Some(origin.caller().clone()), id)?;
Ok(())
}
@@ -497,7 +500,7 @@ pub mod pallet {
call: Box<CallOrHashOf<T>>,
) -> DispatchResult {
T::ScheduleOrigin::ensure_origin(origin.clone())?;
let origin = <T as Config>::Origin::from(origin);
let origin = <T as Config>::RuntimeOrigin::from(origin);
Self::do_schedule(
DispatchTime::After(after),
maybe_periodic,
@@ -523,7 +526,7 @@ pub mod pallet {
call: Box<CallOrHashOf<T>>,
) -> DispatchResult {
T::ScheduleOrigin::ensure_origin(origin.clone())?;
let origin = <T as Config>::Origin::from(origin);
let origin = <T as Config>::RuntimeOrigin::from(origin);
Self::do_schedule_named(
id,
DispatchTime::After(after),