Unverified Commit c868b0de authored by Shawn Tabrizi's avatar Shawn Tabrizi Committed by GitHub
Browse files

ModuleId to PalletId (#2864)



* lock substrate version for testing

* `ModuleId` to `PalletId`

* release substrate version

* Update Cargo.lock
Co-authored-by: default avatarXavier Lau <c.estlavie@icloud.com>
parent cf87cbe6
Pipeline #133557 failed with stages
in 18 minutes and 49 seconds
This diff is collapsed.
......@@ -50,7 +50,7 @@
//! returned to the crowdloan account.
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, ensure, Identity,
decl_module, decl_storage, decl_event, decl_error, ensure, Identity, PalletId,
storage::{child, ChildTriePrefixIterator},
traits::{
Currency, ReservableCurrency, Get, ExistenceRequirement::AllowDeath
......@@ -59,7 +59,7 @@ use frame_support::{
};
use frame_system::{ensure_signed, ensure_root};
use sp_runtime::{
ModuleId, DispatchResult, RuntimeDebug, MultiSignature, MultiSigner,
DispatchResult, RuntimeDebug, MultiSignature, MultiSigner,
traits::{
AccountIdConversion, Hash, Saturating, Zero, One, CheckedAdd, Verify, IdentifyAccount,
},
......@@ -107,8 +107,8 @@ impl WeightInfo for TestWeightInfo {
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
/// ModuleID for the crowdloan module. An appropriate value could be ```ModuleId(*b"py/cfund")```
type ModuleId: Get<ModuleId>;
/// PalletId for the crowdloan module. An appropriate value could be ```PalletId(*b"py/cfund")```
type PalletId: Get<PalletId>;
/// The amount to be held on deposit by the depositor of a crowdloan.
type SubmissionDeposit: Get<BalanceOf<Self>>;
......@@ -287,7 +287,7 @@ decl_module! {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;
const ModuleId: ModuleId = T::ModuleId::get();
const PalletId: PalletId = T::PalletId::get();
const MinContribution: BalanceOf<T> = T::MinContribution::get();
const RemoveKeysLimit: u32 = T::RemoveKeysLimit::get();
......@@ -631,7 +631,7 @@ impl<T: Config> Module<T> {
/// This actually does computation. If you need to keep using it, then make sure you cache the
/// value and only call this once.
pub fn fund_account_id(index: ParaId) -> T::AccountId {
T::ModuleId::get().into_sub_account(index)
T::PalletId::get().into_sub_account(index)
}
pub fn id_from_index(index: TrieIndex) -> child::ChildInfo {
......@@ -900,7 +900,7 @@ mod tests {
parameter_types! {
pub const SubmissionDeposit: u64 = 1;
pub const MinContribution: u64 = 10;
pub const CrowdloanModuleId: ModuleId = ModuleId(*b"py/cfund");
pub const CrowdloanPalletId: PalletId = PalletId(*b"py/cfund");
pub const RemoveKeysLimit: u32 = 10;
pub const MaxMemoLength: u8 = 32;
}
......@@ -909,7 +909,7 @@ mod tests {
type Event = Event;
type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution;
type ModuleId = CrowdloanModuleId;
type PalletId = CrowdloanPalletId;
type RemoveKeysLimit = RemoveKeysLimit;
type Registrar = TestRegistrar<Test>;
type Auctioneer = TestAuctioneer;
......
......@@ -65,11 +65,11 @@ where
mod tests {
use super::*;
use frame_system::limits;
use frame_support::{parameter_types, weights::DispatchClass};
use frame_support::{parameter_types, PalletId, weights::DispatchClass};
use frame_support::traits::FindAuthor;
use sp_core::H256;
use sp_runtime::{
testing::Header, ModuleId,
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
Perbill,
};
......@@ -141,7 +141,7 @@ mod tests {
}
parameter_types! {
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
}
impl pallet_treasury::Config for Test {
......@@ -155,7 +155,7 @@ mod tests {
type SpendPeriod = ();
type Burn = ();
type BurnDestination = ();
type ModuleId = TreasuryModuleId;
type PalletId = TreasuryPalletId;
type SpendFunds = ();
type WeightInfo = ();
}
......
......@@ -20,7 +20,6 @@ use sp_std::sync::Arc;
use sp_io::TestExternalities;
use sp_core::{H256, crypto::KeyTypeId};
use sp_runtime::{
ModuleId,
traits::{
BlakeTwo256, IdentityLookup, One,
},
......@@ -28,7 +27,7 @@ use sp_runtime::{
use sp_keystore::{KeystoreExt, testing::KeyStore};
use primitives::v1::{BlockNumber, Header, Id as ParaId, ValidationCode, HeadData};
use frame_support::{
parameter_types, assert_ok, assert_noop,
parameter_types, assert_ok, assert_noop, PalletId,
storage::StorageMap,
traits::{Currency, OnInitialize, OnFinalize, KeyOwnerProofSystem},
};
......@@ -213,7 +212,7 @@ impl slots::Config for Test {
}
parameter_types! {
pub const CrowdloanId: ModuleId = ModuleId(*b"py/cfund");
pub const CrowdloanId: PalletId = PalletId(*b"py/cfund");
pub const SubmissionDeposit: Balance = 100;
pub const MinContribution: Balance = 1;
pub const RetirementPeriod: BlockNumber = 10;
......@@ -223,7 +222,7 @@ parameter_types! {
impl crowdloan::Config for Test {
type Event = Event;
type ModuleId = CrowdloanId;
type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution;
type RemoveKeysLimit = RemoveKeysLimit;
......
......@@ -38,7 +38,7 @@ use runtime_common::{
ParachainSessionKeyPlaceholder, AssignmentSessionKeyPlaceholder,
};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, ModuleId,
create_runtime_str, generic, impl_opaque_keys,
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill,
transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority},
curve::PiecewiseLinear,
......@@ -56,7 +56,7 @@ use sp_version::NativeVersion;
use sp_core::OpaqueMetadata;
use sp_staking::SessionIndex;
use frame_support::{
parameter_types, construct_runtime, RuntimeDebug,
parameter_types, construct_runtime, RuntimeDebug, PalletId,
traits::{KeyOwnerProofSystem, Randomness, LockIdentifier, Filter, InstanceFilter},
weights::Weight,
};
......@@ -494,7 +494,7 @@ parameter_types! {
pub const TermDuration: BlockNumber = 24 * HOURS;
pub const DesiredMembers: u32 = 19;
pub const DesiredRunnersUp: u32 = 19;
pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
}
// Make sure that there are no more than MaxMembers members elected via phragmen.
......@@ -514,7 +514,7 @@ impl pallet_elections_phragmen::Config for Runtime {
type DesiredMembers = DesiredMembers;
type DesiredRunnersUp = DesiredRunnersUp;
type TermDuration = TermDuration;
type ModuleId = ElectionsPhragmenModuleId;
type PalletId = ElectionsPhragmenPalletId;
type WeightInfo = weights::pallet_elections_phragmen::WeightInfo<Runtime>;
}
......@@ -552,7 +552,7 @@ parameter_types! {
pub const ProposalBondMinimum: Balance = 20 * DOLLARS;
pub const SpendPeriod: BlockNumber = 6 * DAYS;
pub const Burn: Permill = Permill::from_perthousand(2);
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const TipCountdown: BlockNumber = 1 * DAYS;
pub const TipFindersFee: Percent = Percent::from_percent(20);
......@@ -573,7 +573,7 @@ type ApproveOrigin = EnsureOneOf<
>;
impl pallet_treasury::Config for Runtime {
type ModuleId = TreasuryModuleId;
type PalletId = TreasuryPalletId;
type Currency = Balances;
type ApproveOrigin = ApproveOrigin;
type RejectOrigin = MoreThanHalfCouncil;
......@@ -805,7 +805,7 @@ parameter_types! {
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
pub const MaxCandidateIntake: u32 = 1;
pub const SocietyModuleId: ModuleId = ModuleId(*b"py/socie");
pub const SocietyPalletId: PalletId = PalletId(*b"py/socie");
}
impl pallet_society::Config for Runtime {
......@@ -823,7 +823,7 @@ impl pallet_society::Config for Runtime {
type SuspensionJudgementOrigin = pallet_society::EnsureFounder<Runtime>;
type ChallengePeriod = ChallengePeriod;
type MaxCandidateIntake = MaxCandidateIntake;
type ModuleId = SocietyModuleId;
type PalletId = SocietyPalletId;
}
parameter_types! {
......
......@@ -39,7 +39,7 @@ use primitives::v1::{
InboundDownwardMessage, InboundHrmpMessage, SessionInfo,
};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, ModuleId, ApplyExtrinsicResult,
create_runtime_str, generic, impl_opaque_keys, ApplyExtrinsicResult,
KeyTypeId, Percent, Permill, Perbill, curve::PiecewiseLinear,
transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority},
traits::{
......@@ -56,7 +56,7 @@ use sp_version::NativeVersion;
use sp_core::OpaqueMetadata;
use sp_staking::SessionIndex;
use frame_support::{
parameter_types, construct_runtime, RuntimeDebug,
parameter_types, construct_runtime, RuntimeDebug, PalletId,
traits::{KeyOwnerProofSystem, Randomness, LockIdentifier, Filter},
weights::Weight,
};
......@@ -542,14 +542,14 @@ parameter_types! {
/// 13 members initially, to be increased to 23 eventually.
pub const DesiredMembers: u32 = 13;
pub const DesiredRunnersUp: u32 = 20;
pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
}
// Make sure that there are no more than `MaxMembers` members elected via phragmen.
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
impl pallet_elections_phragmen::Config for Runtime {
type Event = Event;
type ModuleId = ElectionsPhragmenModuleId;
type PalletId = ElectionsPhragmenPalletId;
type Currency = Balances;
type ChangeMembers = Council;
type InitializeMembers = Council;
......@@ -599,7 +599,7 @@ parameter_types! {
pub const ProposalBondMinimum: Balance = 100 * DOLLARS;
pub const SpendPeriod: BlockNumber = 24 * DAYS;
pub const Burn: Permill = Permill::from_percent(1);
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const TipCountdown: BlockNumber = 1 * DAYS;
pub const TipFindersFee: Percent = Percent::from_percent(20);
......@@ -620,7 +620,7 @@ type ApproveOrigin = EnsureOneOf<
>;
impl pallet_treasury::Config for Runtime {
type ModuleId = TreasuryModuleId;
type PalletId = TreasuryPalletId;
type Currency = Balances;
type ApproveOrigin = ApproveOrigin;
type RejectOrigin = MoreThanHalfCouncil;
......
......@@ -39,10 +39,15 @@ use runtime_parachains::{
self,
runtime_api_impl::v1 as runtime_api_impl,
};
use frame_support::{construct_runtime, parameter_types, traits::{Filter, KeyOwnerProofSystem, Randomness}, weights::Weight};
use frame_support::{
construct_runtime, parameter_types,
traits::{Filter, KeyOwnerProofSystem, Randomness},
weights::Weight,
PalletId
};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
ApplyExtrinsicResult, KeyTypeId, Perbill, ModuleId,
ApplyExtrinsicResult, KeyTypeId, Perbill,
transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority},
traits::{
self, Keccak256, BlakeTwo256, Block as BlockT, OpaqueKeys, AccountIdLookup,
......@@ -734,7 +739,7 @@ impl slots::Config for Runtime {
}
parameter_types! {
pub const CrowdloanId: ModuleId = ModuleId(*b"py/cfund");
pub const CrowdloanId: PalletId = PalletId(*b"py/cfund");
pub const SubmissionDeposit: Balance = 100 * DOLLARS;
pub const MinContribution: Balance = 1 * DOLLARS;
pub const RetirementPeriod: BlockNumber = 6 * HOURS;
......@@ -745,7 +750,7 @@ parameter_types! {
impl crowdloan::Config for Runtime {
type Event = Event;
type ModuleId = CrowdloanId;
type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution;
type RemoveKeysLimit = RemoveKeysLimit;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment