Unverified Commit efa9b994 authored by thiolliere's avatar thiolliere Committed by GitHub
Browse files

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 <>
parent c58fd0ea
Pipeline #115490 passed with stages
in 20 minutes and 23 seconds
This diff is collapsed.
......@@ -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()));
......
......@@ -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(),
));
......
......@@ -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 = ();
......
......@@ -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;
......
......@@ -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);
}