mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +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
@@ -138,8 +138,8 @@
|
||||
//! ### Example: Rewarding a validator by id.
|
||||
//!
|
||||
//! ```
|
||||
//! use support::{decl_module, dispatch};
|
||||
//! use system::ensure_signed;
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_system::{self as system, ensure_signed};
|
||||
//! use pallet_staking::{self as staking};
|
||||
//!
|
||||
//! pub trait Trait: staking::Trait {}
|
||||
@@ -181,7 +181,7 @@
|
||||
//! [`reward_by_indices`](./enum.Call.html#variant.reward_by_indices).
|
||||
//!
|
||||
//! [`Module`](./struct.Module.html) implements
|
||||
//! [`authorship::EventHandler`](../pallet_authorship/trait.EventHandler.html) to add reward points
|
||||
//! [`pallet_authorship::EventHandler`](../pallet_authorship/trait.EventHandler.html) to add reward points
|
||||
//! to block producer and block producer of referenced uncles.
|
||||
//!
|
||||
//! The validator and its nominator split their reward as following:
|
||||
@@ -257,7 +257,7 @@ pub mod inflation;
|
||||
|
||||
use sp_std::{prelude::*, result};
|
||||
use codec::{HasCompact, Encode, Decode};
|
||||
use support::{
|
||||
use frame_support::{
|
||||
decl_module, decl_event, decl_storage, ensure,
|
||||
weights::SimpleDispatchInfo,
|
||||
traits::{
|
||||
@@ -265,7 +265,7 @@ use support::{
|
||||
WithdrawReasons, OnUnbalanced, Imbalance, Get, Time
|
||||
}
|
||||
};
|
||||
use session::{historical::OnSessionEnding, SelectInitialValidators};
|
||||
use pallet_session::{historical::OnSessionEnding, SelectInitialValidators};
|
||||
use sp_runtime::{
|
||||
Perbill,
|
||||
RuntimeDebug,
|
||||
@@ -281,9 +281,9 @@ use sp_staking::{
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
use sp_runtime::{Serialize, Deserialize};
|
||||
use system::{ensure_signed, ensure_root};
|
||||
use frame_system::{self as system, ensure_signed, ensure_root};
|
||||
|
||||
use phragmen::{ExtendedBalance, PhragmenStakedAssignment};
|
||||
use sp_phragmen::{ExtendedBalance, PhragmenStakedAssignment};
|
||||
|
||||
const DEFAULT_MINIMUM_VALIDATOR_COUNT: u32 = 4;
|
||||
const MAX_NOMINATIONS: usize = 16;
|
||||
@@ -521,17 +521,17 @@ pub struct UnappliedSlash<AccountId, Balance: HasCompact> {
|
||||
}
|
||||
|
||||
pub 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;
|
||||
type PositiveImbalanceOf<T> =
|
||||
<<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::PositiveImbalance;
|
||||
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::PositiveImbalance;
|
||||
type NegativeImbalanceOf<T> =
|
||||
<<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;
|
||||
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
|
||||
type MomentOf<T> = <<T as Trait>::Time as Time>::Moment;
|
||||
|
||||
/// Means for interacting with a specialized version of the `session` trait.
|
||||
///
|
||||
/// This is needed because `Staking` sets the `ValidatorIdOf` of the `session::Trait`
|
||||
pub trait SessionInterface<AccountId>: system::Trait {
|
||||
/// This is needed because `Staking` sets the `ValidatorIdOf` of the `pallet_session::Trait`
|
||||
pub trait SessionInterface<AccountId>: frame_system::Trait {
|
||||
/// Disable a given validator by stash ID.
|
||||
///
|
||||
/// Returns `true` if new era should be forced at the end of this session.
|
||||
@@ -544,31 +544,31 @@ pub trait SessionInterface<AccountId>: system::Trait {
|
||||
fn prune_historical_up_to(up_to: SessionIndex);
|
||||
}
|
||||
|
||||
impl<T: Trait> SessionInterface<<T as system::Trait>::AccountId> for T where
|
||||
T: session::Trait<ValidatorId = <T as system::Trait>::AccountId>,
|
||||
T: session::historical::Trait<
|
||||
FullIdentification = Exposure<<T as system::Trait>::AccountId, BalanceOf<T>>,
|
||||
impl<T: Trait> SessionInterface<<T as frame_system::Trait>::AccountId> for T where
|
||||
T: pallet_session::Trait<ValidatorId = <T as frame_system::Trait>::AccountId>,
|
||||
T: pallet_session::historical::Trait<
|
||||
FullIdentification = Exposure<<T as frame_system::Trait>::AccountId, BalanceOf<T>>,
|
||||
FullIdentificationOf = ExposureOf<T>,
|
||||
>,
|
||||
T::SessionHandler: session::SessionHandler<<T as system::Trait>::AccountId>,
|
||||
T::OnSessionEnding: session::OnSessionEnding<<T as system::Trait>::AccountId>,
|
||||
T::SelectInitialValidators: session::SelectInitialValidators<<T as system::Trait>::AccountId>,
|
||||
T::ValidatorIdOf: Convert<<T as system::Trait>::AccountId, Option<<T as system::Trait>::AccountId>>
|
||||
T::SessionHandler: pallet_session::SessionHandler<<T as frame_system::Trait>::AccountId>,
|
||||
T::OnSessionEnding: pallet_session::OnSessionEnding<<T as frame_system::Trait>::AccountId>,
|
||||
T::SelectInitialValidators: pallet_session::SelectInitialValidators<<T as frame_system::Trait>::AccountId>,
|
||||
T::ValidatorIdOf: Convert<<T as frame_system::Trait>::AccountId, Option<<T as frame_system::Trait>::AccountId>>
|
||||
{
|
||||
fn disable_validator(validator: &<T as system::Trait>::AccountId) -> Result<bool, ()> {
|
||||
<session::Module<T>>::disable(validator)
|
||||
fn disable_validator(validator: &<T as frame_system::Trait>::AccountId) -> Result<bool, ()> {
|
||||
<pallet_session::Module<T>>::disable(validator)
|
||||
}
|
||||
|
||||
fn validators() -> Vec<<T as system::Trait>::AccountId> {
|
||||
<session::Module<T>>::validators()
|
||||
fn validators() -> Vec<<T as frame_system::Trait>::AccountId> {
|
||||
<pallet_session::Module<T>>::validators()
|
||||
}
|
||||
|
||||
fn prune_historical_up_to(up_to: SessionIndex) {
|
||||
<session::historical::Module<T>>::prune_up_to(up_to);
|
||||
<pallet_session::historical::Module<T>>::prune_up_to(up_to);
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Trait: system::Trait {
|
||||
pub trait Trait: frame_system::Trait {
|
||||
/// The staking balance.
|
||||
type Currency: LockableCurrency<Self::AccountId, Moment=Self::BlockNumber>;
|
||||
|
||||
@@ -586,7 +586,7 @@ pub trait Trait: system::Trait {
|
||||
type RewardRemainder: OnUnbalanced<NegativeImbalanceOf<Self>>;
|
||||
|
||||
/// 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>;
|
||||
|
||||
/// Handler for the unbalanced reduction when slashing a staker.
|
||||
type Slash: OnUnbalanced<NegativeImbalanceOf<Self>>;
|
||||
@@ -771,7 +771,7 @@ decl_storage! {
|
||||
}
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T> where Balance = BalanceOf<T>, <T as system::Trait>::AccountId {
|
||||
pub enum Event<T> where Balance = BalanceOf<T>, <T as frame_system::Trait>::AccountId {
|
||||
/// All validators have been rewarded by the first balance; the second is the remainder
|
||||
/// from the maximum amount of reward.
|
||||
Reward(Balance, Balance),
|
||||
@@ -1423,7 +1423,7 @@ impl<T: Trait> Module<T> {
|
||||
});
|
||||
all_nominators.extend(nominator_votes);
|
||||
|
||||
let maybe_phragmen_result = phragmen::elect::<_, _, _, T::CurrencyToVote>(
|
||||
let maybe_phragmen_result = sp_phragmen::elect::<_, _, _, T::CurrencyToVote>(
|
||||
Self::validator_count() as usize,
|
||||
Self::minimum_validator_count().max(1) as usize,
|
||||
all_validators,
|
||||
@@ -1442,7 +1442,7 @@ impl<T: Trait> Module<T> {
|
||||
let to_balance = |e: ExtendedBalance|
|
||||
<T::CurrencyToVote as Convert<ExtendedBalance, BalanceOf<T>>>::convert(e);
|
||||
|
||||
let mut supports = phragmen::build_support_map::<_, _, _, T::CurrencyToVote>(
|
||||
let mut supports = sp_phragmen::build_support_map::<_, _, _, T::CurrencyToVote>(
|
||||
&elected_stashes,
|
||||
&assignments,
|
||||
Self::slashable_balance_of,
|
||||
@@ -1473,7 +1473,7 @@ impl<T: Trait> Module<T> {
|
||||
|
||||
let tolerance = 0_u128;
|
||||
let iterations = 2_usize;
|
||||
phragmen::equalize::<_, _, T::CurrencyToVote, _>(
|
||||
sp_phragmen::equalize::<_, _, T::CurrencyToVote, _>(
|
||||
staked_assignments,
|
||||
&mut supports,
|
||||
tolerance,
|
||||
@@ -1600,7 +1600,7 @@ impl<T: Trait> Module<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> session::OnSessionEnding<T::AccountId> for Module<T> {
|
||||
impl<T: Trait> pallet_session::OnSessionEnding<T::AccountId> for Module<T> {
|
||||
fn on_session_ending(_ending: SessionIndex, start_session: SessionIndex) -> Option<Vec<T::AccountId>> {
|
||||
Self::ensure_storage_upgraded();
|
||||
Self::new_session(start_session - 1).map(|(new, _old)| new)
|
||||
@@ -1627,13 +1627,13 @@ impl<T: Trait> OnFreeBalanceZero<T::AccountId> for Module<T> {
|
||||
/// * 20 points to the block producer for producing a (non-uncle) block in the relay chain,
|
||||
/// * 2 points to the block producer for each reference to a previously unreferenced uncle, and
|
||||
/// * 1 point to the producer of each referenced uncle block.
|
||||
impl<T: Trait + authorship::Trait> authorship::EventHandler<T::AccountId, T::BlockNumber> for Module<T> {
|
||||
impl<T: Trait + pallet_authorship::Trait> pallet_authorship::EventHandler<T::AccountId, T::BlockNumber> for Module<T> {
|
||||
fn note_author(author: T::AccountId) {
|
||||
Self::reward_by_ids(vec![(author, 20)]);
|
||||
}
|
||||
fn note_uncle(author: T::AccountId, _age: T::BlockNumber) {
|
||||
Self::reward_by_ids(vec![
|
||||
(<authorship::Module<T>>::author(), 2),
|
||||
(<pallet_authorship::Module<T>>::author(), 2),
|
||||
(author, 1)
|
||||
])
|
||||
}
|
||||
@@ -1668,19 +1668,19 @@ impl<T: Trait> SelectInitialValidators<T::AccountId> for Module<T> {
|
||||
}
|
||||
|
||||
/// This is intended to be used with `FilterHistoricalOffences`.
|
||||
impl <T: Trait> OnOffenceHandler<T::AccountId, session::historical::IdentificationTuple<T>> for Module<T> where
|
||||
T: session::Trait<ValidatorId = <T as system::Trait>::AccountId>,
|
||||
T: session::historical::Trait<
|
||||
FullIdentification = Exposure<<T as system::Trait>::AccountId, BalanceOf<T>>,
|
||||
impl <T: Trait> OnOffenceHandler<T::AccountId, pallet_session::historical::IdentificationTuple<T>> for Module<T> where
|
||||
T: pallet_session::Trait<ValidatorId = <T as frame_system::Trait>::AccountId>,
|
||||
T: pallet_session::historical::Trait<
|
||||
FullIdentification = Exposure<<T as frame_system::Trait>::AccountId, BalanceOf<T>>,
|
||||
FullIdentificationOf = ExposureOf<T>,
|
||||
>,
|
||||
T::SessionHandler: session::SessionHandler<<T as system::Trait>::AccountId>,
|
||||
T::OnSessionEnding: session::OnSessionEnding<<T as system::Trait>::AccountId>,
|
||||
T::SelectInitialValidators: session::SelectInitialValidators<<T as system::Trait>::AccountId>,
|
||||
T::ValidatorIdOf: Convert<<T as system::Trait>::AccountId, Option<<T as system::Trait>::AccountId>>
|
||||
T::SessionHandler: pallet_session::SessionHandler<<T as frame_system::Trait>::AccountId>,
|
||||
T::OnSessionEnding: pallet_session::OnSessionEnding<<T as frame_system::Trait>::AccountId>,
|
||||
T::SelectInitialValidators: pallet_session::SelectInitialValidators<<T as frame_system::Trait>::AccountId>,
|
||||
T::ValidatorIdOf: Convert<<T as frame_system::Trait>::AccountId, Option<<T as frame_system::Trait>::AccountId>>
|
||||
{
|
||||
fn on_offence(
|
||||
offenders: &[OffenceDetails<T::AccountId, session::historical::IdentificationTuple<T>>],
|
||||
offenders: &[OffenceDetails<T::AccountId, pallet_session::historical::IdentificationTuple<T>>],
|
||||
slash_fraction: &[Perbill],
|
||||
slash_session: SessionIndex,
|
||||
) {
|
||||
|
||||
@@ -25,7 +25,7 @@ pub const CURRENT_VERSION: VersionNumber = 1;
|
||||
#[cfg(any(test, feature = "migrate"))]
|
||||
mod inner {
|
||||
use crate::{Store, Module, Trait};
|
||||
use support::{StorageLinkedMap, StorageValue};
|
||||
use frame_support::{StorageLinkedMap, StorageValue};
|
||||
use sp_std::vec::Vec;
|
||||
use super::{CURRENT_VERSION, VersionNumber};
|
||||
|
||||
@@ -51,21 +51,21 @@ mod inner {
|
||||
);
|
||||
|
||||
if let Err(e) = res {
|
||||
support::print("Encountered error in migration of Staking::Nominators map.");
|
||||
frame_support::print("Encountered error in migration of Staking::Nominators map.");
|
||||
if e.is_none() {
|
||||
support::print("Staking::Nominators map reinitialized");
|
||||
frame_support::print("Staking::Nominators map reinitialized");
|
||||
}
|
||||
}
|
||||
|
||||
support::print("Finished migrating Staking storage to v1.");
|
||||
frame_support::print("Finished migrating Staking storage to v1.");
|
||||
}
|
||||
|
||||
pub(super) fn perform_migrations<T: Trait>() {
|
||||
<Module<T> as Store>::StorageVersion::mutate(|version| {
|
||||
if *version < MIN_SUPPORTED_VERSION {
|
||||
support::print("Cannot migrate staking storage because version is less than\
|
||||
frame_support::print("Cannot migrate staking storage because version is less than\
|
||||
minimum.");
|
||||
support::print(*version);
|
||||
frame_support::print(*version);
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ use sp_runtime::curve::PiecewiseLinear;
|
||||
use sp_runtime::traits::{IdentityLookup, Convert, OpaqueKeys, OnInitialize, SaturatedConversion};
|
||||
use sp_runtime::testing::{Header, UintAuthorityId};
|
||||
use sp_staking::{SessionIndex, offence::{OffenceDetails, OnOffenceHandler}};
|
||||
use primitives::{H256, crypto::key_types};
|
||||
use sp_core::{H256, crypto::key_types};
|
||||
use sp_io;
|
||||
use support::{
|
||||
use frame_support::{
|
||||
assert_ok, impl_outer_origin, parameter_types, StorageLinkedMap, StorageValue,
|
||||
traits::{Currency, Get, FindAuthor},
|
||||
weights::Weight,
|
||||
@@ -55,7 +55,7 @@ thread_local! {
|
||||
}
|
||||
|
||||
pub struct TestSessionHandler;
|
||||
impl session::SessionHandler<AccountId> for TestSessionHandler {
|
||||
impl pallet_session::SessionHandler<AccountId> for TestSessionHandler {
|
||||
const KEY_TYPE_IDS: &'static [KeyTypeId] = &[key_types::DUMMY];
|
||||
|
||||
fn on_genesis_session<Ks: OpaqueKeys>(_validators: &[(AccountId, Ks)]) {}
|
||||
@@ -99,14 +99,14 @@ impl Get<EraIndex> for SlashDeferDuration {
|
||||
}
|
||||
|
||||
impl_outer_origin!{
|
||||
pub enum Origin for Test {}
|
||||
pub enum Origin for Test where system = frame_system {}
|
||||
}
|
||||
|
||||
/// Author of block is always 11
|
||||
pub struct Author11;
|
||||
impl FindAuthor<u64> for Author11 {
|
||||
fn find_author<'a, I>(_digests: I) -> Option<u64>
|
||||
where I: 'a + IntoIterator<Item=(support::ConsensusEngineId, &'a [u8])>
|
||||
where I: 'a + IntoIterator<Item=(frame_support::ConsensusEngineId, &'a [u8])>
|
||||
{
|
||||
Some(11)
|
||||
}
|
||||
@@ -121,7 +121,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 = BlockNumber;
|
||||
@@ -142,7 +142,7 @@ parameter_types! {
|
||||
pub const TransferFee: Balance = 0;
|
||||
pub const CreationFee: Balance = 0;
|
||||
}
|
||||
impl balances::Trait for Test {
|
||||
impl pallet_balances::Trait for Test {
|
||||
type Balance = Balance;
|
||||
type OnFreeBalanceZero = Staking;
|
||||
type OnNewAccount = ();
|
||||
@@ -159,10 +159,10 @@ parameter_types! {
|
||||
pub const UncleGenerations: u64 = 0;
|
||||
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(25);
|
||||
}
|
||||
impl session::Trait for Test {
|
||||
type OnSessionEnding = session::historical::NoteHistoricalRoot<Test, Staking>;
|
||||
impl pallet_session::Trait for Test {
|
||||
type OnSessionEnding = pallet_session::historical::NoteHistoricalRoot<Test, Staking>;
|
||||
type Keys = UintAuthorityId;
|
||||
type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionHandler = TestSessionHandler;
|
||||
type Event = ();
|
||||
type ValidatorId = AccountId;
|
||||
@@ -171,11 +171,11 @@ impl session::Trait for Test {
|
||||
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
|
||||
}
|
||||
|
||||
impl session::historical::Trait for Test {
|
||||
impl pallet_session::historical::Trait for Test {
|
||||
type FullIdentification = crate::Exposure<AccountId, Balance>;
|
||||
type FullIdentificationOf = crate::ExposureOf<Test>;
|
||||
}
|
||||
impl authorship::Trait for Test {
|
||||
impl pallet_authorship::Trait for Test {
|
||||
type FindAuthor = Author11;
|
||||
type UncleGenerations = UncleGenerations;
|
||||
type FilterUncle = ();
|
||||
@@ -184,7 +184,7 @@ impl authorship::Trait for Test {
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = 5;
|
||||
}
|
||||
impl timestamp::Trait for Test {
|
||||
impl pallet_timestamp::Trait for Test {
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
@@ -205,8 +205,8 @@ parameter_types! {
|
||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &I_NPOS;
|
||||
}
|
||||
impl Trait for Test {
|
||||
type Currency = balances::Module<Self>;
|
||||
type Time = timestamp::Module<Self>;
|
||||
type Currency = pallet_balances::Module<Self>;
|
||||
type Time = pallet_timestamp::Module<Self>;
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
type RewardRemainder = ();
|
||||
type Event = ();
|
||||
@@ -214,7 +214,7 @@ impl Trait for Test {
|
||||
type Reward = ();
|
||||
type SessionsPerEra = SessionsPerEra;
|
||||
type SlashDeferDuration = SlashDeferDuration;
|
||||
type SlashCancelOrigin = system::EnsureRoot<Self::AccountId>;
|
||||
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
|
||||
type BondingDuration = BondingDuration;
|
||||
type SessionInterface = Self;
|
||||
type RewardCurve = RewardCurve;
|
||||
@@ -291,7 +291,7 @@ impl ExtBuilder {
|
||||
}
|
||||
pub fn build(self) -> sp_io::TestExternalities {
|
||||
self.set_associated_consts();
|
||||
let mut storage = system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let balance_factor = if self.existential_deposit > 0 {
|
||||
256
|
||||
} else {
|
||||
@@ -303,7 +303,7 @@ impl ExtBuilder {
|
||||
.map(|x| ((x + 1) * 10 + 1) as u64)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let _ = balances::GenesisConfig::<Test>{
|
||||
let _ = pallet_balances::GenesisConfig::<Test>{
|
||||
balances: vec![
|
||||
(1, 10 * balance_factor),
|
||||
(2, 20 * balance_factor),
|
||||
@@ -351,7 +351,7 @@ impl ExtBuilder {
|
||||
..Default::default()
|
||||
}.assimilate_storage(&mut storage);
|
||||
|
||||
let _ = session::GenesisConfig::<Test> {
|
||||
let _ = pallet_session::GenesisConfig::<Test> {
|
||||
keys: validators.iter().map(|x| (*x, UintAuthorityId(*x))).collect(),
|
||||
}.assimilate_storage(&mut storage);
|
||||
|
||||
@@ -366,10 +366,10 @@ impl ExtBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
pub type System = system::Module<Test>;
|
||||
pub type Balances = balances::Module<Test>;
|
||||
pub type Session = session::Module<Test>;
|
||||
pub type Timestamp = timestamp::Module<Test>;
|
||||
pub type System = frame_system::Module<Test>;
|
||||
pub type Balances = pallet_balances::Module<Test>;
|
||||
pub type Session = pallet_session::Module<Test>;
|
||||
pub type Timestamp = pallet_timestamp::Module<Test>;
|
||||
pub type Staking = Module<Test>;
|
||||
|
||||
pub fn check_exposure_all() {
|
||||
@@ -481,7 +481,7 @@ pub fn validator_controllers() -> Vec<AccountId> {
|
||||
}
|
||||
|
||||
pub fn on_offence_in_era(
|
||||
offenders: &[OffenceDetails<AccountId, session::historical::IdentificationTuple<Test>>],
|
||||
offenders: &[OffenceDetails<AccountId, pallet_session::historical::IdentificationTuple<Test>>],
|
||||
slash_fraction: &[Perbill],
|
||||
era: EraIndex,
|
||||
) {
|
||||
@@ -503,7 +503,7 @@ pub fn on_offence_in_era(
|
||||
}
|
||||
|
||||
pub fn on_offence_now(
|
||||
offenders: &[OffenceDetails<AccountId, session::historical::IdentificationTuple<Test>>],
|
||||
offenders: &[OffenceDetails<AccountId, pallet_session::historical::IdentificationTuple<Test>>],
|
||||
slash_fraction: &[Perbill],
|
||||
) {
|
||||
let now = Staking::current_era();
|
||||
|
||||
@@ -53,7 +53,7 @@ use super::{
|
||||
NegativeImbalanceOf, UnappliedSlash,
|
||||
};
|
||||
use sp_runtime::traits::{Zero, Saturating};
|
||||
use support::{
|
||||
use frame_support::{
|
||||
StorageMap, StorageDoubleMap,
|
||||
traits::{Currency, OnUnbalanced, Imbalance},
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ use super::*;
|
||||
use mock::*;
|
||||
use sp_runtime::{assert_eq_error_rate, traits::OnInitialize};
|
||||
use sp_staking::offence::OffenceDetails;
|
||||
use support::{assert_ok, assert_noop, traits::{Currency, ReservableCurrency}};
|
||||
use frame_support::{assert_ok, assert_noop, traits::{Currency, ReservableCurrency}};
|
||||
use substrate_test_utils::assert_eq_uvec;
|
||||
|
||||
#[test]
|
||||
@@ -1688,9 +1688,9 @@ fn reward_validator_slashing_validator_doesnt_overflow() {
|
||||
#[test]
|
||||
fn reward_from_authorship_event_handler_works() {
|
||||
ExtBuilder::default().build().execute_with(|| {
|
||||
use authorship::EventHandler;
|
||||
use pallet_authorship::EventHandler;
|
||||
|
||||
assert_eq!(<authorship::Module<Test>>::author(), 11);
|
||||
assert_eq!(<pallet_authorship::Module<Test>>::author(), 11);
|
||||
|
||||
<Module<Test>>::note_author(11);
|
||||
<Module<Test>>::note_uncle(21, 1);
|
||||
|
||||
Reference in New Issue
Block a user