mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 15:11:03 +00:00
[big refactor] Remove crate aliasing. (#4395)
* Rename: Phase 1. * Unify codec. * Fixing: Phase 2 * Fixing: Phase 3. * Fixing: Phase 4. * Fixing: Phase 5. * Fixing: Phase 6. * Fixing: Phase 7. * Fixing: Phase 8. Tests * Fixing: Phase 9. Tests!!! * Fixing: Phase 10. Moar tests! * Finally done! * More fixes. * Rename primitives:: to sp_core:: * Apply renames in finality-grandpa. * Fix benches. * Fix benches 2. * Revert node-template. * Fix frame-system in our modules.
This commit is contained in:
committed by
Gavin Wood
parent
f14d98a439
commit
8778ca7dc8
@@ -53,8 +53,8 @@
|
||||
//! ## Usage
|
||||
//!
|
||||
//! ```
|
||||
//! use support::{decl_module, dispatch};
|
||||
//! use system::ensure_signed;
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_system::{self as system, ensure_signed};
|
||||
//! use pallet_scored_pool::{self as scored_pool};
|
||||
//!
|
||||
//! pub trait Trait: scored_pool::Trait {}
|
||||
@@ -93,17 +93,17 @@ use sp_std::{
|
||||
fmt::Debug,
|
||||
prelude::*,
|
||||
};
|
||||
use support::{
|
||||
use frame_support::{
|
||||
decl_module, decl_storage, decl_event, ensure,
|
||||
traits::{ChangeMembers, InitializeMembers, Currency, Get, ReservableCurrency},
|
||||
};
|
||||
use system::{self, ensure_root, ensure_signed};
|
||||
use frame_system::{self as system, ensure_root, ensure_signed};
|
||||
use sp_runtime::{
|
||||
traits::{EnsureOrigin, SimpleArithmetic, MaybeSerializeDeserialize, Zero, StaticLookup},
|
||||
};
|
||||
|
||||
type BalanceOf<T, I> = <<T as Trait<I>>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
||||
type PoolT<T, I> = Vec<(<T as system::Trait>::AccountId, Option<<T as Trait<I>>::Score>)>;
|
||||
type BalanceOf<T, I> = <<T as Trait<I>>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
type PoolT<T, I> = Vec<(<T as frame_system::Trait>::AccountId, Option<<T as Trait<I>>::Score>)>;
|
||||
|
||||
/// The enum is supplied when refreshing the members set.
|
||||
/// Depending on the enum variant the corresponding associated
|
||||
@@ -115,7 +115,7 @@ enum ChangeReceiver {
|
||||
MembershipChanged,
|
||||
}
|
||||
|
||||
pub trait Trait<I=DefaultInstance>: system::Trait {
|
||||
pub trait Trait<I=DefaultInstance>: frame_system::Trait {
|
||||
/// The currency used for deposits.
|
||||
type Currency: Currency<Self::AccountId> + ReservableCurrency<Self::AccountId>;
|
||||
|
||||
@@ -124,7 +124,7 @@ pub trait Trait<I=DefaultInstance>: system::Trait {
|
||||
SimpleArithmetic + Clone + Copy + Default + FullCodec + MaybeSerializeDeserialize + Debug;
|
||||
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Trait>::Event>;
|
||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
|
||||
// The deposit which is reserved from candidates if they want to
|
||||
// start a candidacy. The deposit gets returned when the candidacy is
|
||||
@@ -203,7 +203,7 @@ decl_storage! {
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T, I=DefaultInstance> where
|
||||
<T as system::Trait>::AccountId,
|
||||
<T as frame_system::Trait>::AccountId,
|
||||
{
|
||||
/// The given member was removed. See the transaction for who.
|
||||
MemberRemoved,
|
||||
|
||||
@@ -19,17 +19,17 @@
|
||||
use super::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use support::{impl_outer_origin, parameter_types, weights::Weight};
|
||||
use primitives::H256;
|
||||
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
|
||||
use sp_core::H256;
|
||||
// The testing primitives are very useful for avoiding having to work with signatures
|
||||
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried.
|
||||
use sp_runtime::{
|
||||
Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header,
|
||||
};
|
||||
use system::EnsureSignedBy;
|
||||
use frame_system::EnsureSignedBy;
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Test {}
|
||||
pub enum Origin for Test where system = frame_system {}
|
||||
}
|
||||
|
||||
// For testing the module, we construct most of a mock runtime. This means
|
||||
@@ -54,7 +54,7 @@ parameter_types! {
|
||||
pub const CreationFee: u64 = 0;
|
||||
}
|
||||
|
||||
impl system::Trait for Test {
|
||||
impl frame_system::Trait for Test {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -72,7 +72,7 @@ impl system::Trait for Test {
|
||||
type Version = ();
|
||||
}
|
||||
|
||||
impl balances::Trait for Test {
|
||||
impl pallet_balances::Trait for Test {
|
||||
type Balance = u64;
|
||||
type OnFreeBalanceZero = ();
|
||||
type OnNewAccount = ();
|
||||
@@ -116,7 +116,7 @@ impl Trait for Test {
|
||||
type KickOrigin = EnsureSignedBy<KickOrigin, u64>;
|
||||
type MembershipInitialized = TestChangeMembers;
|
||||
type MembershipChanged = TestChangeMembers;
|
||||
type Currency = balances::Module<Self>;
|
||||
type Currency = pallet_balances::Module<Self>;
|
||||
type CandidateDeposit = CandidateDeposit;
|
||||
type Period = Period;
|
||||
type Score = u64;
|
||||
@@ -126,9 +126,9 @@ impl Trait for Test {
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
// We use default for brevity, but you can configure as desired if needed.
|
||||
balances::GenesisConfig::<Test> {
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![
|
||||
(5, 500_000),
|
||||
(10, 500_000),
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
use super::*;
|
||||
use mock::*;
|
||||
|
||||
use support::{assert_ok, assert_noop};
|
||||
use frame_support::{assert_ok, assert_noop};
|
||||
use sp_runtime::traits::OnInitialize;
|
||||
|
||||
type ScoredPool = Module<Test>;
|
||||
type System = system::Module<Test>;
|
||||
type Balances = balances::Module<Test>;
|
||||
type System = frame_system::Module<Test>;
|
||||
type Balances = pallet_balances::Module<Test>;
|
||||
|
||||
const OOB_ERR: &str = "index out of bounds";
|
||||
const INDEX_ERR: &str = "index does not match requested account";
|
||||
|
||||
Reference in New Issue
Block a user