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
+10 -10
View File
@@ -28,10 +28,10 @@ use frame_support::{decl_module, decl_storage};
use sp_authority_discovery::AuthorityId;
/// The module's config trait.
pub trait Trait: frame_system::Trait + pallet_session::Trait {}
pub trait Config: frame_system::Config + pallet_session::Config {}
decl_storage! {
trait Store for Module<T: Trait> as AuthorityDiscovery {
trait Store for Module<T: Config> as AuthorityDiscovery {
/// Keys of the current and next authority set.
Keys get(fn keys): Vec<AuthorityId>;
}
@@ -42,11 +42,11 @@ decl_storage! {
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
pub struct Module<T: Config> for enum Call where origin: T::Origin {
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Retrieve authority identifiers of the current and next authority set.
pub fn authorities() -> Vec<AuthorityId> {
Keys::get()
@@ -60,11 +60,11 @@ impl<T: Trait> Module<T> {
}
}
impl<T: Trait> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
type Public = AuthorityId;
}
impl<T: Trait> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
impl<T: Config> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
type Key = AuthorityId;
fn on_genesis_session<'a, I: 'a>(authorities: I)
@@ -107,13 +107,13 @@ mod tests {
#[derive(Clone, Eq, PartialEq)]
pub struct Test;
impl Trait for Test {}
impl Config for Test {}
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
}
impl pallet_session::Trait for Test {
impl pallet_session::Config for Test {
type SessionManager = ();
type Keys = UintAuthorityId;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
@@ -126,7 +126,7 @@ mod tests {
type WeightInfo = ();
}
impl pallet_session::historical::Trait for Test {
impl pallet_session::historical::Config for Test {
type FullIdentification = ();
type FullIdentificationOf = ();
}
@@ -143,7 +143,7 @@ mod tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Index = u64;