mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +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!(); }
|
||||
|
||||
Reference in New Issue
Block a user