Skip to content

Commit e4274e3

Browse files
gui1117darkfriend77
authored andcommitted
Renames of Trait to Config in README.md, weight templates and few minor ones (paritytech#7636)
* manual rename * renamse in README.md * fix template
1 parent fbf7e76 commit e4274e3

File tree

36 files changed

+115
-115
lines changed

36 files changed

+115
-115
lines changed

.maintain/frame-weight-template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub trait WeightInfo {
4545

4646
/// Weights for {{pallet}} using the Substrate node and recommended hardware.
4747
pub struct SubstrateWeight<T>(PhantomData<T>);
48-
impl<T: frame_system::Trait> WeightInfo for SubstrateWeight<T> {
48+
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
4949
{{~#each benchmarks as |benchmark|}}
5050
fn {{benchmark.name~}}
5151
(

bin/node-template/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Review the [FRAME runtime implementation](./runtime/src/lib.rs) included in this
157157
the following:
158158

159159
- This file configures several pallets to include in the runtime. Each pallet configuration is
160-
defined by a code block that begins with `impl $PALLET_NAME::Trait for Runtime`.
160+
defined by a code block that begins with `impl $PALLET_NAME::Config for Runtime`.
161161
- The pallets are composed into a single runtime by way of the
162162
[`construct_runtime!`](https://crates.parity.io/frame_support/macro.construct_runtime.html)
163163
macro, which is part of the core
@@ -181,8 +181,8 @@ A FRAME pallet is compromised of a number of blockchain primitives:
181181
- Events: Substrate uses [events](https://substrate.dev/docs/en/knowledgebase/runtime/events) to
182182
notify users of important changes in the runtime.
183183
- Errors: When a dispatchable fails, it returns an error.
184-
- Trait: The `Trait` configuration interface is used to define the types and parameters upon which
185-
a FRAME pallet depends.
184+
- Config: The `Config` configuration interface is used to define the types and parameters upon
185+
which a FRAME pallet depends.
186186

187187
## Generate a Custom Node Template
188188

frame/assets/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ with a fixed supply, including:
1111
* Asset Transfer
1212
* Asset Destruction
1313

14-
To use it in your runtime, you need to implement the assets [`Trait`](https://docs.rs/pallet-assets/latest/pallet_assets/trait.Trait.html).
14+
To use it in your runtime, you need to implement the assets [`Config`](https://docs.rs/pallet-assets/latest/pallet_assets/trait.Config.html).
1515

1616
The supported dispatchable functions are documented in the [`Call`](https://docs.rs/pallet-assets/latest/pallet_assets/enum.Call.html) enum.
1717

@@ -72,10 +72,10 @@ use pallet_assets as assets;
7272
use frame_support::{decl_module, dispatch, ensure};
7373
use frame_system::ensure_signed;
7474

75-
pub trait Trait: assets::Trait { }
75+
pub trait Config: assets::Config { }
7676

7777
decl_module! {
78-
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
78+
pub struct Module<T: Config> for enum Call where origin: T::Origin {
7979
pub fn issue_token_airdrop(origin) -> dispatch::DispatchResult {
8080
let sender = ensure_signed(origin).map_err(|e| e.as_str())?;
8181

@@ -106,7 +106,7 @@ Below are assumptions that must be held when using this module. If any of
106106
them are violated, the behavior of this module is undefined.
107107

108108
* The total count of assets should be less than
109-
`Trait::AssetId::max_value()`.
109+
`Config::AssetId::max_value()`.
110110

111111
## Related Modules
112112

frame/atomic-swap/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A module for atomically sending funds.
44

5-
- [`atomic_swap::Trait`](https://docs.rs/pallet-atomic-swap/latest/pallet_atomic_swap/trait.Trait.html)
5+
- [`atomic_swap::Config`](https://docs.rs/pallet-atomic-swap/latest/pallet_atomic_swap/trait.Config.html)
66
- [`Call`](https://docs.rs/pallet-atomic-swap/latest/pallet_atomic_swap/enum.Call.html)
77
- [`Module`](https://docs.rs/pallet-atomic-swap/latest/pallet_atomic_swap/struct.Module.html)
88

frame/aura/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Aura Module
22

3-
- [`aura::Trait`](https://docs.rs/pallet-aura/latest/pallet_aura/trait.Trait.html)
3+
- [`aura::Config`](https://docs.rs/pallet-aura/latest/pallet_aura/trait.Config.html)
44
- [`Module`](https://docs.rs/pallet-aura/latest/pallet_aura/struct.Module.html)
55

66
## Overview

frame/balances/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The Balances module provides functionality for handling accounts and balances.
44

5-
- [`balances::Trait`](https://docs.rs/pallet-balances/latest/pallet_balances/trait.Trait.html)
5+
- [`balances::Config`](https://docs.rs/pallet-balances/latest/pallet_balances/trait.Config.html)
66
- [`Call`](https://docs.rs/pallet-balances/latest/pallet_balances/enum.Call.html)
77
- [`Module`](https://docs.rs/pallet-balances/latest/pallet_balances/struct.Module.html)
88

@@ -83,8 +83,8 @@ The Contract module uses the `Currency` trait to handle gas payment, and its typ
8383
```rust
8484
use frame_support::traits::Currency;
8585

86-
pub type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
87-
pub type NegativeImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
86+
pub type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
87+
pub type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
8888

8989
```
9090

@@ -93,11 +93,11 @@ The Staking module uses the `LockableCurrency` trait to lock a stash account's f
9393
```rust
9494
use frame_support::traits::{WithdrawReasons, LockableCurrency};
9595
use sp_runtime::traits::Bounded;
96-
pub trait Trait: frame_system::Trait {
96+
pub trait Config: frame_system::Config {
9797
type Currency: LockableCurrency<Self::AccountId, Moment=Self::BlockNumber>;
9898
}
9999

100-
fn update_ledger<T: Trait>(
100+
fn update_ledger<T: Config>(
101101
controller: &T::AccountId,
102102
ledger: &StakingLedger<T>
103103
) {
@@ -117,6 +117,6 @@ The Balances module depends on the [`GenesisConfig`](https://docs.rs/pallet-bala
117117

118118
## Assumptions
119119

120-
* Total issued balanced of all accounts should be less than `Trait::Balance::max_value()`.
120+
* Total issued balanced of all accounts should be less than `Config::Balance::max_value()`.
121121

122122
License: Apache-2.0

frame/benchmarking/src/tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ use frame_system::{RawOrigin, ensure_signed, ensure_none};
3030

3131
decl_storage! {
3232
trait Store for Module<T: Config> as Test where
33-
<T as OtherTrait>::OtherEvent: Into<<T as Config>::Event>
33+
<T as OtherConfig>::OtherEvent: Into<<T as Config>::Event>
3434
{
3535
Value get(fn value): Option<u32>;
3636
}
3737
}
3838

3939
decl_module! {
4040
pub struct Module<T: Config> for enum Call where
41-
origin: T::Origin, <T as OtherTrait>::OtherEvent: Into<<T as Config>::Event>
41+
origin: T::Origin, <T as OtherConfig>::OtherEvent: Into<<T as Config>::Event>
4242
{
4343
#[weight = 0]
4444
fn set_value(origin, n: u32) -> DispatchResult {
@@ -59,11 +59,11 @@ impl_outer_origin! {
5959
pub enum Origin for Test where system = frame_system {}
6060
}
6161

62-
pub trait OtherTrait {
62+
pub trait OtherConfig {
6363
type OtherEvent;
6464
}
6565

66-
pub trait Config: frame_system::Config + OtherTrait
66+
pub trait Config: frame_system::Config + OtherConfig
6767
where Self::OtherEvent: Into<<Self as Config>::Event>
6868
{
6969
type Event;
@@ -104,7 +104,7 @@ impl Config for Test {
104104
type Event = ();
105105
}
106106

107-
impl OtherTrait for Test {
107+
impl OtherConfig for Test {
108108
type OtherEvent = ();
109109
}
110110

@@ -113,7 +113,7 @@ fn new_test_ext() -> sp_io::TestExternalities {
113113
}
114114

115115
benchmarks!{
116-
where_clause { where <T as OtherTrait>::OtherEvent: Into<<T as Config>::Event> }
116+
where_clause { where <T as OtherConfig>::OtherEvent: Into<<T as Config>::Event> }
117117

118118
_ {
119119
// Define a common range for `b`.

frame/contracts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The Contract module provides functionality for the runtime to deploy and execute WebAssembly smart-contracts.
44

5-
- [`contract::Trait`](https://docs.rs/pallet-contracts/latest/pallet_contracts/trait.Trait.html)
5+
- [`contract::Config`](https://docs.rs/pallet-contracts/latest/pallet_contracts/trait.Config.html)
66
- [`Call`](https://docs.rs/pallet-contracts/latest/pallet_contracts/enum.Call.html)
77

88
## Overview

frame/democracy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Democracy Pallet
22

3-
- [`democracy::Trait`](https://docs.rs/pallet-democracy/latest/pallet_democracy/trait.Trait.html)
3+
- [`democracy::Config`](https://docs.rs/pallet-democracy/latest/pallet_democracy/trait.Config.html)
44
- [`Call`](https://docs.rs/pallet-democracy/latest/pallet_democracy/enum.Call.html)
55

66
## Overview

frame/elections-phragmen/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ being re-elected at the end of each round.
6060

6161
### Module Information
6262

63-
- [`election_sp_phragmen::Trait`](https://docs.rs/pallet-elections-phragmen/latest/pallet_elections_phragmen/trait.Trait.html)
63+
- [`election_sp_phragmen::Config`](https://docs.rs/pallet-elections-phragmen/latest/pallet_elections_phragmen/trait.Config.html)
6464
- [`Call`](https://docs.rs/pallet-elections-phragmen/latest/pallet_elections_phragmen/enum.Call.html)
6565
- [`Module`](https://docs.rs/pallet-elections-phragmen/latest/pallet_elections_phragmen/struct.Module.html)
6666

0 commit comments

Comments
 (0)