mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 00:01:09 +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
@@ -29,7 +29,7 @@ use sp_runtime::{
|
||||
print,
|
||||
traits::{Zero, One, StaticLookup, Bounded, Saturating},
|
||||
};
|
||||
use support::{
|
||||
use frame_support::{
|
||||
dispatch::Result, decl_storage, decl_event, ensure, decl_module,
|
||||
weights::SimpleDispatchInfo,
|
||||
traits::{
|
||||
@@ -38,7 +38,7 @@ use support::{
|
||||
}
|
||||
};
|
||||
use codec::{Encode, Decode};
|
||||
use system::{self, ensure_signed, ensure_root};
|
||||
use frame_system::{self as system, ensure_signed, ensure_root};
|
||||
|
||||
mod mock;
|
||||
mod tests;
|
||||
@@ -134,9 +134,9 @@ pub const VOTER_SET_SIZE: usize = 64;
|
||||
/// NUmber of approvals grouped in one chunk.
|
||||
pub const APPROVAL_SET_SIZE: usize = 8;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
/// Index used to access chunks.
|
||||
type SetIndex = u32;
|
||||
@@ -147,8 +147,8 @@ type ApprovalFlag = u32;
|
||||
/// Number of approval flags that can fit into [`ApprovalFlag`] type.
|
||||
const APPROVAL_FLAG_LEN: usize = 32;
|
||||
|
||||
pub trait Trait: system::Trait {
|
||||
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
|
||||
pub trait Trait: frame_system::Trait {
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
|
||||
/// The currency that people are electing with.
|
||||
type Currency:
|
||||
@@ -643,7 +643,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T> where <T as system::Trait>::AccountId {
|
||||
pub enum Event<T> where <T as frame_system::Trait>::AccountId {
|
||||
/// reaped voter, reaper
|
||||
VoterReaped(AccountId, AccountId),
|
||||
/// slashed reaper
|
||||
@@ -695,7 +695,7 @@ impl<T: Trait> Module<T> {
|
||||
// if there's a tally in progress, then next tally can begin immediately afterwards
|
||||
(tally_end, c.len() - leavers.len() + comers as usize, comers)
|
||||
} else {
|
||||
(<system::Module<T>>::block_number(), c.len(), 0)
|
||||
(<frame_system::Module<T>>::block_number(), c.len(), 0)
|
||||
};
|
||||
if count < desired_seats as usize {
|
||||
Some(next_possible)
|
||||
@@ -851,7 +851,7 @@ impl<T: Trait> Module<T> {
|
||||
fn start_tally() {
|
||||
let members = Self::members();
|
||||
let desired_seats = Self::desired_seats() as usize;
|
||||
let number = <system::Module<T>>::block_number();
|
||||
let number = <frame_system::Module<T>>::block_number();
|
||||
let expiring =
|
||||
members.iter().take_while(|i| i.1 <= number).map(|i| i.0.clone()).collect::<Vec<_>>();
|
||||
let retaining_seats = members.len() - expiring.len();
|
||||
@@ -879,7 +879,7 @@ impl<T: Trait> Module<T> {
|
||||
.ok_or("finalize can only be called after a tally is started.")?;
|
||||
let leaderboard: Vec<(BalanceOf<T>, T::AccountId)> = <Leaderboard<T>>::take()
|
||||
.unwrap_or_default();
|
||||
let new_expiry = <system::Module<T>>::block_number() + Self::term_duration();
|
||||
let new_expiry = <frame_system::Module<T>>::block_number() + Self::term_duration();
|
||||
|
||||
// return bond to winners.
|
||||
let candidacy_bond = T::CandidacyBond::get();
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#![cfg(test)]
|
||||
|
||||
use std::cell::RefCell;
|
||||
use support::{
|
||||
use frame_support::{
|
||||
StorageValue, StorageMap, parameter_types, assert_ok,
|
||||
traits::{Get, ChangeMembers, Currency},
|
||||
weights::Weight,
|
||||
};
|
||||
use primitives::H256;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
Perbill, BuildStorage, testing::Header, traits::{BlakeTwo256, IdentityLookup, Block as BlockT},
|
||||
};
|
||||
@@ -37,7 +37,7 @@ parameter_types! {
|
||||
pub const MaximumBlockLength: u32 = 2 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
impl system::Trait for Test {
|
||||
impl frame_system::Trait for Test {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -60,7 +60,7 @@ parameter_types! {
|
||||
pub const TransferFee: u64 = 0;
|
||||
pub const CreationFee: u64 = 0;
|
||||
}
|
||||
impl balances::Trait for Test {
|
||||
impl pallet_balances::Trait for Test {
|
||||
type Balance = u64;
|
||||
type OnNewAccount = ();
|
||||
type OnFreeBalanceZero = ();
|
||||
@@ -145,14 +145,15 @@ impl elections::Trait for Test {
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, Call, ()>;
|
||||
|
||||
support::construct_runtime!(
|
||||
use frame_system as system;
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Test where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module, Call, Event},
|
||||
Balances: balances::{Module, Call, Event<T>, Config<T>, Error},
|
||||
Balances: pallet_balances::{Module, Call, Event<T>, Config<T>, Error},
|
||||
Elections: elections::{Module, Call, Event<T>, Config<T>},
|
||||
}
|
||||
);
|
||||
@@ -210,7 +211,7 @@ impl ExtBuilder {
|
||||
PRESENT_SLASH_PER_VOTER.with(|v| *v.borrow_mut() = self.bad_presentation_punishment);
|
||||
DECAY_RATIO.with(|v| *v.borrow_mut() = self.decay_ratio);
|
||||
GenesisConfig {
|
||||
balances: Some(balances::GenesisConfig::<Test>{
|
||||
pallet_balances: Some(pallet_balances::GenesisConfig::<Test>{
|
||||
balances: vec![
|
||||
(1, 10 * self.balance_factor),
|
||||
(2, 20 * self.balance_factor),
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use crate::mock::*;
|
||||
use crate::*;
|
||||
|
||||
use support::{assert_ok, assert_err, assert_noop};
|
||||
use frame_support::{assert_ok, assert_err, assert_noop};
|
||||
|
||||
#[test]
|
||||
fn params_should_work() {
|
||||
|
||||
Reference in New Issue
Block a user