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
+136 -136
View File
File diff suppressed because it is too large Load Diff
+27 -27
View File
@@ -37,13 +37,13 @@ use sp_runtime::{
};
use primitives::v1::ValidityError;
type CurrencyOf<T> = <<T as Trait>::VestingSchedule as VestingSchedule<<T as frame_system::Trait>::AccountId>>::Currency;
type BalanceOf<T> = <CurrencyOf<T> as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
type CurrencyOf<T> = <<T as Config>::VestingSchedule as VestingSchedule<<T as frame_system::Config>::AccountId>>::Currency;
type BalanceOf<T> = <CurrencyOf<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;
/// Configuration trait.
pub trait Trait: frame_system::Trait {
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
type VestingSchedule: VestingSchedule<Self::AccountId, Moment=Self::BlockNumber>;
type Prefix: Get<&'static [u8]>;
type MoveClaimOrigin: EnsureOrigin<Self::Origin>;
@@ -130,7 +130,7 @@ impl sp_std::fmt::Debug for EcdsaSignature {
decl_event!(
pub enum Event<T> where
Balance = BalanceOf<T>,
AccountId = <T as frame_system::Trait>::AccountId
AccountId = <T as frame_system::Config>::AccountId
{
/// Someone claimed some DOTs. [who, ethereum_address, amount]
Claimed(AccountId, EthereumAddress, Balance),
@@ -138,7 +138,7 @@ decl_event!(
);
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Invalid Ethereum signature.
InvalidEthereumSignature,
/// Ethereum address has no claim.
@@ -159,7 +159,7 @@ decl_storage! {
// A macro for the Storage trait, and its implementation, for this module.
// This allows for type-safe usage of the Substrate storage database, so you can
// keep things around between blocks.
trait Store for Module<T: Trait> as Claims {
trait Store for Module<T: Config> as Claims {
Claims get(fn claims) build(|config: &GenesisConfig<T>| {
config.claims.iter().map(|(a, b, _, _)| (a.clone(), b.clone())).collect::<Vec<_>>()
}): map hasher(identity) EthereumAddress => Option<BalanceOf<T>>;
@@ -194,7 +194,7 @@ decl_storage! {
}
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>;
/// The Prefix that is used in signed Ethereum messages for this network
@@ -426,7 +426,7 @@ fn to_ascii_hex(data: &[u8]) -> Vec<u8> {
r
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
// Constructs the message that Ethereum RPC's `personal_sign` and `eth_sign` would sign.
fn ethereum_signable_message(what: &[u8], extra: &[u8]) -> Vec<u8> {
let prefix = T::Prefix::get();
@@ -487,7 +487,7 @@ impl<T: Trait> Module<T> {
}
}
impl<T: Trait> sp_runtime::traits::ValidateUnsigned for Module<T> {
impl<T: Config> sp_runtime::traits::ValidateUnsigned for Module<T> {
type Call = Call<T>;
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
@@ -538,11 +538,11 @@ impl<T: Trait> sp_runtime::traits::ValidateUnsigned for Module<T> {
/// Validate `attest` calls prior to execution. Needed to avoid a DoS attack since they are
/// otherwise free to place on chain.
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
pub struct PrevalidateAttests<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>) where
<T as frame_system::Trait>::Call: IsSubType<Call<T>>;
pub struct PrevalidateAttests<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>) where
<T as frame_system::Config>::Call: IsSubType<Call<T>>;
impl<T: Trait + Send + Sync> Debug for PrevalidateAttests<T> where
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
impl<T: Config + Send + Sync> Debug for PrevalidateAttests<T> where
<T as frame_system::Config>::Call: IsSubType<Call<T>>
{
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
@@ -555,8 +555,8 @@ impl<T: Trait + Send + Sync> Debug for PrevalidateAttests<T> where
}
}
impl<T: Trait + Send + Sync> PrevalidateAttests<T> where
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
impl<T: Config + Send + Sync> PrevalidateAttests<T> where
<T as frame_system::Config>::Call: IsSubType<Call<T>>
{
/// Create new `SignedExtension` to check runtime version.
pub fn new() -> Self {
@@ -564,11 +564,11 @@ impl<T: Trait + Send + Sync> PrevalidateAttests<T> where
}
}
impl<T: Trait + Send + Sync> SignedExtension for PrevalidateAttests<T> where
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T> where
<T as frame_system::Config>::Call: IsSubType<Call<T>>
{
type AccountId = T::AccountId;
type Call = <T as frame_system::Trait>::Call;
type Call = <T as frame_system::Config>::Call;
type AdditionalSigned = ();
type Pre = ();
const IDENTIFIER: &'static str = "PrevalidateAttests";
@@ -615,7 +615,7 @@ mod secp_utils {
res.0.copy_from_slice(&keccak_256(&public(secret).serialize()[1..65])[12..]);
res
}
pub fn sig<T: Trait>(secret: &secp256k1::SecretKey, what: &[u8], extra: &[u8]) -> EcdsaSignature {
pub fn sig<T: Config>(secret: &secp256k1::SecretKey, what: &[u8], extra: &[u8]) -> EcdsaSignature {
let msg = keccak_256(&<super::Module<T>>::ethereum_signable_message(&to_ascii_hex(what)[..], extra));
let (sig, recovery_id) = secp256k1::sign(&secp256k1::Message::parse(&msg), secret);
let mut r = [0u8; 65];
@@ -665,7 +665,7 @@ mod tests {
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = Call;
@@ -697,7 +697,7 @@ mod tests {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -711,7 +711,7 @@ mod tests {
pub const MinVestedTransfer: u64 = 0;
}
impl pallet_vesting::Trait for Test {
impl pallet_vesting::Config for Test {
type Event = ();
type Currency = Balances;
type BlockNumberToBalance = Identity;
@@ -726,7 +726,7 @@ mod tests {
pub const Six: u64 = 6;
}
impl Trait for Test {
impl Config for Test {
type Event = ();
type VestingSchedule = Vesting;
type Prefix = Prefix;
@@ -1048,7 +1048,7 @@ mod tests {
fn claiming_while_vested_doesnt_work() {
new_test_ext().execute_with(|| {
// A user is already vested
assert_ok!(<Test as Trait>::VestingSchedule::add_vesting_schedule(&69, total_claims(), 100, 10));
assert_ok!(<Test as Config>::VestingSchedule::add_vesting_schedule(&69, total_claims(), 100, 10));
CurrencyOf::<Test>::make_free_balance_be(&69, total_claims());
assert_eq!(Balances::free_balance(69), total_claims());
assert_ok!(Claims::mint_claim(Origin::root(), eth(&bob()), 200, Some((50, 10, 1)), None));
@@ -1181,7 +1181,7 @@ mod benchmarking {
const MAX_CLAIMS: u32 = 10_000;
const VALUE: u32 = 1_000_000;
fn create_claim<T: Trait>(input: u32) -> DispatchResult {
fn create_claim<T: Config>(input: u32) -> DispatchResult {
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
let eth_address = eth(&secret_key);
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
@@ -1189,7 +1189,7 @@ mod benchmarking {
Ok(())
}
fn create_claim_attest<T: Trait>(input: u32) -> DispatchResult {
fn create_claim_attest<T: Config>(input: u32) -> DispatchResult {
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
let eth_address = eth(&secret_key);
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
+28 -28
View File
@@ -82,13 +82,13 @@ use sp_std::vec::Vec;
use primitives::v1::{Id as ParaId, HeadData};
pub type BalanceOf<T> =
<<T as slots::Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
<<T as slots::Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
#[allow(dead_code)]
pub type NegativeImbalanceOf<T> =
<<T as slots::Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
<<T as slots::Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
pub trait Trait: slots::Trait {
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
pub trait Config: slots::Config {
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
/// ModuleID for the crowdfund module. An appropriate value could be ```ModuleId(*b"py/cfund")```
type ModuleId: Get<ModuleId>;
@@ -164,7 +164,7 @@ pub struct FundInfo<AccountId, Balance, Hash, BlockNumber> {
}
decl_storage! {
trait Store for Module<T: Trait> as Crowdfund {
trait Store for Module<T: Config> as Crowdfund {
/// Info on all of the funds.
Funds get(fn funds):
map hasher(twox_64_concat) FundIndex
@@ -184,7 +184,7 @@ decl_storage! {
decl_event! {
pub enum Event<T> where
<T as frame_system::Trait>::AccountId,
<T as frame_system::Config>::AccountId,
Balance = BalanceOf<T>,
{
/// Create a new crowdfunding campaign. [fund_index]
@@ -205,7 +205,7 @@ decl_event! {
}
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Last slot must be greater than first slot.
LastSlotBeforeFirstSlot,
/// The last slot cannot be more then 3 slots after the first slot.
@@ -251,7 +251,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>;
const ModuleId: ModuleId = T::ModuleId::get();
@@ -528,7 +528,7 @@ decl_module! {
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// The account ID of the fund pot.
///
/// This actually does computation. If you need to keep using it, then make sure you cache the
@@ -599,7 +599,7 @@ mod tests {
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = ();
@@ -629,7 +629,7 @@ mod tests {
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -667,7 +667,7 @@ mod tests {
fn min_len() -> usize { 0 }
fn max_len() -> usize { 0 }
}
impl pallet_treasury::Trait for Test {
impl pallet_treasury::Config for Test {
type Currency = pallet_balances::Module<Test>;
type ApproveOrigin = frame_system::EnsureRoot<u64>;
type RejectOrigin = frame_system::EnsureRoot<u64>;
@@ -749,7 +749,7 @@ mod tests {
pub const LeasePeriod: u64 = 10;
pub const EndingPeriod: u64 = 3;
}
impl slots::Trait for Test {
impl slots::Config for Test {
type Event = ();
type Currency = Balances;
type Parachains = TestParachains;
@@ -763,7 +763,7 @@ mod tests {
pub const RetirementPeriod: u64 = 5;
pub const CrowdfundModuleId: ModuleId = ModuleId(*b"py/cfund");
}
impl Trait for Test {
impl Config for Test {
type Event = ();
type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution;
@@ -936,7 +936,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into()
));
@@ -947,7 +947,7 @@ mod tests {
assert_eq!(
fund.deploy_data,
Some(DeployData {
code_hash: <Test as frame_system::Trait>::Hash::default(),
code_hash: <Test as frame_system::Config>::Hash::default(),
code_size: 0,
initial_head_data: vec![0].into(),
}),
@@ -966,7 +966,7 @@ mod tests {
assert_noop!(Crowdfund::fix_deploy_data(
Origin::signed(2),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into()),
Error::<Test>::InvalidOrigin
@@ -976,7 +976,7 @@ mod tests {
assert_noop!(Crowdfund::fix_deploy_data(
Origin::signed(1),
1,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into()),
Error::<Test>::InvalidFundIndex
@@ -986,7 +986,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
@@ -994,7 +994,7 @@ mod tests {
assert_noop!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![1].into()),
Error::<Test>::ExistingDeployData
@@ -1014,7 +1014,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
@@ -1060,7 +1060,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
@@ -1088,7 +1088,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
@@ -1131,7 +1131,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
@@ -1273,7 +1273,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
@@ -1302,7 +1302,7 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
@@ -1341,14 +1341,14 @@ mod tests {
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
assert_ok!(Crowdfund::fix_deploy_data(
Origin::signed(2),
1,
<Test as frame_system::Trait>::Hash::default(),
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
+16 -16
View File
@@ -23,12 +23,12 @@ use crate::NegativeImbalance;
pub struct ToAuthor<R>(sp_std::marker::PhantomData<R>);
impl<R> OnUnbalanced<NegativeImbalance<R>> for ToAuthor<R>
where
R: pallet_balances::Trait + pallet_authorship::Trait,
<R as frame_system::Trait>::AccountId: From<primitives::v1::AccountId>,
<R as frame_system::Trait>::AccountId: Into<primitives::v1::AccountId>,
<R as frame_system::Trait>::Event: From<pallet_balances::RawEvent<
<R as frame_system::Trait>::AccountId,
<R as pallet_balances::Trait>::Balance,
R: pallet_balances::Config + pallet_authorship::Config,
<R as frame_system::Config>::AccountId: From<primitives::v1::AccountId>,
<R as frame_system::Config>::AccountId: Into<primitives::v1::AccountId>,
<R as frame_system::Config>::Event: From<pallet_balances::RawEvent<
<R as frame_system::Config>::AccountId,
<R as pallet_balances::Config>::Balance,
pallet_balances::DefaultInstance>
>,
{
@@ -43,13 +43,13 @@ where
pub struct DealWithFees<R>(sp_std::marker::PhantomData<R>);
impl<R> OnUnbalanced<NegativeImbalance<R>> for DealWithFees<R>
where
R: pallet_balances::Trait + pallet_treasury::Trait + pallet_authorship::Trait,
R: pallet_balances::Config + pallet_treasury::Config + pallet_authorship::Config,
pallet_treasury::Module<R>: OnUnbalanced<NegativeImbalance<R>>,
<R as frame_system::Trait>::AccountId: From<primitives::v1::AccountId>,
<R as frame_system::Trait>::AccountId: Into<primitives::v1::AccountId>,
<R as frame_system::Trait>::Event: From<pallet_balances::RawEvent<
<R as frame_system::Trait>::AccountId,
<R as pallet_balances::Trait>::Balance,
<R as frame_system::Config>::AccountId: From<primitives::v1::AccountId>,
<R as frame_system::Config>::AccountId: Into<primitives::v1::AccountId>,
<R as frame_system::Config>::Event: From<pallet_balances::RawEvent<
<R as frame_system::Config>::AccountId,
<R as pallet_balances::Config>::Balance,
pallet_balances::DefaultInstance>
>,
{
@@ -97,7 +97,7 @@ mod tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Index = u64;
@@ -125,7 +125,7 @@ mod tests {
type SystemWeightInfo = ();
}
impl pallet_balances::Trait for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -151,7 +151,7 @@ mod tests {
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
}
impl pallet_treasury::Trait for Test {
impl pallet_treasury::Config for Test {
type Currency = pallet_balances::Module<Test>;
type ApproveOrigin = frame_system::EnsureRoot<AccountId>;
type RejectOrigin = frame_system::EnsureRoot<AccountId>;
@@ -185,7 +185,7 @@ mod tests {
Some(Default::default())
}
}
impl pallet_authorship::Trait for Test {
impl pallet_authorship::Config for Test {
type FindAuthor = OneAuthor;
type UncleGenerations = ();
type FilterUncle = ();
+3 -3
View File
@@ -47,7 +47,7 @@ pub use pallet_balances::Call as BalancesCall;
/// Implementations of some helper traits passed into runtime modules as associated types.
pub use impls::ToAuthor;
pub type NegativeImbalance<T> = <pallet_balances::Module<T> as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
pub type NegativeImbalance<T> = <pallet_balances::Module<T> as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
/// The sequence of bytes a valid wasm module binary always starts with. Apart from that it's also a
/// valid wasm module.
@@ -106,7 +106,7 @@ impl<T> sp_runtime::BoundToRuntimeAppPublic for ParachainSessionKeyPlaceholder<T
type Public = ValidatorId;
}
impl<T: pallet_session::Trait>
impl<T: pallet_session::Config>
pallet_session::OneSessionHandler<T::AccountId> for ParachainSessionKeyPlaceholder<T>
{
type Key = ValidatorId;
@@ -154,7 +154,7 @@ mod multiplier_tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
impl frame_system::Trait for Runtime {
impl frame_system::Config for Runtime {
type BaseCallFilter = ();
type Origin = Origin;
type Index = u64;
+31 -31
View File
@@ -39,15 +39,15 @@ use runtime_parachains::{
};
type BalanceOf<T> =
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
pub trait Trait: paras::Trait + dmp::Trait + ump::Trait + hrmp::Trait {
pub trait Config: paras::Config + dmp::Config + ump::Config + hrmp::Config {
/// The aggregated origin type must support the `parachains` origin. We require that we can
/// infallibly convert between this origin and the system origin, but in reality, they're the
/// same type, we just can't express that to the Rust type system without writing a `where`
/// clause everywhere.
type Origin: From<<Self as frame_system::Trait>::Origin>
+ Into<result::Result<Origin, <Self as Trait>::Origin>>;
type Origin: From<<Self as frame_system::Config>::Origin>
+ Into<result::Result<Origin, <Self as Config>::Origin>>;
/// The system's currency for parathread payment.
type Currency: ReservableCurrency<Self::AccountId>;
@@ -57,7 +57,7 @@ pub trait Trait: paras::Trait + dmp::Trait + ump::Trait + hrmp::Trait {
}
decl_storage! {
trait Store for Module<T: Trait> as Registrar {
trait Store for Module<T: Config> as Registrar {
/// Whether parathreads are enabled or not.
ParathreadsRegistrationEnabled: bool;
@@ -73,7 +73,7 @@ decl_storage! {
}
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Parachain already exists.
ParaAlreadyExists,
/// Invalid parachain ID.
@@ -92,7 +92,7 @@ decl_error! {
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
/// Register a parathread with given code for immediate use.
@@ -117,7 +117,7 @@ decl_module! {
ensure!(outgoing.binary_search(&id).is_err(), Error::<T>::ParaAlreadyExists);
<T as Trait>::Currency::reserve(&who, T::ParathreadDeposit::get())?;
<T as Config>::Currency::reserve(&who, T::ParathreadDeposit::get())?;
<Debtors<T>>::insert(id, who);
Paras::insert(id, false);
@@ -142,7 +142,7 @@ decl_module! {
/// governance intervention).
#[weight = 0]
fn deregister_parathread(origin) -> DispatchResult {
let id = ensure_parachain(<T as Trait>::Origin::from(origin))?;
let id = ensure_parachain(<T as Config>::Origin::from(origin))?;
ensure!(ParathreadsRegistrationEnabled::get(), Error::<T>::ParathreadsRegistrationDisabled);
@@ -151,7 +151,7 @@ decl_module! {
ensure!(!is_parachain, Error::<T>::InvalidThreadId);
let debtor = <Debtors<T>>::take(id);
let _ = <T as Trait>::Currency::unreserve(&debtor, T::ParathreadDeposit::get());
let _ = <T as Config>::Currency::unreserve(&debtor, T::ParathreadDeposit::get());
runtime_parachains::schedule_para_cleanup::<T>(id);
@@ -187,7 +187,7 @@ decl_module! {
/// and the auction deposit are switched.
#[weight = 0]
fn swap(origin, other: ParaId) {
let id = ensure_parachain(<T as Trait>::Origin::from(origin))?;
let id = ensure_parachain(<T as Config>::Origin::from(origin))?;
if PendingSwap::get(other) == Some(id) {
// Remove intention to swap.
@@ -211,7 +211,7 @@ decl_module! {
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Register a parachain with given code. Must be called by root.
/// Fails if given ID is already used.
pub fn register_parachain(
@@ -306,7 +306,7 @@ mod tests {
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = Call;
@@ -345,7 +345,7 @@ mod tests {
pub const ExistentialDeposit: Balance = 1;
}
impl pallet_balances::Trait for Test {
impl pallet_balances::Config for Test {
type Balance = u128;
type DustRemoval = ();
type Event = ();
@@ -371,7 +371,7 @@ mod tests {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
}
impl pallet_session::Trait for Test {
impl pallet_session::Config for Test {
type SessionManager = ();
type Keys = UintAuthorityId;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
@@ -395,7 +395,7 @@ mod tests {
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
}
impl pallet_staking::Trait for Test {
impl pallet_staking::Config for Test {
type RewardRemainder = ();
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type Event = ();
@@ -420,24 +420,24 @@ mod tests {
type WeightInfo = ();
}
impl pallet_timestamp::Trait for Test {
impl pallet_timestamp::Config for Test {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
impl dmp::Trait for Test {}
impl dmp::Config for Test {}
impl ump::Trait for Test {
impl ump::Config for Test {
type UmpSink = ();
}
impl hrmp::Trait for Test {
impl hrmp::Config for Test {
type Origin = Origin;
}
impl pallet_session::historical::Trait for Test {
impl pallet_session::historical::Config for Test {
type FullIdentification = pallet_staking::Exposure<u64, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
}
@@ -467,23 +467,23 @@ mod tests {
pub type ReporterId = app::Public;
}
impl paras::Trait for Test {
impl paras::Config for Test {
type Origin = Origin;
}
impl configuration::Trait for Test { }
impl configuration::Config for Test { }
impl inclusion::Trait for Test {
impl inclusion::Config for Test {
type Event = ();
}
impl session_info::AuthorityDiscoveryTrait for Test {
impl session_info::AuthorityDiscoveryConfig for Test {
fn authorities() -> Vec<AuthorityDiscoveryId> {
Vec::new()
}
}
impl session_info::Trait for Test { }
impl session_info::Config for Test { }
pub struct TestRandomness;
@@ -493,11 +493,11 @@ mod tests {
}
}
impl initializer::Trait for Test {
impl initializer::Config for Test {
type Randomness = TestRandomness;
}
impl scheduler::Trait for Test { }
impl scheduler::Config for Test { }
type Extrinsic = TestXt<Call, ()>;
@@ -507,8 +507,8 @@ mod tests {
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call,
_public: test_keys::ReporterId,
_account: <Test as frame_system::Trait>::AccountId,
nonce: <Test as frame_system::Trait>::Index,
_account: <Test as frame_system::Config>::AccountId,
nonce: <Test as frame_system::Config>::Index,
) -> Option<(Call, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
Some((call, (nonce, ())))
}
@@ -525,7 +525,7 @@ mod tests {
pub const MaxRetries: u32 = 3;
}
impl Trait for Test {
impl Config for Test {
type Origin = Origin;
type Currency = pallet_balances::Module<Test>;
type ParathreadDeposit = ParathreadDeposit;
@@ -30,13 +30,13 @@ use runtime_parachains::{
use primitives::v1::Id as ParaId;
/// The module's configuration trait.
pub trait Trait:
configuration::Trait + paras::Trait + dmp::Trait + ump::Trait + hrmp::Trait
pub trait Config:
configuration::Config + paras::Config + dmp::Config + ump::Config + hrmp::Config
{
}
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// The specified parachain or parathread is not registered.
ParaDoesntExist,
/// A DMP message couldn't be sent because it exceeds the maximum size allowed for a downward
@@ -49,7 +49,7 @@ decl_error! {
decl_module! {
/// A sudo wrapper to call into v1 paras module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
/// Schedule a para to be initialized at the start of the next session.
+25 -25
View File
@@ -28,9 +28,9 @@ use sp_core::sr25519;
use sp_std::prelude::*;
/// Configuration trait.
pub trait Trait: frame_system::Trait {
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
/// Balances Pallet
type Currency: Currency<Self::AccountId>;
/// Vesting Pallet
@@ -47,7 +47,7 @@ pub trait Trait: frame_system::Trait {
type MaxUnlocked: Get<BalanceOf<Self>>;
}
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;
/// The kind of a statement an account needs to make for a claim to be valid.
#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug)]
@@ -103,9 +103,9 @@ pub struct AccountStatus<Balance> {
decl_event!(
pub enum Event<T> where
AccountId = <T as frame_system::Trait>::AccountId,
AccountId = <T as frame_system::Config>::AccountId,
Balance = BalanceOf<T>,
BlockNumber = <T as frame_system::Trait>::BlockNumber,
BlockNumber = <T as frame_system::Config>::BlockNumber,
{
/// A [new] account was created.
AccountCreated(AccountId),
@@ -125,7 +125,7 @@ decl_event!(
);
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Account is not currently valid to use.
InvalidAccount,
/// Account used in the purchase already exists.
@@ -146,7 +146,7 @@ decl_error! {
}
decl_storage! {
trait Store for Module<T: Trait> as Purchase {
trait Store for Module<T: Config> as Purchase {
// A map of all participants in the DOT purchase process.
Accounts: map hasher(blake2_128_concat) T::AccountId => AccountStatus<BalanceOf<T>>;
// The account that will be used to payout participants of the DOT purchase process.
@@ -159,7 +159,7 @@ decl_storage! {
}
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>;
/// The maximum statement length for the statement users to sign when creating an account.
@@ -340,7 +340,7 @@ decl_module! {
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
fn verify_signature(who: &T::AccountId, signature: &[u8]) -> Result<(), DispatchError> {
// sr25519 always expects a 64 byte signature.
ensure!(signature.len() == 64, Error::<T>::InvalidSignature);
@@ -374,7 +374,7 @@ fn account_to_bytes<AccountId>(account: &AccountId) -> Result<[u8; 32], Dispatch
/// WARNING: Executing this function will clear all storage used by this pallet.
/// Be sure this is what you want...
pub fn remove_pallet<T>() -> frame_support::weights::Weight
where T: frame_system::Trait
where T: frame_system::Config
{
use frame_support::migration::remove_storage_prefix;
remove_storage_prefix(b"Purchase", b"Accounts", b"");
@@ -428,7 +428,7 @@ mod tests {
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = Call;
@@ -460,7 +460,7 @@ mod tests {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -474,7 +474,7 @@ mod tests {
pub const MinVestedTransfer: u64 = 0;
}
impl pallet_vesting::Trait for Test {
impl pallet_vesting::Config for Test {
type Event = ();
type Currency = Balances;
type BlockNumberToBalance = Identity;
@@ -494,7 +494,7 @@ mod tests {
pub const ConfigurationOrigin: AccountId = AccountId32::from([2u8; 32]);
}
impl Trait for Test {
impl Config for Test {
type Event = ();
type Currency = Balances;
type VestingSchedule = Vesting;
@@ -692,7 +692,7 @@ mod tests {
);
// Account with vesting
assert_ok!(<Test as Trait>::VestingSchedule::add_vesting_schedule(
assert_ok!(<Test as Config>::VestingSchedule::add_vesting_schedule(
&alice(),
100,
1,
@@ -933,13 +933,13 @@ mod tests {
bob(),
));
// Payment is made.
assert_eq!(<Test as Trait>::Currency::free_balance(&payment_account()), 99_650);
assert_eq!(<Test as Trait>::Currency::free_balance(&alice()), 100);
assert_eq!(<Test as Config>::Currency::free_balance(&payment_account()), 99_650);
assert_eq!(<Test as Config>::Currency::free_balance(&alice()), 100);
// 10% of the 50 units is unlocked automatically for Alice
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&alice()), Some(45));
assert_eq!(<Test as Trait>::Currency::free_balance(&bob()), 250);
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), Some(45));
assert_eq!(<Test as Config>::Currency::free_balance(&bob()), 250);
// A max of 10 units is unlocked automatically for Bob
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&bob()), Some(140));
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&bob()), Some(140));
// Status is completed.
assert_eq!(
Accounts::<Test>::get(alice()),
@@ -966,13 +966,13 @@ mod tests {
let vest_call = Call::Vesting(pallet_vesting::Call::<Test>::vest());
assert_ok!(vest_call.clone().dispatch(Origin::signed(alice())));
assert_ok!(vest_call.clone().dispatch(Origin::signed(bob())));
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&alice()), Some(45));
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&bob()), Some(140));
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), Some(45));
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&bob()), Some(140));
System::set_block_number(101);
assert_ok!(vest_call.clone().dispatch(Origin::signed(alice())));
assert_ok!(vest_call.clone().dispatch(Origin::signed(bob())));
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&alice()), None);
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&bob()), None);
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), None);
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&bob()), None);
});
}
@@ -985,7 +985,7 @@ mod tests {
alice(),
), BadOrigin);
// Account with Existing Vesting Schedule
assert_ok!(<Test as Trait>::VestingSchedule::add_vesting_schedule(
assert_ok!(<Test as Config>::VestingSchedule::add_vesting_schedule(
&bob(), 100, 1, 50,
));
assert_noop!(Purchase::payout(
+17 -17
View File
@@ -34,12 +34,12 @@ use primitives::v1::{
use frame_system::{ensure_signed, ensure_root};
use crate::slot_range::{SlotRange, SLOT_RANGE_COUNT};
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;
/// The module's configuration trait.
pub trait Trait: frame_system::Trait {
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
/// The currency type used for bidding.
type Currency: ReservableCurrency<Self::AccountId>;
@@ -161,18 +161,18 @@ pub enum IncomingParachain<AccountId, Hash> {
Deploy { code: ValidationCode, initial_head_data: HeadData },
}
type LeasePeriodOf<T> = <T as frame_system::Trait>::BlockNumber;
type LeasePeriodOf<T> = <T as frame_system::Config>::BlockNumber;
// Winning data type. This encodes the top bidders of each range together with their bid.
type WinningData<T> =
[Option<(Bidder<<T as frame_system::Trait>::AccountId>, BalanceOf<T>)>; SLOT_RANGE_COUNT];
[Option<(Bidder<<T as frame_system::Config>::AccountId>, BalanceOf<T>)>; SLOT_RANGE_COUNT];
// Winners data type. This encodes each of the final winners of a parachain auction, the parachain
// index assigned to them, their winning bid and the range that they won.
type WinnersData<T> =
Vec<(Option<NewBidder<<T as frame_system::Trait>::AccountId>>, ParaId, BalanceOf<T>, SlotRange)>;
Vec<(Option<NewBidder<<T as frame_system::Config>::AccountId>>, ParaId, BalanceOf<T>, SlotRange)>;
// This module's storage items.
decl_storage! {
trait Store for Module<T: Trait> as Slots {
trait Store for Module<T: Config> as Slots {
/// The number of auctions that have been started so far.
pub AuctionCounter get(fn auction_counter): AuctionIndex;
@@ -245,7 +245,7 @@ fn swap_ordered_existence<T: PartialOrd + Ord + Copy>(ids: &mut [T], one: T, oth
ids.sort();
}
impl<T: Trait> SwapAux for Module<T> {
impl<T: Config> SwapAux for Module<T> {
fn ensure_can_swap(one: ParaId, other: ParaId) -> Result<(), &'static str> {
if <Onboarding<T>>::contains_key(one) || <Onboarding<T>>::contains_key(other) {
Err("can't swap an undeployed parachain")?
@@ -262,8 +262,8 @@ impl<T: Trait> SwapAux for Module<T> {
decl_event!(
pub enum Event<T> where
AccountId = <T as frame_system::Trait>::AccountId,
BlockNumber = <T as frame_system::Trait>::BlockNumber,
AccountId = <T as frame_system::Config>::AccountId,
BlockNumber = <T as frame_system::Config>::BlockNumber,
LeasePeriod = LeasePeriodOf<T>,
ParaId = ParaId,
Balance = BalanceOf<T>,
@@ -292,7 +292,7 @@ decl_event!(
);
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// This auction is already in progress.
AuctionInProgress,
/// The lease period is in the past.
@@ -323,7 +323,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>;
fn deposit_event() = default;
@@ -520,7 +520,7 @@ decl_module! {
.ok_or(Error::<T>::ParaNotOnboarding)?;
if let IncomingParachain::Fixed{code_hash, code_size, initial_head_data} = details {
ensure!(code.0.len() as u32 == code_size, Error::<T>::InvalidCode);
ensure!(<T as frame_system::Trait>::Hashing::hash(&code.0) == code_hash, Error::<T>::InvalidCode);
ensure!(<T as frame_system::Config>::Hashing::hash(&code.0) == code_hash, Error::<T>::InvalidCode);
if starts > Self::lease_period_index() {
// Hasn't yet begun. Replace the on-boarding entry with the new information.
@@ -542,7 +542,7 @@ decl_module! {
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Deposit currently held for a particular parachain that we administer.
fn deposit_held(para_id: &ParaId) -> BalanceOf<T> {
<Deposits<T>>::get(para_id).into_iter().max().unwrap_or_else(Zero::zero)
@@ -968,7 +968,7 @@ mod tests {
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = ();
@@ -1000,7 +1000,7 @@ mod tests {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Trait for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = ();
type DustRemoval = ();
@@ -1074,7 +1074,7 @@ mod tests {
pub const EndingPeriod: BlockNumber = 3;
}
impl Trait for Test {
impl Config for Test {
type Event = ();
type Currency = Balances;
type Parachains = TestParachains;
+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))
@@ -130,24 +130,24 @@ pub struct HostConfiguration<BlockNumber> {
pub hrmp_max_message_num_per_candidate: u32,
}
pub trait Trait: frame_system::Trait { }
pub trait Config: frame_system::Config { }
decl_storage! {
trait Store for Module<T: Trait> as Configuration {
trait Store for Module<T: Config> as Configuration {
/// The active configuration for the current session.
Config get(fn config) config(): HostConfiguration<T::BlockNumber>;
ActiveConfig get(fn config) config(): HostConfiguration<T::BlockNumber>;
/// Pending configuration (if any) for the next session.
PendingConfig: Option<HostConfiguration<T::BlockNumber>>;
}
}
decl_error! {
pub enum Error for Module<T: Trait> { }
pub enum Error for Module<T: Config> { }
}
decl_module! {
/// The parachains configuration module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
/// Set the validation upgrade frequency.
@@ -506,7 +506,7 @@ decl_module! {
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Called by the initializer to initialize the configuration module.
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
0
@@ -518,7 +518,7 @@ impl<T: Trait> Module<T> {
/// Called by the initializer to note that a new session has started.
pub(crate) fn initializer_on_new_session(_validators: &[ValidatorId], _queued: &[ValidatorId]) {
if let Some(pending) = <Self as Store>::PendingConfig::take() {
<Self as Store>::Config::set(pending);
<Self as Store>::ActiveConfig::set(pending);
}
}
+4 -4
View File
@@ -62,10 +62,10 @@ impl fmt::Debug for ProcessedDownwardMessagesAcceptanceErr {
}
}
pub trait Trait: frame_system::Trait + configuration::Trait {}
pub trait Config: frame_system::Config + configuration::Config {}
decl_storage! {
trait Store for Module<T: Trait> as Dmp {
trait Store for Module<T: Config> as Dmp {
/// Paras that are to be cleaned up at the end of the session.
/// The entries are sorted ascending by the para id.
OutgoingParas: Vec<ParaId>;
@@ -85,11 +85,11 @@ decl_storage! {
decl_module! {
/// The DMP module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin { }
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin { }
}
/// Routines and getters related to downward message passing.
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Block initialization logic, called by initializer.
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
0
+10 -10
View File
@@ -207,14 +207,14 @@ impl fmt::Debug for OutboundHrmpAcceptanceErr {
}
}
pub trait Trait: frame_system::Trait + configuration::Trait + paras::Trait + dmp::Trait {
pub trait Config: frame_system::Config + configuration::Config + paras::Config + dmp::Config {
type Origin: From<crate::Origin>
+ From<<Self as frame_system::Trait>::Origin>
+ Into<Result<crate::Origin, <Self as Trait>::Origin>>;
+ From<<Self as frame_system::Config>::Origin>
+ Into<Result<crate::Origin, <Self as Config>::Origin>>;
}
decl_storage! {
trait Store for Module<T: Trait> as Hrmp {
trait Store for Module<T: Config> as Hrmp {
/// Paras that are to be cleaned up at the end of the session.
/// The entries are sorted ascending by the para id.
OutgoingParas: Vec<ParaId>;
@@ -286,7 +286,7 @@ decl_storage! {
}
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// The sender tried to open a channel to themselves.
OpenHrmpChannelToSelf,
/// The recipient is not a valid para.
@@ -322,7 +322,7 @@ decl_error! {
decl_module! {
/// The HRMP module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
#[weight = 0]
@@ -332,7 +332,7 @@ decl_module! {
proposed_max_capacity: u32,
proposed_max_message_size: u32,
) -> DispatchResult {
let origin = ensure_parachain(<T as Trait>::Origin::from(origin))?;
let origin = ensure_parachain(<T as Config>::Origin::from(origin))?;
Self::init_open_channel(
origin,
recipient,
@@ -344,14 +344,14 @@ decl_module! {
#[weight = 0]
fn hrmp_accept_open_channel(origin, sender: ParaId) -> DispatchResult {
let origin = ensure_parachain(<T as Trait>::Origin::from(origin))?;
let origin = ensure_parachain(<T as Config>::Origin::from(origin))?;
Self::accept_open_channel(origin, sender)?;
Ok(())
}
#[weight = 0]
fn hrmp_close_channel(origin, channel_id: HrmpChannelId) -> DispatchResult {
let origin = ensure_parachain(<T as Trait>::Origin::from(origin))?;
let origin = ensure_parachain(<T as Config>::Origin::from(origin))?;
Self::close_channel(origin, channel_id)?;
Ok(())
}
@@ -359,7 +359,7 @@ decl_module! {
}
/// Routines and getters related to HRMP.
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Block initialization logic, called by initializer.
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
0
+17 -17
View File
@@ -85,19 +85,19 @@ impl<H, N> CandidatePendingAvailability<H, N> {
}
}
pub trait Trait:
frame_system::Trait
+ paras::Trait
+ dmp::Trait
+ ump::Trait
+ hrmp::Trait
+ configuration::Trait
pub trait Config:
frame_system::Config
+ paras::Config
+ dmp::Config
+ ump::Config
+ hrmp::Config
+ configuration::Config
{
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
}
decl_storage! {
trait Store for Module<T: Trait> as ParaInclusion {
trait Store for Module<T: Config> as ParaInclusion {
/// The latest bitfield for each validator, referred to by their index in the validator set.
AvailabilityBitfields: map hasher(twox_64_concat) ValidatorIndex
=> Option<AvailabilityBitfieldRecord<T::BlockNumber>>;
@@ -119,7 +119,7 @@ decl_storage! {
}
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Availability bitfield has unexpected size.
WrongBitfieldSize,
/// Multiple bitfields submitted by same validator or validators out of order by index.
@@ -170,7 +170,7 @@ decl_error! {
}
decl_event! {
pub enum Event<T> where <T as frame_system::Trait>::Hash {
pub enum Event<T> where <T as frame_system::Config>::Hash {
/// A candidate was backed. [candidate, head_data]
CandidateBacked(CandidateReceipt<Hash>, HeadData),
/// A candidate was included. [candidate, head_data]
@@ -182,8 +182,8 @@ decl_event! {
decl_module! {
/// The parachain-candidate inclusion module.
pub struct Module<T: Trait>
for enum Call where origin: <T as frame_system::Trait>::Origin
pub struct Module<T: Config>
for enum Call where origin: <T as frame_system::Config>::Origin
{
type Error = Error<T>;
@@ -193,7 +193,7 @@ decl_module! {
const LOG_TARGET: &str = "parachains_runtime_inclusion";
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Block initialization logic, called by initializer.
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { 0 }
@@ -733,7 +733,7 @@ enum AcceptanceCheckErr<BlockNumber> {
impl<BlockNumber> AcceptanceCheckErr<BlockNumber> {
/// Returns the same error so that it can be threaded through a needle of `DispatchError` and
/// ultimately returned from a `Dispatchable`.
fn strip_into_dispatch_err<T: Trait>(self) -> Error<T> {
fn strip_into_dispatch_err<T: Config>(self) -> Error<T> {
use AcceptanceCheckErr::*;
match self {
HeadDataTooLarge => Error::<T>::HeadDataTooLarge,
@@ -748,13 +748,13 @@ impl<BlockNumber> AcceptanceCheckErr<BlockNumber> {
}
/// A collection of data required for checking a candidate.
struct CandidateCheckContext<T: Trait> {
struct CandidateCheckContext<T: Config> {
config: configuration::HostConfiguration<T::BlockNumber>,
now: T::BlockNumber,
relay_parent_number: T::BlockNumber,
}
impl<T: Trait> CandidateCheckContext<T> {
impl<T: Config> CandidateCheckContext<T> {
fn new() -> Self {
let now = <frame_system::Module<T>>::block_number();
Self {
@@ -39,10 +39,10 @@ use crate::{
};
use inherents::{InherentIdentifier, InherentData, MakeFatalError, ProvideInherent};
pub trait Trait: inclusion::Trait + scheduler::Trait {}
pub trait Config: inclusion::Config + scheduler::Config {}
decl_storage! {
trait Store for Module<T: Trait> as ParaInclusionInherent {
trait Store for Module<T: Config> as ParaInclusionInherent {
/// Whether the inclusion inherent was included within this block.
///
/// The `Option<()>` is effectively a bool, but it never hits storage in the `None` variant
@@ -54,7 +54,7 @@ decl_storage! {
}
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Inclusion inherent called more than once per block.
TooManyInclusionInherents,
}
@@ -62,7 +62,7 @@ decl_error! {
decl_module! {
/// The inclusion inherent module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
fn on_initialize() -> Weight {
@@ -127,7 +127,7 @@ decl_module! {
}
}
impl<T: Trait> ProvideInherent for Module<T> {
impl<T: Config> ProvideInherent for Module<T> {
type Call = Call<T>;
type Error = MakeFatalError<()>;
const INHERENT_IDENTIFIER: InherentIdentifier = INCLUSION_INHERENT_IDENTIFIER;
+16 -16
View File
@@ -57,23 +57,23 @@ struct BufferedSessionChange<N> {
session_index: sp_staking::SessionIndex,
}
pub trait Trait:
frame_system::Trait
+ configuration::Trait
+ paras::Trait
+ scheduler::Trait
+ inclusion::Trait
+ session_info::Trait
+ dmp::Trait
+ ump::Trait
+ hrmp::Trait
pub trait Config:
frame_system::Config
+ configuration::Config
+ paras::Config
+ scheduler::Config
+ inclusion::Config
+ session_info::Config
+ dmp::Config
+ ump::Config
+ hrmp::Config
{
/// A randomness beacon.
type Randomness: Randomness<Self::Hash>;
}
decl_storage! {
trait Store for Module<T: Trait> as Initializer {
trait Store for Module<T: Config> as Initializer {
/// Whether the parachains modules have been initialized within this block.
///
/// Semantically a bool, but this guarantees it should never hit the trie,
@@ -95,12 +95,12 @@ decl_storage! {
}
decl_error! {
pub enum Error for Module<T: Trait> { }
pub enum Error for Module<T: Config> { }
}
decl_module! {
/// The initializer module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
fn on_initialize(now: T::BlockNumber) -> Weight {
@@ -159,7 +159,7 @@ decl_module! {
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
fn apply_new_session(
session_index: sp_staking::SessionIndex,
validators: Vec<ValidatorId>,
@@ -225,11 +225,11 @@ impl<T: Trait> Module<T> {
}
}
impl<T: Trait> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
type Public = ValidatorId;
}
impl<T: pallet_session::Trait + Trait> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
impl<T: pallet_session::Config + Config> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
type Key = ValidatorId;
fn on_genesis_session<'a, I: 'a>(_validators: I)
+5 -5
View File
@@ -45,7 +45,7 @@ mod mock;
pub use origin::{Origin, ensure_parachain};
/// Schedule a para to be initialized at the start of the next session with the given genesis data.
pub fn schedule_para_initialize<T: paras::Trait>(
pub fn schedule_para_initialize<T: paras::Config>(
id: primitives::v1::Id,
genesis: paras::ParaGenesisArgs,
) {
@@ -55,10 +55,10 @@ pub fn schedule_para_initialize<T: paras::Trait>(
/// Schedule a para to be cleaned up at the start of the next session.
pub fn schedule_para_cleanup<T>(id: primitives::v1::Id)
where
T: paras::Trait
+ dmp::Trait
+ ump::Trait
+ hrmp::Trait,
T: paras::Config
+ dmp::Config
+ ump::Config
+ hrmp::Config,
{
<paras::Module<T>>::schedule_para_cleanup(id);
<dmp::Module<T>>::schedule_para_cleanup(id);
+11 -11
View File
@@ -70,7 +70,7 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}
impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = Call;
@@ -98,35 +98,35 @@ impl frame_system::Trait for Test {
type SystemWeightInfo = ();
}
impl crate::initializer::Trait for Test {
impl crate::initializer::Config for Test {
type Randomness = TestRandomness;
}
impl crate::configuration::Trait for Test { }
impl crate::configuration::Config for Test { }
impl crate::paras::Trait for Test {
impl crate::paras::Config for Test {
type Origin = Origin;
}
impl crate::dmp::Trait for Test { }
impl crate::dmp::Config for Test { }
impl crate::ump::Trait for Test {
impl crate::ump::Config for Test {
type UmpSink = crate::ump::mock_sink::MockUmpSink;
}
impl crate::hrmp::Trait for Test {
impl crate::hrmp::Config for Test {
type Origin = Origin;
}
impl crate::scheduler::Trait for Test { }
impl crate::scheduler::Config for Test { }
impl crate::inclusion::Trait for Test {
impl crate::inclusion::Config for Test {
type Event = TestEvent;
}
impl crate::session_info::Trait for Test { }
impl crate::session_info::Config for Test { }
impl crate::session_info::AuthorityDiscoveryTrait for Test {
impl crate::session_info::AuthorityDiscoveryConfig for Test {
fn authorities() -> Vec<AuthorityDiscoveryId> {
Vec::new()
}
+2 -2
View File
@@ -40,7 +40,7 @@ pub fn ensure_parachain<OuterOrigin>(o: OuterOrigin) -> result::Result<ParaId, B
}
/// The origin module.
pub trait Trait: frame_system::Trait {}
pub trait Config: frame_system::Config {}
frame_support::decl_module! {
/// There is no way to register an origin type in `construct_runtime` without a pallet the origin
@@ -49,7 +49,7 @@ frame_support::decl_module! {
/// This module fulfills only the single purpose of housing the `Origin` in `construct_runtime`.
///
// ideally, though, the `construct_runtime` should support a free-standing origin.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {}
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {}
}
impl From<u32> for Origin {
+8 -8
View File
@@ -45,11 +45,11 @@ use serde::{Serialize, Deserialize};
pub use crate::Origin;
pub trait Trait: frame_system::Trait + configuration::Trait {
pub trait Config: frame_system::Config + configuration::Config {
/// The outer origin type.
type Origin: From<Origin>
+ From<<Self as frame_system::Trait>::Origin>
+ Into<result::Result<Origin, <Self as Trait>::Origin>>;
+ From<<Self as frame_system::Config>::Origin>
+ Into<result::Result<Origin, <Self as Config>::Origin>>;
}
// the two key times necessary to track for every code replacement.
@@ -177,7 +177,7 @@ pub struct ParaGenesisArgs {
}
decl_storage! {
trait Store for Module<T: Trait> as Paras {
trait Store for Module<T: Config> as Paras {
/// All parachains. Ordered ascending by ParaId. Parathreads are not included.
Parachains get(fn parachains): Vec<ParaId>;
/// All parathreads.
@@ -224,7 +224,7 @@ decl_storage! {
}
#[cfg(feature = "std")]
fn build<T: Trait>(config: &GenesisConfig<T>) {
fn build<T: Config>(config: &GenesisConfig<T>) {
let mut parachains: Vec<_> = config.paras
.iter()
.filter(|(_, args)| args.parachain)
@@ -244,17 +244,17 @@ fn build<T: Trait>(config: &GenesisConfig<T>) {
}
decl_error! {
pub enum Error for Module<T: Trait> { }
pub enum Error for Module<T: Config> { }
}
decl_module! {
/// The parachains configuration module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Called by the initializer to initialize the configuration module.
pub(crate) fn initializer_initialize(now: T::BlockNumber) -> Weight {
Self::prune_old_code(now)
@@ -31,12 +31,12 @@ use frame_support::debug;
use crate::{initializer, inclusion, scheduler, configuration, paras, session_info, dmp, hrmp};
/// Implementation for the `validators` function of the runtime API.
pub fn validators<T: initializer::Trait>() -> Vec<ValidatorId> {
pub fn validators<T: initializer::Config>() -> Vec<ValidatorId> {
<inclusion::Module<T>>::validators()
}
/// Implementation for the `validator_groups` function of the runtime API.
pub fn validator_groups<T: initializer::Trait>() -> (
pub fn validator_groups<T: initializer::Config>() -> (
Vec<Vec<ValidatorIndex>>,
GroupRotationInfo<T::BlockNumber>,
) {
@@ -47,7 +47,7 @@ pub fn validator_groups<T: initializer::Trait>() -> (
}
/// Implementation for the `availability_cores` function of the runtime API.
pub fn availability_cores<T: initializer::Trait>() -> Vec<CoreState<T::BlockNumber>> {
pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::BlockNumber>> {
let cores = <scheduler::Module<T>>::availability_cores();
let parachains = <paras::Module<T>>::parachains();
let config = <configuration::Module<T>>::config();
@@ -163,24 +163,24 @@ pub fn availability_cores<T: initializer::Trait>() -> Vec<CoreState<T::BlockNumb
core_states
}
fn with_assumption<Trait, T, F>(
fn with_assumption<Config, T, F>(
para_id: ParaId,
assumption: OccupiedCoreAssumption,
build: F,
) -> Option<T> where
Trait: inclusion::Trait,
Config: inclusion::Config,
F: FnOnce() -> Option<T>,
{
match assumption {
OccupiedCoreAssumption::Included => {
<inclusion::Module<Trait>>::force_enact(para_id);
<inclusion::Module<Config>>::force_enact(para_id);
build()
}
OccupiedCoreAssumption::TimedOut => {
build()
}
OccupiedCoreAssumption::Free => {
if <inclusion::Module<Trait>>::pending_availability(para_id).is_some() {
if <inclusion::Module<Config>>::pending_availability(para_id).is_some() {
None
} else {
build()
@@ -190,7 +190,7 @@ fn with_assumption<Trait, T, F>(
}
/// Implementation for the `full_validation_data` function of the runtime API.
pub fn full_validation_data<T: initializer::Trait>(
pub fn full_validation_data<T: initializer::Config>(
para_id: ParaId,
assumption: OccupiedCoreAssumption,
)
@@ -207,7 +207,7 @@ pub fn full_validation_data<T: initializer::Trait>(
}
/// Implementation for the `persisted_validation_data` function of the runtime API.
pub fn persisted_validation_data<T: initializer::Trait>(
pub fn persisted_validation_data<T: initializer::Config>(
para_id: ParaId,
assumption: OccupiedCoreAssumption,
) -> Option<PersistedValidationData<T::BlockNumber>> {
@@ -219,7 +219,7 @@ pub fn persisted_validation_data<T: initializer::Trait>(
}
/// Implementation for the `check_validation_outputs` function of the runtime API.
pub fn check_validation_outputs<T: initializer::Trait>(
pub fn check_validation_outputs<T: initializer::Config>(
para_id: ParaId,
outputs: primitives::v1::CandidateCommitments,
) -> bool {
@@ -227,7 +227,7 @@ pub fn check_validation_outputs<T: initializer::Trait>(
}
/// Implementation for the `session_index_for_child` function of the runtime API.
pub fn session_index_for_child<T: initializer::Trait>() -> SessionIndex {
pub fn session_index_for_child<T: initializer::Config>() -> SessionIndex {
// Just returns the session index from `inclusion`. Runtime APIs follow
// initialization so the initializer will have applied any pending session change
// which is expected at the child of the block whose context the runtime API was invoked
@@ -239,7 +239,7 @@ pub fn session_index_for_child<T: initializer::Trait>() -> SessionIndex {
}
/// Implementation for the `validation_code` function of the runtime API.
pub fn validation_code<T: initializer::Trait>(
pub fn validation_code<T: initializer::Config>(
para_id: ParaId,
assumption: OccupiedCoreAssumption,
) -> Option<ValidationCode> {
@@ -251,7 +251,7 @@ pub fn validation_code<T: initializer::Trait>(
}
/// Implementation for the `historical_validation_code` function of the runtime API.
pub fn historical_validation_code<T: initializer::Trait>(
pub fn historical_validation_code<T: initializer::Config>(
para_id: ParaId,
context_height: T::BlockNumber,
) -> Option<ValidationCode> {
@@ -259,7 +259,7 @@ pub fn historical_validation_code<T: initializer::Trait>(
}
/// Implementation for the `candidate_pending_availability` function of the runtime API.
pub fn candidate_pending_availability<T: initializer::Trait>(para_id: ParaId)
pub fn candidate_pending_availability<T: initializer::Config>(para_id: ParaId)
-> Option<CommittedCandidateReceipt<T::Hash>>
{
<inclusion::Module<T>>::candidate_pending_availability(para_id)
@@ -270,8 +270,8 @@ pub fn candidate_pending_availability<T: initializer::Trait>(para_id: ParaId)
// this means it can run in a different session than other runtime APIs at the same block.
pub fn candidate_events<T, F>(extract_event: F) -> Vec<CandidateEvent<T::Hash>>
where
T: initializer::Trait,
F: Fn(<T as frame_system::Trait>::Event) -> Option<inclusion::Event<T>>,
T: initializer::Config,
F: Fn(<T as frame_system::Config>::Event) -> Option<inclusion::Event<T>>,
{
use inclusion::Event as RawEvent;
@@ -286,19 +286,19 @@ where
}
/// Get the session info for the given session, if stored.
pub fn session_info<T: session_info::Trait>(index: SessionIndex) -> Option<SessionInfo> {
pub fn session_info<T: session_info::Config>(index: SessionIndex) -> Option<SessionInfo> {
<session_info::Module<T>>::session_info(index)
}
/// Implementation for the `dmq_contents` function of the runtime API.
pub fn dmq_contents<T: dmp::Trait>(
pub fn dmq_contents<T: dmp::Config>(
recipient: ParaId,
) -> Vec<InboundDownwardMessage<T::BlockNumber>> {
<dmp::Module<T>>::dmq_contents(recipient)
}
/// Implementation for the `inbound_hrmp_channels_contents` function of the runtime API.
pub fn inbound_hrmp_channels_contents<T: hrmp::Trait>(
pub fn inbound_hrmp_channels_contents<T: hrmp::Config>(
recipient: ParaId,
) -> BTreeMap<ParaId, Vec<InboundHrmpMessage<T::BlockNumber>>> {
<hrmp::Module<T>>::inbound_hrmp_channels_contents(recipient)
+5 -5
View File
@@ -153,10 +153,10 @@ impl CoreAssignment {
}
}
pub trait Trait: frame_system::Trait + configuration::Trait + paras::Trait { }
pub trait Config: frame_system::Config + configuration::Config + paras::Config { }
decl_storage! {
trait Store for Module<T: Trait> as ParaScheduler {
trait Store for Module<T: Config> as ParaScheduler {
/// All the validator groups. One for each core.
///
/// Bound: The number of cores is the sum of the numbers of parachains and parathread multiplexers.
@@ -190,17 +190,17 @@ decl_storage! {
}
decl_error! {
pub enum Error for Module<T: Trait> { }
pub enum Error for Module<T: Config> { }
}
decl_module! {
/// The scheduler module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Called by the initializer to initialize the scheduler module.
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
Self::schedule(Vec::new());
+13 -13
View File
@@ -27,17 +27,17 @@ use frame_support::{
use crate::{configuration, paras, scheduler};
use sp_std::{cmp, vec::Vec};
pub trait Trait:
frame_system::Trait
+ configuration::Trait
+ paras::Trait
+ scheduler::Trait
+ AuthorityDiscoveryTrait
pub trait Config:
frame_system::Config
+ configuration::Config
+ paras::Config
+ scheduler::Config
+ AuthorityDiscoveryConfig
{
}
decl_storage! {
trait Store for Module<T: Trait> as ParaSessionInfo {
trait Store for Module<T: Config> as ParaSessionInfo {
/// The earliest session for which previous session info is stored.
EarliestStoredSession get(fn earliest_stored_session): SessionIndex;
/// Session information in a rolling window.
@@ -48,30 +48,30 @@ decl_storage! {
}
decl_error! {
pub enum Error for Module<T: Trait> { }
pub enum Error for Module<T: Config> { }
}
decl_module! {
/// The session info module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
}
}
/// An abstraction for the authority discovery pallet
/// to help with mock testing.
pub trait AuthorityDiscoveryTrait {
pub trait AuthorityDiscoveryConfig {
/// Retrieve authority identifiers of the current and next authority set.
fn authorities() -> Vec<AuthorityDiscoveryId>;
}
impl<T: pallet_authority_discovery::Trait> AuthorityDiscoveryTrait for T {
impl<T: pallet_authority_discovery::Config> AuthorityDiscoveryConfig for T {
fn authorities() -> Vec<AuthorityDiscoveryId> {
<pallet_authority_discovery::Module<T>>::authorities()
}
}
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Handle an incoming session change.
pub(crate) fn initializer_on_new_session(
notification: &crate::initializer::SessionChangeNotification<T::BlockNumber>
@@ -82,7 +82,7 @@ impl<T: Trait> Module<T> {
let n_parachains = <paras::Module<T>>::parachains().len() as u32;
let validators = notification.validators.clone();
let discovery_keys = <T as AuthorityDiscoveryTrait>::authorities();
let discovery_keys = <T as AuthorityDiscoveryConfig>::authorities();
// FIXME: once we store these keys: https://github.com/paritytech/polkadot/issues/1975
let approval_keys = Default::default();
let validator_groups = <scheduler::Module<T>>::validator_groups();
+8 -8
View File
@@ -105,13 +105,13 @@ impl fmt::Debug for AcceptanceCheckErr {
}
}
pub trait Trait: frame_system::Trait + configuration::Trait {
pub trait Config: frame_system::Config + configuration::Config {
/// A place where all received upward messages are funneled.
type UmpSink: UmpSink;
}
decl_storage! {
trait Store for Module<T: Trait> as Ump {
trait Store for Module<T: Config> as Ump {
/// Paras that are to be cleaned up at the end of the session.
/// The entries are sorted ascending by the para id.
OutgoingParas: Vec<ParaId>;
@@ -152,12 +152,12 @@ decl_storage! {
decl_module! {
/// The UMP module.
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
}
}
/// Routines related to the upward message passing.
impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
/// Block initialization logic, called by initializer.
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
0
@@ -365,7 +365,7 @@ impl QueueCache {
///
/// - `upward_message` a dequeued message or `None` if the queue _was_ empty.
/// - `became_empty` is true if the queue _became_ empty.
fn dequeue<T: Trait>(&mut self, para: ParaId) -> (Option<UpwardMessage>, bool) {
fn dequeue<T: Config>(&mut self, para: ParaId) -> (Option<UpwardMessage>, bool) {
let cache_entry = self.0.entry(para).or_insert_with(|| {
let queue = <Module<T> as Store>::RelayDispatchQueues::get(&para);
let (count, total_size) = <Module<T> as Store>::RelayDispatchQueueSize::get(&para);
@@ -386,7 +386,7 @@ impl QueueCache {
}
/// Flushes the updated queues into the storage.
fn flush<T: Trait>(self) {
fn flush<T: Config>(self) {
// NOTE we use an explicit method here instead of Drop impl because it has unwanted semantics
// within runtime. It is dangerous to use because of double-panics and flushing on a panic
// is not necessary as well.
@@ -427,7 +427,7 @@ struct NeedsDispatchCursor {
}
impl NeedsDispatchCursor {
fn new<T: Trait>() -> Self {
fn new<T: Config>() -> Self {
let needs_dispatch: Vec<ParaId> = <Module<T> as Store>::NeedsDispatch::get();
let start_with = <Module<T> as Store>::NextDispatchRoundStartWith::get();
@@ -481,7 +481,7 @@ impl NeedsDispatchCursor {
}
/// Flushes the dispatcher state into the persistent storage.
fn flush<T: Trait>(self) {
fn flush<T: Config>(self) {
let next_one = self.peek();
<Module<T> as Store>::NextDispatchRoundStartWith::set(next_one);
<Module<T> as Store>::NeedsDispatch::put(self.needs_dispatch);
+2 -2
View File
@@ -25,7 +25,7 @@ use crate::{configuration, paras, dmp, hrmp};
/// Make the persisted validation data for a particular parachain.
///
/// This ties together the storage of several modules.
pub fn make_persisted_validation_data<T: paras::Trait + hrmp::Trait>(
pub fn make_persisted_validation_data<T: paras::Config + hrmp::Config>(
para_id: ParaId,
) -> Option<PersistedValidationData<T::BlockNumber>> {
let config = <configuration::Module<T>>::config();
@@ -43,7 +43,7 @@ pub fn make_persisted_validation_data<T: paras::Trait + hrmp::Trait>(
/// Make the transient validation data for a particular parachain.
///
/// This ties together the storage of several modules.
pub fn make_transient_validation_data<T: paras::Trait + dmp::Trait>(
pub fn make_transient_validation_data<T: paras::Config + dmp::Config>(
para_id: ParaId,
) -> Option<TransientValidationData<T::BlockNumber>> {
let config = <configuration::Module<T>>::config();
+31 -31
View File
@@ -140,7 +140,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;
@@ -172,7 +172,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;
@@ -188,7 +188,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;
@@ -217,7 +217,7 @@ parameter_types! {
pub const IndexDeposit: Balance = 10 * DOLLARS;
}
impl pallet_indices::Trait for Runtime {
impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex;
type Currency = Balances;
type Deposit = IndexDeposit;
@@ -230,7 +230,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;
@@ -244,7 +244,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<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
@@ -254,7 +254,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;
@@ -266,7 +266,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 = ();
@@ -287,7 +287,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>;
@@ -300,7 +300,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>;
}
@@ -344,7 +344,7 @@ type SlashCancelOrigin = EnsureOneOf<
pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>
>;
impl pallet_staking::Trait for Runtime {
impl pallet_staking::Config for Runtime {
type Currency = Balances;
type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote;
@@ -382,7 +382,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 BasicDeposit = BasicDeposit;
@@ -411,7 +411,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;
@@ -480,7 +480,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;
@@ -504,7 +504,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 ModuleId = ElectionsPhragmenModuleId;
type Currency = Balances;
@@ -529,7 +529,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;
@@ -540,7 +540,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;
@@ -576,7 +576,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;
@@ -606,14 +606,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 _;
@@ -625,7 +625,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 SessionDuration = SessionDuration;
@@ -634,7 +634,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;
@@ -662,7 +662,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()
@@ -717,7 +717,7 @@ parameter_types! {
pub Prefix: &'static [u8] = b"Pay DOTs to the Polkadot account:";
}
impl claims::Trait for Runtime {
impl claims::Config for Runtime {
type Event = Event;
type VestingSchedule = Vesting;
type Prefix = Prefix;
@@ -729,7 +729,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;
@@ -737,7 +737,7 @@ impl pallet_vesting::Trait for Runtime {
type WeightInfo = weights::pallet_vesting::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>;
@@ -751,7 +751,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;
@@ -879,7 +879,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;
@@ -1243,9 +1243,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
@@ -42,7 +42,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_851_000 as Weight)
}
@@ -42,7 +42,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 {
(90_334_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -42,7 +42,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_942_000 as Weight).saturating_mul(m as Weight))
@@ -42,7 +42,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_078_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
@@ -42,7 +42,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 {
(85_361_000 as Weight)
.saturating_add((113_000 as Weight).saturating_mul(v as Weight))
@@ -42,7 +42,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_935_000 as Weight)
.saturating_add((309_000 as Weight).saturating_mul(r as Weight))
@@ -42,7 +42,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 {
(107_274_000 as Weight)
.saturating_add((218_000 as Weight).saturating_mul(k as Weight))
@@ -42,7 +42,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 {
(50_502_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -42,7 +42,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_023_000 as Weight)
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
@@ -42,7 +42,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_511_000 as Weight)
.saturating_add((189_000 as Weight).saturating_mul(p as Weight))
@@ -42,7 +42,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_070_000 as Weight)
.saturating_add((43_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 {
(93_498_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
@@ -42,7 +42,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 {
(92_188_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
@@ -42,7 +42,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_868_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
@@ -42,7 +42,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_150_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -42,7 +42,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_624_000 as Weight)
.saturating_add((1_986_000 as Weight).saturating_mul(c as Weight))
@@ -42,7 +42,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 {
(53_484_000 as Weight)
.saturating_add((134_000 as Weight).saturating_mul(l as Weight))
+29 -29
View File
@@ -210,7 +210,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;
@@ -255,7 +255,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()
@@ -294,7 +294,7 @@ impl frame_system::offchain::SigningTypes for Runtime {
type Signature = Signature;
}
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>;
}
@@ -334,7 +334,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;
@@ -343,7 +343,7 @@ impl pallet_im_online::Trait for Runtime {
type WeightInfo = ();
}
impl pallet_staking::Trait for Runtime {
impl pallet_staking::Config for Runtime {
type Currency = Balances;
type UnixTime = Timestamp;
type CurrencyToVote = frame_support::traits::U128CurrencyToVote;
@@ -374,7 +374,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;
@@ -401,19 +401,19 @@ 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 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;
@@ -424,7 +424,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, ToAuthor<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
@@ -435,7 +435,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>;
@@ -453,7 +453,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;
@@ -482,7 +482,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;
@@ -494,7 +494,7 @@ parameter_types! {
pub const AttestationPeriod: BlockNumber = 50;
}
impl pallet_grandpa::Trait for Runtime {
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;
@@ -518,54 +518,54 @@ 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 = ();
type EventHandler = (Staking, ImOnline);
}
impl parachains_origin::Trait for Runtime {}
impl parachains_origin::Config for Runtime {}
impl parachains_configuration::Trait for Runtime {}
impl parachains_configuration::Config for Runtime {}
impl parachains_inclusion::Trait for Runtime {
impl parachains_inclusion::Config for Runtime {
type Event = Event;
}
impl parachains_paras::Trait for Runtime {
impl parachains_paras::Config for Runtime {
type Origin = Origin;
}
impl parachains_session_info::Trait for Runtime {}
impl parachains_session_info::Config for Runtime {}
impl parachains_ump::Trait for Runtime {
impl parachains_ump::Config for Runtime {
type UmpSink = (); // TODO: #1873 To be handled by the XCM receiver.
}
impl parachains_dmp::Trait for Runtime {}
impl parachains_dmp::Config for Runtime {}
impl parachains_hrmp::Trait for Runtime {
impl parachains_hrmp::Config for Runtime {
type Origin = Origin;
}
impl parachains_inclusion_inherent::Trait for Runtime {}
impl parachains_inclusion_inherent::Config for Runtime {}
impl parachains_scheduler::Trait for Runtime {}
impl parachains_scheduler::Config for Runtime {}
impl parachains_initializer::Trait for Runtime {
impl parachains_initializer::Config for Runtime {
type Randomness = Babe;
}
impl paras_sudo_wrapper::Trait for Runtime {}
impl paras_sudo_wrapper::Config for Runtime {}
impl paras_registrar::Trait for Runtime {
impl paras_registrar::Config for Runtime {
type Currency = Balances;
type ParathreadDeposit = ParathreadDeposit;
type Origin = Origin;
}
impl pallet_sudo::Trait for Runtime {
impl pallet_sudo::Config for Runtime {
type Event = Event;
type Call = Call;
}
+28 -28
View File
@@ -123,7 +123,7 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}
impl frame_system::Trait for Runtime {
impl frame_system::Config for Runtime {
type BaseCallFilter = ();
type Origin = Origin;
type Call = Call;
@@ -163,7 +163,7 @@ parameter_types! {
pub storage ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
}
impl pallet_babe::Trait for Runtime {
impl pallet_babe::Config for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
@@ -191,7 +191,7 @@ parameter_types! {
pub storage 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;
@@ -204,7 +204,7 @@ parameter_types! {
pub storage MaxLocks: u32 = 50;
}
impl pallet_balances::Trait for Runtime {
impl pallet_balances::Config for Runtime {
type Balance = Balance;
type DustRemoval = ();
type Event = Event;
@@ -218,7 +218,7 @@ parameter_types! {
pub storage TransactionByteFee: Balance = 10 * MILLICENTS;
}
impl pallet_transaction_payment::Trait for Runtime {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
@@ -229,7 +229,7 @@ parameter_types! {
pub storage SlotDuration: u64 = SLOT_DURATION;
pub storage MinimumPeriod: u64 = SlotDuration::get() / 2;
}
impl pallet_timestamp::Trait for Runtime {
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Babe;
type MinimumPeriod = MinimumPeriod;
@@ -241,7 +241,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 = ();
@@ -266,7 +266,7 @@ parameter_types! {
pub storage 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>;
@@ -279,7 +279,7 @@ impl pallet_session::Trait for Runtime {
type WeightInfo = ();
}
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>;
}
@@ -310,7 +310,7 @@ parameter_types! {
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
}
impl pallet_staking::Trait for Runtime {
impl pallet_staking::Config for Runtime {
type Currency = Balances;
type UnixTime = Timestamp;
type CurrencyToVote = frame_support::traits::U128CurrencyToVote;
@@ -337,7 +337,7 @@ impl pallet_staking::Trait for Runtime {
}
impl pallet_grandpa::Trait for Runtime {
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;
@@ -363,7 +363,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)> {
let period = BlockHashCount::get()
.checked_next_power_of_two()
@@ -404,14 +404,14 @@ parameter_types! {
pub storage 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 storage LeasePeriod: BlockNumber = 100_000;
@@ -422,7 +422,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;
@@ -433,7 +433,7 @@ parameter_types! {
pub storage 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;
@@ -441,42 +441,42 @@ impl pallet_vesting::Trait for Runtime {
type WeightInfo = ();
}
impl pallet_sudo::Trait for Runtime {
impl pallet_sudo::Config for Runtime {
type Event = Event;
type Call = Call;
}
impl parachains_configuration::Trait for Runtime {}
impl parachains_configuration::Config for Runtime {}
impl parachains_inclusion::Trait for Runtime {
impl parachains_inclusion::Config for Runtime {
type Event = Event;
}
impl parachains_inclusion_inherent::Trait for Runtime {}
impl parachains_inclusion_inherent::Config for Runtime {}
impl parachains_initializer::Trait for Runtime {
impl parachains_initializer::Config for Runtime {
type Randomness = RandomnessCollectiveFlip;
}
impl parachains_session_info::Trait for Runtime {}
impl parachains_session_info::Config for Runtime {}
impl parachains_paras::Trait for Runtime {
impl parachains_paras::Config for Runtime {
type Origin = Origin;
}
impl parachains_dmp::Trait for Runtime {}
impl parachains_dmp::Config for Runtime {}
impl parachains_ump::Trait for Runtime {
impl parachains_ump::Config for Runtime {
type UmpSink = ();
}
impl parachains_hrmp::Trait for Runtime {
impl parachains_hrmp::Config for Runtime {
type Origin = Origin;
}
impl parachains_scheduler::Trait for Runtime {}
impl parachains_scheduler::Config for Runtime {}
impl paras_sudo_wrapper::Trait for Runtime {}
impl paras_sudo_wrapper::Config for Runtime {}
construct_runtime! {
pub enum Runtime where
+26 -26
View File
@@ -118,7 +118,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;
@@ -150,7 +150,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;
@@ -166,7 +166,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;
@@ -195,7 +195,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;
@@ -208,7 +208,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;
@@ -222,7 +222,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, ToAuthor<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
@@ -232,7 +232,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;
@@ -244,7 +244,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 = ();
@@ -270,7 +270,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>;
@@ -283,7 +283,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>;
}
@@ -317,7 +317,7 @@ parameter_types! {
.saturating_sub(ExtrinsicBaseWeight::get());
}
impl pallet_staking::Trait for Runtime {
impl pallet_staking::Config for Runtime {
type Currency = Balances;
type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote;
@@ -359,14 +359,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 _;
@@ -377,7 +377,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;
@@ -386,7 +386,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;
@@ -414,7 +414,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()
@@ -470,7 +470,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 = ();
@@ -485,7 +485,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>;
@@ -499,7 +499,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;
@@ -516,7 +516,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;
@@ -530,7 +530,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;
@@ -538,7 +538,7 @@ impl pallet_vesting::Trait for Runtime {
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
}
impl pallet_sudo::Trait for Runtime {
impl pallet_sudo::Config for Runtime {
type Event = Event;
type Call = Call;
}
@@ -628,7 +628,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;
@@ -992,9 +992,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
@@ -41,7 +41,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_859_000 as Weight)
}
@@ -41,7 +41,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 {
(92_296_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -41,7 +41,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_425_000 as Weight)
.saturating_add((296_000 as Weight).saturating_mul(r as Weight))
@@ -41,7 +41,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_057_000 as Weight)
.saturating_add((217_000 as Weight).saturating_mul(k as Weight))
@@ -41,7 +41,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_356_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
@@ -41,7 +41,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_253_000 as Weight)
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
@@ -41,7 +41,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 {
(29_891_000 as Weight)
.saturating_add((182_000 as Weight).saturating_mul(p as Weight))
@@ -41,7 +41,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_042_000 as Weight)
.saturating_add((43_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_357_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
@@ -41,7 +41,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 {
(92_588_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
@@ -41,7 +41,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 {
(9_830_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
@@ -41,7 +41,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_268_000 as Weight)
.saturating_add((1_504_000 as Weight).saturating_mul(c as Weight))
@@ -41,7 +41,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 {
(52_570_000 as Weight)
.saturating_add((130_000 as Weight).saturating_mul(l as Weight))