decl_module! macro: use 'frame_system' instead of system as default ident (#6500)

* Use frame_system as default ident.

* Remove unused 'frame_system' to 'system' renaming.

* Fix construct_runtime_ui tests.

* Rename system to frame_system in sudo/utility pallet test.

* Bump runtime impl_version.

* Update formatting.
This commit is contained in:
Shaopeng Wang
2020-07-08 11:06:21 +12:00
committed by GitHub
parent 36cf6e7dc4
commit a6702b7121
30 changed files with 57 additions and 57 deletions
+6 -6
View File
@@ -70,7 +70,7 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
/// # #[macro_use]
/// # extern crate frame_support;
/// # use frame_support::dispatch;
/// # use frame_system::{self as system, Trait, ensure_signed};
/// # use frame_system::{Trait, ensure_signed};
/// decl_module! {
/// pub struct Module<T: Trait> for enum Call where origin: T::Origin {
///
@@ -112,7 +112,7 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
/// # #[macro_use]
/// # extern crate frame_support;
/// # use frame_support::dispatch;
/// # use frame_system::{self as system, Trait, ensure_signed};
/// # use frame_system::{Trait, ensure_signed};
/// decl_module! {
/// pub struct Module<T: Trait> for enum Call where origin: T::Origin {
/// #[weight = 0]
@@ -147,7 +147,7 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
/// # #[macro_use]
/// # extern crate frame_support;
/// # use frame_support::dispatch::{DispatchResultWithPostInfo, WithPostDispatchInfo};
/// # use frame_system::{self as system, Trait, ensure_signed};
/// # use frame_system::{Trait, ensure_signed};
/// decl_module! {
/// pub struct Module<T: Trait> for enum Call where origin: T::Origin {
/// #[weight = 1_000_000]
@@ -175,7 +175,7 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
/// # #[macro_use]
/// # extern crate frame_support;
/// # use frame_support::dispatch;
/// # use frame_system::{self as system, Trait, ensure_signed, ensure_root};
/// # use frame_system::{Trait, ensure_signed, ensure_root};
/// decl_module! {
/// pub struct Module<T: Trait> for enum Call where origin: T::Origin {
/// #[weight = 0]
@@ -292,7 +292,7 @@ macro_rules! decl_module {
pub struct $mod_type<
$trait_instance: $trait_name $(<I>, I: $instantiable $(= $module_default_instance)?)?
>
for enum $call_type where origin: $origin_type, system = system
for enum $call_type where origin: $origin_type, system = frame_system
{ $( $where_ty: $where_bound ),* }
{}
{}
@@ -2339,7 +2339,7 @@ mod tests {
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin, T::AccountId: From<u32> {
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system = system, T::AccountId: From<u32> {
/// Hi, this is a comment.
#[weight = 0]
fn aux_0(_origin) -> DispatchResult { unreachable!() }
+1 -1
View File
@@ -47,7 +47,7 @@ pub use frame_metadata::{ModuleErrorMetadata, ErrorMetadata, DecodeDifferent};
/// }
/// }
///
/// # use frame_system::{self as system, Trait};
/// # use frame_system::Trait;
///
/// // You need to register the error type in `decl_module!` as well to make the error
/// // exported in the metadata.
+6 -6
View File
@@ -39,7 +39,7 @@
//! `Yes`**.
//!
//! ```
//! # use frame_system::{self as system, Trait};
//! # use frame_system::Trait;
//! frame_support::decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
//! #[weight = 1000]
@@ -52,7 +52,7 @@
//! 2.1 Define weight and class, **in which case `PaysFee` would be `Yes`**.
//!
//! ```
//! # use frame_system::{self as system, Trait};
//! # use frame_system::Trait;
//! # use frame_support::weights::DispatchClass;
//! frame_support::decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
@@ -66,7 +66,7 @@
//! 2.2 Define weight and `PaysFee`, **in which case `ClassifyDispatch` would be `Normal`**.
//!
//! ```
//! # use frame_system::{self as system, Trait};
//! # use frame_system::Trait;
//! # use frame_support::weights::Pays;
//! frame_support::decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
@@ -80,7 +80,7 @@
//! 3. Define all 3 parameters.
//!
//! ```
//! # use frame_system::{self as system, Trait};
//! # use frame_system::Trait;
//! # use frame_support::weights::{DispatchClass, Pays};
//! frame_support::decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
@@ -100,7 +100,7 @@
//! all 3 are static values, providing a raw tuple is easier.
//!
//! ```
//! # use frame_system::{self as system, Trait};
//! # use frame_system::Trait;
//! # use frame_support::weights::{DispatchClass, FunctionOf, Pays};
//! frame_support::decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
@@ -589,7 +589,7 @@ pub trait WeightToFeePolynomial {
Self::polynomial().iter().fold(Self::Balance::saturated_from(0u32), |mut acc, args| {
let w = Self::Balance::saturated_from(*weight).saturating_pow(args.degree.into());
// The sum could get negative. Therefore we only sum with the accumulator.
// The sum could get negative. Therefore we only sum with the accumulator.
// The Perbill Mul implementation is non overflowing.
let frac = args.coeff_frac * w;
let integer = args.coeff_integer.saturating_mul(w);