Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[big refactor] Remove crate aliasing. #4395

Merged
merged 22 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix frame-system in our modules.
  • Loading branch information
tomusdrw committed Dec 16, 2019
commit 40731ece76ed8c5a1e69c291cc914e81c4c33569
14 changes: 7 additions & 7 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}

impl frame_system::Trait for Runtime {
impl system::Trait for Runtime {
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
Expand Down Expand Up @@ -268,19 +268,19 @@ pub type SignedBlock = generic::SignedBlock<Block>;
pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic.
pub type SignedExtra = (
frame_system::CheckVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
system::CheckVersion<Runtime>,
system::CheckGenesis<Runtime>,
system::CheckEra<Runtime>,
system::CheckNonce<Runtime>,
system::CheckWeight<Runtime>,
transaction_payment::ChargeTransactionPayment<Runtime>
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllModules>;
pub type Executive = frame_executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down
13 changes: 6 additions & 7 deletions bin/node-template/runtime/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs

use frame_support::{decl_module, decl_storage, decl_event, dispatch};
use frame_system::ensure_signed;
use system::ensure_signed;

/// The module's configuration trait.
pub trait Trait: frame_system::Trait {
pub trait Trait: system::Trait {
// TODO: Add other types and constants required configure this module.

/// The overarching event type.
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
}

// This module's storage items.
Expand Down Expand Up @@ -56,7 +56,7 @@ decl_module! {
}

decl_event!(
pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
pub enum Event<T> where AccountId = <T as system::Trait>::AccountId {
// Just a dummy event.
// Event `Something` is declared with a parameter of the type `u32` and `AccountId`
// To emit this event, we call the deposit funtion, from our runtime funtions
Expand All @@ -71,7 +71,6 @@ mod tests {

use sp_core::H256;
use frame_support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight};
use frame_system as system;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup}, testing::Header, Perbill,
};
Expand All @@ -91,7 +90,7 @@ mod tests {
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl frame_system::Trait for Test {
impl system::Trait for Test {
type Origin = Origin;
type Call = ();
type Index = u64;
Expand All @@ -116,7 +115,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> sp_io::TestExternalities {
frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions bin/node-template/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,20 @@ fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
pallet_indices: Some(IndicesConfig {
indices: Some(IndicesConfig {
ids: endowed_accounts.clone(),
}),
pallet_balances: Some(BalancesConfig {
balances: Some(BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(),
vesting: vec![],
}),
pallet_sudo: Some(SudoConfig {
sudo: Some(SudoConfig {
key: root_key,
}),
pallet_aura: Some(AuraConfig {
aura: Some(AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
}),
pallet_grandpa: Some(GrandpaConfig {
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
}),
}
Expand Down
4 changes: 2 additions & 2 deletions frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
//!
//! ```rust,ignore
//! use frame_support::{decl_module, dispatch};
//! use frame_system::ensure_signed;
//! use frame_system::{self as system, ensure_signed};
//!
//! pub trait Trait: assets::Trait { }
//!
Expand Down Expand Up @@ -132,7 +132,7 @@

use frame_support::{Parameter, decl_module, decl_event, decl_storage, ensure};
use sp_runtime::traits::{Member, SimpleArithmetic, Zero, StaticLookup};
use frame_system::ensure_signed;
use frame_system::{self as system, ensure_signed};
use sp_runtime::traits::One;

/// The module configuration trait.
Expand Down
4 changes: 1 addition & 3 deletions frame/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use frame_support::{
traits::{ChangeMembers, InitializeMembers}, decl_module, decl_event,
decl_storage, ensure,
};
use frame_system::{self as system, self as system, ensure_signed, ensure_root};
use frame_system::{self as system, ensure_signed, ensure_root};

/// Simple index type for proposal counting.
pub type ProposalIndex = u32;
Expand Down Expand Up @@ -425,8 +425,6 @@ mod tests {
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, Call, ()>;

use frame_system as system;

frame_support::construct_runtime!(
pub enum Test where
Block = Block,
Expand Down
1 change: 0 additions & 1 deletion frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ mod contract {
use frame_support::impl_outer_event;
}

use frame_system as system;
use pallet_balances as balances;

impl_outer_event! {
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sp_std::{vec::Vec, marker::PhantomData};
use frame_support::{dispatch, decl_module, decl_storage, decl_event};
use frame_support::weights::{Weight, WeighData, ClassifyDispatch, DispatchClass, PaysFee};
use frame_support::traits::{Currency, WithdrawReason, ExistenceRequirement};
use frame_system::ensure_signed;
use frame_system::{self as system, ensure_signed};
use sp_runtime::ModuleId;
use frame_support::weights::SimpleDispatchInfo;
use sp_runtime::traits::{UniqueSaturatedInto, AccountIdConversion, SaturatedConversion};
Expand Down
3 changes: 1 addition & 2 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ use sp_runtime::{
#[allow(deprecated)]
use sp_runtime::traits::ValidateUnsigned;
use codec::{Codec, Encode};
use frame_system::{self as system, extrinsics_root, DigestOf};
use frame_system::{extrinsics_root, DigestOf};

/// Trait that can be used to execute a block.
pub trait ExecuteBlock<Block: BlockT> {
Expand Down Expand Up @@ -373,7 +373,6 @@ mod tests {
type Balances = pallet_balances::Module<Runtime>;
type Custom = custom::Module<Runtime>;

use frame_system as system;
use pallet_balances as balances;

impl_outer_origin! {
Expand Down
2 changes: 1 addition & 1 deletion frame/finality-tracker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use sp_runtime::traits::{One, Zero, SaturatedConversion};
use sp_std::{prelude::*, result, cmp, vec};
use frame_support::{decl_module, decl_storage};
use frame_support::traits::Get;
use frame_system::{self as system, ensure_none, Trait as SystemTrait};
use frame_system::{ensure_none, Trait as SystemTrait};
use sp_finality_tracker::{INHERENT_IDENTIFIER, FinalizedInherentData};

pub const DEFAULT_WINDOW_SIZE: u32 = 101;
Expand Down
2 changes: 1 addition & 1 deletion frame/grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use sp_runtime::{testing::Digest, traits::{Header, OnFinalize}};
use crate::mock::*;
use frame_system::{self as system, EventRecord, Phase};
use frame_system::{EventRecord, Phase};
use codec::{Decode, Encode};
use fg_primitives::ScheduledChange;
use super::*;
Expand Down
4 changes: 2 additions & 2 deletions frame/im-online/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
//!
//! ```
//! use frame_support::{decl_module, dispatch};
//! use frame_system::ensure_signed;
//! use frame_system::{self as system, ensure_signed};
//! use pallet_im_online::{self as im_online};
//!
//! pub trait Trait: im_online::Trait {}
Expand Down Expand Up @@ -92,7 +92,7 @@ use frame_support::{
decl_module, decl_event, decl_storage, print, Parameter, debug,
traits::Get,
};
use frame_system::ensure_none;
use frame_system::{self as system, ensure_none};
use frame_system::offchain::SubmitUnsignedTransaction;

pub mod sr25519 {
Expand Down
2 changes: 1 addition & 1 deletion frame/indices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use sp_std::{prelude::*, marker::PhantomData, convert::TryInto};
use codec::{Encode, Codec};
use frame_support::{Parameter, decl_module, decl_event, decl_storage};
use sp_runtime::traits::{One, SimpleArithmetic, StaticLookup, Member, LookupError};
use frame_system::{self as system, IsDeadAccount, OnNewAccount};
use frame_system::{IsDeadAccount, OnNewAccount};

use self::address::Address as RawAddress;

Expand Down
1 change: 1 addition & 0 deletions frame/offences/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use sp_staking::{
offence::{Offence, ReportOffence, Kind, OnOffenceHandler, OffenceDetails},
};
use codec::{Encode, Decode};
use frame_system as system;

/// A binary blob which represents a SCALE codec-encoded `O::TimeSlot`.
type OpaqueTimeSlot = Vec<u8>;
Expand Down
2 changes: 1 addition & 1 deletion frame/offences/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::mock::{
offence_reports,
};
use sp_runtime::Perbill;
use frame_system::{self as system, EventRecord, Phase};
use frame_system::{EventRecord, Phase};

#[test]
fn should_report_an_authority_and_trigger_on_offence() {
Expand Down
2 changes: 1 addition & 1 deletion frame/scored-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
//!
//! ```
//! use frame_support::{decl_module, dispatch};
//! use frame_system::ensure_signed;
//! use frame_system::{self as system, ensure_signed};
//! use pallet_scored_pool::{self as scored_pool};
//!
//! pub trait Trait: scored_pool::Trait {}
Expand Down
2 changes: 1 addition & 1 deletion frame/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
//!
//! ```
//! use frame_support::{decl_module, dispatch};
//! use frame_system::ensure_signed;
//! use frame_system::{self as system, ensure_signed};
//! use pallet_staking::{self as staking};
//!
//! pub trait Trait: staking::Trait {}
Expand Down
2 changes: 1 addition & 1 deletion frame/sudo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
//!
//! ```
//! use frame_support::{decl_module, dispatch};
//! use frame_system::ensure_root;
//! use frame_system::{self as system, ensure_root};
//!
//! pub trait Trait: frame_system::Trait {}
//!
Expand Down
2 changes: 1 addition & 1 deletion frame/timestamp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
//! ```
//! use frame_support::{decl_module, dispatch};
//! # use pallet_timestamp as timestamp;
//! use frame_system::ensure_signed;
//! use frame_system::{self as system, ensure_signed};
//!
//! pub trait Trait: timestamp::Trait {}
//!
Expand Down
2 changes: 1 addition & 1 deletion frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ use sp_runtime::traits::{
};
use frame_support::weights::SimpleDispatchInfo;
use codec::{Encode, Decode};
use frame_system::ensure_signed;
use frame_system::{self as system, ensure_signed};

type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
type PositiveImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::PositiveImbalance;
Expand Down
2 changes: 1 addition & 1 deletion frame/utility/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

use sp_std::prelude::*;
use frame_support::{decl_module, decl_event, Parameter, weights::SimpleDispatchInfo};
use frame_system::ensure_root;
use frame_system::{self as system, ensure_root};
use sp_runtime::{traits::Dispatchable, DispatchError};

/// Configuration trait.
Expand Down