mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +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
@@ -114,14 +114,14 @@
|
||||
//! The Fees module uses the `Currency` trait to handle fee charge/refund, and its types inherit from `Currency`:
|
||||
//!
|
||||
//! ```
|
||||
//! use support::{
|
||||
//! use frame_support::{
|
||||
//! dispatch,
|
||||
//! traits::{Currency, ExistenceRequirement, WithdrawReason},
|
||||
//! };
|
||||
//! # pub trait Trait: system::Trait {
|
||||
//! # pub trait Trait: frame_system::Trait {
|
||||
//! # type Currency: Currency<Self::AccountId>;
|
||||
//! # }
|
||||
//! type AssetOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
||||
//! type AssetOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
//!
|
||||
//! fn charge_fee<T: Trait>(transactor: &T::AccountId, amount: AssetOf<T>) -> dispatch::Result {
|
||||
//! // ...
|
||||
@@ -161,7 +161,7 @@ use sp_runtime::traits::{
|
||||
|
||||
use sp_std::prelude::*;
|
||||
use sp_std::{cmp, result, fmt::Debug};
|
||||
use support::{
|
||||
use frame_support::{
|
||||
decl_event, decl_module, decl_storage, ensure, dispatch,
|
||||
traits::{
|
||||
Currency, ExistenceRequirement, Imbalance, LockIdentifier, LockableCurrency, ReservableCurrency,
|
||||
@@ -169,14 +169,14 @@ use support::{
|
||||
},
|
||||
Parameter, StorageMap,
|
||||
};
|
||||
use system::{ensure_signed, ensure_root};
|
||||
use frame_system::{self as system, ensure_signed, ensure_root};
|
||||
|
||||
mod mock;
|
||||
mod tests;
|
||||
|
||||
pub use self::imbalances::{NegativeImbalance, PositiveImbalance};
|
||||
|
||||
pub trait Trait: system::Trait {
|
||||
pub trait Trait: frame_system::Trait {
|
||||
type Balance: Parameter
|
||||
+ Member
|
||||
+ SimpleArithmetic
|
||||
@@ -185,10 +185,10 @@ pub trait Trait: system::Trait {
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Debug;
|
||||
type AssetId: Parameter + Member + SimpleArithmetic + Default + Copy;
|
||||
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
}
|
||||
|
||||
pub trait Subtrait: system::Trait {
|
||||
pub trait Subtrait: frame_system::Trait {
|
||||
type Balance: Parameter
|
||||
+ Member
|
||||
+ SimpleArithmetic
|
||||
@@ -495,10 +495,10 @@ decl_storage! {
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T> where
|
||||
<T as system::Trait>::AccountId,
|
||||
<T as frame_system::Trait>::AccountId,
|
||||
<T as Trait>::Balance,
|
||||
<T as Trait>::AssetId,
|
||||
AssetOptions = AssetOptions<<T as Trait>::Balance, <T as system::Trait>::AccountId>
|
||||
AssetOptions = AssetOptions<<T as Trait>::Balance, <T as frame_system::Trait>::AccountId>
|
||||
{
|
||||
/// Asset created (asset_id, creator, asset_options).
|
||||
Created(AssetId, AccountId, AssetOptions),
|
||||
@@ -760,7 +760,7 @@ impl<T: Trait> Module<T> {
|
||||
if locks.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
if Self::locks(who)
|
||||
.into_iter()
|
||||
.all(|l| now >= l.until || new_balance >= l.amount || !l.reasons.intersects(reasons))
|
||||
@@ -792,7 +792,7 @@ impl<T: Trait> Module<T> {
|
||||
until: T::BlockNumber,
|
||||
reasons: WithdrawReasons,
|
||||
) {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
let mut new_lock = Some(BalanceLock {
|
||||
id,
|
||||
amount,
|
||||
@@ -824,7 +824,7 @@ impl<T: Trait> Module<T> {
|
||||
until: T::BlockNumber,
|
||||
reasons: WithdrawReasons,
|
||||
) {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
let mut new_lock = Some(BalanceLock {
|
||||
id,
|
||||
amount,
|
||||
@@ -855,7 +855,7 @@ impl<T: Trait> Module<T> {
|
||||
}
|
||||
|
||||
fn remove_lock(id: LockIdentifier, who: &T::AccountId) {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
let locks = <Module<T>>::locks(who)
|
||||
.into_iter()
|
||||
.filter_map(|l| if l.until > now && l.id != id { Some(l) } else { None })
|
||||
@@ -1076,7 +1076,7 @@ impl<T: Subtrait> PartialEq for ElevatedTrait<T> {
|
||||
}
|
||||
}
|
||||
impl<T: Subtrait> Eq for ElevatedTrait<T> {}
|
||||
impl<T: Subtrait> system::Trait for ElevatedTrait<T> {
|
||||
impl<T: Subtrait> frame_system::Trait for ElevatedTrait<T> {
|
||||
type Origin = T::Origin;
|
||||
type Call = T::Call;
|
||||
type Index = T::Index;
|
||||
|
||||
@@ -25,13 +25,13 @@ use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
};
|
||||
use primitives::H256;
|
||||
use support::{parameter_types, impl_outer_event, impl_outer_origin, weights::Weight};
|
||||
use sp_core::H256;
|
||||
use frame_support::{parameter_types, impl_outer_event, impl_outer_origin, weights::Weight};
|
||||
|
||||
use super::*;
|
||||
|
||||
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
|
||||
@@ -45,7 +45,7 @@ parameter_types! {
|
||||
pub const MaximumBlockLength: u32 = 2 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
impl system::Trait for Test {
|
||||
impl frame_system::Trait for Test {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -73,6 +73,7 @@ mod generic_asset {
|
||||
pub use crate::Event;
|
||||
}
|
||||
|
||||
use frame_system as system;
|
||||
impl_outer_event! {
|
||||
pub enum TestEvent for Test {
|
||||
generic_asset<T>,
|
||||
@@ -81,7 +82,7 @@ impl_outer_event! {
|
||||
|
||||
pub type GenericAsset = Module<Test>;
|
||||
|
||||
pub type System = system::Module<Test>;
|
||||
pub type System = frame_system::Module<Test>;
|
||||
|
||||
pub struct ExtBuilder {
|
||||
asset_id: u32,
|
||||
@@ -118,7 +119,7 @@ impl ExtBuilder {
|
||||
|
||||
// builds genesis config
|
||||
pub fn build(self) -> sp_io::TestExternalities {
|
||||
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
|
||||
GenesisConfig::<Test> {
|
||||
assets: vec![self.asset_id],
|
||||
@@ -137,7 +138,7 @@ impl ExtBuilder {
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
system::GenesisConfig::default()
|
||||
frame_system::GenesisConfig::default()
|
||||
.build_storage::<Test>()
|
||||
.unwrap()
|
||||
.into()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
use super::*;
|
||||
use crate::mock::{new_test_ext, ExtBuilder, GenericAsset, Origin, System, Test, TestEvent};
|
||||
use support::{assert_noop, assert_ok};
|
||||
use frame_support::{assert_noop, assert_ok};
|
||||
|
||||
#[test]
|
||||
fn issuing_asset_units_to_issuer_should_work() {
|
||||
@@ -906,7 +906,7 @@ fn update_permission_should_throw_error_when_lack_of_permissions() {
|
||||
fn create_asset_works_with_given_asset_id_and_from_account() {
|
||||
ExtBuilder::default().next_asset_id(10).build().execute_with(|| {
|
||||
let origin = 1;
|
||||
let from_account: Option<<Test as system::Trait>::AccountId> = Some(1);
|
||||
let from_account: Option<<Test as frame_system::Trait>::AccountId> = Some(1);
|
||||
|
||||
let default_permission = PermissionLatest {
|
||||
update: Owner::Address(origin),
|
||||
@@ -943,7 +943,7 @@ fn create_asset_works_with_given_asset_id_and_from_account() {
|
||||
fn create_asset_with_non_reserved_asset_id_should_not_work() {
|
||||
ExtBuilder::default().next_asset_id(10).build().execute_with(|| {
|
||||
let origin = 1;
|
||||
let from_account: Option<<Test as system::Trait>::AccountId> = Some(1);
|
||||
let from_account: Option<<Test as frame_system::Trait>::AccountId> = Some(1);
|
||||
|
||||
let default_permission = PermissionLatest {
|
||||
update: Owner::Address(origin),
|
||||
@@ -977,7 +977,7 @@ fn create_asset_with_non_reserved_asset_id_should_not_work() {
|
||||
fn create_asset_with_a_taken_asset_id_should_not_work() {
|
||||
ExtBuilder::default().next_asset_id(10).build().execute_with(|| {
|
||||
let origin = 1;
|
||||
let from_account: Option<<Test as system::Trait>::AccountId> = Some(1);
|
||||
let from_account: Option<<Test as frame_system::Trait>::AccountId> = Some(1);
|
||||
|
||||
let default_permission = PermissionLatest {
|
||||
update: Owner::Address(origin),
|
||||
@@ -1022,7 +1022,7 @@ fn create_asset_with_a_taken_asset_id_should_not_work() {
|
||||
fn create_asset_should_create_a_reserved_asset_when_from_account_is_none() {
|
||||
ExtBuilder::default().next_asset_id(10).build().execute_with(|| {
|
||||
let origin = 1;
|
||||
let from_account: Option<<Test as system::Trait>::AccountId> = None;
|
||||
let from_account: Option<<Test as frame_system::Trait>::AccountId> = None;
|
||||
|
||||
let default_permission = PermissionLatest {
|
||||
update: Owner::Address(origin),
|
||||
@@ -1065,7 +1065,7 @@ fn create_asset_should_create_a_reserved_asset_when_from_account_is_none() {
|
||||
fn create_asset_should_create_a_user_asset() {
|
||||
ExtBuilder::default().next_asset_id(10).build().execute_with(|| {
|
||||
let origin = 1;
|
||||
let from_account: Option<<Test as system::Trait>::AccountId> = None;
|
||||
let from_account: Option<<Test as frame_system::Trait>::AccountId> = None;
|
||||
|
||||
let default_permission = PermissionLatest {
|
||||
update: Owner::Address(origin),
|
||||
|
||||
Reference in New Issue
Block a user