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
+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(),
));