Companion: Rename pallet trait Trait to Config (#2014)

* rename Trait -> Config

* revert diener changes

* rename HostConfig to ActiveConfig as more meaningful

* fix merge

* "Update Substrate"

* cargo update -p sp-io

Co-authored-by: parity-processbot <>
This commit is contained in:
Guillaume Thiolliere
2020-11-30 16:13:43 +01:00
committed by GitHub
parent 7df537fcdd
commit 2d4aa3a42e
76 changed files with 613 additions and 613 deletions
+33 -33
View File
@@ -127,7 +127,7 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}
impl frame_system::Trait for Runtime {
impl frame_system::Config for Runtime {
type BaseCallFilter = BaseFilter;
type Origin = Origin;
type Call = Call;
@@ -159,7 +159,7 @@ parameter_types! {
pub const MaxScheduledPerBlock: u32 = 50;
}
impl pallet_scheduler::Trait for Runtime {
impl pallet_scheduler::Config for Runtime {
type Event = Event;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
@@ -175,7 +175,7 @@ parameter_types! {
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
}
impl pallet_babe::Trait for Runtime {
impl pallet_babe::Config for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
@@ -204,7 +204,7 @@ parameter_types! {
pub const IndexDeposit: Balance = 1 * DOLLARS;
}
impl pallet_indices::Trait for Runtime {
impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex;
type Currency = Balances;
type Deposit = IndexDeposit;
@@ -217,7 +217,7 @@ parameter_types! {
pub const MaxLocks: u32 = 50;
}
impl pallet_balances::Trait for Runtime {
impl pallet_balances::Config for Runtime {
type Balance = Balance;
type DustRemoval = ();
type Event = Event;
@@ -231,7 +231,7 @@ parameter_types! {
pub const TransactionByteFee: Balance = 10 * MILLICENTS;
}
impl pallet_transaction_payment::Trait for Runtime {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Self>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
@@ -241,7 +241,7 @@ impl pallet_transaction_payment::Trait for Runtime {
parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}
impl pallet_timestamp::Trait for Runtime {
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Babe;
type MinimumPeriod = MinimumPeriod;
@@ -253,7 +253,7 @@ parameter_types! {
}
// TODO: substrate#2986 implement this properly
impl pallet_authorship::Trait for Runtime {
impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
type UncleGenerations = UncleGenerations;
type FilterUncle = ();
@@ -279,7 +279,7 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl pallet_session::Trait for Runtime {
impl pallet_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
@@ -292,7 +292,7 @@ impl pallet_session::Trait for Runtime {
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}
impl pallet_session::historical::Trait for Runtime {
impl pallet_session::historical::Config for Runtime {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}
@@ -337,7 +337,7 @@ type SlashCancelOrigin = EnsureOneOf<
pallet_collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>
>;
impl pallet_staking::Trait for Runtime {
impl pallet_staking::Config for Runtime {
type Currency = Balances;
type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote;
@@ -379,7 +379,7 @@ parameter_types! {
pub const MaxProposals: u32 = 100;
}
impl pallet_democracy::Trait for Runtime {
impl pallet_democracy::Config for Runtime {
type Proposal = Call;
type Event = Event;
type Currency = Balances;
@@ -435,7 +435,7 @@ parameter_types! {
}
type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Trait<CouncilCollective> for Runtime {
impl pallet_collective::Config<CouncilCollective> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
@@ -458,7 +458,7 @@ parameter_types! {
// Make sure that there are no more than MaxMembers members elected via phragmen.
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
impl pallet_elections_phragmen::Trait for Runtime {
impl pallet_elections_phragmen::Config for Runtime {
type Event = Event;
type Currency = Balances;
type ChangeMembers = Council;
@@ -483,7 +483,7 @@ parameter_types! {
}
type TechnicalCollective = pallet_collective::Instance2;
impl pallet_collective::Trait<TechnicalCollective> for Runtime {
impl pallet_collective::Config<TechnicalCollective> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
@@ -494,7 +494,7 @@ impl pallet_collective::Trait<TechnicalCollective> for Runtime {
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
}
impl pallet_membership::Trait<pallet_membership::Instance1> for Runtime {
impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type Event = Event;
type AddOrigin = MoreThanHalfCouncil;
type RemoveOrigin = MoreThanHalfCouncil;
@@ -530,7 +530,7 @@ type ApproveOrigin = EnsureOneOf<
pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>
>;
impl pallet_treasury::Trait for Runtime {
impl pallet_treasury::Config for Runtime {
type ModuleId = TreasuryModuleId;
type Currency = Balances;
type ApproveOrigin = ApproveOrigin;
@@ -560,14 +560,14 @@ parameter_types! {
pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get();
}
impl pallet_offences::Trait for Runtime {
impl pallet_offences::Config for Runtime {
type Event = Event;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
}
impl pallet_authority_discovery::Trait for Runtime {}
impl pallet_authority_discovery::Config for Runtime {}
parameter_types! {
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
@@ -579,7 +579,7 @@ parameter_types! {
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
}
impl pallet_im_online::Trait for Runtime {
impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type ReportUnresponsiveness = Offences;
@@ -588,7 +588,7 @@ impl pallet_im_online::Trait for Runtime {
type WeightInfo = weights::pallet_im_online::WeightInfo<Runtime>;
}
impl pallet_grandpa::Trait for Runtime {
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;
@@ -616,7 +616,7 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
call: Call,
public: <Signature as Verify>::Signer,
account: AccountId,
nonce: <Runtime as frame_system::Trait>::Index,
nonce: <Runtime as frame_system::Config>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
// take the biggest period possible.
let period = BlockHashCount::get()
@@ -666,7 +666,7 @@ parameter_types! {
pub Prefix: &'static [u8] = b"Pay KSMs to the Kusama account:";
}
impl claims::Trait for Runtime {
impl claims::Config for Runtime {
type Event = Event;
type VestingSchedule = Vesting;
type Prefix = Prefix;
@@ -683,7 +683,7 @@ parameter_types! {
pub const MaxRegistrars: u32 = 20;
}
impl pallet_identity::Trait for Runtime {
impl pallet_identity::Config for Runtime {
type Event = Event;
type Currency = Balances;
type Slashed = Treasury;
@@ -698,7 +698,7 @@ impl pallet_identity::Trait for Runtime {
type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
}
impl pallet_utility::Trait for Runtime {
impl pallet_utility::Config for Runtime {
type Event = Event;
type Call = Call;
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
@@ -712,7 +712,7 @@ parameter_types! {
pub const MaxSignatories: u16 = 100;
}
impl pallet_multisig::Trait for Runtime {
impl pallet_multisig::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
@@ -729,7 +729,7 @@ parameter_types! {
pub const RecoveryDeposit: Balance = 5 * DOLLARS;
}
impl pallet_recovery::Trait for Runtime {
impl pallet_recovery::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
@@ -750,7 +750,7 @@ parameter_types! {
pub const SocietyModuleId: ModuleId = ModuleId(*b"py/socie");
}
impl pallet_society::Trait for Runtime {
impl pallet_society::Config for Runtime {
type Event = Event;
type Currency = Balances;
type Randomness = RandomnessCollectiveFlip;
@@ -771,7 +771,7 @@ parameter_types! {
pub const MinVestedTransfer: Balance = 100 * DOLLARS;
}
impl pallet_vesting::Trait for Runtime {
impl pallet_vesting::Config for Runtime {
type Event = Event;
type Currency = Balances;
type BlockNumberToBalance = ConvertInto;
@@ -874,7 +874,7 @@ impl InstanceFilter<Call> for ProxyType {
}
}
impl pallet_proxy::Trait for Runtime {
impl pallet_proxy::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
@@ -1248,9 +1248,9 @@ sp_api::impl_runtime_apis! {
use pallet_offences_benchmarking::Module as OffencesBench;
use frame_system_benchmarking::Module as SystemBench;
impl pallet_session_benchmarking::Trait for Runtime {}
impl pallet_offences_benchmarking::Trait for Runtime {}
impl frame_system_benchmarking::Trait for Runtime {}
impl pallet_session_benchmarking::Config for Runtime {}
impl pallet_offences_benchmarking::Config for Runtime {}
impl frame_system_benchmarking::Config for Runtime {}
let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for frame_system.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> frame_system::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
fn remark(_b: u32, ) -> Weight {
(1_815_000 as Weight)
}
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_balances.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_balances::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
fn transfer() -> Weight {
(91_625_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_collective.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_collective::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
fn set_members(m: u32, n: u32, p: u32, ) -> Weight {
(0 as Weight)
.saturating_add((20_744_000 as Weight).saturating_mul(m as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_democracy.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_democracy::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_democracy::WeightInfo for WeightInfo<T> {
fn propose() -> Weight {
(73_769_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_elections_phragmen.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_elections_phragmen::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightInfo<T> {
fn vote(v: u32, ) -> Weight {
(83_050_000 as Weight)
.saturating_add((124_000 as Weight).saturating_mul(v as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_identity.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_identity::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
fn add_registrar(r: u32, ) -> Weight {
(26_618_000 as Weight)
.saturating_add((318_000 as Weight).saturating_mul(r as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_im_online.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_im_online::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_im_online::WeightInfo for WeightInfo<T> {
fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight {
(108_140_000 as Weight)
.saturating_add((217_000 as Weight).saturating_mul(k as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_indices.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_indices::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_indices::WeightInfo for WeightInfo<T> {
fn claim() -> Weight {
(51_086_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_multisig.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_multisig::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
fn as_multi_threshold_1(z: u32, ) -> Weight {
(12_168_000 as Weight)
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_proxy.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_proxy::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
fn proxy(p: u32, ) -> Weight {
(30_797_000 as Weight)
.saturating_add((182_000 as Weight).saturating_mul(p as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_scheduler.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_scheduler::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_scheduler::WeightInfo for WeightInfo<T> {
fn schedule(s: u32, ) -> Weight {
(33_450_000 as Weight)
.saturating_add((48_000 as Weight).saturating_mul(s as Weight))
@@ -41,7 +41,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_session.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_session::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
fn set_keys() -> Weight {
(89_426_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_staking.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_staking::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
fn bond() -> Weight {
(91_974_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_timestamp.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_timestamp::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> {
fn set() -> Weight {
(10_514_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_treasury.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_treasury::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
fn propose_spend() -> Weight {
(52_217_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_utility.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_utility::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
fn batch(c: u32, ) -> Weight {
(18_717_000 as Weight)
.saturating_add((1_995_000 as Weight).saturating_mul(c as Weight))
@@ -43,7 +43,7 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_vesting.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> pallet_vesting::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_vesting::WeightInfo for WeightInfo<T> {
fn vest_locked(l: u32, ) -> Weight {
(54_477_000 as Weight)
.saturating_add((129_000 as Weight).saturating_mul(l as Weight))