Skip to content

Commit f7f1b1e

Browse files
authored
Rename pallet trait Trait to Config (#7599)
* rename Trait to Config * add test asserting using Trait is still valid. * fix ui tests
1 parent bb5dfba commit f7f1b1e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
//! # Recovery Pallet
1919
//!
20-
//! - [`recovery::Trait`](./trait.Trait.html)
20+
//! - [`recovery::Config`](./trait.Config.html)
2121
//! - [`Call`](./enum.Call.html)
2222
//!
2323
//! ## Overview
@@ -172,12 +172,12 @@ mod mock;
172172
mod tests;
173173

174174
type BalanceOf<T> =
175-
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
175+
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
176176

177177
/// Configuration trait.
178-
pub trait Trait: frame_system::Trait {
178+
pub trait Config: frame_system::Config {
179179
/// The overarching event type.
180-
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
180+
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
181181

182182
/// The overarching call type.
183183
type Call: Parameter + Dispatchable<Origin=Self::Origin, PostInfo=PostDispatchInfo> + GetDispatchInfo;
@@ -237,7 +237,7 @@ pub struct RecoveryConfig<BlockNumber, Balance, AccountId> {
237237
}
238238

239239
decl_storage! {
240-
trait Store for Module<T: Trait> as Recovery {
240+
trait Store for Module<T: Config> as Recovery {
241241
/// The set of recoverable accounts and their recovery configuration.
242242
pub Recoverable get(fn recovery_config):
243243
map hasher(twox_64_concat) T::AccountId
@@ -262,7 +262,7 @@ decl_storage! {
262262
decl_event! {
263263
/// Events type.
264264
pub enum Event<T> where
265-
AccountId = <T as system::Trait>::AccountId,
265+
AccountId = <T as system::Config>::AccountId,
266266
{
267267
/// A recovery process has been set up for an \[account\].
268268
RecoveryCreated(AccountId),
@@ -284,7 +284,7 @@ decl_event! {
284284
}
285285

286286
decl_error! {
287-
pub enum Error for Module<T: Trait> {
287+
pub enum Error for Module<T: Config> {
288288
/// User is not allowed to make a call on behalf of this account
289289
NotAllowed,
290290
/// Threshold must be greater than zero
@@ -321,7 +321,7 @@ decl_error! {
321321
}
322322

323323
decl_module! {
324-
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
324+
pub struct Module<T: Config> for enum Call where origin: T::Origin {
325325
type Error = Error<T>;
326326

327327
/// The base amount of currency needed to reserve for creating a recovery configuration.
@@ -361,7 +361,7 @@ decl_module! {
361361
)]
362362
fn as_recovered(origin,
363363
account: T::AccountId,
364-
call: Box<<T as Trait>::Call>
364+
call: Box<<T as Config>::Call>
365365
) -> DispatchResult {
366366
let who = ensure_signed(origin)?;
367367
// Check `who` is allowed to make a call on behalf of `account`
@@ -677,7 +677,7 @@ decl_module! {
677677
}
678678
}
679679

680-
impl<T: Trait> Module<T> {
680+
impl<T: Config> Module<T> {
681681
/// Check that friends list is sorted and has no duplicates.
682682
fn is_sorted_and_unique(friends: &Vec<T::AccountId>) -> bool {
683683
friends.windows(2).all(|w| w[0] < w[1])

src/mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ parameter_types! {
5858
pub const AvailableBlockRatio: Perbill = Perbill::one();
5959
}
6060

61-
impl frame_system::Trait for Test {
61+
impl frame_system::Config for Test {
6262
type BaseCallFilter = ();
6363
type Origin = Origin;
6464
type Call = Call;
@@ -90,7 +90,7 @@ parameter_types! {
9090
pub const ExistentialDeposit: u64 = 1;
9191
}
9292

93-
impl pallet_balances::Trait for Test {
93+
impl pallet_balances::Config for Test {
9494
type MaxLocks = ();
9595
type Balance = u128;
9696
type DustRemoval = ();
@@ -107,7 +107,7 @@ parameter_types! {
107107
pub const RecoveryDeposit: u64 = 10;
108108
}
109109

110-
impl Trait for Test {
110+
impl Config for Test {
111111
type Event = TestEvent;
112112
type Call = Call;
113113
type Currency = Balances;

0 commit comments

Comments
 (0)