Renames of Trait to Config in README.md, weight templates and few minor ones (#7636)

* manual rename

* renamse in README.md

* fix template
This commit is contained in:
Guillaume Thiolliere
2020-11-30 21:33:49 +01:00
committed by GitHub
parent 35efc8e4b0
commit 15b0dece54
36 changed files with 115 additions and 115 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
The Session module allows validators to manage their session keys, provides a function for changing
the session length, and handles session rotation.
- [`session::Trait`](https://docs.rs/pallet-session/latest/pallet_session/trait.Trait.html)
- [`session::Config`](https://docs.rs/pallet-session/latest/pallet_session/trait.Config.html)
- [`Call`](https://docs.rs/pallet-session/latest/pallet_session/enum.Call.html)
- [`Module`](https://docs.rs/pallet-session/latest/pallet_session/struct.Module.html)
@@ -71,7 +71,7 @@ The [Staking pallet](https://docs.rs/pallet-staking/latest/pallet_staking/) uses
```rust
use pallet_session as session;
fn validators<T: pallet_session::Trait>() -> Vec<<T as pallet_session::Trait>::ValidatorId> {
fn validators<T: pallet_session::Config>() -> Vec<<T as pallet_session::Config>::ValidatorId> {
<pallet_session::Module<T>>::validators()
}
```
@@ -189,12 +189,12 @@ mod tests {
#[test]
fn encode_decode_roundtrip() {
use codec::{Decode, Encode};
use super::super::super::Config as SessionTrait;
use super::super::Config as HistoricalTrait;
use super::super::super::Config as SessionConfig;
use super::super::Config as HistoricalConfig;
let sample = (
22u32 as <Test as SessionTrait>::ValidatorId,
7_777_777 as <Test as HistoricalTrait>::FullIdentification);
22u32 as <Test as SessionConfig>::ValidatorId,
7_777_777 as <Test as HistoricalConfig>::FullIdentification);
let encoded = sample.encode();
let decoded = Decode::decode(&mut encoded.as_slice()).expect("Must decode");
@@ -20,9 +20,9 @@
use codec::Encode;
use sp_runtime::traits::Convert;
use super::super::Config as SessionTrait;
use super::super::Config as SessionConfig;
use super::super::{Module as SessionModule, SessionIndex};
use super::Config as HistoricalTrait;
use super::Config as HistoricalConfig;
use super::shared;
use sp_std::prelude::*;
@@ -35,14 +35,14 @@ use sp_std::prelude::*;
/// `on_initialize(..)` or `on_finalization(..)`.
/// **Must** be called during the session, which validator-set is to be stored for further
/// off-chain processing. Otherwise the `FullIdentification` might not be available.
pub fn store_session_validator_set_to_offchain<T: HistoricalTrait + SessionTrait>(
pub fn store_session_validator_set_to_offchain<T: HistoricalConfig + SessionConfig>(
session_index: SessionIndex,
) {
let encoded_validator_list = <SessionModule<T>>::validators()
.into_iter()
.filter_map(|validator_id: <T as SessionTrait>::ValidatorId| {
.filter_map(|validator_id: <T as SessionConfig>::ValidatorId| {
let full_identification =
<<T as HistoricalTrait>::FullIdentificationOf>::convert(validator_id.clone());
<<T as HistoricalConfig>::FullIdentificationOf>::convert(validator_id.clone());
full_identification.map(|full_identification| (validator_id, full_identification))
})
.collect::<Vec<_>>();
@@ -57,6 +57,6 @@ pub fn store_session_validator_set_to_offchain<T: HistoricalTrait + SessionTrait
///
/// See [`fn store_session_validator_set_...(..)`](Self::store_session_validator_set_to_offchain)
/// for further information and restrictions.
pub fn store_current_session_validator_set_to_offchain<T: HistoricalTrait + SessionTrait>() {
pub fn store_current_session_validator_set_to_offchain<T: HistoricalConfig + SessionConfig>() {
store_session_validator_set_to_offchain::<T>(<SessionModule<T>>::current_index());
}