mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +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
@@ -21,9 +21,9 @@
|
||||
|
||||
use sp_std::{prelude::*, marker::PhantomData, convert::TryInto};
|
||||
use codec::{Encode, Codec};
|
||||
use support::{Parameter, decl_module, decl_event, decl_storage};
|
||||
use frame_support::{Parameter, decl_module, decl_event, decl_storage};
|
||||
use sp_runtime::traits::{One, SimpleArithmetic, StaticLookup, Member, LookupError};
|
||||
use system::{IsDeadAccount, OnNewAccount};
|
||||
use frame_system::{IsDeadAccount, OnNewAccount};
|
||||
|
||||
use self::address::Address as RawAddress;
|
||||
|
||||
@@ -35,7 +35,7 @@ mod tests;
|
||||
/// Number of account IDs stored per enum set.
|
||||
const ENUM_SET_SIZE: u32 = 64;
|
||||
|
||||
pub type Address<T> = RawAddress<<T as system::Trait>::AccountId, <T as Trait>::AccountIndex>;
|
||||
pub type Address<T> = RawAddress<<T as frame_system::Trait>::AccountId, <T as Trait>::AccountIndex>;
|
||||
|
||||
/// Turn an Id into an Index, or None for the purpose of getting
|
||||
/// a hint at a possibly desired index.
|
||||
@@ -56,7 +56,7 @@ impl<AccountId: Encode, AccountIndex: From<u32>>
|
||||
}
|
||||
|
||||
/// The module's config trait.
|
||||
pub trait Trait: system::Trait {
|
||||
pub trait Trait: frame_system::Trait {
|
||||
/// Type used for storing an account's index; implies the maximum number of accounts the system
|
||||
/// can hold.
|
||||
type AccountIndex: Parameter + Member + Codec + Default + SimpleArithmetic + Copy;
|
||||
@@ -68,18 +68,18 @@ pub trait Trait: system::Trait {
|
||||
type ResolveHint: ResolveHint<Self::AccountId, Self::AccountIndex>;
|
||||
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system = frame_system {
|
||||
fn deposit_event() = default;
|
||||
}
|
||||
}
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T> where
|
||||
<T as system::Trait>::AccountId,
|
||||
<T as frame_system::Trait>::AccountId,
|
||||
<T as Trait>::AccountIndex
|
||||
{
|
||||
/// A new account index was assigned.
|
||||
|
||||
@@ -22,13 +22,12 @@ use std::collections::HashSet;
|
||||
use ref_thread_local::{ref_thread_local, RefThreadLocal};
|
||||
use sp_runtime::testing::Header;
|
||||
use sp_runtime::Perbill;
|
||||
use primitives::H256;
|
||||
use support::{impl_outer_origin, parameter_types, weights::Weight};
|
||||
use {sp_io, system};
|
||||
use sp_core::H256;
|
||||
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
|
||||
use crate::{GenesisConfig, Module, Trait, IsDeadAccount, OnNewAccount, ResolveHint};
|
||||
|
||||
impl_outer_origin!{
|
||||
pub enum Origin for Runtime {}
|
||||
pub enum Origin for Runtime where system = frame_system {}
|
||||
}
|
||||
|
||||
ref_thread_local! {
|
||||
@@ -71,7 +70,7 @@ parameter_types! {
|
||||
pub const MaximumBlockLength: u32 = 2 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
impl system::Trait for Runtime {
|
||||
impl frame_system::Trait for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -102,7 +101,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
for i in 1..5 { h.insert(i); }
|
||||
}
|
||||
|
||||
let mut t = system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
GenesisConfig::<Runtime> {
|
||||
ids: vec![1, 2, 3, 4]
|
||||
}.assimilate_storage(&mut t).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user