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
+5 -5
View File
@@ -33,7 +33,7 @@ use sp_runtime::RuntimeDebug;
use sp_staking::SessionIndex;
use inherents::{ProvideInherent, InherentData, MakeFatalError, InherentIdentifier};
use system::ensure_none;
use frame_system::ensure_none;
/// Parachain blocks included in a recent relay-chain block.
#[derive(Encode, Decode)]
@@ -76,9 +76,9 @@ impl RewardAttestation for () {
}
}
impl<T: staking::Trait> RewardAttestation for staking::Module<T> {
impl<T: pallet_staking::Trait> RewardAttestation for pallet_staking::Module<T> {
fn reward_immediate(validator_indices: impl IntoIterator<Item=u32>) {
use staking::SessionInterface;
use pallet_staking::SessionInterface;
// The number of points to reward for a validity statement.
// https://research.web3.foundation/en/latest/polkadot/Token%20Economics/#payment-details
@@ -94,7 +94,7 @@ impl<T: staking::Trait> RewardAttestation for staking::Module<T> {
}
}
pub trait Trait: session::Trait {
pub trait Trait: pallet_session::Trait {
/// How many blocks ago we're willing to accept attestations for.
type AttestationPeriod: Get<Self::BlockNumber>;
@@ -130,7 +130,7 @@ decl_error! {
decl_module! {
/// Parachain-attestations module.
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin, system = system {
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
type Error = Error<T>;
/// Provide candidate receipts for parachains, in ascending order by id.
+26 -27
View File
@@ -22,7 +22,7 @@ use frame_support::{
decl_event, decl_storage, decl_module, decl_error, ensure, dispatch::IsSubType,
traits::{Currency, Get, VestingSchedule, EnsureOrigin}, weights::{Pays, DispatchClass}
};
use system::{ensure_signed, ensure_root, ensure_none};
use frame_system::{ensure_signed, ensure_root, ensure_none};
use codec::{Encode, Decode};
#[cfg(feature = "std")]
use serde::{self, Serialize, Deserialize, Serializer, Deserializer};
@@ -37,13 +37,13 @@ use sp_runtime::{
};
use primitives::v0::ValidityError;
type CurrencyOf<T> = <<T as Trait>::VestingSchedule as VestingSchedule<<T as system::Trait>::AccountId>>::Currency;
type BalanceOf<T> = <CurrencyOf<T> as Currency<<T as system::Trait>::AccountId>>::Balance;
type CurrencyOf<T> = <<T as Trait>::VestingSchedule as VestingSchedule<<T as frame_system::Trait>::AccountId>>::Currency;
type BalanceOf<T> = <CurrencyOf<T> as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
/// 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>;
type VestingSchedule: VestingSchedule<Self::AccountId, Moment=Self::BlockNumber>;
type Prefix: Get<&'static [u8]>;
type MoveClaimOrigin: EnsureOrigin<Self::Origin>;
@@ -130,7 +130,7 @@ impl sp_std::fmt::Debug for EcdsaSignature {
decl_event!(
pub enum Event<T> where
Balance = BalanceOf<T>,
AccountId = <T as system::Trait>::AccountId
AccountId = <T as frame_system::Trait>::AccountId
{
/// Someone claimed some DOTs.
Claimed(AccountId, EthereumAddress, Balance),
@@ -194,7 +194,7 @@ decl_storage! {
}
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>;
/// The Prefix that is used in signed Ethereum messages for this network
@@ -539,10 +539,10 @@ impl<T: Trait> sp_runtime::traits::ValidateUnsigned for Module<T> {
/// otherwise free to place on chain.
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
pub struct PrevalidateAttests<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>) where
<T as system::Trait>::Call: IsSubType<Call<T>>;
<T as frame_system::Trait>::Call: IsSubType<Call<T>>;
impl<T: Trait + Send + Sync> Debug for PrevalidateAttests<T> where
<T as system::Trait>::Call: IsSubType<Call<T>>
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
{
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
@@ -556,7 +556,7 @@ impl<T: Trait + Send + Sync> Debug for PrevalidateAttests<T> where
}
impl<T: Trait + Send + Sync> PrevalidateAttests<T> where
<T as system::Trait>::Call: IsSubType<Call<T>>
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
{
/// Create new `SignedExtension` to check runtime version.
pub fn new() -> Self {
@@ -565,10 +565,10 @@ impl<T: Trait + Send + Sync> PrevalidateAttests<T> where
}
impl<T: Trait + Send + Sync> SignedExtension for PrevalidateAttests<T> where
<T as system::Trait>::Call: IsSubType<Call<T>>
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
{
type AccountId = T::AccountId;
type Call = <T as system::Trait>::Call;
type Call = <T as frame_system::Trait>::Call;
type AdditionalSigned = ();
type Pre = ();
const IDENTIFIER: &'static str = "PrevalidateAttests";
@@ -642,11 +642,11 @@ mod tests {
ord_parameter_types, weights::{Pays, GetDispatchInfo}, traits::ExistenceRequirement,
dispatch::DispatchError::BadOrigin,
};
use balances;
use pallet_balances;
use super::Call as ClaimsCall;
impl_outer_origin! {
pub enum Origin for Test where system = system {}
pub enum Origin for Test {}
}
impl_outer_dispatch! {
@@ -665,7 +665,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 = Call;
@@ -687,7 +687,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 = ();
@@ -699,7 +699,7 @@ mod tests {
pub const MinVestedTransfer: u64 = 0;
}
impl balances::Trait for Test {
impl pallet_balances::Trait for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -708,7 +708,7 @@ mod tests {
type WeightInfo = ();
}
impl vesting::Trait for Test {
impl pallet_vesting::Trait for Test {
type Event = ();
type Currency = Balances;
type BlockNumberToBalance = Identity;
@@ -727,11 +727,11 @@ mod tests {
type Event = ();
type VestingSchedule = Vesting;
type Prefix = Prefix;
type MoveClaimOrigin = system::EnsureSignedBy<Six, u64>;
type MoveClaimOrigin = frame_system::EnsureSignedBy<Six, u64>;
}
type System = system::Module<Test>;
type Balances = balances::Module<Test>;
type Vesting = vesting::Module<Test>;
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type Vesting = pallet_vesting::Module<Test>;
type Claims = Module<Test>;
fn alice() -> secp256k1::SecretKey {
@@ -753,9 +753,9 @@ mod tests {
// 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>::default().assimilate_storage(&mut t).unwrap();
pallet_balances::GenesisConfig::<Test>::default().assimilate_storage(&mut t).unwrap();
GenesisConfig::<Test>{
claims: vec![
(eth(&alice()), 100, None, None),
@@ -982,7 +982,7 @@ mod tests {
// Make sure we can not transfer the vested balance.
assert_err!(
<Balances as Currency<_>>::transfer(&69, &80, 180, ExistenceRequirement::AllowDeath),
balances::Error::<Test, _>::LiquidityRestrictions,
pallet_balances::Error::<Test, _>::LiquidityRestrictions,
);
});
}
@@ -1167,8 +1167,7 @@ mod tests {
mod benchmarking {
use super::*;
use secp_utils::*;
use system::RawOrigin;
use system as frame_system; // NOTE: required for the benchmarks! macro
use frame_system::RawOrigin;
use frame_benchmarking::{benchmarks, account};
use sp_runtime::DispatchResult;
use sp_runtime::traits::ValidateUnsigned;
+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(),
));
+14 -14
View File
@@ -25,20 +25,20 @@ pub struct ToAuthor<R>(sp_std::marker::PhantomData<R>);
impl<R> OnUnbalanced<NegativeImbalance<R>> for ToAuthor<R>
where
R: balances::Trait + authorship::Trait,
<R as system::Trait>::AccountId: From<primitives::v0::AccountId>,
<R as system::Trait>::AccountId: Into<primitives::v0::AccountId>,
<R as system::Trait>::Event: From<balances::RawEvent<
<R as system::Trait>::AccountId,
<R as balances::Trait>::Balance,
balances::DefaultInstance>
R: pallet_balances::Trait + pallet_authorship::Trait,
<R as frame_system::Trait>::AccountId: From<primitives::v0::AccountId>,
<R as frame_system::Trait>::AccountId: Into<primitives::v0::AccountId>,
<R as frame_system::Trait>::Event: From<pallet_balances::RawEvent<
<R as frame_system::Trait>::AccountId,
<R as pallet_balances::Trait>::Balance,
pallet_balances::DefaultInstance>
>,
{
fn on_nonzero_unbalanced(amount: NegativeImbalance<R>) {
let numeric_amount = amount.peek();
let author = <authorship::Module<R>>::author();
<balances::Module<R>>::resolve_creating(&<authorship::Module<R>>::author(), amount);
<system::Module<R>>::deposit_event(balances::RawEvent::Deposit(author, numeric_amount));
let author = <pallet_authorship::Module<R>>::author();
<pallet_balances::Module<R>>::resolve_creating(&<pallet_authorship::Module<R>>::author(), amount);
<frame_system::Module<R>>::deposit_event(pallet_balances::RawEvent::Deposit(author, numeric_amount));
}
}
@@ -47,18 +47,18 @@ pub struct CurrencyToVoteHandler<R>(sp_std::marker::PhantomData<R>);
impl<R> CurrencyToVoteHandler<R>
where
R: balances::Trait,
R: pallet_balances::Trait,
R::Balance: Into<u128>,
{
fn factor() -> u128 {
let issuance: u128 = <balances::Module<R>>::total_issuance().into();
let issuance: u128 = <pallet_balances::Module<R>>::total_issuance().into();
(issuance / u64::max_value() as u128).max(1)
}
}
impl<R> Convert<u128, u64> for CurrencyToVoteHandler<R>
where
R: balances::Trait,
R: pallet_balances::Trait,
R::Balance: Into<u128>,
{
fn convert(x: u128) -> u64 { (x / Self::factor()) as u64 }
@@ -66,7 +66,7 @@ where
impl<R> Convert<u128, u128> for CurrencyToVoteHandler<R>
where
R: balances::Trait,
R: pallet_balances::Trait,
R::Balance: Into<u128>,
{
fn convert(x: u128) -> u128 { x * Self::factor() }
+9 -9
View File
@@ -35,23 +35,23 @@ use frame_support::{
parameter_types, traits::{Currency},
weights::{Weight, constants::WEIGHT_PER_SECOND},
};
use transaction_payment::{TargetedFeeAdjustment, Multiplier};
use pallet_transaction_payment::{TargetedFeeAdjustment, Multiplier};
use static_assertions::const_assert;
pub use frame_support::weights::constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
#[cfg(feature = "std")]
pub use staking::StakerStatus;
pub use pallet_staking::StakerStatus;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use timestamp::Call as TimestampCall;
pub use balances::Call as BalancesCall;
pub use pallet_timestamp::Call as TimestampCall;
pub use pallet_balances::Call as BalancesCall;
pub use attestations::{Call as AttestationsCall, MORE_ATTESTATIONS_IDENTIFIER};
pub use parachains::Call as ParachainsCall;
/// Implementations of some helper traits passed into runtime modules as associated types.
pub use impls::{CurrencyToVoteHandler, ToAuthor};
pub type NegativeImbalance<T> = <balances::Module<T> as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;
pub type NegativeImbalance<T> = <pallet_balances::Module<T> as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
/// We assume that an on-initialize consumes 10% of the weight on average, hence a single extrinsic
/// will not be allowed to consume more than `AvailableBlockRatio - 10%`.
@@ -107,7 +107,7 @@ mod multiplier_tests {
pub struct Runtime;
impl_outer_origin!{
pub enum Origin for Runtime where system = system {}
pub enum Origin for Runtime {}
}
parameter_types! {
@@ -118,7 +118,7 @@ mod multiplier_tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
impl system::Trait for Runtime {
impl frame_system::Trait for Runtime {
type BaseCallFilter = ();
type Origin = Origin;
type Index = u64;
@@ -146,11 +146,11 @@ mod multiplier_tests {
type SystemWeightInfo = ();
}
type System = system::Module<Runtime>;
type System = frame_system::Module<Runtime>;
fn run_with_system_weight<F>(w: Weight, assertions: F) where F: Fn() -> () {
let mut t: sp_io::TestExternalities =
system::GenesisConfig::default().build_storage::<Runtime>().unwrap().into();
frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap().into();
t.execute_with(|| {
System::set_block_limits(w, 0);
assertions()
+87 -87
View File
@@ -54,7 +54,7 @@ use sp_runtime::transaction_validity::InvalidTransaction;
use inherents::{ProvideInherent, InherentData, MakeFatalError, InherentIdentifier};
use system::{
use frame_system::{
ensure_none, ensure_signed,
offchain::{CreateSignedTransaction, SendSignedTransaction, Signer},
};
@@ -232,9 +232,9 @@ impl<Proof: Parameter + GetSessionNumber> DoubleVoteReport<Proof> {
}
}
impl<T: session::Trait> Get<Vec<T::ValidatorId>> for ValidatorIdentities<T> {
impl<T: pallet_session::Trait> Get<Vec<T::ValidatorId>> for ValidatorIdentities<T> {
fn get() -> Vec<T::ValidatorId> {
<session::Module<T>>::validators()
<pallet_session::Module<T>>::validators()
}
}
@@ -249,13 +249,13 @@ impl GetSessionNumber for sp_session::MembershipProof {
}
}
pub trait Trait: CreateSignedTransaction<Call<Self>> + attestations::Trait + session::historical::Trait {
pub trait Trait: CreateSignedTransaction<Call<Self>> + attestations::Trait + pallet_session::historical::Trait {
// The transaction signing authority
type AuthorityId: system::offchain::AppCrypto<Self::Public, Self::Signature>;
type AuthorityId: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>;
/// The outer origin type.
type Origin: From<Origin>
+ From<<Self as system::Trait>::Origin>
+ From<<Self as frame_system::Trait>::Origin>
+ Into<result::Result<Origin, <Self as Trait>::Origin>>;
/// The outer call dispatch type.
@@ -572,7 +572,7 @@ decl_error! {
decl_module! {
/// Parachains module.
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin, system = system {
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
type Error = Error<T>;
fn on_initialize(now: T::BlockNumber) -> Weight {
@@ -683,7 +683,7 @@ decl_module! {
) -> DispatchResult {
let reporter = ensure_signed(origin)?;
let validators = <session::Module<T>>::validators();
let validators = <pallet_session::Module<T>>::validators();
let validator_set_count = validators.len() as u32;
let session_index = report.proof.session();
@@ -845,7 +845,7 @@ impl<T: Trait> Module<T> {
}
if let Some(code) = code {
Self::note_past_code(id, <system::Module<T>>::block_number(), code);
Self::note_past_code(id, <frame_system::Module<T>>::block_number(), code);
}
}
@@ -916,8 +916,8 @@ impl<T: Trait> Module<T> {
/// Get a `SigningContext` with a current `SessionIndex` and parent hash.
pub fn signing_context() -> SigningContext {
let session_index = <session::Module<T>>::current_index();
let parent_hash = <system::Module<T>>::parent_hash();
let session_index = <pallet_session::Module<T>>::current_index();
let parent_hash = <frame_system::Module<T>>::parent_hash();
SigningContext {
session_index,
@@ -948,11 +948,11 @@ impl<T: Trait> Module<T> {
if let Ok(message_call) = <T as Trait>::Call::decode(&mut &data[..]) {
let origin: <T as Trait>::Origin = match origin {
ParachainDispatchOrigin::Signed =>
<T as Trait>::Origin::from(<T as system::Trait>::Origin::from(system::RawOrigin::Signed(id.into_account()))),
<T as Trait>::Origin::from(<T as frame_system::Trait>::Origin::from(frame_system::RawOrigin::Signed(id.into_account()))),
ParachainDispatchOrigin::Parachain =>
Origin::Parachain(id).into(),
ParachainDispatchOrigin::Root =>
<T as Trait>::Origin::from(<T as system::Trait>::Origin::from(system::RawOrigin::Root)),
<T as Trait>::Origin::from(<T as frame_system::Trait>::Origin::from(frame_system::RawOrigin::Root)),
};
let _ok = message_call.dispatch(origin).is_ok();
// Not much to do with the result as it is. It's up to the parachain to ensure that the
@@ -1169,7 +1169,7 @@ impl<T: Trait> Module<T> {
/// Get the global validation schedule for all parachains.
pub fn global_validation_data() -> GlobalValidationData {
let now = <system::Module<T>>::block_number();
let now = <frame_system::Module<T>>::block_number();
GlobalValidationData {
max_code_size: T::MaxCodeSize::get(),
max_head_data_size: T::MaxHeadDataSize::get(),
@@ -1185,7 +1185,7 @@ impl<T: Trait> Module<T> {
/// Get the local validation schedule for a particular parachain.
pub fn local_validation_data(id: &ParaId, perceived_height: T::BlockNumber) -> Option<LocalValidationData> {
if perceived_height + One::one() != <system::Module<T>>::block_number() {
if perceived_height + One::one() != <frame_system::Module<T>>::block_number() {
// sanity-check - no non-direct-parent blocks allowed at the moment.
return None
}
@@ -1232,7 +1232,7 @@ impl<T: Trait> Module<T> {
/// Get the local validation data for a particular parent w.r.t. the current
/// block height.
pub fn current_local_validation_data(id: &ParaId) -> Option<LocalValidationData> {
let now: T::BlockNumber = <system::Module<T>>::block_number();
let now: T::BlockNumber = <frame_system::Module<T>>::block_number();
if now >= One::one() {
Self::local_validation_data(id, now - One::one())
} else {
@@ -1353,8 +1353,8 @@ impl<T: Trait> Module<T> {
let sorted_validators = make_sorted_duties(&duty_roster.validator_duty);
let relay_height_now = <system::Module<T>>::block_number();
let parent_hash = <system::Module<T>>::parent_hash();
let relay_height_now = <frame_system::Module<T>>::block_number();
let parent_hash = <frame_system::Module<T>>::parent_hash();
let signing_context = Self::signing_context();
let code_upgrade_delay = T::ValidationUpgradeDelay::get();
@@ -1380,7 +1380,7 @@ impl<T: Trait> Module<T> {
);
// Since we only allow execution in context of parent hash.
let perceived_relay_block_height = <system::Module<T>>::block_number() - One::one();
let perceived_relay_block_height = <frame_system::Module<T>>::block_number() - One::one();
ensure!(
candidate.validity_votes.len() >= majority_of(validator_group.len()),
@@ -1452,7 +1452,7 @@ impl<T: Trait> Module<T> {
Ok(IncludedBlocks {
actual_number: relay_height_now,
session: <session::Module<T>>::current_index(),
session: <pallet_session::Module<T>>::current_index(),
random_seed,
active_parachains: active_parachains.iter().map(|x| x.0).collect(),
para_blocks: para_block_hashes,
@@ -1506,7 +1506,7 @@ impl<T: Trait> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
type Public = ValidatorId;
}
impl<T: Trait> session::OneSessionHandler<T::AccountId> for Module<T> {
impl<T: Trait> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
type Key = ValidatorId;
fn on_genesis_session<'a, I: 'a>(validators: I)
@@ -1602,11 +1602,11 @@ pub enum DoubleVoteValidityError {
}
impl<T: Trait + Send + Sync> SignedExtension for ValidateDoubleVoteReports<T> where
<T as system::Trait>::Call: IsSubType<Call<T>>
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
{
const IDENTIFIER: &'static str = "ValidateDoubleVoteReports";
type AccountId = T::AccountId;
type Call = <T as system::Trait>::Call;
type Call = <T as frame_system::Trait>::Call;
type AdditionalSigned = ();
type Pre = ();
@@ -1627,7 +1627,7 @@ impl<T: Trait + Send + Sync> SignedExtension for ValidateDoubleVoteReports<T> wh
if let Some(local_call) = call.is_sub_type() {
if let Call::report_double_vote(report) = local_call {
let validators = <session::Module<T>>::validators();
let validators = <pallet_session::Module<T>>::validators();
let expected_session = report.signing_context.session_index;
let session = report.proof.session();
@@ -1692,8 +1692,8 @@ mod tests {
use crate::parachains;
use crate::registrar;
use crate::slots;
use session::{SessionHandler, SessionManager};
use staking::EraIndex;
use pallet_session::{SessionHandler, SessionManager};
use pallet_staking::EraIndex;
// result of <NodeCodec<Blake2Hasher> as trie_db::NodeCodec<Blake2Hasher>>::hashed_null_node()
const EMPTY_TRIE_ROOT: [u8; 32] = [
@@ -1702,7 +1702,7 @@ mod tests {
];
impl_outer_origin! {
pub enum Origin for Test where system = system {
pub enum Origin for Test {
parachains
}
}
@@ -1729,7 +1729,7 @@ mod tests {
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 = Call;
@@ -1751,13 +1751,13 @@ mod tests {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = balances::AccountData<u128>;
type AccountData = pallet_balances::AccountData<u128>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
impl<C> system::offchain::SendTransactionTypes<C> for Test where
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test where
Call: From<C>,
{
type OverarchingCall = Call;
@@ -1784,28 +1784,28 @@ mod tests {
fn on_disabled(_: usize) {}
}
impl session::Trait for Test {
impl pallet_session::Trait for Test {
type Event = ();
type ValidatorId = u64;
type ValidatorIdOf = staking::StashOf<Self>;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = session::PeriodicSessions<Period, Offset>;
type SessionManager = session::historical::NoteHistoricalRoot<Self, Staking>;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = TestSessionHandler;
type Keys = TestSessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = ();
}
impl session::historical::Trait for Test {
type FullIdentification = staking::Exposure<u64, Balance>;
type FullIdentificationOf = staking::ExposureOf<Self>;
impl pallet_session::historical::Trait for Test {
type FullIdentification = pallet_staking::Exposure<u64, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
}
parameter_types! {
pub const MinimumPeriod: u64 = 3;
}
impl timestamp::Trait for Test {
impl pallet_timestamp::Trait for Test {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
@@ -1825,23 +1825,23 @@ mod tests {
pub const ExpectedBlockTime: u64 = time::MILLISECS_PER_BLOCK;
}
impl babe::Trait for Test {
impl pallet_babe::Trait for Test {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
// session module is the trigger
type EpochChangeTrigger = babe::ExternalTrigger;
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type KeyOwnerProofSystem = ();
type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
babe::AuthorityId,
pallet_babe::AuthorityId,
)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
babe::AuthorityId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;
type HandleEquivocation = ();
@@ -1851,7 +1851,7 @@ mod tests {
pub const ExistentialDeposit: Balance = 1;
}
impl balances::Trait for Test {
impl pallet_balances::Trait for Test {
type Balance = u128;
type DustRemoval = ();
type Event = ();
@@ -1873,8 +1873,8 @@ mod tests {
parameter_types! {
pub const SessionsPerEra: sp_staking::SessionIndex = 3;
pub const BondingDuration: staking::EraIndex = 3;
pub const SlashDeferDuration: staking::EraIndex = 0;
pub const BondingDuration: pallet_staking::EraIndex = 3;
pub const SlashDeferDuration: pallet_staking::EraIndex = 0;
pub const AttestationPeriod: BlockNumber = 100;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64;
@@ -1892,7 +1892,7 @@ mod tests {
fn convert(x: u128) -> u64 { x.saturated_into() }
}
impl staking::Trait for Test {
impl pallet_staking::Trait for Test {
type RewardRemainder = ();
type CurrencyToVote = CurrencyToVoteHandler;
type Event = ();
@@ -1902,9 +1902,9 @@ mod tests {
type SessionsPerEra = SessionsPerEra;
type BondingDuration = BondingDuration;
type SlashDeferDuration = SlashDeferDuration;
type SlashCancelOrigin = system::EnsureRoot<Self::AccountId>;
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
type SessionInterface = Self;
type UnixTime = timestamp::Module<Test>;
type UnixTime = pallet_timestamp::Module<Test>;
type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
@@ -1956,9 +1956,9 @@ mod tests {
pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get();
}
impl offences::Trait for Test {
impl pallet_offences::Trait for Test {
type Event = ();
type IdentificationTuple = session::historical::IdentificationTuple<Self>;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
@@ -1995,7 +1995,7 @@ mod tests {
pub type ReporterId = app::Public;
pub struct ReporterAuthorityId;
impl system::offchain::AppCrypto<ReporterId, sr25519::Signature> for ReporterAuthorityId {
impl frame_system::offchain::AppCrypto<ReporterId, sr25519::Signature> for ReporterAuthorityId {
type RuntimeAppPublic = ReporterId;
type GenericSignature = sr25519::Signature;
type GenericPublic = sr25519::Public;
@@ -2027,40 +2027,40 @@ mod tests {
type Extrinsic = TestXt<Call, ()>;
impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Test where
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Test where
Call: From<LocalCall>,
{
fn create_transaction<C: system::offchain::AppCrypto<Self::Public, Self::Signature>>(
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call,
_public: test_keys::ReporterId,
_account: <Test as system::Trait>::AccountId,
nonce: <Test as system::Trait>::Index,
_account: <Test as frame_system::Trait>::AccountId,
nonce: <Test as frame_system::Trait>::Index,
) -> Option<(Call, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
Some((call, (nonce, ())))
}
}
impl system::offchain::SigningTypes for Test {
impl frame_system::offchain::SigningTypes for Test {
type Public = test_keys::ReporterId;
type Signature = sr25519::Signature;
}
type Parachains = Module<Test>;
type Balances = balances::Module<Test>;
type System = system::Module<Test>;
type Offences = offences::Module<Test>;
type Staking = staking::Module<Test>;
type Session = session::Module<Test>;
type Timestamp = timestamp::Module<Test>;
type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type System = frame_system::Module<Test>;
type Offences = pallet_offences::Module<Test>;
type Staking = pallet_staking::Module<Test>;
type Session = pallet_session::Module<Test>;
type Timestamp = pallet_timestamp::Module<Test>;
type RandomnessCollectiveFlip = pallet_randomness_collective_flip::Module<Test>;
type Registrar = registrar::Module<Test>;
type Historical = session::historical::Module<Test>;
type Historical = pallet_session::historical::Module<Test>;
fn new_test_ext(parachains: Vec<(ParaId, ValidationCode, HeadData)>) -> TestExternalities {
use staking::StakerStatus;
use babe::AuthorityId as BabeAuthorityId;
use pallet_staking::StakerStatus;
use pallet_babe::AuthorityId as BabeAuthorityId;
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let authority_keys = [
Sr25519Keyring::Alice,
@@ -2105,22 +2105,22 @@ mod tests {
_phdata: Default::default(),
}.assimilate_storage(&mut t).unwrap();
session::GenesisConfig::<Test> {
pallet_session::GenesisConfig::<Test> {
keys: session_keys,
}.assimilate_storage(&mut t).unwrap();
babe::GenesisConfig {
pallet_babe::GenesisConfig {
authorities: babe_authorities,
}.assimilate_storage::<Test>(&mut t).unwrap();
balances::GenesisConfig::<Test> {
pallet_balances::GenesisConfig::<Test> {
balances,
}.assimilate_storage(&mut t).unwrap();
staking::GenesisConfig::<Test> {
pallet_staking::GenesisConfig::<Test> {
stakers,
validator_count: 8,
force_era: staking::Forcing::ForceNew,
force_era: pallet_staking::Forcing::ForceNew,
minimum_validator_count: 0,
invulnerables: vec![],
.. Default::default()
@@ -3161,7 +3161,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(1, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3192,7 +3192,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(2, 0),
staking::Exposure {
pallet_staking::Exposure {
total: 0,
own: 0,
others: vec![],
@@ -3206,7 +3206,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(2, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3256,7 +3256,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(1, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3285,7 +3285,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(Staking::current_era().unwrap(), 0),
staking::Exposure {
pallet_staking::Exposure {
total: 0,
own: 0,
others: vec![],
@@ -3299,7 +3299,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(2, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3350,7 +3350,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(1, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3379,7 +3379,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(2, 0),
staking::Exposure {
pallet_staking::Exposure {
total: 0,
own: 0,
others: vec![],
@@ -3393,7 +3393,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(2, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3447,7 +3447,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(1, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3479,7 +3479,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(2, 0),
staking::Exposure {
pallet_staking::Exposure {
total: 0,
own: 0,
others: vec![],
@@ -3493,7 +3493,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(2, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3611,7 +3611,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(1, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -3643,7 +3643,7 @@ mod tests {
assert_eq!(
Staking::eras_stakers(1, i as u64),
staking::Exposure {
pallet_staking::Exposure {
total: 10_000,
own: 10_000,
others: vec![],
@@ -21,7 +21,7 @@ use frame_support::{
dispatch::DispatchResult,
weights::DispatchClass,
};
use system::ensure_root;
use frame_system::ensure_root;
use runtime_parachains::paras::{
self,
ParaGenesisArgs,
@@ -37,7 +37,7 @@ decl_error! {
decl_module! {
/// A sudo wrapper to call into v1 paras module.
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin, system = system {
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
type Error = Error<T>;
/// Schedule a para to be initialized at the start of the next session.
+21 -21
View File
@@ -23,14 +23,14 @@ use frame_support::{decl_event, decl_storage, decl_module, decl_error, ensure};
use frame_support::traits::{
EnsureOrigin, Currency, ExistenceRequirement, VestingSchedule, Get
};
use system::ensure_signed;
use frame_system::ensure_signed;
use sp_core::sr25519;
use sp_std::prelude::*;
/// 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>;
/// Balances Pallet
type Currency: Currency<Self::AccountId>;
/// Vesting Pallet
@@ -47,7 +47,7 @@ pub trait Trait: system::Trait {
type MaxUnlocked: Get<BalanceOf<Self>>;
}
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 kind of a statement an account needs to make for a claim to be valid.
#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug)]
@@ -103,9 +103,9 @@ pub struct AccountStatus<Balance> {
decl_event!(
pub enum Event<T> where
AccountId = <T as system::Trait>::AccountId,
AccountId = <T as frame_system::Trait>::AccountId,
Balance = BalanceOf<T>,
BlockNumber = <T as system::Trait>::BlockNumber,
BlockNumber = <T as frame_system::Trait>::BlockNumber,
{
/// A new account was created
AccountCreated(AccountId),
@@ -159,7 +159,7 @@ decl_storage! {
}
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>;
/// The maximum statement length for the statement users to sign when creating an account.
@@ -332,7 +332,7 @@ decl_module! {
#[weight = T::DbWeight::get().writes(1)]
fn set_unlock_block(origin, unlock_block: T::BlockNumber) {
T::ConfigurationOrigin::ensure_origin(origin)?;
ensure!(unlock_block > system::Module::<T>::block_number(), Error::<T>::InvalidUnlockBlock);
ensure!(unlock_block > frame_system::Module::<T>::block_number(), Error::<T>::InvalidUnlockBlock);
// Possibly this is worse than having the caller account be the payment account?
UnlockBlock::<T>::set(unlock_block);
Self::deposit_event(RawEvent::UnlockBlockUpdated(unlock_block));
@@ -388,10 +388,10 @@ mod tests {
ord_parameter_types, dispatch::DispatchError::BadOrigin,
};
use frame_support::traits::Currency;
use balances::Error as BalancesError;
use pallet_balances::Error as BalancesError;
impl_outer_origin! {
pub enum Origin for Test where system = system {}
pub enum Origin for Test {}
}
impl_outer_dispatch! {
@@ -414,7 +414,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 = Call;
@@ -436,7 +436,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 = ();
@@ -446,7 +446,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 = ();
@@ -459,7 +459,7 @@ mod tests {
pub const MinVestedTransfer: u64 = 0;
}
impl vesting::Trait for Test {
impl pallet_vesting::Trait for Test {
type Event = ();
type Currency = Balances;
type BlockNumberToBalance = Identity;
@@ -483,22 +483,22 @@ mod tests {
type Event = ();
type Currency = Balances;
type VestingSchedule = Vesting;
type ValidityOrigin = system::EnsureSignedBy<ValidityOrigin, AccountId>;
type ConfigurationOrigin = system::EnsureSignedBy<ConfigurationOrigin, AccountId>;
type ValidityOrigin = frame_system::EnsureSignedBy<ValidityOrigin, AccountId>;
type ConfigurationOrigin = frame_system::EnsureSignedBy<ConfigurationOrigin, AccountId>;
type MaxStatementLength = MaxStatementLength;
type UnlockedProportion = UnlockedProportion;
type MaxUnlocked = MaxUnlocked;
}
type System = system::Module<Test>;
type Balances = balances::Module<Test>;
type Vesting = vesting::Module<Test>;
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type Vesting = pallet_vesting::Module<Test>;
type Purchase = Module<Test>;
// This function basically just builds a genesis storage key/value store according to
// our desired mockup. It also executes our `setup` function which sets up this pallet for use.
pub fn new_test_ext() -> sp_io::TestExternalities {
let t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| setup());
ext
@@ -948,7 +948,7 @@ mod tests {
);
// Vesting lock is removed in whole on block 101 (100 blocks after block 1)
System::set_block_number(100);
let vest_call = Call::Vesting(vesting::Call::<Test>::vest());
let vest_call = Call::Vesting(pallet_vesting::Call::<Test>::vest());
assert_ok!(vest_call.clone().dispatch(Origin::signed(alice())));
assert_ok!(vest_call.clone().dispatch(Origin::signed(bob())));
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&alice()), Some(45));
+52 -52
View File
@@ -33,7 +33,7 @@ use frame_support::{
dispatch::{DispatchResult, IsSubType}, traits::{Get, Currency, ReservableCurrency},
weights::{DispatchClass, Weight},
};
use system::{self, ensure_root, ensure_signed};
use frame_system::{self, ensure_root, ensure_signed};
use primitives::v0::{
Id as ParaId, CollatorId, Scheduling, LOWEST_USER_ID, SwapAux, Info as ParaInfo, ActiveParas,
Retriable, ValidationCode, HeadData,
@@ -129,17 +129,17 @@ impl<T: Trait> Registrar<T::AccountId> for Module<T> {
}
type BalanceOf<T> =
<<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
pub trait Trait: parachains::Trait {
/// The overarching event type.
type Event: From<Event> + Into<<Self as system::Trait>::Event>;
type Event: From<Event> + Into<<Self as frame_system::Trait>::Event>;
/// The aggregated origin type must support the parachains origin. We require that we can
/// infallibly convert between this origin and the system origin, but in reality, they're the
/// same type, we just can't express that to the Rust type system without writing a `where`
/// clause everywhere.
type Origin: From<<Self as system::Trait>::Origin>
type Origin: From<<Self as frame_system::Trait>::Origin>
+ Into<result::Result<parachains::Origin, <Self as Trait>::Origin>>;
/// The system's currency for parathread payment.
@@ -254,7 +254,7 @@ decl_error! {
decl_module! {
/// Parachains module.
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin, system = system {
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
type Error = Error<T>;
fn deposit_event() = default;
@@ -561,10 +561,10 @@ impl<T: Trait> ActiveParas for Module<T> {
/// Ensure that parathread selections happen prioritized by fees.
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
pub struct LimitParathreadCommits<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>) where
<T as system::Trait>::Call: IsSubType<Call<T>>;
<T as frame_system::Trait>::Call: IsSubType<Call<T>>;
impl<T: Trait + Send + Sync> LimitParathreadCommits<T> where
<T as system::Trait>::Call: IsSubType<Call<T>>
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
{
/// Create a new `LimitParathreadCommits` struct.
pub fn new() -> Self {
@@ -573,7 +573,7 @@ impl<T: Trait + Send + Sync> LimitParathreadCommits<T> where
}
impl<T: Trait + Send + Sync> sp_std::fmt::Debug for LimitParathreadCommits<T> where
<T as system::Trait>::Call: IsSubType<Call<T>>
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
{
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
write!(f, "LimitParathreadCommits<T>")
@@ -590,11 +590,11 @@ pub enum ValidityError {
}
impl<T: Trait + Send + Sync> SignedExtension for LimitParathreadCommits<T> where
<T as system::Trait>::Call: IsSubType<Call<T>>
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
{
const IDENTIFIER: &'static str = "LimitParathreadCommits";
type AccountId = T::AccountId;
type Call = <T as system::Trait>::Call;
type Call = <T as frame_system::Trait>::Call;
type AdditionalSigned = ();
type Pre = ();
@@ -688,7 +688,7 @@ mod tests {
use crate::attestations;
impl_outer_origin! {
pub enum Origin for Test where system = system {
pub enum Origin for Test {
parachains,
}
}
@@ -720,7 +720,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 = Call;
@@ -742,13 +742,13 @@ mod tests {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = balances::AccountData<u128>;
type AccountData = pallet_balances::AccountData<u128>;
type OnNewAccount = ();
type OnKilledAccount = Balances;
type SystemWeightInfo = ();
}
impl<C> system::offchain::SendTransactionTypes<C> for Test where
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test where
Call: From<C>,
{
type OverarchingCall = Call;
@@ -759,7 +759,7 @@ mod tests {
pub const ExistentialDeposit: Balance = 1;
}
impl balances::Trait for Test {
impl pallet_balances::Trait for Test {
type Balance = u128;
type DustRemoval = ();
type Event = ();
@@ -775,7 +775,7 @@ mod tests {
impl slots::Trait for Test {
type Event = ();
type Currency = balances::Module<Test>;
type Currency = pallet_balances::Module<Test>;
type Parachains = Registrar;
type EndingPeriod = EndingPeriod;
type LeasePeriod = LeasePeriod;
@@ -783,11 +783,11 @@ mod tests {
}
parameter_types!{
pub const SlashDeferDuration: staking::EraIndex = 7;
pub const SlashDeferDuration: pallet_staking::EraIndex = 7;
pub const AttestationPeriod: BlockNumber = 100;
pub const MinimumPeriod: u64 = 3;
pub const SessionsPerEra: sp_staking::SessionIndex = 6;
pub const BondingDuration: staking::EraIndex = 28;
pub const BondingDuration: pallet_staking::EraIndex = 28;
pub const MaxNominatorRewardedPerValidator: u32 = 64;
}
@@ -804,12 +804,12 @@ mod tests {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
}
impl session::Trait for Test {
impl pallet_session::Trait for Test {
type SessionManager = ();
type Keys = UintAuthorityId;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = session::PeriodicSessions<Period, Offset>;
type SessionHandler = session::TestSessionHandler;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionHandler = pallet_session::TestSessionHandler;
type Event = ();
type ValidatorId = u64;
type ValidatorIdOf = ();
@@ -828,19 +828,19 @@ mod tests {
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
}
impl staking::Trait for Test {
impl pallet_staking::Trait for Test {
type RewardRemainder = ();
type CurrencyToVote = ();
type Event = ();
type Currency = balances::Module<Test>;
type Currency = pallet_balances::Module<Test>;
type Slash = ();
type Reward = ();
type SessionsPerEra = SessionsPerEra;
type BondingDuration = BondingDuration;
type SlashDeferDuration = SlashDeferDuration;
type SlashCancelOrigin = system::EnsureRoot<Self::AccountId>;
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
type SessionInterface = Self;
type UnixTime = timestamp::Module<Test>;
type UnixTime = pallet_timestamp::Module<Test>;
type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
@@ -852,16 +852,16 @@ mod tests {
type WeightInfo = ();
}
impl timestamp::Trait for Test {
impl pallet_timestamp::Trait for Test {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
impl session::historical::Trait for Test {
type FullIdentification = staking::Exposure<u64, Balance>;
type FullIdentificationOf = staking::ExposureOf<Self>;
impl pallet_session::historical::Trait for Test {
type FullIdentification = pallet_staking::Exposure<u64, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
}
// This is needed for a custom `AccountId` type which is `u64` in testing here.
@@ -889,7 +889,7 @@ mod tests {
pub type ReporterId = app::Public;
pub struct ReporterAuthorityId;
impl system::offchain::AppCrypto<ReporterId, Signature> for ReporterAuthorityId {
impl frame_system::offchain::AppCrypto<ReporterId, Signature> for ReporterAuthorityId {
type RuntimeAppPublic = ReporterId;
type GenericSignature = sr25519::Signature;
type GenericPublic = sr25519::Public;
@@ -900,7 +900,7 @@ mod tests {
type AuthorityId = test_keys::ReporterAuthorityId;
type Origin = Origin;
type Call = Call;
type ParachainCurrency = balances::Module<Test>;
type ParachainCurrency = pallet_balances::Module<Test>;
type BlockNumberConversion = sp_runtime::traits::Identity;
type ActiveParachains = Registrar;
type Registrar = Registrar;
@@ -911,7 +911,7 @@ mod tests {
type ValidationUpgradeDelay = ValidationUpgradeDelay;
type SlashPeriod = SlashPeriod;
type Proof = sp_session::MembershipProof;
type KeyOwnerProofSystem = session::historical::Module<Test>;
type KeyOwnerProofSystem = pallet_session::historical::Module<Test>;
type IdentificationTuple = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
Vec<u8>,
@@ -922,20 +922,20 @@ mod tests {
type Extrinsic = TestXt<Call, ()>;
impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Test where
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Test where
Call: From<LocalCall>,
{
fn create_transaction<C: system::offchain::AppCrypto<Self::Public, Self::Signature>>(
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call,
_public: test_keys::ReporterId,
_account: <Test as system::Trait>::AccountId,
nonce: <Test as system::Trait>::Index,
_account: <Test as frame_system::Trait>::AccountId,
nonce: <Test as frame_system::Trait>::Index,
) -> Option<(Call, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
Some((call, (nonce, ())))
}
}
impl system::offchain::SigningTypes for Test {
impl frame_system::offchain::SigningTypes for Test {
type Public = test_keys::ReporterId;
type Signature = Signature;
}
@@ -949,21 +949,21 @@ mod tests {
impl Trait for Test {
type Event = ();
type Origin = Origin;
type Currency = balances::Module<Test>;
type Currency = pallet_balances::Module<Test>;
type ParathreadDeposit = ParathreadDeposit;
type SwapAux = slots::Module<Test>;
type QueueSize = QueueSize;
type MaxRetries = MaxRetries;
}
type Balances = balances::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type Parachains = parachains::Module<Test>;
type System = system::Module<Test>;
type System = frame_system::Module<Test>;
type Slots = slots::Module<Test>;
type Registrar = Module<Test>;
type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>;
type Session = session::Module<Test>;
type Staking = staking::Module<Test>;
type RandomnessCollectiveFlip = pallet_randomness_collective_flip::Module<Test>;
type Session = pallet_session::Module<Test>;
type Staking = pallet_staking::Module<Test>;
const AUTHORITY_KEYS: [Sr25519Keyring; 8] = [
Sr25519Keyring::Alice,
@@ -977,7 +977,7 @@ mod tests {
];
fn new_test_ext(parachains: Vec<(ParaId, ValidationCode, HeadData)>) -> TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let authority_keys = [
Sr25519Keyring::Alice,
@@ -1008,11 +1008,11 @@ mod tests {
_phdata: Default::default(),
}.assimilate_storage(&mut t).unwrap();
session::GenesisConfig::<Test> {
pallet_session::GenesisConfig::<Test> {
keys: session_keys,
}.assimilate_storage(&mut t).unwrap();
balances::GenesisConfig::<Test> {
pallet_balances::GenesisConfig::<Test> {
balances,
}.assimilate_storage(&mut t).unwrap();
@@ -1034,7 +1034,7 @@ mod tests {
println!("Finalizing {}", System::block_number());
if !parachains::DidUpdate::exists() {
println!("Null heads update");
assert_ok!(Parachains::set_heads(system::RawOrigin::None.into(), vec![]));
assert_ok!(Parachains::set_heads(frame_system::RawOrigin::None.into(), vec![]));
}
Slots::on_finalize(System::block_number());
Parachains::on_finalize(System::block_number());
@@ -1082,7 +1082,7 @@ mod tests {
};
let (candidate, _) = candidate.abridge();
let candidate_hash = candidate.hash();
let payload = (Statement::Valid(candidate_hash), session::Module::<Test>::current_index(), System::parent_hash()).encode();
let payload = (Statement::Valid(candidate_hash), pallet_session::Module::<Test>::current_index(), System::parent_hash()).encode();
let roster = Parachains::calculate_duty_roster().0.validator_duty;
AttestedCandidate {
candidate,
@@ -1498,8 +1498,8 @@ mod tests {
let good_para_id = user_id(0);
let bad_para_id = user_id(1);
let bad_head_hash = <Test as system::Trait>::Hashing::hash(&vec![1, 2, 1]);
let good_head_hash = <Test as system::Trait>::Hashing::hash(&vec![1, 1, 1]);
let bad_head_hash = <Test as frame_system::Trait>::Hashing::hash(&vec![1, 2, 1]);
let good_head_hash = <Test as frame_system::Trait>::Hashing::hash(&vec![1, 1, 1]);
let info = &DispatchInfo::default();
// Allow for threads
@@ -1562,7 +1562,7 @@ mod tests {
for x in 0..5 {
let para_id = user_id(x as u32);
let collator_id = CollatorId::default();
let head_hash = <Test as system::Trait>::Hashing::hash(&vec![x; 3]);
let head_hash = <Test as frame_system::Trait>::Hashing::hash(&vec![x; 3]);
let inner = super::Call::select_parathread(para_id, collator_id, head_hash);
let call = Call::Registrar(inner);
let info = &DispatchInfo::default();
+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()