diff --git a/pallets/distance/src/mock.rs b/pallets/distance/src/mock.rs index 0f232b82d1f8a39e870fb4c901e8640a76c71199..edcfedbfe7cc4ee222045d5e91ff21a0359be511 100644 --- a/pallets/distance/src/mock.rs +++ b/pallets/distance/src/mock.rs @@ -233,6 +233,7 @@ impl pallet_identity::Config for Test { type AccountLinker = (); type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckAccountWorthiness = (); type CheckIdtyCallAllowed = (); type ConfirmPeriod = ConfirmPeriod; type DeletionPeriod = DeletionPeriod; diff --git a/pallets/duniter-account/src/lib.rs b/pallets/duniter-account/src/lib.rs index 514084f8725211cc7e3ecfed5aaa77cfdb91e14e..76209d0427d0cb2bcb5ede65795a0796d594ba5e 100644 --- a/pallets/duniter-account/src/lib.rs +++ b/pallets/duniter-account/src/lib.rs @@ -28,9 +28,17 @@ pub use pallet::*; pub use types::*; pub use weights::WeightInfo; +use core::cmp; +#[cfg(feature = "runtime-benchmarks")] +use frame_support::traits::tokens::fungible::Mutate; use frame_support::{ pallet_prelude::*, - traits::{fungible, fungible::Credit, IsSubType, StorageVersion, StoredMap}, + traits::{ + fungible, + fungible::{Credit, Inspect}, + tokens::WithdrawConsequence, + IsSubType, StorageVersion, StoredMap, + }, }; use frame_system::pallet_prelude::*; use pallet_quota::traits::RefundFee; @@ -337,3 +345,33 @@ where Ok(()) } } + +/// Implementation of the CheckAccountWorthiness trait for the Pallet. +/// This trait is used to verify the worthiness of an account in terms +/// of existence and sufficient balance to handle identity creation. +impl<AccountId, T: Config> pallet_identity::traits::CheckAccountWorthiness<T> for Pallet<T> +where + T: frame_system::Config<AccountId = AccountId>, + AccountId: cmp::Eq, +{ + /// Checks that the account exists and has the balance to handle the + /// identity creation process. + fn check_account_worthiness(account: &AccountId) -> Result<(), DispatchError> { + ensure!( + frame_system::Pallet::<T>::providers(account) > 0, + pallet_identity::Error::<T>::AccountNotExist + ); + // This check verifies that the account can withdraw at least twice the minimum balance. + ensure!( + T::Currency::can_withdraw(account, T::Currency::minimum_balance() * 2u32.into()) + == WithdrawConsequence::Success, + pallet_identity::Error::<T>::InsufficientBalance + ); + Ok(()) + } + + #[cfg(feature = "runtime-benchmarks")] + fn set_worthy(account: &AccountId) { + T::Currency::set_balance(account, T::Currency::minimum_balance() * 4u32.into()); + } +} diff --git a/pallets/duniter-wot/src/mock.rs b/pallets/duniter-wot/src/mock.rs index 60148e0ec4b87242d09b3ec558aad7fd36002677..9ebef148ce76c05eb0750d4b4ee93060ecd2a0dc 100644 --- a/pallets/duniter-wot/src/mock.rs +++ b/pallets/duniter-wot/src/mock.rs @@ -113,6 +113,7 @@ impl pallet_identity::Config for Test { type AccountLinker = (); type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckAccountWorthiness = (); type CheckIdtyCallAllowed = DuniterWot; type ConfirmPeriod = ConfirmPeriod; type DeletionPeriod = DeletionPeriod; diff --git a/pallets/identity/src/benchmarking.rs b/pallets/identity/src/benchmarking.rs index 20e7462133e6d8bc564e1ecd41cd56e82800e6e0..831b724292df6b14a98468f82f3a6da285c12fd4 100644 --- a/pallets/identity/src/benchmarking.rs +++ b/pallets/identity/src/benchmarking.rs @@ -60,6 +60,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(); let owner_key_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(owner_key.clone()).into(); + T::CheckAccountWorthiness::set_worthy(&owner_key); Pallet::<T>::create_identity(caller_origin.clone(), owner_key.clone())?; let name = IdtyName("new_identity".into()); Pallet::<T>::confirm_identity(owner_key_origin.clone(), name.clone())?; @@ -124,6 +125,7 @@ mod benchmarks { fn create_identity() { let caller: T::AccountId = Identities::<T>::get(T::IdtyIndex::one()).unwrap().owner_key; // Alice let owner_key: T::AccountId = account("new_identity", 2, 1); + T::CheckAccountWorthiness::set_worthy(&owner_key); #[extrinsic_call] _(RawOrigin::Signed(caller), owner_key.clone()); @@ -145,6 +147,7 @@ mod benchmarks { let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into(); let owner_key: T::AccountId = account("new_identity", 2, 1); + T::CheckAccountWorthiness::set_worthy(&owner_key); Pallet::<T>::create_identity(caller_origin.clone(), owner_key.clone())?; #[extrinsic_call] diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index 886e62586abedd82752f6dc32b288b4e195d695a..f41a81e4693c8ebaf5cb915dda00e52b649cabd4 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -91,6 +91,8 @@ pub mod pallet { /// Management of the authorizations of the different calls. /// The default implementation allows everything. type CheckIdtyCallAllowed: CheckIdtyCallAllowed<Self>; + /// The type used to check account worthiness. + type CheckAccountWorthiness: CheckAccountWorthiness<Self>; /// Custom data to store in each identity. type IdtyData: Clone + Codec @@ -109,7 +111,7 @@ pub mod pallet { + MaybeSerializeDeserialize + Debug + MaxEncodedLen; - /// custom type for account data + /// Custom type for account data. type AccountLinker: LinkIdty<Self::AccountId, Self::IdtyIndex>; /// Handle logic to validate an identity name type IdtyNameValidator: IdtyNameValidator; @@ -618,6 +620,8 @@ pub mod pallet { CanNotRevokeUnvalidated, /// Cannot link to an inexisting account. AccountNotExist, + /// Insufficient balance to create an identity. + InsufficientBalance, } // INTERNAL FUNCTIONS // @@ -838,6 +842,7 @@ pub mod pallet { // --- other checks depend on other pallets // run checks for identity creation T::CheckIdtyCallAllowed::check_create_identity(creator_index)?; + T::CheckAccountWorthiness::check_account_worthiness(receiver_key)?; Ok(creator_index) } diff --git a/pallets/identity/src/mock.rs b/pallets/identity/src/mock.rs index e13c48b212238f7dd8a2a009f34503b3e66d137f..dcd757c0b2f1da86cc793c31951ef673921c95fe 100644 --- a/pallets/identity/src/mock.rs +++ b/pallets/identity/src/mock.rs @@ -106,6 +106,7 @@ impl pallet_identity::Config for Test { type AccountLinker = (); type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckAccountWorthiness = (); type CheckIdtyCallAllowed = (); type ConfirmPeriod = ConfirmPeriod; type DeletionPeriod = DeletionPeriod; diff --git a/pallets/identity/src/traits.rs b/pallets/identity/src/traits.rs index 8031d50c96d4d273391f3755abc64025eef31331..548d666f3f413a4de6eaa8cc527c8491d17d1714 100644 --- a/pallets/identity/src/traits.rs +++ b/pallets/identity/src/traits.rs @@ -29,6 +29,24 @@ impl<T: Config> CheckIdtyCallAllowed<T> for () { } } +/// Trait to check the worthiness of an account. +pub trait CheckAccountWorthiness<T: Config> { + /// Checks the worthiness of an account. + fn check_account_worthiness(account: &T::AccountId) -> Result<(), DispatchError>; + #[cfg(feature = "runtime-benchmarks")] + fn set_worthy(account: &T::AccountId); +} + +impl<T: Config> CheckAccountWorthiness<T> for () { + /// Default no-op check for account worthiness. + fn check_account_worthiness(_account: &T::AccountId) -> Result<(), DispatchError> { + Ok(()) + } + + #[cfg(feature = "runtime-benchmarks")] + fn set_worthy(_account: &T::AccountId) {} +} + /// A trait defining operations for validating identity names. pub trait IdtyNameValidator { /// Validates an identity name. diff --git a/pallets/quota/src/mock.rs b/pallets/quota/src/mock.rs index fac5bad2089a38e39a560dc869ef792e6d586b4e..e533345ea301040f456ced63ddb89ba05597c895 100644 --- a/pallets/quota/src/mock.rs +++ b/pallets/quota/src/mock.rs @@ -147,6 +147,7 @@ impl pallet_identity::Config for Test { type AccountLinker = (); type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckAccountWorthiness = (); type CheckIdtyCallAllowed = (); type ConfirmPeriod = ConfirmPeriod; type DeletionPeriod = DeletionPeriod; diff --git a/primitives/duniter/src/lib.rs b/primitives/duniter/src/lib.rs index 1d71c0a590bb651a031afed211d113477b40ee12..0dccbe9d79abdcaa5b9b6be2a57b2e1b9ab6d68b 100644 --- a/primitives/duniter/src/lib.rs +++ b/primitives/duniter/src/lib.rs @@ -16,13 +16,12 @@ #![cfg_attr(not(feature = "std"), no_std)] -/// Rules for valid identity names are defined below -/// - Bound length to 42 -/// - accept only ascii alphanumeric or - or _ +/// Checks rules for valid identity names +/// - Limit length to 42 +/// - Accept only ascii alphanumeric or `-` or `_` pub fn validate_idty_name(idty_name: &[u8]) -> bool { idty_name.len() >= 3 - && idty_name.len() <= 42 // length smaller than 42 - // all characters are alphanumeric or - or _ + && idty_name.len() <= 42 && idty_name .iter() .all(|c| c.is_ascii_alphanumeric() || *c == b'-' || *c == b'_') diff --git a/resources/metadata.scale b/resources/metadata.scale index a7d62dcf1ef7c1b04ff72729a9f83eb8693d861a..fef41d8bafe615f1ce210c92a47aa4f81e05496d 100644 Binary files a/resources/metadata.scale and b/resources/metadata.scale differ diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index 4537936a837263ab2daa3c9734f4f6c245201cad..694fdec255b008068a2b530b193d8d56050e0ca8 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -16,9 +16,7 @@ #[macro_export] macro_rules! pallets_config { - {$($custom:tt)*} => { - $($custom)* - + () => { // SYSTEM // parameter_types! { @@ -26,59 +24,59 @@ macro_rules! pallets_config { } 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. type BaseCallFilter = BaseCallFilter; - /// Block & extrinsics weights: base values and limits. - type BlockWeights = BlockWeights; + /// The block type for the runtime. + 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). type BlockLength = BlockLength; - /// The identifier used to distinguish between accounts. - type AccountId = AccountId; - /// The aggregated dispatch type that is available for extrinsics. - type RuntimeCall = RuntimeCall; - /// The lookup mechanism to get account ID from whatever is passed in dispatchers. - type Lookup = AccountIdLookup<AccountId, ()>; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = BlockWeights; + /// The weight of database operations that the runtime can invoke. + type DbWeight = DbWeight; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. type Hashing = BlakeTwo256; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; - /// The ubiquitous origin type. - type RuntimeOrigin = RuntimeOrigin; - /// Maximum number of block number to block hash mappings to keep (oldest pruned first). - type BlockHashCount = BlockHashCount; - /// The weight of database operations that the runtime can invoke. - type DbWeight = DbWeight; - /// Version of the runtime. - type Version = Version; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = AccountIdLookup<AccountId, ()>; + type MaxConsumers = frame_support::traits::ConstU32<16>; + type MultiBlockMigrator = (); + /// The type for storing how many extrinsics an account has signed. + type Nonce = node_primitives::Nonce; + /// What to do if an account is fully reaped from the system. + type OnKilledAccount = (); + /// What to do if a new account is created. + 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!`. /// /// This type is being generated by `construct_runtime!`. type PalletInfo = PalletInfo; - /// What to do if a new account is created. - type OnNewAccount = (); - /// What to do if an account is fully reaped from the system. - type OnKilledAccount = (); - /// The data to be stored in an account. - type AccountData = pallet_duniter_account::AccountData<Balance, IdtyIndex>; - /// Weight information for the extrinsics of this pallet. - type SystemWeightInfo = common_runtime::weights::frame_system::WeightInfo<Runtime>; + type PostInherents = (); + type PostTransactions = (); + type PreInherents = (); + /// The aggregated dispatch type that is available for extrinsics. + type RuntimeCall = RuntimeCall; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + /// The ubiquitous origin type. + type RuntimeOrigin = RuntimeOrigin; + type RuntimeTask = (); /// This is used as an identifier of the chain. 42 is the generic substrate prefix. 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 MultiBlockMigrator = (); - type PreInherents = (); - type PostInherents = (); - type PostTransactions = (); + /// Weight information for the extrinsics of this pallet. + type SystemWeightInfo = common_runtime::weights::frame_system::WeightInfo<Runtime>; + /// Version of the runtime. + type Version = Version; } // SCHEDULER // @@ -90,26 +88,26 @@ macro_rules! pallets_config { pub const NoPreimagePostponement: Option<u32> = Some(10); } impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type MaximumWeight = MaximumSchedulerWeight; + type OriginPrivilegeCmp = EqualPrivilegeOnly; type PalletsOrigin = OriginCaller; + type Preimages = Preimage; type RuntimeCall = RuntimeCall; - type MaximumWeight = MaximumSchedulerWeight; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type ScheduleOrigin = EnsureRoot<AccountId>; - type OriginPrivilegeCmp = EqualPrivilegeOnly; - type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = common_runtime::weights::pallet_scheduler::WeightInfo<Runtime>; - type Preimages = Preimage; } // ACCOUNT // 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 type InnerOnChargeTransaction = FungibleAdapter<Balances, HandleFees>; type Refund = Quota; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = common_runtime::weights::pallet_duniter_account::WeightInfo<Runtime>; } // QUOTA // @@ -122,61 +120,58 @@ macro_rules! pallets_config { } } parameter_types! { - pub const ReloadRate: BlockNumber = 1 * HOURS; // faster than DAYS - pub const MaxQuota: Balance = 1000; // 10 ÄžD - pub const MaxNominators: u32 = 64; -pub TreasuryAccount: AccountId = Treasury::account_id(); // TODO - } + pub const ReloadRate: BlockNumber = 1 * HOURS; // faster than DAYS + pub const MaxQuota: Balance = 1000; // 10 ÄžD + pub const MaxNominators: u32 = 64; + pub TreasuryAccount: AccountId = Treasury::account_id(); // TODO + } impl pallet_quota::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - // type IdtyId = IdtyIndex; - type ReloadRate = ReloadRate; type MaxQuota = MaxQuota; type RefundAccount = TreasuryAccountId; + type ReloadRate = ReloadRate; + type RuntimeEvent = RuntimeEvent; type WeightInfo = common_runtime::weights::pallet_quota::WeightInfo<Runtime>; } // BLOCK CREATION // impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDuration; - type ExpectedBlockTime = ExpectedBlockTime; + type DisabledValidators = Session; // session module is the trigger type EpochChangeTrigger = pallet_babe::ExternalTrigger; - type DisabledValidators = Session; - type KeyOwnerProof = <Historical as KeyOwnerProofSystem<( - KeyTypeId, - pallet_babe::AuthorityId, - )>>::Proof; + type EpochDuration = EpochDuration; type EquivocationReportSystem = 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 MaxNominators = MaxNominators; + type MaxNominators = MaxNominators; + type WeightInfo = common_runtime::weights::pallet_babe::WeightInfo<Runtime>; } impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = MinimumPeriod; type Moment = u64; type OnTimestampSet = (Babe, UniversalDividend); - type MinimumPeriod = MinimumPeriod; type WeightInfo = common_runtime::weights::pallet_timestamp::WeightInfo<Runtime>; } // MONEY MANAGEMENT // impl pallet_balances::Config for Runtime { - type RuntimeHoldReason = RuntimeHoldReason; - type RuntimeFreezeReason = (); - type RuntimeEvent = RuntimeEvent; - type MaxLocks = MaxLocks; - type MaxReserves = frame_support::pallet_prelude::ConstU32<5>; - type ReserveIdentifier = [u8; 8]; + type AccountStore = Account; type Balance = Balance; type DustRemoval = HandleFees; type ExistentialDeposit = ExistentialDeposit; - type AccountStore = Account; type FreezeIdentifier = (); 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>; } @@ -185,32 +180,33 @@ type MaxNominators = MaxNominators; impl frame_support::traits::OnUnbalanced<CreditOf> for HandleFees { fn on_nonzero_unbalanced(amount: CreditOf) { // fee is moved to treasury - let _ = Balances::deposit(&Treasury::account_id(), amount.peek(), frame_support::traits::tokens::Precision::Exact); - // should move the tip to author - // if let Some(author) = Authorship::author() { - // Balances::resolve_creating(&author, amount); - // } + let _ = Balances::deposit( + &Treasury::account_id(), + amount.peek(), + frame_support::traits::tokens::Precision::Exact, + ); } } pub struct OnChargeTransaction; 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 { - type RuntimeEvent = RuntimeEvent; + type FeeMultiplierUpdate = + pallet_transaction_payment::ConstFeeMultiplier<FeeMultiplier>; + type LengthToFee = common_runtime::fees::LengthToFeeImpl<Balance>; // does a filter on the call type OnChargeTransaction = OneshotAccount; type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>; + type RuntimeEvent = RuntimeEvent; 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 { - type RuntimeEvent = RuntimeEvent; type Currency = Balances; // when call is not oneshot account, fall back to duniter-account implementation type InnerOnChargeTransaction = Account; + type RuntimeEvent = RuntimeEvent; type WeightInfo = common_runtime::weights::pallet_oneshot_account::WeightInfo<Runtime>; } @@ -220,49 +216,51 @@ type MaxNominators = MaxNominators; type MaxAuthorities = MaxAuthorities; } impl pallet_authority_members::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type IsMember = SmithMembers; - type OnNewSession = OnNewSessionHandler<Runtime>; + type MaxAuthorities = MaxAuthorities; type MemberId = IdtyIndex; 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 OnNewSession = OnNewSessionHandler<Runtime>; 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 { type EventHandler = ImOnline; type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>; } impl pallet_im_online::Config for Runtime { - type RuntimeEvent = RuntimeEvent; 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"))] type MaxKeys = MaxAuthorities; #[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 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 { - type RuntimeEvent = RuntimeEvent; type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; type OnOffenceHandler = AuthorityMembers; + type RuntimeEvent = RuntimeEvent; } impl pallet_session::Config for Runtime { + type Keys = opaque::SessionKeys; + type NextSessionRotation = Babe; 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 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>; } impl pallet_session::historical::Config for Runtime { @@ -270,16 +268,19 @@ type MaxNominators = MaxNominators; type FullIdentificationOf = FullIdentificationOfImpl; } impl pallet_grandpa::Config for Runtime { + type EquivocationReportSystem = pallet_grandpa::EquivocationReportSystem< + Self, + Offences, + Historical, + ReportLongevity, + >; + type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; + type MaxAuthorities = MaxAuthorities; + type MaxNominators = frame_support::traits::ConstU32<64>; + type MaxSetIdSessionEntries = MaxSetIdSessionEntries; type RuntimeEvent = RuntimeEvent; - type KeyOwnerProof = - <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; - type EquivocationReportSystem = - pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>; type WeightInfo = common_runtime::weights::pallet_grandpa::WeightInfo<Runtime>; - type MaxAuthorities = MaxAuthorities; - type MaxSetIdSessionEntries = MaxSetIdSessionEntries; - type MaxNominators = frame_support::traits::ConstU32<64>; - } + } parameter_types! { // BondingDuration::get() * SessionsPerEra::get(); pub const MaxSetIdSessionEntries: u32 = 1000; @@ -287,22 +288,26 @@ type MaxNominators = MaxNominators; // ONCHAINÂ GOVERNANCE // - #[cfg(feature = "runtime-benchmarks")] - parameter_types! { - pub const WorstCaseOrigin: pallet_collective::RawOrigin<AccountId, TechnicalCommitteeInstance> = - pallet_collective::RawOrigin::<AccountId, TechnicalCommitteeInstance>::Members(2, 3); - } - - impl pallet_upgrade_origin::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Call = RuntimeCall; - type UpgradableOrigin = pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeInstance, 2, 3>; - type WeightInfo = common_runtime::weights::pallet_upgrade_origin::WeightInfo<Runtime>; - #[cfg(feature = "runtime-benchmarks")] - type WorstCaseOriginType = pallet_collective::RawOrigin<AccountId, TechnicalCommitteeInstance>; - #[cfg(feature = "runtime-benchmarks")] - type WorstCaseOrigin = WorstCaseOrigin; - } + #[cfg(feature = "runtime-benchmarks")] + parameter_types! { + pub const WorstCaseOrigin: WorstOrigin = WorstOrigin::Members(2, 3); + } + + impl pallet_upgrade_origin::Config for Runtime { + type Call = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type UpgradableOrigin = pallet_collective::EnsureProportionAtLeast< + AccountId, + TechnicalCommitteeInstance, + 2, + 3, + >; + type WeightInfo = common_runtime::weights::pallet_upgrade_origin::WeightInfo<Runtime>; + #[cfg(feature = "runtime-benchmarks")] + type WorstCaseOrigin = WorstCaseOrigin; + #[cfg(feature = "runtime-benchmarks")] + type WorstCaseOriginType = RawOrigin<AccountId, TechnicalCommitteeInstance>; + } parameter_types! { pub const PreimageMaxSize: u32 = 4096 * 1024; @@ -311,32 +316,33 @@ type MaxNominators = MaxNominators; } impl pallet_preimage::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = common_runtime::weights::pallet_preimage::WeightInfo<Runtime>; + type Consideration = (); type Currency = Balances; type ManagerOrigin = EnsureRoot<AccountId>; - type Consideration = (); + type RuntimeEvent = RuntimeEvent; + type WeightInfo = common_runtime::weights::pallet_preimage::WeightInfo<Runtime>; } // UTILITIES // impl pallet_atomic_swap::Config for Runtime { + type ProofLimit = frame_support::traits::ConstU32<1_024>; type RuntimeEvent = RuntimeEvent; type SwapAction = pallet_atomic_swap::BalanceSwapAction<AccountId, Balances>; - type ProofLimit = frame_support::traits::ConstU32<1_024>; } impl pallet_provide_randomness::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Currency = Balances; type GetCurrentEpochIndex = GetCurrentEpochIndex<Self>; type MaxRequests = frame_support::traits::ConstU32<100>; - type RequestPrice = frame_support::traits::ConstU64<2_000>; type OnFilledRandomness = (); type OnUnbalanced = HandleFees; type ParentBlockRandomness = pallet_babe::ParentBlockRandomness<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! { @@ -348,17 +354,17 @@ type MaxNominators = MaxNominators; pub const AnnouncementDepositFactor: Balance = deposit(0, 66); } impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; + type CallHasher = BlakeTwo256; type Currency = Balances; - type ProxyType = ProxyType; + type MaxPending = frame_support::traits::ConstU32<32>; + type MaxProxies = frame_support::traits::ConstU32<32>; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = frame_support::traits::ConstU32<32>; - type MaxPending = frame_support::traits::ConstU32<32>; - type CallHasher = BlakeTwo256; - type AnnouncementDepositBase = AnnouncementDepositBase; - type AnnouncementDepositFactor = AnnouncementDepositFactor; + type ProxyType = ProxyType; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = common_runtime::weights::pallet_proxy::WeightInfo<Runtime>; } @@ -367,19 +373,19 @@ type MaxNominators = MaxNominators; pub const DepositFactor: Balance = DEPOSIT_PER_BYTE * 32; } impl pallet_multisig::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = common_runtime::weights::pallet_multisig::WeightInfo<Runtime>; } impl pallet_utility::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = common_runtime::weights::pallet_utility::WeightInfo<Runtime>; } @@ -394,62 +400,64 @@ type MaxNominators = MaxNominators; } impl pallet_treasury::Config for Runtime { 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 BurnDestination = (); type Currency = Balances; - type RuntimeEvent = RuntimeEvent; + type MaxApprovals = frame_support::traits::ConstU32<100>; 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 ProposalBondMinimum = frame_support::traits::ConstU64<10_000>; type ProposalBondMaximum = ProposalBondMaximum; - type MaxApprovals = frame_support::traits::ConstU32<100>; - type PalletId = TreasuryPalletId; + type ProposalBondMinimum = frame_support::traits::ConstU64<10_000>; type RejectOrigin = TreasuryRejectOrigin; + type RuntimeEvent = RuntimeEvent; type SpendFunds = TreasurySpendFunds<Self>; - type SpendPeriod = SpendPeriod; type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>; + type SpendPeriod = SpendPeriod; 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 // - pub struct MembersCount; - impl frame_support::pallet_prelude::Get<Balance> for MembersCount { - fn get() -> Balance { - <Membership as sp_membership::traits::MembersCount>::members_count() as Balance - } - } + pub struct MembersCount; + impl frame_support::pallet_prelude::Get<Balance> for MembersCount { + fn get() -> Balance { + <Membership as sp_membership::traits::MembersCount>::members_count() as Balance + } + } impl pallet_universal_dividend::Config for Runtime { - type MomentIntoBalance = sp_runtime::traits::ConvertInto; type Currency = Balances; - type RuntimeEvent = RuntimeEvent; - type MaxPastReeval = frame_support::traits::ConstU32<160>; + #[cfg(feature = "runtime-benchmarks")] + type IdtyAttr = Identity; + type MaxPastReeval = frame_support::traits::ConstU32<160>; type MembersCount = MembersCount; type MembersStorage = common_runtime::providers::UdMembersStorage<Runtime>; + type MomentIntoBalance = sp_runtime::traits::ConvertInto; + type RuntimeEvent = RuntimeEvent; type SquareMoneyGrowthRate = SquareMoneyGrowthRate; type UdCreationPeriod = UdCreationPeriod; type UdReevalPeriod = UdReevalPeriod; type UnitsPerUd = frame_support::traits::ConstU64<1_000>; - type WeightInfo = common_runtime::weights::pallet_universal_dividend::WeightInfo<Runtime>; - #[cfg(feature = "runtime-benchmarks")] - type IdtyAttr = Identity; + type WeightInfo = + common_runtime::weights::pallet_universal_dividend::WeightInfo<Runtime>; } // WEBÂ OFÂ TRUST // impl pallet_duniter_wot::Config for Runtime { type FirstIssuableOn = WotFirstCertIssuableOn; - type MinCertForMembership = WotMinCertForMembership; type MinCertForCreateIdtyRight = WotMinCertForCreateIdtyRight; + type MinCertForMembership = WotMinCertForMembership; } parameter_types! { @@ -457,86 +465,87 @@ type MaxNominators = MaxNominators; pub const DeletionPeriod: BlockNumber = 10 * YEARS; } impl pallet_identity::Config for Runtime { - type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; - type ConfirmPeriod = ConfirmPeriod; - type ValidationPeriod = ValidationPeriod; + type AccountLinker = Account; type AutorevocationPeriod = AutorevocationPeriod; - type DeletionPeriod = DeletionPeriod; + type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckAccountWorthiness = Account; type CheckIdtyCallAllowed = Wot; + type ConfirmPeriod = ConfirmPeriod; + type DeletionPeriod = DeletionPeriod; type IdtyCreationPeriod = IdtyCreationPeriod; - type IdtyData = IdtyData; + type IdtyData = IdtyData; type IdtyIndex = IdtyIndex; - type AccountLinker = Account; type IdtyNameValidator = IdtyNameValidatorImpl; - type Signer = <Signature as sp_runtime::traits::Verify>::Signer; - type Signature = Signature; type OnNewIdty = OnNewIdtyHandler<Runtime>; type OnRemoveIdty = OnRemoveIdtyHandler<Runtime>; 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>; } - impl pallet_sudo::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - type WeightInfo = common_runtime::weights::pallet_sudo::WeightInfo<Runtime>; - } + impl pallet_sudo::Config for Runtime { + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = common_runtime::weights::pallet_sudo::WeightInfo<Runtime>; + } impl pallet_membership::Config for Runtime { + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkSetupHandler = common_runtime::providers::BenchmarkSetupHandler<Runtime>; type CheckMembershipOpAllowed = Wot; - type IdtyId = IdtyIndex; type IdtyAttr = Identity; + type IdtyId = IdtyIndex; type MembershipPeriod = MembershipPeriod; type MembershipRenewalPeriod = MembershipRenewalPeriod; type OnNewMembership = OnNewMembershipHandler<Runtime>; type OnRemoveMembership = OnRemoveMembershipHandler<Runtime>; type RuntimeEvent = RuntimeEvent; 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 { type CertPeriod = CertPeriod; - type IdtyIndex = IdtyIndex; - type IdtyAttr = Identity; type CheckCertAllowed = Wot; + type IdtyAttr = Identity; + type IdtyIndex = IdtyIndex; type MaxByIssuer = MaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert; type OnNewcert = Wot; type OnRemovedCert = Wot; type RuntimeEvent = RuntimeEvent; - type WeightInfo = common_runtime::weights::pallet_certification::WeightInfo<Runtime>; type ValidityPeriod = ValidityPeriod; + type WeightInfo = common_runtime::weights::pallet_certification::WeightInfo<Runtime>; } parameter_types! { pub const MinAccessibleReferees: Perbill = Perbill::from_percent(80); } impl pallet_distance::Config for Runtime { + type CheckRequestDistanceEvaluation = Wot; type Currency = Balances; type EvaluationPeriod = frame_support::traits::ConstU32<7>; type EvaluationPrice = frame_support::traits::ConstU64<1000>; type MaxRefereeDistance = frame_support::traits::ConstU32<5>; type MinAccessibleReferees = MinAccessibleReferees; - type RuntimeHoldReason = RuntimeHoldReason; + type OnValidDistanceStatus = Wot; type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = RuntimeHoldReason; type WeightInfo = common_runtime::weights::pallet_distance::WeightInfo<Runtime>; - type OnValidDistanceStatus = Wot; - type CheckRequestDistanceEvaluation = Wot; } // SMITH-MEMBERS impl pallet_smith_members::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type IdtyAttr = Identity; + type IdtyIdOfAuthorityId = sp_runtime::traits::ConvertInto; type IdtyIndex = IdtyIndex; type IsWoTMember = common_runtime::providers::IsWoTMemberProvider<Runtime>; - type IdtyAttr = Identity; - type MinCertForMembership = SmithWotMinCertForMembership; type MaxByIssuer = SmithMaxByIssuer; - type SmithInactivityMaxDuration = SmithInactivityMaxDuration; - type OnSmithDelete = OnSmithDeletedHandler<Runtime>; - type IdtyIdOfAuthorityId = sp_runtime::traits::ConvertInto; 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>; } @@ -553,22 +562,22 @@ type MaxNominators = MaxNominators; } parameter_types! { 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 { - 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"))] type DefaultVote = TechnicalCommitteeDefaultVote; #[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>; } }; } diff --git a/runtime/common/src/weights/pallet_identity.rs b/runtime/common/src/weights/pallet_identity.rs index 47bc27779ff43bc4c40b39ce40415a3b73558029..5b0f3d032225d25d212dc8ae68d52ac156e7ab62 100644 --- a/runtime/common/src/weights/pallet_identity.rs +++ b/runtime/common/src/weights/pallet_identity.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_identity` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-05-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-05-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bgallois-ms7d43`, CPU: `12th Gen Intel(R) Core(TM) i3-12100F` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024 @@ -29,7 +29,7 @@ // --chain=dev // --steps=50 // --repeat=20 -// --pallet=* +// --pallet=pallet-identity // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 @@ -71,11 +71,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { /// Proof: `Quota::IdtyQuota` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) fn create_identity() -> Weight { // Proof Size summary in bytes: - // Measured: `1022` - // Estimated: `6962` - // Minimum execution time: 60_413_000 picoseconds. - Weight::from_parts(62_000_000, 0) - .saturating_add(Weight::from_parts(0, 6962)) + // Measured: `1070` + // Estimated: `7010` + // Minimum execution time: 64_979_000 picoseconds. + Weight::from_parts(66_407_000, 0) + .saturating_add(Weight::from_parts(0, 7010)) .saturating_add(T::DbWeight::get().reads(13)) .saturating_add(T::DbWeight::get().writes(12)) } @@ -91,8 +91,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `698` // Estimated: `6638` - // Minimum execution time: 26_800_000 picoseconds. - Weight::from_parts(27_994_000, 0) + // Minimum execution time: 28_030_000 picoseconds. + Weight::from_parts(29_442_000, 0) .saturating_add(Weight::from_parts(0, 6638)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -107,11 +107,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`) fn change_owner_key() -> Weight { // Proof Size summary in bytes: - // Measured: `727` - // Estimated: `6667` - // Minimum execution time: 74_390_000 picoseconds. - Weight::from_parts(75_575_000, 0) - .saturating_add(Weight::from_parts(0, 6667)) + // Measured: `723` + // Estimated: `6663` + // Minimum execution time: 73_717_000 picoseconds. + Weight::from_parts(75_195_000, 0) + .saturating_add(Weight::from_parts(0, 6663)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -129,8 +129,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `664` // Estimated: `6604` - // Minimum execution time: 63_320_000 picoseconds. - Weight::from_parts(65_355_000, 0) + // Minimum execution time: 64_566_000 picoseconds. + Weight::from_parts(65_978_000, 0) .saturating_add(Weight::from_parts(0, 6604)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -142,11 +142,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_521_000 picoseconds. - Weight::from_parts(3_726_000, 0) + // Minimum execution time: 3_611_000 picoseconds. + Weight::from_parts(3_788_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_009 - .saturating_add(Weight::from_parts(1_167_883, 0).saturating_mul(i.into())) + // Standard Error: 1_076 + .saturating_add(Weight::from_parts(1_174_325, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } @@ -156,8 +156,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `104` // Estimated: `3558` - // Minimum execution time: 5_689_000 picoseconds. - Weight::from_parts(6_207_000, 0) + // Minimum execution time: 6_271_000 picoseconds. + Weight::from_parts(6_529_000, 0) .saturating_add(Weight::from_parts(0, 3558)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -172,8 +172,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `403` // Estimated: `3868` - // Minimum execution time: 51_045_000 picoseconds. - Weight::from_parts(52_911_000, 0) + // Minimum execution time: 50_535_000 picoseconds. + Weight::from_parts(51_906_000, 0) .saturating_add(Weight::from_parts(0, 3868)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -182,8 +182,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_000 picoseconds. - Weight::from_parts(92_000, 0) + // Minimum execution time: 83_000 picoseconds. + Weight::from_parts(107_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `Identity::Identities` (r:1 w:0) @@ -192,8 +192,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `302` // Estimated: `3767` - // Minimum execution time: 3_481_000 picoseconds. - Weight::from_parts(3_682_000, 0) + // Minimum execution time: 3_424_000 picoseconds. + Weight::from_parts(3_629_000, 0) .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -231,8 +231,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `1555` // Estimated: `9970` - // Minimum execution time: 80_541_000 picoseconds. - Weight::from_parts(83_780_000, 0) + // Minimum execution time: 81_169_000 picoseconds. + Weight::from_parts(83_252_000, 0) .saturating_add(Weight::from_parts(0, 9970)) .saturating_add(T::DbWeight::get().reads(16)) .saturating_add(T::DbWeight::get().writes(20)) @@ -243,8 +243,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `302` // Estimated: `3767` - // Minimum execution time: 3_401_000 picoseconds. - Weight::from_parts(3_647_000, 0) + // Minimum execution time: 3_406_000 picoseconds. + Weight::from_parts(3_698_000, 0) .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -288,8 +288,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `1990` // Estimated: `12880` - // Minimum execution time: 110_832_000 picoseconds. - Weight::from_parts(114_246_000, 0) + // Minimum execution time: 110_128_000 picoseconds. + Weight::from_parts(113_248_000, 0) .saturating_add(Weight::from_parts(0, 12880)) .saturating_add(T::DbWeight::get().reads(21)) .saturating_add(T::DbWeight::get().writes(26)) @@ -334,8 +334,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `1999` // Estimated: `12889` - // Minimum execution time: 106_765_000 picoseconds. - Weight::from_parts(113_444_000, 0) + // Minimum execution time: 106_877_000 picoseconds. + Weight::from_parts(111_899_000, 0) .saturating_add(Weight::from_parts(0, 12889)) .saturating_add(T::DbWeight::get().reads(22)) .saturating_add(T::DbWeight::get().writes(25)) @@ -348,8 +348,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `407` // Estimated: `6347` - // Minimum execution time: 13_367_000 picoseconds. - Weight::from_parts(13_900_000, 0) + // Minimum execution time: 14_063_000 picoseconds. + Weight::from_parts(14_485_000, 0) .saturating_add(Weight::from_parts(0, 6347)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -360,8 +360,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `157` // Estimated: `3622` - // Minimum execution time: 2_586_000 picoseconds. - Weight::from_parts(2_760_000, 0) + // Minimum execution time: 2_535_000 picoseconds. + Weight::from_parts(2_722_000, 0) .saturating_add(Weight::from_parts(0, 3622)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -373,8 +373,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `327` // Estimated: `3792` - // Minimum execution time: 5_582_000 picoseconds. - Weight::from_parts(6_138_000, 0) + // Minimum execution time: 5_830_000 picoseconds. + Weight::from_parts(6_226_000, 0) .saturating_add(Weight::from_parts(0, 3792)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -399,8 +399,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `851` // Estimated: `4316` - // Minimum execution time: 29_033_000 picoseconds. - Weight::from_parts(30_980_000, 0) + // Minimum execution time: 29_919_000 picoseconds. + Weight::from_parts(30_964_000, 0) .saturating_add(Weight::from_parts(0, 4316)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(7)) diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index a8c6ba1c0750e0574dc65f44b7b84d906e35022f..b1a610b3e3caec792796cf60fa38f189cdf4a83b 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -29,37 +29,40 @@ extern crate frame_benchmarking; pub mod parameters; pub use self::parameters::*; +use common_runtime::IdtyNameValidatorImpl; pub use common_runtime::{ constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, 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; +use frame_system::EnsureRoot; 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_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical; pub use pallet_timestamp::Call as TimestampCall; -use pallet_transaction_payment::FungibleAdapter; +use pallet_transaction_payment::{FungibleAdapter, Multiplier}; 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_core::OpaqueMetadata; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; +pub use sp_runtime::{KeyTypeId, Perbill, Permill}; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; @@ -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. -common_runtime::pallets_config! {} +common_runtime::pallets_config!(); // Create the runtime by composing the pallets that were previously configured. construct_runtime!( diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index f2955b84117d90bc6ce3b1778510de7e9f65ff0e..37b9acd9ec60727b1adf2f6595eb41771b5bee24 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -29,37 +29,40 @@ extern crate frame_benchmarking; pub mod parameters; pub use self::parameters::*; +use common_runtime::IdtyNameValidatorImpl; pub use common_runtime::{ constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, 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; +use frame_system::EnsureRoot; 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; +use pallet_grandpa::{ + fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, +}; pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical; pub use pallet_timestamp::Call as TimestampCall; -use pallet_transaction_payment::FungibleAdapter; +use pallet_transaction_payment::{FungibleAdapter, Multiplier}; 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_core::OpaqueMetadata; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; +pub use sp_runtime::{KeyTypeId, Perbill, Permill}; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; @@ -242,38 +245,38 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType { } } -// Configure pallets to include in runtime. -common_runtime::pallets_config! { - // Dynamic parameters - pub type EpochDuration = pallet_duniter_test_parameters::BabeEpochDuration<Runtime>; - pub type CertPeriod = pallet_duniter_test_parameters::CertPeriod<Runtime>; - pub type MaxByIssuer = pallet_duniter_test_parameters::CertMaxByIssuer<Runtime>; - pub type MinReceivedCertToBeAbleToIssueCert = - pallet_duniter_test_parameters::CertMinReceivedCertToIssueCert<Runtime>; - pub type ValidityPeriod = pallet_duniter_test_parameters::CertValidityPeriod<Runtime>; - pub type ConfirmPeriod = pallet_duniter_test_parameters::IdtyConfirmPeriod<Runtime>; - pub type IdtyCreationPeriod = pallet_duniter_test_parameters::IdtyCreationPeriod<Runtime>; - pub type MembershipPeriod = pallet_duniter_test_parameters::MembershipPeriod<Runtime>; - pub type MembershipRenewalPeriod = pallet_duniter_test_parameters::MembershipRenewalPeriod<Runtime>; - pub type UdCreationPeriod = pallet_duniter_test_parameters::UdCreationPeriod<Runtime>; - pub type UdReevalPeriod = pallet_duniter_test_parameters::UdReevalPeriod<Runtime>; - pub type WotFirstCertIssuableOn = pallet_duniter_test_parameters::WotFirstCertIssuableOn<Runtime>; - pub type WotMinCertForMembership = pallet_duniter_test_parameters::WotMinCertForMembership<Runtime>; - pub type WotMinCertForCreateIdtyRight = - pallet_duniter_test_parameters::WotMinCertForCreateIdtyRight<Runtime>; - pub type SmithMaxByIssuer = pallet_duniter_test_parameters::SmithCertMaxByIssuer<Runtime>; - pub type SmithWotMinCertForMembership = - pallet_duniter_test_parameters::SmithWotMinCertForMembership<Runtime>; - pub type SmithInactivityMaxDuration = - pallet_duniter_test_parameters::SmithInactivityMaxDuration<Runtime>; +// Dynamic parameters +pub type EpochDuration = pallet_duniter_test_parameters::BabeEpochDuration<Runtime>; +pub type CertPeriod = pallet_duniter_test_parameters::CertPeriod<Runtime>; +pub type MaxByIssuer = pallet_duniter_test_parameters::CertMaxByIssuer<Runtime>; +pub type MinReceivedCertToBeAbleToIssueCert = + pallet_duniter_test_parameters::CertMinReceivedCertToIssueCert<Runtime>; +pub type ValidityPeriod = pallet_duniter_test_parameters::CertValidityPeriod<Runtime>; +pub type ConfirmPeriod = pallet_duniter_test_parameters::IdtyConfirmPeriod<Runtime>; +pub type IdtyCreationPeriod = pallet_duniter_test_parameters::IdtyCreationPeriod<Runtime>; +pub type MembershipPeriod = pallet_duniter_test_parameters::MembershipPeriod<Runtime>; +pub type MembershipRenewalPeriod = pallet_duniter_test_parameters::MembershipRenewalPeriod<Runtime>; +pub type UdCreationPeriod = pallet_duniter_test_parameters::UdCreationPeriod<Runtime>; +pub type UdReevalPeriod = pallet_duniter_test_parameters::UdReevalPeriod<Runtime>; +pub type WotFirstCertIssuableOn = pallet_duniter_test_parameters::WotFirstCertIssuableOn<Runtime>; +pub type WotMinCertForMembership = pallet_duniter_test_parameters::WotMinCertForMembership<Runtime>; +pub type WotMinCertForCreateIdtyRight = + pallet_duniter_test_parameters::WotMinCertForCreateIdtyRight<Runtime>; +pub type SmithMaxByIssuer = pallet_duniter_test_parameters::SmithCertMaxByIssuer<Runtime>; +pub type SmithWotMinCertForMembership = + pallet_duniter_test_parameters::SmithWotMinCertForMembership<Runtime>; +pub type SmithInactivityMaxDuration = + pallet_duniter_test_parameters::SmithInactivityMaxDuration<Runtime>; - impl pallet_duniter_test_parameters::Config for Runtime { - type BlockNumber = u32; - type CertCount = u32; - type PeriodCount = Balance; - type SessionCount = u32; - } +impl pallet_duniter_test_parameters::Config for Runtime { + type BlockNumber = u32; + type CertCount = u32; + type PeriodCount = Balance; + 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. construct_runtime!( diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index df3f1d85a48bb6a8a30b68785dbb572b267a2ae5..f6bbdf48d9d539098bab860f7099ab69edd0c09d 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -1041,6 +1041,20 @@ fn test_create_new_idty() { MultiAddress::Id(AccountKeyring::Eve.to_account_id()), 200 )); + assert_noop!( + Identity::create_identity( + frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + AccountKeyring::Eve.to_account_id(), + ), + pallet_identity::Error::<Runtime>::InsufficientBalance + ); + + assert_ok!(Balances::transfer_allow_death( + frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + 200 + )); + assert_ok!(Identity::create_identity( frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), AccountKeyring::Eve.to_account_id(), @@ -1065,7 +1079,22 @@ fn test_create_new_idty_without_founds() { 0 ); - // Should be able to create an identity without founds + // Should not be able to create an identity without founds + assert_noop!( + Identity::create_identity( + frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + AccountKeyring::Eve.to_account_id(), + ), + pallet_identity::Error::<Runtime>::AccountNotExist + ); + + // Deposit some founds on the account + assert_ok!(Balances::transfer_allow_death( + frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + 500 + )); + assert_ok!(Identity::create_identity( frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), AccountKeyring::Eve.to_account_id(), @@ -1082,18 +1111,11 @@ fn test_create_new_idty_without_founds() { let events = System::events(); assert_eq!(events.len(), 0); - // Deposit some founds on the identity account - assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - MultiAddress::Id(AccountKeyring::Eve.to_account_id()), - 200 - )); - // At next block, nothing should be preleved run_to_block(4); assert_eq!( Balances::free_balance(AccountKeyring::Eve.to_account_id()), - 200 + 500 ); }); } @@ -1171,6 +1193,7 @@ fn test_claim_memberhsip_after_few_uds() { (AccountKeyring::Alice.to_account_id(), 1_000), (AccountKeyring::Bob.to_account_id(), 1_000), (AccountKeyring::Charlie.to_account_id(), 1_000), + (AccountKeyring::Eve.to_account_id(), 1_000), ]) .build() .execute_with(|| { @@ -1547,23 +1570,29 @@ fn test_unlink_identity() { /// test that the account of a newly created identity is linked to the identity #[test] fn test_new_account_linked() { - ExtBuilder::new(1, 3, 4).build().execute_with(|| { - let eve_account = AccountKeyring::Eve.to_account_id(); - assert_eq!( - frame_system::Pallet::<Runtime>::get(&eve_account).linked_idty, - None - ); - // Alice creates identity for Eve - assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - eve_account.clone(), - )); - // then eve account should be linked to her identity - assert_eq!( - frame_system::Pallet::<Runtime>::get(&eve_account).linked_idty, - Some(5) - ); - }) + ExtBuilder::new(1, 3, 4) + .with_initial_balances(vec![ + (AccountKeyring::Alice.to_account_id(), 1_000), + (AccountKeyring::Eve.to_account_id(), 1_000), + ]) + .build() + .execute_with(|| { + let eve_account = AccountKeyring::Eve.to_account_id(); + assert_eq!( + frame_system::Pallet::<Runtime>::get(&eve_account).linked_idty, + None + ); + // Alice creates identity for Eve + assert_ok!(Identity::create_identity( + frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + eve_account.clone(), + )); + // then eve account should be linked to her identity + assert_eq!( + frame_system::Pallet::<Runtime>::get(&eve_account).linked_idty, + Some(5) + ); + }) } /// test killed account diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index 5d35e67fbc003f4bd6bfa7e3e1c19ac23da9e2d0..124c8b74380ad1fb4491e5fc14bf09214c9abf9d 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -29,36 +29,39 @@ extern crate frame_benchmarking; pub mod parameters; pub use self::parameters::*; +use common_runtime::IdtyNameValidatorImpl; pub use common_runtime::{ constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, 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; +use frame_system::EnsureRoot; 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; use pallet_session::historical as session_historical; pub use pallet_timestamp::Call as TimestampCall; -use pallet_transaction_payment::FungibleAdapter; +use pallet_transaction_payment::{FungibleAdapter, Multiplier}; 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_core::OpaqueMetadata; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; +pub use sp_runtime::{KeyTypeId, Perbill, Permill}; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; @@ -237,7 +240,9 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType { } // 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. construct_runtime!( diff --git a/rustfmt.toml b/rustfmt.toml index f2abd12533cc86c456bcebc3989330f39983ef2a..793ece8dbcdab0bd62adbc1a5e5b9f4100d1fce2 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,3 @@ imports_granularity = "Crate" reorder_impl_items = true +error_on_unformatted = true