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'_')
......
This diff is collapsed.
...@@ -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