Skip to content
Snippets Groups Projects
Unverified Commit 35cbc18b authored by bgallois's avatar bgallois
Browse files

fix pallets_config macro formatting

parent f5f55549
No related branches found
No related tags found
1 merge request!265Fix #218 and #158
Pipeline #37058 passed
...@@ -29,11 +29,13 @@ pub use types::*; ...@@ -29,11 +29,13 @@ pub use types::*;
pub use weights::WeightInfo; pub use weights::WeightInfo;
use core::cmp; use core::cmp;
#[cfg(feature = "runtime-benchmarks")]
use frame_support::traits::tokens::fungible::Mutate;
use frame_support::{ use frame_support::{
pallet_prelude::*, pallet_prelude::*,
traits::{ traits::{
fungible, fungible,
fungible::{Credit, Inspect, Mutate}, fungible::{Credit, Inspect},
tokens::WithdrawConsequence, tokens::WithdrawConsequence,
IsSubType, StorageVersion, StoredMap, IsSubType, StorageVersion, StoredMap,
}, },
......
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
/// - Bound length to 42 /// - Bound length to 42
/// - accept only ascii alphanumeric or - or _ /// - accept only ascii alphanumeric or - or _
pub fn validate_idty_name(idty_name: &[u8]) -> bool { pub fn validate_idty_name(idty_name: &[u8]) -> bool {
idty_name.len() >= 3 // length smaller than 42
&& idty_name.len() <= 42 // length smaller than 42
// all characters are alphanumeric or - or _ // all characters are alphanumeric or - or _
idty_name.len() >= 3
&& idty_name.len() <= 42
&& idty_name && idty_name
.iter() .iter()
.all(|c| c.is_ascii_alphanumeric() || *c == b'-' || *c == b'_') .all(|c| c.is_ascii_alphanumeric() || *c == b'-' || *c == b'_')
......
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
#[macro_export] #[macro_export]
macro_rules! pallets_config { macro_rules! pallets_config {
{$($custom:tt)*} => { () => {
$($custom)*
// SYSTEM // // SYSTEM //
parameter_types! { parameter_types! {
...@@ -26,59 +24,59 @@ macro_rules! pallets_config { ...@@ -26,59 +24,59 @@ macro_rules! pallets_config {
} }
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
/// The data to be stored in an account.
type AccountData = pallet_duniter_account::AccountData<Balance, IdtyIndex>;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The basic call filter to use in dispatchable. /// The basic call filter to use in dispatchable.
type BaseCallFilter = BaseCallFilter; type BaseCallFilter = BaseCallFilter;
/// Block & extrinsics weights: base values and limits. /// The block type for the runtime.
type BlockWeights = BlockWeights; type Block = Block;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = BlockHashCount;
/// The maximum length of a block (in bytes). /// The maximum length of a block (in bytes).
type BlockLength = BlockLength; type BlockLength = BlockLength;
/// The identifier used to distinguish between accounts. /// Block & extrinsics weights: base values and limits.
type AccountId = AccountId; type BlockWeights = BlockWeights;
/// The aggregated dispatch type that is available for extrinsics. /// The weight of database operations that the runtime can invoke.
type RuntimeCall = RuntimeCall; type DbWeight = DbWeight;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
/// The type for hashing blocks and tries. /// The type for hashing blocks and tries.
type Hash = Hash; type Hash = Hash;
/// The hashing algorithm used. /// The hashing algorithm used.
type Hashing = BlakeTwo256; type Hashing = BlakeTwo256;
/// The ubiquitous event type. /// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type RuntimeEvent = RuntimeEvent; type Lookup = AccountIdLookup<AccountId, ()>;
/// The ubiquitous origin type. type MaxConsumers = frame_support::traits::ConstU32<16>;
type RuntimeOrigin = RuntimeOrigin; type MultiBlockMigrator = ();
/// Maximum number of block number to block hash mappings to keep (oldest pruned first). /// The type for storing how many extrinsics an account has signed.
type BlockHashCount = BlockHashCount; type Nonce = node_primitives::Nonce;
/// The weight of database operations that the runtime can invoke. /// What to do if an account is fully reaped from the system.
type DbWeight = DbWeight; type OnKilledAccount = ();
/// Version of the runtime. /// What to do if a new account is created.
type Version = Version; type OnNewAccount = ();
/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
/// Converts a module to the index of the module in `construct_runtime!`. /// Converts a module to the index of the module in `construct_runtime!`.
/// ///
/// This type is being generated by `construct_runtime!`. /// This type is being generated by `construct_runtime!`.
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
/// What to do if a new account is created. type PostInherents = ();
type OnNewAccount = (); type PostTransactions = ();
/// What to do if an account is fully reaped from the system. type PreInherents = ();
type OnKilledAccount = (); /// The aggregated dispatch type that is available for extrinsics.
/// The data to be stored in an account. type RuntimeCall = RuntimeCall;
type AccountData = pallet_duniter_account::AccountData<Balance, IdtyIndex>; /// The ubiquitous event type.
/// Weight information for the extrinsics of this pallet. type RuntimeEvent = RuntimeEvent;
type SystemWeightInfo = common_runtime::weights::frame_system::WeightInfo<Runtime>; /// The ubiquitous origin type.
type RuntimeOrigin = RuntimeOrigin;
type RuntimeTask = ();
/// This is used as an identifier of the chain. 42 is the generic substrate prefix. /// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix; type SS58Prefix = SS58Prefix;
/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
/// The type for storing how many extrinsics an account has signed.
type Nonce = node_primitives::Nonce;
/// The block type for the runtime.
type Block = Block;
type RuntimeTask = ();
type SingleBlockMigrations = (); type SingleBlockMigrations = ();
type MultiBlockMigrator = (); /// Weight information for the extrinsics of this pallet.
type PreInherents = (); type SystemWeightInfo = common_runtime::weights::frame_system::WeightInfo<Runtime>;
type PostInherents = (); /// Version of the runtime.
type PostTransactions = (); type Version = Version;
} }
// SCHEDULER // // SCHEDULER //
...@@ -90,26 +88,26 @@ macro_rules! pallets_config { ...@@ -90,26 +88,26 @@ macro_rules! pallets_config {
pub const NoPreimagePostponement: Option<u32> = Some(10); pub const NoPreimagePostponement: Option<u32> = Some(10);
} }
impl pallet_scheduler::Config for Runtime { impl pallet_scheduler::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type MaxScheduledPerBlock = MaxScheduledPerBlock;
type RuntimeOrigin = RuntimeOrigin; type MaximumWeight = MaximumSchedulerWeight;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type Preimages = Preimage;
type RuntimeCall = RuntimeCall; type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight; type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type ScheduleOrigin = EnsureRoot<AccountId>; type ScheduleOrigin = EnsureRoot<AccountId>;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = common_runtime::weights::pallet_scheduler::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_scheduler::WeightInfo<Runtime>;
type Preimages = Preimage;
} }
// ACCOUNT // // ACCOUNT //
impl pallet_duniter_account::Config for Runtime { impl pallet_duniter_account::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_duniter_account::WeightInfo<Runtime>;
// does currency adapter in any case, but adds "refund with quota" feature // does currency adapter in any case, but adds "refund with quota" feature
type InnerOnChargeTransaction = FungibleAdapter<Balances, HandleFees>; type InnerOnChargeTransaction = FungibleAdapter<Balances, HandleFees>;
type Refund = Quota; type Refund = Quota;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_duniter_account::WeightInfo<Runtime>;
} }
// QUOTA // // QUOTA //
...@@ -128,55 +126,52 @@ macro_rules! pallets_config { ...@@ -128,55 +126,52 @@ macro_rules! pallets_config {
pub TreasuryAccount: AccountId = Treasury::account_id(); // TODO pub TreasuryAccount: AccountId = Treasury::account_id(); // TODO
} }
impl pallet_quota::Config for Runtime { impl pallet_quota::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// type IdtyId = IdtyIndex;
type ReloadRate = ReloadRate;
type MaxQuota = MaxQuota; type MaxQuota = MaxQuota;
type RefundAccount = TreasuryAccountId; type RefundAccount = TreasuryAccountId;
type ReloadRate = ReloadRate;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_quota::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_quota::WeightInfo<Runtime>;
} }
// BLOCK CREATION // // BLOCK CREATION //
impl pallet_babe::Config for Runtime { impl pallet_babe::Config for Runtime {
type EpochDuration = EpochDuration; type DisabledValidators = Session;
type ExpectedBlockTime = ExpectedBlockTime;
// session module is the trigger // session module is the trigger
type EpochChangeTrigger = pallet_babe::ExternalTrigger; type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session; type EpochDuration = EpochDuration;
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;
type EquivocationReportSystem = type EquivocationReportSystem =
pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>; pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
type WeightInfo = common_runtime::weights::pallet_babe::WeightInfo<Runtime>; type ExpectedBlockTime = ExpectedBlockTime;
type KeyOwnerProof =
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxNominators; type MaxNominators = MaxNominators;
type WeightInfo = common_runtime::weights::pallet_babe::WeightInfo<Runtime>;
} }
impl pallet_timestamp::Config for Runtime { impl pallet_timestamp::Config for Runtime {
type MinimumPeriod = MinimumPeriod;
type Moment = u64; type Moment = u64;
type OnTimestampSet = (Babe, UniversalDividend); type OnTimestampSet = (Babe, UniversalDividend);
type MinimumPeriod = MinimumPeriod;
type WeightInfo = common_runtime::weights::pallet_timestamp::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_timestamp::WeightInfo<Runtime>;
} }
// MONEY MANAGEMENT // // MONEY MANAGEMENT //
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason; type AccountStore = Account;
type RuntimeFreezeReason = ();
type RuntimeEvent = RuntimeEvent;
type MaxLocks = MaxLocks;
type MaxReserves = frame_support::pallet_prelude::ConstU32<5>;
type ReserveIdentifier = [u8; 8];
type Balance = Balance; type Balance = Balance;
type DustRemoval = HandleFees; type DustRemoval = HandleFees;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = Account;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxFreezes = frame_support::pallet_prelude::ConstU32<0>; type MaxFreezes = frame_support::pallet_prelude::ConstU32<0>;
type MaxLocks = MaxLocks;
type MaxReserves = frame_support::pallet_prelude::ConstU32<5>;
type ReserveIdentifier = [u8; 8];
type RuntimeEvent = RuntimeEvent;
type RuntimeFreezeReason = ();
type RuntimeHoldReason = RuntimeHoldReason;
type WeightInfo = common_runtime::weights::pallet_balances::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_balances::WeightInfo<Runtime>;
} }
...@@ -185,32 +180,33 @@ type MaxNominators = MaxNominators; ...@@ -185,32 +180,33 @@ type MaxNominators = MaxNominators;
impl frame_support::traits::OnUnbalanced<CreditOf> for HandleFees { impl frame_support::traits::OnUnbalanced<CreditOf> for HandleFees {
fn on_nonzero_unbalanced(amount: CreditOf) { fn on_nonzero_unbalanced(amount: CreditOf) {
// fee is moved to treasury // fee is moved to treasury
let _ = Balances::deposit(&Treasury::account_id(), amount.peek(), frame_support::traits::tokens::Precision::Exact); let _ = Balances::deposit(
// should move the tip to author &Treasury::account_id(),
// if let Some(author) = Authorship::author() { amount.peek(),
// Balances::resolve_creating(&author, amount); frame_support::traits::tokens::Precision::Exact,
// } );
} }
} }
pub struct OnChargeTransaction; pub struct OnChargeTransaction;
parameter_types! { parameter_types! {
pub FeeMultiplier: pallet_transaction_payment::Multiplier = pallet_transaction_payment::Multiplier::one(); pub FeeMultiplier: Multiplier = Multiplier::one();
} }
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type FeeMultiplierUpdate =
pallet_transaction_payment::ConstFeeMultiplier<FeeMultiplier>;
type LengthToFee = common_runtime::fees::LengthToFeeImpl<Balance>;
// does a filter on the call // does a filter on the call
type OnChargeTransaction = OneshotAccount; type OnChargeTransaction = OneshotAccount;
type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>; type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>;
type RuntimeEvent = RuntimeEvent;
type WeightToFee = common_runtime::fees::WeightToFeeImpl<Balance>; type WeightToFee = common_runtime::fees::WeightToFeeImpl<Balance>;
type LengthToFee = common_runtime::fees::LengthToFeeImpl<Balance>;
type FeeMultiplierUpdate = pallet_transaction_payment::ConstFeeMultiplier<FeeMultiplier>;
} }
impl pallet_oneshot_account::Config for Runtime { impl pallet_oneshot_account::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
// when call is not oneshot account, fall back to duniter-account implementation // when call is not oneshot account, fall back to duniter-account implementation
type InnerOnChargeTransaction = Account; type InnerOnChargeTransaction = Account;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_oneshot_account::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_oneshot_account::WeightInfo<Runtime>;
} }
...@@ -220,49 +216,51 @@ type MaxNominators = MaxNominators; ...@@ -220,49 +216,51 @@ type MaxNominators = MaxNominators;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = MaxAuthorities;
} }
impl pallet_authority_members::Config for Runtime { impl pallet_authority_members::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type IsMember = SmithMembers; type IsMember = SmithMembers;
type OnNewSession = OnNewSessionHandler<Runtime>; type MaxAuthorities = MaxAuthorities;
type MemberId = IdtyIndex; type MemberId = IdtyIndex;
type MemberIdOf = common_runtime::providers::IdentityIndexOf<Self>; type MemberIdOf = common_runtime::providers::IdentityIndexOf<Self>;
type MaxAuthorities = MaxAuthorities;
type RemoveMemberOrigin = EnsureRoot<Self::AccountId>;
type WeightInfo = common_runtime::weights::pallet_authority_members::WeightInfo<Runtime>;
type OnIncomingMember = SmithMembers; type OnIncomingMember = SmithMembers;
type OnNewSession = OnNewSessionHandler<Runtime>;
type OnOutgoingMember = SmithMembers; type OnOutgoingMember = SmithMembers;
type RemoveMemberOrigin = EnsureRoot<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type WeightInfo =
common_runtime::weights::pallet_authority_members::WeightInfo<Runtime>;
} }
impl pallet_authorship::Config for Runtime { impl pallet_authorship::Config for Runtime {
type EventHandler = ImOnline; type EventHandler = ImOnline;
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>; type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
} }
impl pallet_im_online::Config for Runtime { impl pallet_im_online::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = ImOnlineId; type AuthorityId = ImOnlineId;
type ValidatorSet = Historical;
type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences;
type UnsignedPriority = ImOnlineUnsignedPriority;
type WeightInfo = common_runtime::weights::pallet_im_online::WeightInfo<Runtime>;
#[cfg(not(feature = "runtime-benchmarks"))] #[cfg(not(feature = "runtime-benchmarks"))]
type MaxKeys = MaxAuthorities; type MaxKeys = MaxAuthorities;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
type MaxKeys = frame_support::traits::ConstU32<1_000>; // At least 1000 to be benchmarkable see https://github.com/paritytech/substrate/blob/e94cb0dafd4f30ff29512c1c00ec513ada7d2b5d/frame/im-online/src/benchmarking.rs#L35 type MaxKeys = frame_support::traits::ConstU32<1_000>;
type MaxPeerInHeartbeats = MaxPeerInHeartbeats; type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences;
type RuntimeEvent = RuntimeEvent;
type UnsignedPriority = ImOnlineUnsignedPriority;
type ValidatorSet = Historical;
type WeightInfo = common_runtime::weights::pallet_im_online::WeightInfo<Runtime>;
} }
impl pallet_offences::Config for Runtime { impl pallet_offences::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = AuthorityMembers; type OnOffenceHandler = AuthorityMembers;
type RuntimeEvent = RuntimeEvent;
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
type Keys = opaque::SessionKeys;
type NextSessionRotation = Babe;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type SessionManager =
pallet_session::historical::NoteHistoricalRoot<Self, AuthorityMembers>;
type ShouldEndSession = Babe;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = sp_runtime::traits::ConvertInto; type ValidatorIdOf = sp_runtime::traits::ConvertInto;
type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, AuthorityMembers>;
type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type WeightInfo = common_runtime::weights::pallet_session::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_session::WeightInfo<Runtime>;
} }
impl pallet_session::historical::Config for Runtime { impl pallet_session::historical::Config for Runtime {
...@@ -270,15 +268,18 @@ type MaxNominators = MaxNominators; ...@@ -270,15 +268,18 @@ type MaxNominators = MaxNominators;
type FullIdentificationOf = FullIdentificationOfImpl; type FullIdentificationOf = FullIdentificationOfImpl;
} }
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type EquivocationReportSystem = pallet_grandpa::EquivocationReportSystem<
type KeyOwnerProof = Self,
<Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; Offences,
type EquivocationReportSystem = Historical,
pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>; ReportLongevity,
type WeightInfo = common_runtime::weights::pallet_grandpa::WeightInfo<Runtime>; >;
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = MaxAuthorities;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
type MaxNominators = frame_support::traits::ConstU32<64>; type MaxNominators = frame_support::traits::ConstU32<64>;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_grandpa::WeightInfo<Runtime>;
} }
parameter_types! { parameter_types! {
// BondingDuration::get() * SessionsPerEra::get(); // BondingDuration::get() * SessionsPerEra::get();
...@@ -289,19 +290,23 @@ type MaxNominators = MaxNominators; ...@@ -289,19 +290,23 @@ type MaxNominators = MaxNominators;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
parameter_types! { parameter_types! {
pub const WorstCaseOrigin: pallet_collective::RawOrigin<AccountId, TechnicalCommitteeInstance> = pub const WorstCaseOrigin: WorstOrigin = WorstOrigin::Members(2, 3);
pallet_collective::RawOrigin::<AccountId, TechnicalCommitteeInstance>::Members(2, 3);
} }
impl pallet_upgrade_origin::Config for Runtime { impl pallet_upgrade_origin::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Call = RuntimeCall; type Call = RuntimeCall;
type UpgradableOrigin = pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeInstance, 2, 3>; type RuntimeEvent = RuntimeEvent;
type UpgradableOrigin = pallet_collective::EnsureProportionAtLeast<
AccountId,
TechnicalCommitteeInstance,
2,
3,
>;
type WeightInfo = common_runtime::weights::pallet_upgrade_origin::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_upgrade_origin::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
type WorstCaseOriginType = pallet_collective::RawOrigin<AccountId, TechnicalCommitteeInstance>;
#[cfg(feature = "runtime-benchmarks")]
type WorstCaseOrigin = WorstCaseOrigin; type WorstCaseOrigin = WorstCaseOrigin;
#[cfg(feature = "runtime-benchmarks")]
type WorstCaseOriginType = RawOrigin<AccountId, TechnicalCommitteeInstance>;
} }
parameter_types! { parameter_types! {
...@@ -311,32 +316,33 @@ type MaxNominators = MaxNominators; ...@@ -311,32 +316,33 @@ type MaxNominators = MaxNominators;
} }
impl pallet_preimage::Config for Runtime { impl pallet_preimage::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type Consideration = ();
type WeightInfo = common_runtime::weights::pallet_preimage::WeightInfo<Runtime>;
type Currency = Balances; type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>; type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = (); type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_preimage::WeightInfo<Runtime>;
} }
// UTILITIES // // UTILITIES //
impl pallet_atomic_swap::Config for Runtime { impl pallet_atomic_swap::Config for Runtime {
type ProofLimit = frame_support::traits::ConstU32<1_024>;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type SwapAction = pallet_atomic_swap::BalanceSwapAction<AccountId, Balances>; type SwapAction = pallet_atomic_swap::BalanceSwapAction<AccountId, Balances>;
type ProofLimit = frame_support::traits::ConstU32<1_024>;
} }
impl pallet_provide_randomness::Config for Runtime { impl pallet_provide_randomness::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type GetCurrentEpochIndex = GetCurrentEpochIndex<Self>; type GetCurrentEpochIndex = GetCurrentEpochIndex<Self>;
type MaxRequests = frame_support::traits::ConstU32<100>; type MaxRequests = frame_support::traits::ConstU32<100>;
type RequestPrice = frame_support::traits::ConstU64<2_000>;
type OnFilledRandomness = (); type OnFilledRandomness = ();
type OnUnbalanced = HandleFees; type OnUnbalanced = HandleFees;
type ParentBlockRandomness = pallet_babe::ParentBlockRandomness<Self>; type ParentBlockRandomness = pallet_babe::ParentBlockRandomness<Self>;
type RandomnessFromOneEpochAgo = pallet_babe::RandomnessFromOneEpochAgo<Self>; type RandomnessFromOneEpochAgo = pallet_babe::RandomnessFromOneEpochAgo<Self>;
type WeightInfo = common_runtime::weights::pallet_provide_randomness::WeightInfo<Runtime>; type RequestPrice = frame_support::traits::ConstU64<2_000>;
type RuntimeEvent = RuntimeEvent;
type WeightInfo =
common_runtime::weights::pallet_provide_randomness::WeightInfo<Runtime>;
} }
parameter_types! { parameter_types! {
...@@ -348,17 +354,17 @@ type MaxNominators = MaxNominators; ...@@ -348,17 +354,17 @@ type MaxNominators = MaxNominators;
pub const AnnouncementDepositFactor: Balance = deposit(0, 66); pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
} }
impl pallet_proxy::Config for Runtime { impl pallet_proxy::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type AnnouncementDepositBase = AnnouncementDepositBase;
type RuntimeCall = RuntimeCall; type AnnouncementDepositFactor = AnnouncementDepositFactor;
type CallHasher = BlakeTwo256;
type Currency = Balances; type Currency = Balances;
type ProxyType = ProxyType; type MaxPending = frame_support::traits::ConstU32<32>;
type MaxProxies = frame_support::traits::ConstU32<32>;
type ProxyDepositBase = ProxyDepositBase; type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor; type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = frame_support::traits::ConstU32<32>; type ProxyType = ProxyType;
type MaxPending = frame_support::traits::ConstU32<32>; type RuntimeCall = RuntimeCall;
type CallHasher = BlakeTwo256; type RuntimeEvent = RuntimeEvent;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
type WeightInfo = common_runtime::weights::pallet_proxy::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_proxy::WeightInfo<Runtime>;
} }
...@@ -367,19 +373,19 @@ type MaxNominators = MaxNominators; ...@@ -367,19 +373,19 @@ type MaxNominators = MaxNominators;
pub const DepositFactor: Balance = DEPOSIT_PER_BYTE * 32; pub const DepositFactor: Balance = DEPOSIT_PER_BYTE * 32;
} }
impl pallet_multisig::Config for Runtime { impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type DepositBase = DepositBase; type DepositBase = DepositBase;
type DepositFactor = DepositFactor; type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories; type MaxSignatories = MaxSignatories;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_multisig::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_multisig::WeightInfo<Runtime>;
} }
impl pallet_utility::Config for Runtime { impl pallet_utility::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_utility::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_utility::WeightInfo<Runtime>;
} }
...@@ -394,29 +400,30 @@ type MaxNominators = MaxNominators; ...@@ -394,29 +400,30 @@ type MaxNominators = MaxNominators;
} }
impl pallet_treasury::Config for Runtime { impl pallet_treasury::Config for Runtime {
type ApproveOrigin = TreasuryApproveOrigin; type ApproveOrigin = TreasuryApproveOrigin;
type AssetKind = ();
type BalanceConverter = frame_support::traits::tokens::UnityAssetBalanceConversion;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
type Beneficiary = AccountId;
type BeneficiaryLookup = AccountIdLookup<AccountId, ()>;
type Burn = Burn; type Burn = Burn;
type BurnDestination = (); type BurnDestination = ();
type Currency = Balances; type Currency = Balances;
type RuntimeEvent = RuntimeEvent; type MaxApprovals = frame_support::traits::ConstU32<100>;
type OnSlash = Treasury; type OnSlash = Treasury;
type PalletId = TreasuryPalletId;
type Paymaster =
frame_support::traits::tokens::pay::PayFromAccount<Balances, TreasuryAccount>;
type PayoutPeriod = sp_core::ConstU32<10>;
type ProposalBond = ProposalBond; type ProposalBond = ProposalBond;
type ProposalBondMinimum = frame_support::traits::ConstU64<10_000>;
type ProposalBondMaximum = ProposalBondMaximum; type ProposalBondMaximum = ProposalBondMaximum;
type MaxApprovals = frame_support::traits::ConstU32<100>; type ProposalBondMinimum = frame_support::traits::ConstU64<10_000>;
type PalletId = TreasuryPalletId;
type RejectOrigin = TreasuryRejectOrigin; type RejectOrigin = TreasuryRejectOrigin;
type RuntimeEvent = RuntimeEvent;
type SpendFunds = TreasurySpendFunds<Self>; type SpendFunds = TreasurySpendFunds<Self>;
type SpendPeriod = SpendPeriod;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>; type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
type SpendPeriod = SpendPeriod;
type WeightInfo = common_runtime::weights::pallet_treasury::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_treasury::WeightInfo<Runtime>;
type AssetKind = ();
type Beneficiary = AccountId;
type BeneficiaryLookup = AccountIdLookup<AccountId, ()>;
type Paymaster = frame_support::traits::tokens::pay::PayFromAccount<Balances, TreasuryAccount>;
type BalanceConverter = frame_support::traits::tokens::UnityAssetBalanceConversion;
type PayoutPeriod = sp_core::ConstU32<10>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
} }
// UNIVERSAL DIVIDEND // // UNIVERSAL DIVIDEND //
...@@ -429,27 +436,28 @@ type MaxNominators = MaxNominators; ...@@ -429,27 +436,28 @@ type MaxNominators = MaxNominators;
} }
impl pallet_universal_dividend::Config for Runtime { impl pallet_universal_dividend::Config for Runtime {
type MomentIntoBalance = sp_runtime::traits::ConvertInto;
type Currency = Balances; type Currency = Balances;
type RuntimeEvent = RuntimeEvent; #[cfg(feature = "runtime-benchmarks")]
type IdtyAttr = Identity;
type MaxPastReeval = frame_support::traits::ConstU32<160>; type MaxPastReeval = frame_support::traits::ConstU32<160>;
type MembersCount = MembersCount; type MembersCount = MembersCount;
type MembersStorage = common_runtime::providers::UdMembersStorage<Runtime>; type MembersStorage = common_runtime::providers::UdMembersStorage<Runtime>;
type MomentIntoBalance = sp_runtime::traits::ConvertInto;
type RuntimeEvent = RuntimeEvent;
type SquareMoneyGrowthRate = SquareMoneyGrowthRate; type SquareMoneyGrowthRate = SquareMoneyGrowthRate;
type UdCreationPeriod = UdCreationPeriod; type UdCreationPeriod = UdCreationPeriod;
type UdReevalPeriod = UdReevalPeriod; type UdReevalPeriod = UdReevalPeriod;
type UnitsPerUd = frame_support::traits::ConstU64<1_000>; type UnitsPerUd = frame_support::traits::ConstU64<1_000>;
type WeightInfo = common_runtime::weights::pallet_universal_dividend::WeightInfo<Runtime>; type WeightInfo =
#[cfg(feature = "runtime-benchmarks")] common_runtime::weights::pallet_universal_dividend::WeightInfo<Runtime>;
type IdtyAttr = Identity;
} }
// WEB OF TRUST // // WEB OF TRUST //
impl pallet_duniter_wot::Config for Runtime { impl pallet_duniter_wot::Config for Runtime {
type FirstIssuableOn = WotFirstCertIssuableOn; type FirstIssuableOn = WotFirstCertIssuableOn;
type MinCertForMembership = WotMinCertForMembership;
type MinCertForCreateIdtyRight = WotMinCertForCreateIdtyRight; type MinCertForCreateIdtyRight = WotMinCertForCreateIdtyRight;
type MinCertForMembership = WotMinCertForMembership;
} }
parameter_types! { parameter_types! {
...@@ -457,87 +465,87 @@ type MaxNominators = MaxNominators; ...@@ -457,87 +465,87 @@ type MaxNominators = MaxNominators;
pub const DeletionPeriod: BlockNumber = 10 * YEARS; pub const DeletionPeriod: BlockNumber = 10 * YEARS;
} }
impl pallet_identity::Config for Runtime { impl pallet_identity::Config for Runtime {
type AccountLinker = Account;
type AutorevocationPeriod = AutorevocationPeriod;
type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod;
type CheckAccountWorthiness = Account;
type CheckIdtyCallAllowed = Wot;
type ConfirmPeriod = ConfirmPeriod; type ConfirmPeriod = ConfirmPeriod;
type ValidationPeriod = ValidationPeriod;
type AutorevocationPeriod = AutorevocationPeriod;
type DeletionPeriod = DeletionPeriod; type DeletionPeriod = DeletionPeriod;
type CheckIdtyCallAllowed = Wot;
type CheckAccountWorthiness = Account;
type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyCreationPeriod = IdtyCreationPeriod;
type IdtyData = IdtyData; type IdtyData = IdtyData;
type IdtyIndex = IdtyIndex; type IdtyIndex = IdtyIndex;
type AccountLinker = Account;
type IdtyNameValidator = IdtyNameValidatorImpl; type IdtyNameValidator = IdtyNameValidatorImpl;
type Signer = <Signature as sp_runtime::traits::Verify>::Signer;
type Signature = Signature;
type OnNewIdty = OnNewIdtyHandler<Runtime>; type OnNewIdty = OnNewIdtyHandler<Runtime>;
type OnRemoveIdty = OnRemoveIdtyHandler<Runtime>; type OnRemoveIdty = OnRemoveIdtyHandler<Runtime>;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type Signature = Signature;
type Signer = <Signature as sp_runtime::traits::Verify>::Signer;
type ValidationPeriod = ValidationPeriod;
type WeightInfo = common_runtime::weights::pallet_identity::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_identity::WeightInfo<Runtime>;
} }
impl pallet_sudo::Config for Runtime { impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall; type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_sudo::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_sudo::WeightInfo<Runtime>;
} }
impl pallet_membership::Config for Runtime { impl pallet_membership::Config for Runtime {
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkSetupHandler = common_runtime::providers::BenchmarkSetupHandler<Runtime>;
type CheckMembershipOpAllowed = Wot; type CheckMembershipOpAllowed = Wot;
type IdtyId = IdtyIndex;
type IdtyAttr = Identity; type IdtyAttr = Identity;
type IdtyId = IdtyIndex;
type MembershipPeriod = MembershipPeriod; type MembershipPeriod = MembershipPeriod;
type MembershipRenewalPeriod = MembershipRenewalPeriod; type MembershipRenewalPeriod = MembershipRenewalPeriod;
type OnNewMembership = OnNewMembershipHandler<Runtime>; type OnNewMembership = OnNewMembershipHandler<Runtime>;
type OnRemoveMembership = OnRemoveMembershipHandler<Runtime>; type OnRemoveMembership = OnRemoveMembershipHandler<Runtime>;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_membership::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_membership::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkSetupHandler = common_runtime::providers::BenchmarkSetupHandler<Runtime>;
} }
impl pallet_certification::Config for Runtime { impl pallet_certification::Config for Runtime {
type CertPeriod = CertPeriod; type CertPeriod = CertPeriod;
type IdtyIndex = IdtyIndex;
type IdtyAttr = Identity;
type CheckCertAllowed = Wot; type CheckCertAllowed = Wot;
type IdtyAttr = Identity;
type IdtyIndex = IdtyIndex;
type MaxByIssuer = MaxByIssuer; type MaxByIssuer = MaxByIssuer;
type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert; type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert;
type OnNewcert = Wot; type OnNewcert = Wot;
type OnRemovedCert = Wot; type OnRemovedCert = Wot;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type WeightInfo = common_runtime::weights::pallet_certification::WeightInfo<Runtime>;
type ValidityPeriod = ValidityPeriod; type ValidityPeriod = ValidityPeriod;
type WeightInfo = common_runtime::weights::pallet_certification::WeightInfo<Runtime>;
} }
parameter_types! { parameter_types! {
pub const MinAccessibleReferees: Perbill = Perbill::from_percent(80); pub const MinAccessibleReferees: Perbill = Perbill::from_percent(80);
} }
impl pallet_distance::Config for Runtime { impl pallet_distance::Config for Runtime {
type CheckRequestDistanceEvaluation = Wot;
type Currency = Balances; type Currency = Balances;
type EvaluationPeriod = frame_support::traits::ConstU32<7>; type EvaluationPeriod = frame_support::traits::ConstU32<7>;
type EvaluationPrice = frame_support::traits::ConstU64<1000>; type EvaluationPrice = frame_support::traits::ConstU64<1000>;
type MaxRefereeDistance = frame_support::traits::ConstU32<5>; type MaxRefereeDistance = frame_support::traits::ConstU32<5>;
type MinAccessibleReferees = MinAccessibleReferees; type MinAccessibleReferees = MinAccessibleReferees;
type RuntimeHoldReason = RuntimeHoldReason; type OnValidDistanceStatus = Wot;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type RuntimeHoldReason = RuntimeHoldReason;
type WeightInfo = common_runtime::weights::pallet_distance::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_distance::WeightInfo<Runtime>;
type OnValidDistanceStatus = Wot;
type CheckRequestDistanceEvaluation = Wot;
} }
// SMITH-MEMBERS // SMITH-MEMBERS
impl pallet_smith_members::Config for Runtime { impl pallet_smith_members::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type IdtyAttr = Identity;
type IdtyIdOfAuthorityId = sp_runtime::traits::ConvertInto;
type IdtyIndex = IdtyIndex; type IdtyIndex = IdtyIndex;
type IsWoTMember = common_runtime::providers::IsWoTMemberProvider<Runtime>; type IsWoTMember = common_runtime::providers::IsWoTMemberProvider<Runtime>;
type IdtyAttr = Identity;
type MinCertForMembership = SmithWotMinCertForMembership;
type MaxByIssuer = SmithMaxByIssuer; type MaxByIssuer = SmithMaxByIssuer;
type SmithInactivityMaxDuration = SmithInactivityMaxDuration;
type OnSmithDelete = OnSmithDeletedHandler<Runtime>;
type IdtyIdOfAuthorityId = sp_runtime::traits::ConvertInto;
type MemberId = IdtyIndex; type MemberId = IdtyIndex;
type MinCertForMembership = SmithWotMinCertForMembership;
type OnSmithDelete = OnSmithDeletedHandler<Runtime>;
type RuntimeEvent = RuntimeEvent;
type SmithInactivityMaxDuration = SmithInactivityMaxDuration;
type WeightInfo = common_runtime::weights::pallet_smith_members::WeightInfo<Runtime>; type WeightInfo = common_runtime::weights::pallet_smith_members::WeightInfo<Runtime>;
} }
...@@ -554,22 +562,22 @@ type MaxNominators = MaxNominators; ...@@ -554,22 +562,22 @@ type MaxNominators = MaxNominators;
} }
parameter_types! { parameter_types! {
pub const TechnicalCommitteeMotionDuration: BlockNumber = 7 * DAYS; pub const TechnicalCommitteeMotionDuration: BlockNumber = 7 * DAYS;
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * BlockWeights::get().max_block; pub MaxWeight: Weight = Perbill::from_percent(50) * BlockWeights::get().max_block;
} }
impl pallet_collective::Config<Instance2> for Runtime { impl pallet_collective::Config<Instance2> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalCommitteeMotionDuration;
type MaxProposals = frame_support::pallet_prelude::ConstU32<20>;
type MaxMembers = frame_support::pallet_prelude::ConstU32<100>;
type WeightInfo = common_runtime::weights::pallet_collective::WeightInfo<Runtime>;
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposalWeight = MaxProposalWeight;
#[cfg(not(feature = "runtime-benchmarks"))] #[cfg(not(feature = "runtime-benchmarks"))]
type DefaultVote = TechnicalCommitteeDefaultVote; type DefaultVote = TechnicalCommitteeDefaultVote;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
type DefaultVote = pallet_collective::PrimeDefaultVote; // Overwrite with a default vote that can return `true` sometimes as it is necessary for benchmarking type DefaultVote = pallet_collective::PrimeDefaultVote;
type MaxMembers = frame_support::pallet_prelude::ConstU32<100>;
type MaxProposalWeight = MaxWeight;
type MaxProposals = frame_support::pallet_prelude::ConstU32<20>;
type MotionDuration = TechnicalCommitteeMotionDuration;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type SetMembersOrigin = EnsureRoot<AccountId>;
type WeightInfo = common_runtime::weights::pallet_collective::WeightInfo<Runtime>;
} }
}; };
} }
...@@ -29,37 +29,40 @@ extern crate frame_benchmarking; ...@@ -29,37 +29,40 @@ extern crate frame_benchmarking;
pub mod parameters; pub mod parameters;
pub use self::parameters::*; pub use self::parameters::*;
use common_runtime::IdtyNameValidatorImpl;
pub use common_runtime::{ pub use common_runtime::{
constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber,
FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature, FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature,
}; };
use frame_support::traits::{fungible::Balanced, Imbalance}; use frame_support::{
traits::{fungible::Balanced, Contains, Imbalance},
PalletId,
};
pub use frame_system::Call as SystemCall; pub use frame_system::Call as SystemCall;
use frame_system::EnsureRoot;
pub use pallet_balances::Call as BalancesCall; pub use pallet_balances::Call as BalancesCall;
#[cfg(feature = "runtime-benchmarks")]
pub use pallet_collective::RawOrigin;
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
pub use pallet_identity::{IdtyStatus, IdtyValue}; pub use pallet_identity::{IdtyStatus, IdtyValue};
pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId; pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_session::historical as session_historical; use pallet_session::historical as session_historical;
pub use pallet_timestamp::Call as TimestampCall; pub use pallet_timestamp::Call as TimestampCall;
use pallet_transaction_payment::FungibleAdapter; use pallet_transaction_payment::{FungibleAdapter, Multiplier};
pub use pallet_universal_dividend; pub use pallet_universal_dividend;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{KeyTypeId, Perbill, Permill};
use common_runtime::IdtyNameValidatorImpl;
use frame_support::{traits::Contains, PalletId};
use frame_system::EnsureRoot;
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata; use sp_core::OpaqueMetadata;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, ApplyExtrinsicResult,
}; };
pub use sp_runtime::{KeyTypeId, Perbill, Permill};
use sp_std::prelude::*; use sp_std::prelude::*;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use sp_version::NativeVersion; use sp_version::NativeVersion;
...@@ -231,8 +234,10 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType { ...@@ -231,8 +234,10 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
} }
} }
#[cfg(feature = "runtime-benchmarks")]
type WorstOrigin = RawOrigin<AccountId, TechnicalCommitteeInstance>;
// Configure pallets to include in runtime. // Configure pallets to include in runtime.
common_runtime::pallets_config! {} common_runtime::pallets_config!();
// Create the runtime by composing the pallets that were previously configured. // Create the runtime by composing the pallets that were previously configured.
construct_runtime!( construct_runtime!(
......
...@@ -29,37 +29,40 @@ extern crate frame_benchmarking; ...@@ -29,37 +29,40 @@ extern crate frame_benchmarking;
pub mod parameters; pub mod parameters;
pub use self::parameters::*; pub use self::parameters::*;
use common_runtime::IdtyNameValidatorImpl;
pub use common_runtime::{ pub use common_runtime::{
constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber,
FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature, FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature,
}; };
use frame_support::traits::{fungible::Balanced, Imbalance}; use frame_support::{
traits::{fungible::Balanced, Contains, Imbalance},
PalletId,
};
pub use frame_system::Call as SystemCall; pub use frame_system::Call as SystemCall;
use frame_system::EnsureRoot;
pub use pallet_balances::Call as BalancesCall; pub use pallet_balances::Call as BalancesCall;
#[cfg(feature = "runtime-benchmarks")]
pub use pallet_collective::RawOrigin;
pub use pallet_duniter_test_parameters::Parameters as GenesisParameters; pub use pallet_duniter_test_parameters::Parameters as GenesisParameters;
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId; pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_session::historical as session_historical; use pallet_session::historical as session_historical;
pub use pallet_timestamp::Call as TimestampCall; pub use pallet_timestamp::Call as TimestampCall;
use pallet_transaction_payment::FungibleAdapter; use pallet_transaction_payment::{FungibleAdapter, Multiplier};
pub use pallet_universal_dividend; pub use pallet_universal_dividend;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{KeyTypeId, Perbill, Permill};
use common_runtime::IdtyNameValidatorImpl;
use frame_support::{traits::Contains, PalletId};
use frame_system::EnsureRoot;
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata; use sp_core::OpaqueMetadata;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, ApplyExtrinsicResult,
}; };
pub use sp_runtime::{KeyTypeId, Perbill, Permill};
use sp_std::prelude::*; use sp_std::prelude::*;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use sp_version::NativeVersion; use sp_version::NativeVersion;
...@@ -242,8 +245,6 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType { ...@@ -242,8 +245,6 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
} }
} }
// Configure pallets to include in runtime.
common_runtime::pallets_config! {
// Dynamic parameters // Dynamic parameters
pub type EpochDuration = pallet_duniter_test_parameters::BabeEpochDuration<Runtime>; pub type EpochDuration = pallet_duniter_test_parameters::BabeEpochDuration<Runtime>;
pub type CertPeriod = pallet_duniter_test_parameters::CertPeriod<Runtime>; pub type CertPeriod = pallet_duniter_test_parameters::CertPeriod<Runtime>;
...@@ -273,7 +274,9 @@ common_runtime::pallets_config! { ...@@ -273,7 +274,9 @@ common_runtime::pallets_config! {
type PeriodCount = Balance; type PeriodCount = Balance;
type SessionCount = u32; type SessionCount = u32;
} }
} #[cfg(feature = "runtime-benchmarks")]
type WorstOrigin = RawOrigin<AccountId, TechnicalCommitteeInstance>;
common_runtime::pallets_config!();
// Create the runtime by composing the pallets that were previously configured. // Create the runtime by composing the pallets that were previously configured.
construct_runtime!( construct_runtime!(
......
...@@ -29,36 +29,39 @@ extern crate frame_benchmarking; ...@@ -29,36 +29,39 @@ extern crate frame_benchmarking;
pub mod parameters; pub mod parameters;
pub use self::parameters::*; pub use self::parameters::*;
use common_runtime::IdtyNameValidatorImpl;
pub use common_runtime::{ pub use common_runtime::{
constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber,
FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature, FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature,
}; };
use frame_support::traits::{fungible::Balanced, Imbalance}; use frame_support::{
traits::{fungible::Balanced, Contains, Imbalance},
PalletId,
};
pub use frame_system::Call as SystemCall; pub use frame_system::Call as SystemCall;
use frame_system::EnsureRoot;
pub use pallet_balances::Call as BalancesCall; pub use pallet_balances::Call as BalancesCall;
#[cfg(feature = "runtime-benchmarks")]
pub use pallet_collective::RawOrigin;
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId; pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_session::historical as session_historical; use pallet_session::historical as session_historical;
pub use pallet_timestamp::Call as TimestampCall; pub use pallet_timestamp::Call as TimestampCall;
use pallet_transaction_payment::FungibleAdapter; use pallet_transaction_payment::{FungibleAdapter, Multiplier};
pub use pallet_universal_dividend; pub use pallet_universal_dividend;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{KeyTypeId, Perbill, Permill};
use common_runtime::IdtyNameValidatorImpl;
use frame_support::{traits::Contains, PalletId};
use frame_system::EnsureRoot;
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata; use sp_core::OpaqueMetadata;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, ApplyExtrinsicResult,
}; };
pub use sp_runtime::{KeyTypeId, Perbill, Permill};
use sp_std::prelude::*; use sp_std::prelude::*;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use sp_version::NativeVersion; use sp_version::NativeVersion;
...@@ -237,7 +240,9 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType { ...@@ -237,7 +240,9 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
} }
// Configure pallets to include in runtime. // Configure pallets to include in runtime.
common_runtime::pallets_config! {} #[cfg(feature = "runtime-benchmarks")]
type WorstOrigin = RawOrigin<AccountId, TechnicalCommitteeInstance>;
common_runtime::pallets_config!();
// Create the runtime by composing the pallets that were previously configured. // Create the runtime by composing the pallets that were previously configured.
construct_runtime!( construct_runtime!(
......
imports_granularity = "Crate" imports_granularity = "Crate"
reorder_impl_items = true reorder_impl_items = true
error_on_unformatted = true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment