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
+24 -24
View File
@@ -31,16 +31,16 @@ use frame_support::{
use primitives::v0::{
SwapAux, PARACHAIN_INFO, Id as ParaId, ValidationCode, HeadData,
};
use system::{ensure_signed, ensure_root};
use frame_system::{ensure_signed, ensure_root};
use crate::registrar::{Registrar, swap_ordered_existence};
use crate::slot_range::{SlotRange, SLOT_RANGE_COUNT};
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
/// The module's configuration trait.
pub trait Trait: system::Trait {
pub trait Trait: frame_system::Trait {
/// 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>;
/// The currency type used for bidding.
type Currency: ReservableCurrency<Self::AccountId>;
@@ -118,14 +118,14 @@ pub enum IncomingParachain<AccountId, Hash> {
Deploy { code: ValidationCode, initial_head_data: HeadData },
}
type LeasePeriodOf<T> = <T as system::Trait>::BlockNumber;
type LeasePeriodOf<T> = <T as frame_system::Trait>::BlockNumber;
// Winning data type. This encodes the top bidders of each range together with their bid.
type WinningData<T> =
[Option<(Bidder<<T as system::Trait>::AccountId>, BalanceOf<T>)>; SLOT_RANGE_COUNT];
[Option<(Bidder<<T as frame_system::Trait>::AccountId>, BalanceOf<T>)>; SLOT_RANGE_COUNT];
// Winners data type. This encodes each of the final winners of a parachain auction, the parachain
// index assigned to them, their winning bid and the range that they won.
type WinnersData<T> =
Vec<(Option<NewBidder<<T as system::Trait>::AccountId>>, ParaId, BalanceOf<T>, SlotRange)>;
Vec<(Option<NewBidder<<T as frame_system::Trait>::AccountId>>, ParaId, BalanceOf<T>, SlotRange)>;
// This module's storage items.
decl_storage! {
@@ -204,8 +204,8 @@ impl<T: Trait> SwapAux for Module<T> {
decl_event!(
pub enum Event<T> where
AccountId = <T as system::Trait>::AccountId,
BlockNumber = <T as system::Trait>::BlockNumber,
AccountId = <T as frame_system::Trait>::AccountId,
BlockNumber = <T as frame_system::Trait>::BlockNumber,
LeasePeriod = LeasePeriodOf<T>,
ParaId = ParaId,
Balance = BalanceOf<T>,
@@ -262,7 +262,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>;
fn deposit_event() = default;
@@ -322,7 +322,7 @@ decl_module! {
let n = <AuctionCounter>::mutate(|n| { *n += 1; *n });
// Set the information.
let ending = <system::Module<T>>::block_number() + duration;
let ending = <frame_system::Module<T>>::block_number() + duration;
<AuctionInfo<T>>::put((lease_period_index, ending));
Self::deposit_event(RawEvent::AuctionStarted(n, lease_period_index, ending))
@@ -459,7 +459,7 @@ decl_module! {
.ok_or(Error::<T>::ParaNotOnboarding)?;
if let IncomingParachain::Fixed{code_hash, code_size, initial_head_data} = details {
ensure!(code.0.len() as u32 == code_size, Error::<T>::InvalidCode);
ensure!(<T as system::Trait>::Hashing::hash(&code.0) == code_hash, Error::<T>::InvalidCode);
ensure!(<T as frame_system::Trait>::Hashing::hash(&code.0) == code_hash, Error::<T>::InvalidCode);
if starts > Self::lease_period_index() {
// Hasn't yet begun. Replace the on-boarding entry with the new information.
@@ -507,7 +507,7 @@ impl<T: Trait> Module<T> {
/// Returns the current lease period.
fn lease_period_index() -> LeasePeriodOf<T> {
(<system::Module<T>>::block_number() / T::LeasePeriod::get()).into()
(<frame_system::Module<T>>::block_number() / T::LeasePeriod::get()).into()
}
/// Some when the auction's end is known (with the end block number). None if it is unknown.
@@ -751,7 +751,7 @@ impl<T: Trait> Module<T> {
// Range as an array index.
let range_index = range as u8 as usize;
// The offset into the auction ending set.
let offset = Self::is_ending(<system::Module<T>>::block_number()).unwrap_or_default();
let offset = Self::is_ending(<frame_system::Module<T>>::block_number()).unwrap_or_default();
// The current winning ranges.
let mut current_winning = <Winning<T>>::get(offset)
.or_else(|| offset.checked_sub(&One::one()).and_then(<Winning<T>>::get))
@@ -889,11 +889,11 @@ mod tests {
impl_outer_origin, parameter_types, assert_ok, assert_noop,
traits::{OnInitialize, OnFinalize}
};
use balances;
use pallet_balances;
use primitives::v0::{BlockNumber, Header, Id as ParaId, Info as ParaInfo, Scheduling};
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
@@ -907,7 +907,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 = ();
@@ -929,7 +929,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 = ();
@@ -939,7 +939,7 @@ mod tests {
pub const ExistentialDeposit: u64 = 1;
}
impl balances::Trait for Test {
impl pallet_balances::Trait for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -1025,16 +1025,16 @@ mod tests {
type Randomness = RandomnessCollectiveFlip;
}
type System = system::Module<Test>;
type Balances = balances::Module<Test>;
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type Slots = Module<Test>;
type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>;
type RandomnessCollectiveFlip = pallet_randomness_collective_flip::Module<Test>;
// This function basically just builds a genesis storage key/value store according to
// our desired mock up.
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, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
}.assimilate_storage(&mut t).unwrap();
t.into()