Unalias Substrate Imports (#1530)

* cargo.toml updates

* session and system

* more

* more

* more

* more

* more

* fix

* compiles

* fix tests

* fix more tests

* fix mock

* fix deleted space

* Update validation/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update Cargo.lock

* update rococo

* remove unused warning

* update add benchmarks

* rename weight file

* forgot a file

* Update chain_spec.rs

* Revert "remove unused warning"

This reverts commit 4227cd0d1525286fb466dccb817564c9b37f8645.

* fix merge

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-08-04 15:23:33 +02:00
committed by GitHub
parent c01aa8bae8
commit 73f09e5154
54 changed files with 1680 additions and 1690 deletions
+41 -41
View File
@@ -72,7 +72,7 @@ use frame_support::{
Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
},
};
use system::ensure_signed;
use frame_system::ensure_signed;
use sp_runtime::{ModuleId,
traits::{AccountIdConversion, Hash, Saturating, Zero, CheckedAdd}
};
@@ -82,13 +82,13 @@ use sp_std::vec::Vec;
use primitives::v0::{Id as ParaId, HeadData};
pub type BalanceOf<T> =
<<T as slots::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
<<T as slots::Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
#[allow(dead_code)]
pub type NegativeImbalanceOf<T> =
<<T as slots::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;
<<T as slots::Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
pub trait Trait: slots::Trait {
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
/// ModuleID for the crowdfund module. An appropriate value could be ```ModuleId(*b"py/cfund")```
type ModuleId: Get<ModuleId>;
@@ -184,7 +184,7 @@ decl_storage! {
decl_event! {
pub enum Event<T> where
<T as system::Trait>::AccountId,
<T as frame_system::Trait>::AccountId,
Balance = BalanceOf<T>,
{
Created(FundIndex),
@@ -244,7 +244,7 @@ decl_error! {
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system = system {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
type Error = Error<T>;
const ModuleId: ModuleId = T::ModuleId::get();
@@ -263,7 +263,7 @@ decl_module! {
ensure!(first_slot < last_slot, Error::<T>::LastSlotBeforeFirstSlot);
ensure!(last_slot <= first_slot + 3.into(), Error::<T>::LastSlotTooFarInFuture);
ensure!(end > <system::Module<T>>::block_number(), Error::<T>::CannotEndInPast);
ensure!(end > <frame_system::Module<T>>::block_number(), Error::<T>::CannotEndInPast);
let deposit = T::SubmissionDeposit::get();
let transfer = WithdrawReason::Transfer.into();
@@ -306,7 +306,7 @@ decl_module! {
ensure!(fund.raised <= fund.cap, Error::<T>::CapExceeded);
// Make sure crowdfund has not ended
let now = <system::Module<T>>::block_number();
let now = <frame_system::Module<T>>::block_number();
ensure!(fund.end > now, Error::<T>::ContributionPeriodOver);
T::Currency::transfer(&who, &Self::fund_account_id(index), value, AllowDeath)?;
@@ -394,7 +394,7 @@ decl_module! {
ensure!(fund.parachain.is_none(), Error::<T>::AlreadyOnboard);
fund.parachain = Some(para_id);
let fund_origin = system::RawOrigin::Signed(Self::fund_account_id(index)).into();
let fund_origin = frame_system::RawOrigin::Signed(Self::fund_account_id(index)).into();
<slots::Module<T>>::fix_deploy_data(
fund_origin,
index,
@@ -423,7 +423,7 @@ decl_module! {
ensure!(T::Currency::free_balance(&account) >= fund.raised, Error::<T>::FundsNotReturned);
// This fund just ended. Withdrawal period begins.
let now = <system::Module<T>>::block_number();
let now = <frame_system::Module<T>>::block_number();
fund.end = now;
<Funds<T>>::insert(index, &fund);
@@ -438,7 +438,7 @@ decl_module! {
let mut fund = Self::funds(index).ok_or(Error::<T>::InvalidFundIndex)?;
ensure!(fund.parachain.is_none(), Error::<T>::FundNotRetired);
let now = <system::Module<T>>::block_number();
let now = <frame_system::Module<T>>::block_number();
// `fund.end` can represent the end of a failed crowdsale or the beginning of retirement
ensure!(now >= fund.end, Error::<T>::FundNotEnded);
@@ -469,7 +469,7 @@ decl_module! {
let fund = Self::funds(index).ok_or(Error::<T>::InvalidFundIndex)?;
ensure!(fund.parachain.is_none(), Error::<T>::HasActiveParachain);
let now = <system::Module<T>>::block_number();
let now = <frame_system::Module<T>>::block_number();
ensure!(
now >= fund.end.saturating_add(T::RetirementPeriod::get()),
Error::<T>::InRetirementPeriod
@@ -578,7 +578,7 @@ mod tests {
use crate::registrar::Registrar;
impl_outer_origin! {
pub enum Origin for Test where system = system {}
pub enum Origin for Test {}
}
// For testing the module, we construct most of a mock runtime. This means
@@ -592,7 +592,7 @@ mod tests {
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl system::Trait for Test {
impl frame_system::Trait for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = ();
@@ -614,7 +614,7 @@ mod tests {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = balances::AccountData<u64>;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = Balances;
type SystemWeightInfo = ();
@@ -622,7 +622,7 @@ mod tests {
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl balances::Trait for Test {
impl pallet_balances::Trait for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -653,10 +653,10 @@ mod tests {
fn min_len() -> usize { 0 }
fn max_len() -> usize { 0 }
}
impl treasury::Trait for Test {
type Currency = balances::Module<Test>;
type ApproveOrigin = system::EnsureRoot<u64>;
type RejectOrigin = system::EnsureRoot<u64>;
impl pallet_treasury::Trait for Test {
type Currency = pallet_balances::Module<Test>;
type ApproveOrigin = frame_system::EnsureRoot<u64>;
type RejectOrigin = frame_system::EnsureRoot<u64>;
type Event = ();
type ProposalRejection = ();
type ProposalBond = ProposalBond;
@@ -756,20 +756,20 @@ mod tests {
type ModuleId = CrowdfundModuleId;
}
type System = system::Module<Test>;
type Balances = balances::Module<Test>;
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type Slots = slots::Module<Test>;
type Treasury = treasury::Module<Test>;
type Treasury = pallet_treasury::Module<Test>;
type Crowdfund = Module<Test>;
type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>;
use balances::Error as BalancesError;
type RandomnessCollectiveFlip = pallet_randomness_collective_flip::Module<Test>;
use pallet_balances::Error as BalancesError;
use slots::Error as SlotsError;
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
balances::GenesisConfig::<Test>{
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
pallet_balances::GenesisConfig::<Test>{
balances: vec![(1, 1000), (2, 2000), (3, 3000), (4, 4000)],
}.assimilate_storage(&mut t).unwrap();
t.into()
@@ -920,7 +920,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into()
));
@@ -931,7 +931,7 @@ mod tests {
assert_eq!(
fund.deploy_data,
Some(DeployData {
code_hash: <Test as system::Trait>::Hash::default(),
code_hash: <Test as frame_system::Trait>::Hash::default(),
code_size: 0,
initial_head_data: vec![0].into(),
}),
@@ -950,7 +950,7 @@ mod tests {
assert_noop!(Crowdfund::fix_deploy_data(
Origin::signed(2),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into()),
Error::<Test>::InvalidOrigin
@@ -960,7 +960,7 @@ mod tests {
assert_noop!(Crowdfund::fix_deploy_data(
Origin::signed(1),
1,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into()),
Error::<Test>::InvalidFundIndex
@@ -970,7 +970,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
@@ -978,7 +978,7 @@ mod tests {
assert_noop!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![1].into()),
Error::<Test>::ExistingDeployData
@@ -998,7 +998,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
@@ -1044,7 +1044,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
@@ -1072,7 +1072,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
@@ -1115,7 +1115,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
@@ -1257,7 +1257,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
@@ -1286,7 +1286,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
@@ -1325,14 +1325,14 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(2),
1,
<Test as system::Trait>::Hash::default(),
<Test as frame_system::Trait>::Hash::default(),
0,
vec![0].into(),
));