mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
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:
@@ -650,7 +650,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{Config, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
///
|
||||
/// // Private functions are dispatchable, but not available to other
|
||||
/// // FRAME pallets.
|
||||
@@ -677,7 +677,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// * `Module`: The struct generated by the macro, with type `Config`.
|
||||
/// * `Call`: The enum generated for every pallet, which implements
|
||||
/// [`Callable`](./dispatch/trait.Callable.html).
|
||||
/// * `origin`: Alias of `T::Origin`.
|
||||
/// * `origin`: Alias of `T::RuntimeOrigin`.
|
||||
/// * `Result`: The expected return type from pallet functions.
|
||||
///
|
||||
/// The first parameter of dispatchable functions must always be `origin`.
|
||||
@@ -693,7 +693,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{Config, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 0]
|
||||
/// fn my_long_function(origin) -> dispatch::DispatchResult {
|
||||
/// // Your implementation
|
||||
@@ -728,7 +728,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// # use frame_support::{weights::Weight, dispatch::{DispatchResultWithPostInfo, WithPostDispatchInfo}};
|
||||
/// # use frame_system::{Config, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 1_000_000]
|
||||
/// fn my_long_function(origin, do_expensive_calc: bool) -> DispatchResultWithPostInfo {
|
||||
/// ensure_signed(origin).map_err(|e| e.with_weight(Weight::from_ref_time(100_000)))?;
|
||||
@@ -758,7 +758,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// # use frame_support::transactional;
|
||||
/// # use frame_system::Config;
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 0]
|
||||
/// #[transactional]
|
||||
/// fn my_short_function(origin) {
|
||||
@@ -779,7 +779,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{Config, ensure_signed, ensure_root};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 0]
|
||||
/// fn my_privileged_function(origin) -> dispatch::DispatchResult {
|
||||
/// ensure_root(origin)?;
|
||||
@@ -819,7 +819,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// pub trait Config<I: Instance=DefaultInstance>: frame_system::Config {}
|
||||
///
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config<I>, I: Instance = DefaultInstance> for enum Call where origin: T::Origin {
|
||||
/// pub struct Module<T: Config<I>, I: Instance = DefaultInstance> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// // Your implementation
|
||||
/// }
|
||||
/// }
|
||||
@@ -831,7 +831,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
///
|
||||
/// ## Where clause
|
||||
///
|
||||
/// Besides the default `origin: T::Origin`, you can also pass other bounds to the module
|
||||
/// Besides the default `origin: T::RuntimeOrigin`, you can also pass other bounds to the module
|
||||
/// declaration. This where bound will be replicated to all types generated by this macro. The
|
||||
/// chaining of multiple trait bounds with `+` is not supported. If multiple bounds for one type are
|
||||
/// required, it needs to be split up into multiple bounds.
|
||||
@@ -844,7 +844,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
/// pub trait Config: system::Config where Self::AccountId: From<u32> {}
|
||||
///
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::Origin, T::AccountId: From<u32> {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, T::AccountId: From<u32> {
|
||||
/// // Your implementation
|
||||
/// }
|
||||
/// }
|
||||
@@ -1885,7 +1885,7 @@ macro_rules! decl_module {
|
||||
)
|
||||
);
|
||||
};
|
||||
// Ignore any ident which is not `origin` with type `T::Origin`.
|
||||
// Ignore any ident which is not `origin` with type `T::RuntimeOrigin`.
|
||||
(@normalize
|
||||
$(#[$attr:meta])*
|
||||
pub struct $mod_type:ident<$trait_instance:ident: $trait_name:ident$(<I>, I: $instantiable:path $(= $module_default_instance:path)?)?>
|
||||
@@ -1906,7 +1906,7 @@ macro_rules! decl_module {
|
||||
$(#[weight = $weight:expr])?
|
||||
$(#[$fn_attr:meta])*
|
||||
$fn_vis:vis fn $fn_name:ident(
|
||||
$origin:ident : T::Origin $( , $( #[$codec_attr:ident] )* $param_name:ident : $param:ty )* $(,)?
|
||||
$origin:ident : T::RuntimeOrigin $( , $( #[$codec_attr:ident] )* $param_name:ident : $param:ty )* $(,)?
|
||||
) $( -> $result:ty )* { $( $impl:tt )* }
|
||||
$($rest:tt)*
|
||||
) => {
|
||||
@@ -2906,8 +2906,8 @@ macro_rules! decl_module {
|
||||
impl<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?> $crate::traits::UnfilteredDispatchable
|
||||
for $call_type<$trait_instance $(, $instance)?> where $( $other_where_bounds )*
|
||||
{
|
||||
type Origin = $origin_type;
|
||||
fn dispatch_bypass_filter(self, _origin: Self::Origin) -> $crate::dispatch::DispatchResultWithPostInfo {
|
||||
type RuntimeOrigin = $origin_type;
|
||||
fn dispatch_bypass_filter(self, _origin: Self::RuntimeOrigin) -> $crate::dispatch::DispatchResultWithPostInfo {
|
||||
match self {
|
||||
$(
|
||||
$call_type::$fn_name { $( $param_name ),* } => {
|
||||
@@ -3200,7 +3200,7 @@ mod tests {
|
||||
type AccountId;
|
||||
type RuntimeCall;
|
||||
type BaseCallFilter;
|
||||
type Origin: crate::traits::OriginTrait<Call = Self::RuntimeCall>;
|
||||
type RuntimeOrigin: crate::traits::OriginTrait<Call = Self::RuntimeCall>;
|
||||
type BlockNumber: Into<u32>;
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: Get<RuntimeDbWeight>;
|
||||
@@ -3212,7 +3212,7 @@ mod tests {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system = system, T::AccountId: From<u32> {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, system = system, T::AccountId: From<u32> {
|
||||
/// Hi, this is a comment.
|
||||
#[weight = 0]
|
||||
fn aux_0(_origin) -> DispatchResult { unreachable!() }
|
||||
@@ -3347,7 +3347,7 @@ mod tests {
|
||||
}
|
||||
|
||||
impl system::Config for TraitImpl {
|
||||
type Origin = OuterOrigin;
|
||||
type RuntimeOrigin = OuterOrigin;
|
||||
type AccountId = u32;
|
||||
type RuntimeCall = ();
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
@@ -3500,7 +3500,7 @@ mod weight_tests {
|
||||
use sp_weights::RuntimeDbWeight;
|
||||
|
||||
pub trait Config: 'static {
|
||||
type Origin;
|
||||
type RuntimeOrigin;
|
||||
type Balance;
|
||||
type BlockNumber;
|
||||
type DbWeight: Get<RuntimeDbWeight>;
|
||||
@@ -3517,7 +3517,7 @@ mod weight_tests {
|
||||
}
|
||||
|
||||
impl Config for TraitImpl {
|
||||
type Origin = u32;
|
||||
type RuntimeOrigin = u32;
|
||||
type BlockNumber = u32;
|
||||
type Balance = u32;
|
||||
type DbWeight = DbWeight;
|
||||
@@ -3525,7 +3525,7 @@ mod weight_tests {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, system=self {
|
||||
// no arguments, fixed weight
|
||||
#[weight = 1000]
|
||||
fn f00(_origin) { unimplemented!(); }
|
||||
|
||||
@@ -51,7 +51,7 @@ pub use sp_runtime::traits::{BadOrigin, LookupError};
|
||||
/// // exported in the metadata.
|
||||
///
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// type Error = MyError<T>;
|
||||
///
|
||||
/// #[weight = 0]
|
||||
|
||||
@@ -845,7 +845,7 @@ pub mod tests {
|
||||
|
||||
pub trait Config: 'static {
|
||||
type BlockNumber: Codec + EncodeLike + Default + TypeInfo;
|
||||
type Origin;
|
||||
type RuntimeOrigin;
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: crate::traits::Get<crate::weights::RuntimeDbWeight>;
|
||||
}
|
||||
@@ -856,7 +856,7 @@ pub mod tests {
|
||||
use super::Config;
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {}
|
||||
pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, system=self {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ pub mod tests {
|
||||
|
||||
impl Config for Test {
|
||||
type BlockNumber = u32;
|
||||
type Origin = u32;
|
||||
type RuntimeOrigin = u32;
|
||||
type PalletInfo = PanicPalletInfo;
|
||||
type DbWeight = ();
|
||||
}
|
||||
|
||||
@@ -512,14 +512,14 @@ mod test_iterators {
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
pub trait Config: 'static {
|
||||
type Origin;
|
||||
type RuntimeOrigin;
|
||||
type BlockNumber;
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: crate::traits::Get<crate::weights::RuntimeDbWeight>;
|
||||
}
|
||||
|
||||
crate::decl_module! {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {}
|
||||
pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, system=self {}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
||||
|
||||
@@ -354,14 +354,14 @@ mod test_iterators {
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
pub trait Config: 'static {
|
||||
type Origin;
|
||||
type RuntimeOrigin;
|
||||
type BlockNumber;
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: crate::traits::Get<crate::weights::RuntimeDbWeight>;
|
||||
}
|
||||
|
||||
crate::decl_module! {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {}
|
||||
pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, system=self {}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
||||
|
||||
@@ -47,21 +47,21 @@ mod tests {
|
||||
struct Runtime;
|
||||
|
||||
pub trait Config: 'static {
|
||||
type Origin;
|
||||
type RuntimeOrigin;
|
||||
type BlockNumber;
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: crate::traits::Get<crate::weights::RuntimeDbWeight>;
|
||||
}
|
||||
|
||||
impl Config for Runtime {
|
||||
type Origin = u32;
|
||||
type RuntimeOrigin = u32;
|
||||
type BlockNumber = u32;
|
||||
type PalletInfo = crate::tests::PanicPalletInfo;
|
||||
type DbWeight = ();
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {}
|
||||
pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, system=self {}
|
||||
}
|
||||
|
||||
crate::decl_storage! {
|
||||
|
||||
@@ -460,14 +460,14 @@ mod test_iterators {
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
pub trait Config: 'static {
|
||||
type Origin;
|
||||
type RuntimeOrigin;
|
||||
type BlockNumber;
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: crate::traits::Get<crate::weights::RuntimeDbWeight>;
|
||||
}
|
||||
|
||||
crate::decl_module! {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {}
|
||||
pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, system=self {}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
||||
|
||||
@@ -229,14 +229,14 @@ impl<
|
||||
/// Implemented for pallet dispatchable type by `decl_module` and for runtime dispatchable by
|
||||
/// `construct_runtime`.
|
||||
pub trait UnfilteredDispatchable {
|
||||
/// The origin type of the runtime, (i.e. `frame_system::Config::Origin`).
|
||||
type Origin;
|
||||
/// The origin type of the runtime, (i.e. `frame_system::Config::RuntimeOrigin`).
|
||||
type RuntimeOrigin;
|
||||
|
||||
/// Dispatch this call but do not check the filter in origin.
|
||||
fn dispatch_bypass_filter(self, origin: Self::Origin) -> DispatchResultWithPostInfo;
|
||||
fn dispatch_bypass_filter(self, origin: Self::RuntimeOrigin) -> DispatchResultWithPostInfo;
|
||||
}
|
||||
|
||||
/// Methods available on `frame_system::Config::Origin`.
|
||||
/// Methods available on `frame_system::Config::RuntimeOrigin`.
|
||||
pub trait OriginTrait: Sized {
|
||||
/// Runtime call type, as in `frame_system::Config::Call`
|
||||
type Call;
|
||||
|
||||
@@ -132,7 +132,7 @@ pub mod v1 {
|
||||
use super::*;
|
||||
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Anon<BlockNumber, Call, Origin> {
|
||||
pub trait Anon<BlockNumber, Call, RuntimeOrigin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + Debug + TypeInfo + MaxEncodedLen;
|
||||
|
||||
@@ -143,7 +143,7 @@ pub mod v1 {
|
||||
when: DispatchTime<BlockNumber>,
|
||||
maybe_periodic: Option<Period<BlockNumber>>,
|
||||
priority: Priority,
|
||||
origin: Origin,
|
||||
origin: RuntimeOrigin,
|
||||
call: Call,
|
||||
) -> Result<Self::Address, DispatchError>;
|
||||
|
||||
@@ -177,7 +177,7 @@ pub mod v1 {
|
||||
}
|
||||
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Named<BlockNumber, Call, Origin> {
|
||||
pub trait Named<BlockNumber, Call, RuntimeOrigin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug + MaxEncodedLen;
|
||||
|
||||
@@ -189,7 +189,7 @@ pub mod v1 {
|
||||
when: DispatchTime<BlockNumber>,
|
||||
maybe_periodic: Option<Period<BlockNumber>>,
|
||||
priority: Priority,
|
||||
origin: Origin,
|
||||
origin: RuntimeOrigin,
|
||||
call: Call,
|
||||
) -> Result<Self::Address, ()>;
|
||||
|
||||
@@ -215,9 +215,9 @@ pub mod v1 {
|
||||
fn next_dispatch_time(id: Vec<u8>) -> Result<BlockNumber, ()>;
|
||||
}
|
||||
|
||||
impl<T, BlockNumber, Call, Origin> Anon<BlockNumber, Call, Origin> for T
|
||||
impl<T, BlockNumber, Call, RuntimeOrigin> Anon<BlockNumber, Call, RuntimeOrigin> for T
|
||||
where
|
||||
T: v2::Anon<BlockNumber, Call, Origin>,
|
||||
T: v2::Anon<BlockNumber, Call, RuntimeOrigin>,
|
||||
{
|
||||
type Address = T::Address;
|
||||
|
||||
@@ -225,7 +225,7 @@ pub mod v1 {
|
||||
when: DispatchTime<BlockNumber>,
|
||||
maybe_periodic: Option<Period<BlockNumber>>,
|
||||
priority: Priority,
|
||||
origin: Origin,
|
||||
origin: RuntimeOrigin,
|
||||
call: Call,
|
||||
) -> Result<Self::Address, DispatchError> {
|
||||
let c = MaybeHashed::<Call, T::Hash>::Value(call);
|
||||
@@ -248,9 +248,9 @@ pub mod v1 {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, BlockNumber, Call, Origin> Named<BlockNumber, Call, Origin> for T
|
||||
impl<T, BlockNumber, Call, RuntimeOrigin> Named<BlockNumber, Call, RuntimeOrigin> for T
|
||||
where
|
||||
T: v2::Named<BlockNumber, Call, Origin>,
|
||||
T: v2::Named<BlockNumber, Call, RuntimeOrigin>,
|
||||
{
|
||||
type Address = T::Address;
|
||||
|
||||
@@ -259,7 +259,7 @@ pub mod v1 {
|
||||
when: DispatchTime<BlockNumber>,
|
||||
maybe_periodic: Option<Period<BlockNumber>>,
|
||||
priority: Priority,
|
||||
origin: Origin,
|
||||
origin: RuntimeOrigin,
|
||||
call: Call,
|
||||
) -> Result<Self::Address, ()> {
|
||||
let c = MaybeHashed::<Call, T::Hash>::Value(call);
|
||||
@@ -287,7 +287,7 @@ pub mod v2 {
|
||||
use super::*;
|
||||
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Anon<BlockNumber, Call, Origin> {
|
||||
pub trait Anon<BlockNumber, Call, RuntimeOrigin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + Debug + TypeInfo + MaxEncodedLen;
|
||||
/// A means of expressing a call by the hash of its encoded data.
|
||||
@@ -300,7 +300,7 @@ pub mod v2 {
|
||||
when: DispatchTime<BlockNumber>,
|
||||
maybe_periodic: Option<Period<BlockNumber>>,
|
||||
priority: Priority,
|
||||
origin: Origin,
|
||||
origin: RuntimeOrigin,
|
||||
call: MaybeHashed<Call, Self::Hash>,
|
||||
) -> Result<Self::Address, DispatchError>;
|
||||
|
||||
@@ -334,7 +334,7 @@ pub mod v2 {
|
||||
}
|
||||
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Named<BlockNumber, Call, Origin> {
|
||||
pub trait Named<BlockNumber, Call, RuntimeOrigin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug + MaxEncodedLen;
|
||||
/// A means of expressing a call by the hash of its encoded data.
|
||||
@@ -348,7 +348,7 @@ pub mod v2 {
|
||||
when: DispatchTime<BlockNumber>,
|
||||
maybe_periodic: Option<Period<BlockNumber>>,
|
||||
priority: Priority,
|
||||
origin: Origin,
|
||||
origin: RuntimeOrigin,
|
||||
call: MaybeHashed<Call, Self::Hash>,
|
||||
) -> Result<Self::Address, ()>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user