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
+9 -9
View File
@@ -139,9 +139,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 frame_system::Trait>::AccountId>>::Balance;
type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
type NegativeImbalanceOf<T> =
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
/// Index used to access chunks.
type SetIndex = u32;
@@ -152,8 +152,8 @@ type ApprovalFlag = u32;
/// Number of approval flags that can fit into [`ApprovalFlag`] type.
const APPROVAL_FLAG_LEN: usize = 32;
pub trait Trait: frame_system::Trait {
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
/// Identifier for the elections pallet's lock
type ModuleId: Get<LockIdentifier>;
@@ -218,7 +218,7 @@ pub trait Trait: frame_system::Trait {
}
decl_storage! {
trait Store for Module<T: Trait> as Elections {
trait Store for Module<T: Config> as Elections {
// ---- parameters
/// How long to give each top candidate to present themselves after the vote ends.
@@ -286,7 +286,7 @@ decl_storage! {
decl_error! {
/// Error for the elections module.
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Reporter must be a voter.
NotVoter,
/// Target for inactivity cleanup must be active.
@@ -345,7 +345,7 @@ decl_error! {
}
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 {
type Error = Error<T>;
/// How much should be locked up in order to submit one's candidacy. A reasonable
@@ -706,7 +706,7 @@ decl_module! {
}
decl_event!(
pub enum Event<T> where <T as frame_system::Trait>::AccountId {
pub enum Event<T> where <T as frame_system::Config>::AccountId {
/// Reaped \[voter, reaper\].
VoterReaped(AccountId, AccountId),
/// Slashed \[reaper\].
@@ -719,7 +719,7 @@ decl_event!(
}
);
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
// exposed immutables.
/// True if we're currently in a presentation period.