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
@@ -39,12 +39,13 @@ pub struct CheckedExtrinsic<AccountId, Call, Extra> {
pub function: Call,
}
impl<AccountId, Call, Extra, Origin> traits::Applyable for CheckedExtrinsic<AccountId, Call, Extra>
impl<AccountId, Call, Extra, RuntimeOrigin> traits::Applyable
for CheckedExtrinsic<AccountId, Call, Extra>
where
AccountId: Member + MaybeDisplay,
Call: Member + Dispatchable<Origin = Origin>,
Call: Member + Dispatchable<RuntimeOrigin = RuntimeOrigin>,
Extra: SignedExtension<AccountId = AccountId, Call = Call>,
Origin: From<Option<AccountId>>,
RuntimeOrigin: From<Option<AccountId>>,
{
type Call = Call;
@@ -78,7 +79,7 @@ where
U::pre_dispatch(&self.function)?;
(None, None)
};
let res = self.function.dispatch(Origin::from(maybe_who));
let res = self.function.dispatch(RuntimeOrigin::from(maybe_who));
let post_info = match res {
Ok(info) => info,
Err(err) => err.post_info,
+9 -2
View File
@@ -358,8 +358,15 @@ where
impl<Origin, Call, Extra> Applyable for TestXt<Call, Extra>
where
Call:
'static + Sized + Send + Sync + Clone + Eq + Codec + Debug + Dispatchable<Origin = Origin>,
Call: 'static
+ Sized
+ Send
+ Sync
+ Clone
+ Eq
+ Codec
+ Debug
+ Dispatchable<RuntimeOrigin = Origin>,
Extra: SignedExtension<AccountId = u64, Call = Call>,
Origin: From<Option<u64>>,
{
+8 -4
View File
@@ -1018,7 +1018,7 @@ pub trait Dispatchable {
/// Every function call from your runtime has an origin, which specifies where the extrinsic was
/// generated from. In the case of a signed extrinsic (transaction), the origin contains an
/// identifier for the caller. The origin can be empty in the case of an inherent extrinsic.
type Origin;
type RuntimeOrigin;
/// ...
type Config;
/// An opaque set of information attached to the transaction. This could be constructed anywhere
@@ -1029,7 +1029,8 @@ pub trait Dispatchable {
/// with information about a `Dispatchable` that is ownly known post dispatch.
type PostInfo: Eq + PartialEq + Clone + Copy + Encode + Decode + Printable;
/// Actually dispatch this call and return the result of it.
fn dispatch(self, origin: Self::Origin) -> crate::DispatchResultWithInfo<Self::PostInfo>;
fn dispatch(self, origin: Self::RuntimeOrigin)
-> crate::DispatchResultWithInfo<Self::PostInfo>;
}
/// Shortcut to reference the `Info` type of a `Dispatchable`.
@@ -1038,11 +1039,14 @@ pub type DispatchInfoOf<T> = <T as Dispatchable>::Info;
pub type PostDispatchInfoOf<T> = <T as Dispatchable>::PostInfo;
impl Dispatchable for () {
type Origin = ();
type RuntimeOrigin = ();
type Config = ();
type Info = ();
type PostInfo = ();
fn dispatch(self, _origin: Self::Origin) -> crate::DispatchResultWithInfo<Self::PostInfo> {
fn dispatch(
self,
_origin: Self::RuntimeOrigin,
) -> crate::DispatchResultWithInfo<Self::PostInfo> {
panic!("This implementation should not be used for actual dispatch.");
}
}