Rename pallet trait Trait to Config (#7599)

* rename Trait to Config

* add test asserting using Trait is still valid.

* fix ui tests
This commit is contained in:
Guillaume Thiolliere
2020-11-30 15:34:54 +01:00
committed by GitHub
parent dd3c84c362
commit 1cbfc9257f
200 changed files with 1767 additions and 1607 deletions
@@ -41,10 +41,10 @@ use sp_runtime::traits::{One, StaticLookup};
const MAX_VALIDATORS: u32 = 1000;
pub struct Module<T: Trait>(pallet_session::Module<T>);
pub trait Trait: pallet_session::Trait + pallet_session::historical::Trait + pallet_staking::Trait {}
pub struct Module<T: Config>(pallet_session::Module<T>);
pub trait Config: pallet_session::Config + pallet_session::historical::Config + pallet_staking::Config {}
impl<T: Trait> OnInitialize<T::BlockNumber> for Module<T> {
impl<T: Config> OnInitialize<T::BlockNumber> for Module<T> {
fn on_initialize(n: T::BlockNumber) -> frame_support::weights::Weight {
pallet_session::Module::<T>::on_initialize(n)
}
@@ -121,7 +121,7 @@ benchmarks! {
/// Sets up the benchmark for checking a membership proof. It creates the given
/// number of validators, sets random session keys and then creates a membership
/// proof for the first authority and returns its key and the proof.
fn check_membership_proof_setup<T: Trait>(
fn check_membership_proof_setup<T: Config>(
n: u32,
) -> (
(sp_runtime::KeyTypeId, &'static [u8; 32]),
@@ -45,7 +45,7 @@ impl_outer_dispatch! {
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct Test;
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Index = AccountIndex;
@@ -75,7 +75,7 @@ impl frame_system::Trait for Test {
parameter_types! {
pub const ExistentialDeposit: Balance = 10;
}
impl pallet_balances::Trait for Test {
impl pallet_balances::Config for Test {
type MaxLocks = ();
type Balance = Balance;
type Event = ();
@@ -88,13 +88,13 @@ impl pallet_balances::Trait for Test {
parameter_types! {
pub const MinimumPeriod: u64 = 5;
}
impl pallet_timestamp::Trait for Test {
impl pallet_timestamp::Config for Test {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
impl pallet_session::historical::Trait for Test {
impl pallet_session::historical::Config for Test {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Test>;
}
@@ -120,7 +120,7 @@ impl pallet_session::SessionHandler<AccountId> for TestSessionHandler {
fn on_disabled(_: usize) {}
}
impl pallet_session::Trait for Test {
impl pallet_session::Config for Test {
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Test, Staking>;
type Keys = SessionKeys;
type ShouldEndSession = pallet_session::PeriodicSessions<(), ()>;
@@ -157,7 +157,7 @@ impl<C> frame_system::offchain::SendTransactionTypes<C> for Test where
type Extrinsic = Extrinsic;
}
impl pallet_staking::Trait for Test {
impl pallet_staking::Config for Test {
type Currency = Balances;
type UnixTime = pallet_timestamp::Module<Self>;
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
@@ -182,7 +182,7 @@ impl pallet_staking::Trait for Test {
type WeightInfo = ();
}
impl crate::Trait for Test {}
impl crate::Config for Test {}
pub fn new_test_ext() -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();