From bf3e6a24bd31f4a2ef926dec554d0650765bd11d Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 17:39:02 +0900 Subject: [PATCH 01/20] `Elections`: approve candidacy --- libs/price-provider/Cargo.toml | 12 +- libs/price-provider/src/currency_pair.rs | 54 +- .../elections-phragmen/src/benchmarking.rs | 36 +- substrate/frame/elections-phragmen/src/lib.rs | 463 +++++++++++------- 4 files changed, 382 insertions(+), 183 deletions(-) diff --git a/libs/price-provider/Cargo.toml b/libs/price-provider/Cargo.toml index d32e36b..7ba69e0 100644 --- a/libs/price-provider/Cargo.toml +++ b/libs/price-provider/Cargo.toml @@ -1,13 +1,17 @@ [package] name = "price-provider" -version = "0.4.0" +version = "0.4.1" authors = ["Dock.io"] edition = "2021" [dependencies] utils = { package = "utils", path = "../utils", default-features = false } -codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.0.0", features = [ + "derive", +], default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = [ + "derive", +] } serde = { version = "1.0", features = ["derive"], optional = true } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } @@ -29,5 +33,5 @@ std = [ "sp-core/std", "scale-info/std", "frame-system/std", - "frame-support/std" + "frame-support/std", ] diff --git a/libs/price-provider/src/currency_pair.rs b/libs/price-provider/src/currency_pair.rs index 45c2651..cea7cb9 100644 --- a/libs/price-provider/src/currency_pair.rs +++ b/libs/price-provider/src/currency_pair.rs @@ -54,7 +54,7 @@ impl CurrencySymbolPair { Self { from, to } } - /// Maps given currency pair over `from` member and attempts to create a new `CurrencySymbolPair`. + /// Maps given currency pair over `from` member and creates a new `CurrencySymbolPair`. pub fn map_over_from R>( self, map: F, @@ -64,7 +64,7 @@ impl CurrencySymbolPair { CurrencySymbolPair::new((map)(from), to) } - /// Maps given currency pair over `to` member and attempts to create a new `CurrencySymbolPair`. + /// Maps given currency pair over `to` member and creates a new `CurrencySymbolPair`. pub fn map_over_to R>( self, map: F, @@ -73,14 +73,41 @@ impl CurrencySymbolPair { CurrencySymbolPair::new(from, (map)(to)) } + + /// Translates given currency pair over `from` member and attempts to create a new `CurrencySymbolPair`. + pub fn translate_over_from Result>( + self, + translate: F, + ) -> Result, E> { + let Self { from, to } = self; + + (translate)(from).map(|from| CurrencySymbolPair::new(from, to)) + } + + /// Translates given currency pair over `to` member and attempts to create a new `CurrencySymbolPair`. + pub fn translate_over_to Result>( + self, + translate: F, + ) -> Result, E> { + let Self { from, to } = self; + + (translate)(to).map(|to| CurrencySymbolPair::new(from, to)) + } } impl CurrencySymbolPair { /// Maps given currency pair over `from`/`to` members and attempts to create a new `CurrencySymbolPair`. pub fn map_pair R>(self, mut map: F) -> CurrencySymbolPair { - let Self { from, to } = self; + self.map_over_from(&mut map).map_over_to(map) + } - CurrencySymbolPair::new((map)(from), (map)(to)) + /// Maps given currency pair over `from`/`to` members and attempts to create a new `CurrencySymbolPair`. + pub fn translate_pair Result>( + self, + mut translate: F, + ) -> Result, E> { + self.translate_over_from(&mut translate)? + .translate_over_to(translate) } } @@ -116,9 +143,9 @@ where MaxSymBytesLen: Get, { fn decode(input: &mut I) -> Result { - let res = CurrencySymbolPair::::decode(input)?.try_into()?; - - Ok(res) + CurrencySymbolPair::::decode(input)? + .try_into() + .map_err(Into::into) } } @@ -132,14 +159,13 @@ impl MaxEncodedLen for BoundedCurrencySymbolPair + 'static, + MaxSymBytesLen: Get, { fn max_encoded_len() -> usize { - BoundedString::::max_encoded_len().saturating_add(BoundedString::< - MaxSymBytesLen, - To, - >::max_encoded_len( - )) + let from_max_encoded_len = BoundedString::::max_encoded_len(); + let to_max_encoded_len = BoundedString::::max_encoded_len(); + + from_max_encoded_len.saturating_add(to_max_encoded_len) } } @@ -148,7 +174,7 @@ impl From + 'static, + MaxSymBytesLen: Get, { fn from( BoundedCurrencySymbolPair(currency_pair): BoundedCurrencySymbolPair< diff --git a/substrate/frame/elections-phragmen/src/benchmarking.rs b/substrate/frame/elections-phragmen/src/benchmarking.rs index 1b93240..51418e1 100644 --- a/substrate/frame/elections-phragmen/src/benchmarking.rs +++ b/substrate/frame/elections-phragmen/src/benchmarking.rs @@ -22,8 +22,13 @@ use super::*; use frame_benchmarking::{account, benchmarks, whitelist, BenchmarkError, BenchmarkResult}; -use frame_support::{dispatch::DispatchResultWithPostInfo, traits::OnInitialize}; +use frame_support::{ + assert_ok, + dispatch::DispatchResultWithPostInfo, + traits::{EnsureOrigin, OnInitialize}, +}; use frame_system::RawOrigin; +use sp_runtime::DispatchResult; use crate::Pallet as Elections; @@ -59,6 +64,13 @@ fn candidate_count() -> u32 { >::decode_len().unwrap_or(0usize) as u32 } +fn approve(account: &T::AccountId) -> DispatchResult { + Elections::::approve_candidacy( + T::CandidatesApproverOrigin::successful_origin(), + account.clone(), + ) +} + /// Add `c` new candidates. fn submit_candidates( c: u32, @@ -67,6 +79,8 @@ fn submit_candidates( (0..c) .map(|i| { let account = endowed_account::(prefix, i); + approve::(&account).map_err(|_| "failed to approve candidacy")?; + >::submit_candidacy( RawOrigin::Signed(account.clone()).into(), candidate_count::(), @@ -259,6 +273,7 @@ benchmarks! { // we assume worse case that: extrinsic is successful and candidate is not duplicate. let candidate_account = endowed_account::("caller", 0); + assert_ok!(approve::(&candidate_account)); whitelist!(candidate_account); }: _(RawOrigin::Signed(candidate_account.clone()), candidate_count::()) verify { @@ -270,6 +285,25 @@ benchmarks! { } } + approve_candidacy { + clean::(); + let candidacy = endowed_account::("approved_candidacy", 0); + + }: _(T::CandidatesApproverOrigin::successful_origin(), candidacy.clone()) + verify { + ApprovedCandidates::::get(&candidacy).is_some() + } + + disapprove_candidacy { + clean::(); + let candidacy = endowed_account::("approved_candidacy", 0); + assert_ok!(approve::(&candidacy)); + + }: _(T::CandidatesApproverOrigin::successful_origin(), candidacy.clone()) + verify { + ApprovedCandidates::::get(&candidacy).is_none() + } + renounce_candidacy_candidate { // this will check members, runners-up and candidate for removal. Members and runners-up are // limited by the runtime bound, nonetheless we fill them by `m`. diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 282a4c0..46aa305 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -200,7 +200,10 @@ type AccountIdLookupOf = <::Lookup as StaticLookup #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; + use frame_support::{ + pallet_prelude::{OptionQuery, StorageMap, ValueQuery, *}, + Twox64Concat, + }; use frame_system::pallet_prelude::*; /// The current storage version. @@ -290,6 +293,9 @@ pub mod pallet { /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; + + /// An origin that can approve candidates. + type CandidatesApproverOrigin: EnsureOrigin; } #[pallet::hooks] @@ -458,6 +464,11 @@ pub mod pallet { ) -> DispatchResult { let who = ensure_signed(origin)?; + ensure!( + ApprovedCandidates::::contains_key(&who), + Error::::CandidacyMustBeApproved + ); + let actual_count = >::decode_len().unwrap_or(0) as u32; ensure!( actual_count <= candidate_count, @@ -623,6 +634,36 @@ pub mod pallet { Ok(()) } + + /// Approves supplied candidacy. This method must be called before a new candidate will call `submit_candidacy`. + #[pallet::weight(T::DbWeight::get().reads(10))] + pub fn approve_candidacy(origin: OriginFor, candidacy: T::AccountId) -> DispatchResult { + T::CandidatesApproverOrigin::ensure_origin(origin)?; + + ensure!( + !ApprovedCandidates::::contains_key(&candidacy), + Error::::CandidacyIsAlreadyApproved + ); + ApprovedCandidates::::insert(candidacy, ()); + + Ok(()) + } + + /// Removes an approval for the supplied candidacy. + #[pallet::weight(T::DbWeight::get().reads(10))] + pub fn disapprove_candidacy( + origin: OriginFor, + candidacy: T::AccountId, + ) -> DispatchResult { + T::CandidatesApproverOrigin::ensure_origin(origin)?; + + ensure!( + ApprovedCandidates::::take(candidacy).is_some(), + Error::::CandidacyIsNotApproved + ); + + Ok(()) + } } #[pallet::event] @@ -701,6 +742,12 @@ pub mod pallet { InvalidRenouncing, /// Prediction regarding replacement after member removal is wrong. InvalidReplacement, + /// Supplied candidacy is already approved. + CandidacyIsAlreadyApproved, + /// Supplied candidacy isn't approved. + CandidacyIsNotApproved, + /// Before submitting a candidacy, make sure it was approved. + CandidacyMustBeApproved, } /// The current elected members. @@ -744,6 +791,14 @@ pub mod pallet { pub type Voting = StorageMap<_, Twox64Concat, T::AccountId, Voter>, ValueQuery>; + /// Map containing approved candidates. + /// + /// TWOX-NOTE: SAFE as `AccountId` is a crypto hash. + #[pallet::storage] + #[pallet::getter(fn approved_candidates)] + pub type ApprovedCandidates = + StorageMap<_, Twox64Concat, T::AccountId, (), OptionQuery>; + #[pallet::storage] #[pallet::getter(fn version)] pub type Version = StorageValue<_, PalletStorageVersion, ValueQuery>; @@ -1295,14 +1350,14 @@ mod tests { use frame_support::{ assert_noop, assert_ok, dispatch::DispatchResultWithPostInfo, - parameter_types, + ord_parameter_types, parameter_types, traits::{ConstU32, ConstU64, OnInitialize}, }; - use frame_system::ensure_signed; + use frame_system::{ensure_signed, EnsureSignedBy, RawOrigin}; use sp_core::H256; use sp_runtime::{ testing::Header, - traits::{BlakeTwo256, IdentityLookup}, + traits::{BadOrigin, BlakeTwo256, IdentityLookup}, BuildStorage, }; use substrate_test_utils::assert_eq_uvec; @@ -1414,6 +1469,17 @@ mod tests { pub const PhragmenMaxVoters: u32 = 1000; pub const PhragmenMaxCandidates: u32 = 100; pub const CandidacyDelay: u32 = 4; + + } + + ord_parameter_types! { + pub const CandidacyApprover: u64 = 10; + } + + impl CandidacyApprover { + fn signed() -> Origin { + Origin::signed(Self::get()) + } } impl Config for Test { @@ -1421,6 +1487,7 @@ mod tests { type PalletId = ElectionsPhragmenPalletId; type Event = Event; type Currency = Balances; + type CandidatesApproverOrigin = EnsureSignedBy; type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote; type ChangeMembers = TestChangeMembers; type InitializeMembers = (); @@ -1641,6 +1708,22 @@ mod tests { ensure_members_has_approval_stake(); } + fn approve_candidacy(origin: Origin) -> sp_runtime::DispatchResult { + if let Some(account) = Result::from(origin).ok().and_then(|o| match o { + RawOrigin::Signed(acc) => Some(acc), + _ => None, + }) { + Elections::approve_candidacy(Origin::signed(10), account) + } else { + Err(BadOrigin.into()) + } + } + + fn approve_and_submit_candidacy(origin: Origin) -> sp_runtime::DispatchResult { + approve_candidacy(origin.clone())?; + submit_candidacy(origin) + } + fn submit_candidacy(origin: Origin) -> sp_runtime::DispatchResult { Elections::submit_candidacy(origin, Elections::candidates().len() as u32) } @@ -1657,6 +1740,57 @@ mod tests { Voting::::get(who).votes } + #[test] + fn candidacy_approval_works() { + ExtBuilder::default().build_and_execute(|| { + assert!(Elections::approved_candidates(2).is_none()); + assert_noop!( + Elections::approve_candidacy(Origin::signed(1), 2), + DispatchError::BadOrigin + ); + assert_noop!( + Elections::approve_candidacy(Origin::signed(2), 2), + DispatchError::BadOrigin + ); + assert_noop!( + Elections::approve_candidacy(Origin::root(), 2), + DispatchError::BadOrigin + ); + assert!(Elections::approved_candidates(2).is_none()); + + assert_noop!( + Elections::submit_candidacy(Origin::signed(2), 1), + Error::::CandidacyMustBeApproved + ); + assert_noop!( + Elections::submit_candidacy(Origin::signed(3), 1), + Error::::CandidacyMustBeApproved + ); + + assert_ok!(Elections::approve_candidacy(CandidacyApprover::signed(), 2)); + assert!(Elections::approved_candidates(2).is_some()); + assert_ok!(Elections::approve_candidacy(CandidacyApprover::signed(), 3)); + assert!(Elections::approved_candidates(3).is_some()); + + assert_ok!(Elections::submit_candidacy(Origin::signed(2), 1),); + + assert_ok!(Elections::disapprove_candidacy( + CandidacyApprover::signed(), + 3 + )); + + assert_noop!( + Elections::submit_candidacy(Origin::signed(3), 1), + Error::::CandidacyMustBeApproved + ); + + assert_noop!( + Elections::disapprove_candidacy(CandidacyApprover::signed(), 3), + Error::::CandidacyIsNotApproved + ); + }) + } + #[test] fn params_should_work() { ExtBuilder::default().build_and_execute(|| { @@ -1863,7 +1997,7 @@ mod tests { assert!(Elections::is_candidate(&2).is_err()); assert_eq!(balances(&1), (10, 0)); - assert_ok!(submit_candidacy(Origin::signed(1))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(1))); assert_eq!(balances(&1), (7, 3)); assert_eq!(candidate_ids(), vec![1]); @@ -1872,7 +2006,7 @@ mod tests { assert!(Elections::is_candidate(&2).is_err()); assert_eq!(balances(&2), (20, 0)); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_eq!(balances(&2), (17, 3)); assert_eq!(candidate_ids(), vec![1, 2]); @@ -1889,7 +2023,7 @@ mod tests { #[test] fn updating_candidacy_bond_works() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_eq!( Elections::candidates(), @@ -1899,7 +2033,7 @@ mod tests { // a runtime upgrade changes the bond. CANDIDACY_BOND.with(|v| *v.borrow_mut() = 4); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_eq!( Elections::candidates(), @@ -1938,13 +2072,13 @@ mod tests { ExtBuilder::default().build_and_execute(|| { assert_eq!(candidate_ids(), Vec::::new()); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_eq!(candidate_ids(), vec![3]); - assert_ok!(submit_candidacy(Origin::signed(1))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(1))); assert_eq!(candidate_ids(), vec![1, 3]); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_eq!(candidate_ids(), vec![1, 2, 3]); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_eq!(candidate_ids(), vec![1, 2, 3, 4]); }); } @@ -1953,7 +2087,7 @@ mod tests { fn dupe_candidate_submission_should_not_work() { ExtBuilder::default().build_and_execute(|| { assert_eq!(candidate_ids(), Vec::::new()); - assert_ok!(submit_candidacy(Origin::signed(1))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(1))); assert_eq!(candidate_ids(), vec![1]); assert_noop!( submit_candidacy(Origin::signed(1)), @@ -1966,7 +2100,7 @@ mod tests { fn member_candidacy_submission_should_not_work() { // critically important to make sure that outgoing candidates and losers are not mixed up. ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); System::set_block_number(5); @@ -1988,9 +2122,9 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(2), vec![5, 4], 20)); assert_ok!(vote(Origin::signed(1), vec![3], 10)); @@ -2012,6 +2146,7 @@ mod tests { fn poor_candidate_submission_should_not_work() { ExtBuilder::default().build_and_execute(|| { assert_eq!(candidate_ids(), Vec::::new()); + assert_ok!(approve_candidacy(Origin::signed(7))); assert_noop!( submit_candidacy(Origin::signed(7)), Error::::InsufficientCandidateFunds, @@ -2025,7 +2160,7 @@ mod tests { assert_eq!(candidate_ids(), Vec::::new()); assert_eq!(balances(&2), (20, 0)); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); assert_eq!(balances(&2), (18, 2)); @@ -2039,7 +2174,7 @@ mod tests { assert_eq!(candidate_ids(), Vec::::new()); assert_eq!(balances(&2), (20, 0)); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(2), vec![5], 12)); assert_eq!(balances(&2), (18, 2)); @@ -2052,8 +2187,8 @@ mod tests { ExtBuilder::default().build_and_execute(|| { assert_eq!(balances(&2), (20, 0)); - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); // User only locks up to their free balance. @@ -2072,7 +2207,7 @@ mod tests { #[test] fn updated_voting_bond_works() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_eq!(balances(&2), (20, 0)); assert_ok!(vote(Origin::signed(2), vec![5], 5)); @@ -2101,8 +2236,8 @@ mod tests { .build_and_execute(|| { assert_eq!(balances(&2), (20, 0)); - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); // initial vote. assert_ok!(vote(Origin::signed(2), vec![5], 10)); @@ -2149,8 +2284,8 @@ mod tests { #[test] fn can_vote_for_old_members_even_when_no_new_candidates() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(2), vec![4, 5], 20)); @@ -2167,9 +2302,9 @@ mod tests { #[test] fn prime_works() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(1), vec![4, 3], 10)); assert_ok!(vote(Origin::signed(2), vec![4], 20)); @@ -2191,9 +2326,9 @@ mod tests { #[test] fn prime_votes_for_exiting_members_are_removed() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(1), vec![4, 3], 10)); assert_ok!(vote(Origin::signed(2), vec![4], 20)); @@ -2219,8 +2354,8 @@ mod tests { #[test] fn prime_is_kept_if_other_members_leave() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_ok!(vote(Origin::signed(5), vec![5], 50)); @@ -2243,8 +2378,8 @@ mod tests { #[test] fn prime_is_gone_if_renouncing() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_ok!(vote(Origin::signed(5), vec![5], 50)); @@ -2271,9 +2406,9 @@ mod tests { .balance_factor(10) .build_and_execute(|| { // when we have only candidates - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_noop!( // content of the vote is irrelevant. @@ -2289,7 +2424,7 @@ mod tests { Elections::on_initialize(System::block_number()); // now we have 2 members, 1 runner-up, and 1 new candidate - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(1), vec![9, 99, 999, 9999], 5)); assert_noop!( @@ -2302,8 +2437,8 @@ mod tests { #[test] fn cannot_vote_for_less_than_ed() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_noop!( vote(Origin::signed(2), vec![4], 1), @@ -2315,8 +2450,8 @@ mod tests { #[test] fn can_vote_for_more_than_free_balance_but_moot() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); // User has 100 free and 50 reserved. assert_ok!(Balances::set_balance(Origin::root(), 2, 100, 50)); @@ -2331,7 +2466,7 @@ mod tests { #[test] fn remove_voter_should_work() { ExtBuilder::default().voter_bond(8).build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); assert_ok!(vote(Origin::signed(3), vec![5], 30)); @@ -2368,7 +2503,7 @@ mod tests { #[test] fn dupe_remove_should_fail() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); assert_ok!(Elections::remove_voter(Origin::signed(2))); @@ -2384,9 +2519,9 @@ mod tests { #[test] fn removed_voter_should_not_be_counted() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -2404,9 +2539,9 @@ mod tests { #[test] fn simple_voting_rounds_should_work() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); assert_ok!(vote(Origin::signed(4), vec![4], 15)); @@ -2454,8 +2589,8 @@ mod tests { #[test] fn all_outgoing() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -2490,7 +2625,7 @@ mod tests { fn candidacy_delay() { ExtBuilder::default().build_and_execute(|| { System::set_block_number(2); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); System::set_block_number(3); @@ -2528,7 +2663,7 @@ mod tests { #[test] fn defunct_voter_will_be_counted() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); // This guy's vote is pointless for this round. assert_ok!(vote(Origin::signed(3), vec![4], 30)); @@ -2541,7 +2676,7 @@ mod tests { assert_eq!(Elections::election_rounds(), 1); // but now it has a valid target. - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); System::set_block_number(10); Elections::on_initialize(System::block_number()); @@ -2556,10 +2691,10 @@ mod tests { #[test] fn only_desired_seats_are_chosen() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![2], 20)); assert_ok!(vote(Origin::signed(3), vec![3], 30)); @@ -2577,8 +2712,8 @@ mod tests { #[test] fn phragmen_should_not_self_vote() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); System::set_block_number(5); Elections::on_initialize(System::block_number()); @@ -2598,10 +2733,10 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![3], 20)); assert_ok!(vote(Origin::signed(3), vec![2], 30)); @@ -2627,10 +2762,10 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![2], 20)); assert_ok!(vote(Origin::signed(3), vec![3], 30)); @@ -2657,9 +2792,9 @@ mod tests { ExtBuilder::default() .desired_runners_up(1) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![2], 20)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -2671,7 +2806,7 @@ mod tests { assert_eq!(runners_up_ids(), vec![2]); assert_eq!(balances(&2), (15, 5)); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(3), vec![3], 30)); System::set_block_number(10); @@ -2687,7 +2822,7 @@ mod tests { ExtBuilder::default().build_and_execute(|| { assert_eq!(balances(&5), (50, 0)); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_eq!(balances(&5), (47, 3)); assert_ok!(vote(Origin::signed(5), vec![5], 50)); @@ -2711,8 +2846,8 @@ mod tests { #[test] fn candidates_lose_the_bond_when_outgoing() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(4), vec![5], 40)); @@ -2734,8 +2869,8 @@ mod tests { #[test] fn current_members_are_always_next_candidate() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_ok!(vote(Origin::signed(5), vec![5], 50)); @@ -2746,10 +2881,10 @@ mod tests { assert_eq!(members_ids(), vec![4, 5]); assert_eq!(Elections::election_rounds(), 1); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![2], 20)); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(3), vec![3], 30)); assert_ok!(Elections::remove_voter(Origin::signed(4))); @@ -2772,10 +2907,10 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -2805,8 +2940,8 @@ mod tests { #[test] fn remove_members_triggers_election() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_ok!(vote(Origin::signed(5), vec![5], 50)); @@ -2817,7 +2952,7 @@ mod tests { assert_eq!(Elections::election_rounds(), 1); // a new candidate - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(3), vec![3], 30)); System::set_block_number(10); @@ -2832,9 +2967,9 @@ mod tests { #[test] fn seats_should_be_released_when_no_vote() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(2), vec![3], 20)); assert_ok!(vote(Origin::signed(3), vec![3], 30)); @@ -2866,8 +3001,8 @@ mod tests { #[test] fn incoming_outgoing_are_reported() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_ok!(vote(Origin::signed(5), vec![5], 50)); @@ -2876,9 +3011,9 @@ mod tests { Elections::on_initialize(System::block_number()); assert_eq!(members_ids(), vec![4, 5]); - assert_ok!(submit_candidacy(Origin::signed(1))); - assert_ok!(submit_candidacy(Origin::signed(2))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(1))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); // 5 will change their vote and becomes an `outgoing` assert_ok!(vote(Origin::signed(5), vec![4], 8)); @@ -2913,8 +3048,8 @@ mod tests { #[test] fn invalid_votes_are_moot() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(3), vec![3], 30)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -2933,10 +3068,10 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![3], 20)); assert_ok!(vote(Origin::signed(3), vec![2], 30)); @@ -2957,9 +3092,9 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -2979,10 +3114,10 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -3011,8 +3146,8 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -3040,10 +3175,10 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(5), vec![4], 50)); assert_ok!(vote(Origin::signed(4), vec![5], 40)); @@ -3072,10 +3207,10 @@ mod tests { ExtBuilder::default() .desired_runners_up(2) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![5], 20)); assert_ok!(vote(Origin::signed(3), vec![3], 30)); @@ -3099,7 +3234,7 @@ mod tests { #[test] fn can_renounce_candidacy_candidate() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_eq!(balances(&5), (47, 3)); assert_eq!(candidate_ids(), vec![5]); @@ -3135,9 +3270,9 @@ mod tests { ExtBuilder::default() .desired_runners_up(1) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -3161,9 +3296,9 @@ mod tests { ExtBuilder::default() .desired_runners_up(1) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -3185,9 +3320,9 @@ mod tests { #[test] fn wrong_candidate_count_renounce_should_fail() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_noop!( Elections::renounce_candidacy(Origin::signed(4), Renouncing::Candidate(2)), @@ -3204,9 +3339,9 @@ mod tests { #[test] fn renounce_candidacy_count_can_overestimate() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); // while we have only 3 candidates. assert_ok!(Elections::renounce_candidacy( Origin::signed(4), @@ -3221,9 +3356,9 @@ mod tests { .desired_runners_up(2) .desired_members(1) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 5)); @@ -3235,7 +3370,7 @@ mod tests { assert_eq!(members_ids(), vec![5]); assert_eq!(runners_up_ids(), vec![4, 3]); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(2), vec![2], 10)); System::set_block_number(10); @@ -3257,9 +3392,9 @@ mod tests { .desired_runners_up(2) .desired_members(1) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_ok!(vote(Origin::signed(3), vec![3], 30)); @@ -3276,7 +3411,7 @@ mod tests { assert_eq!(balances(&2), (15, 5)); // this guy will shift everyone down. - assert_ok!(submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); System::set_block_number(10); @@ -3300,9 +3435,9 @@ mod tests { .desired_runners_up(2) .desired_members(1) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_ok!(vote(Origin::signed(4), vec![4], 40)); assert_ok!(vote(Origin::signed(3), vec![3], 30)); @@ -3340,9 +3475,9 @@ mod tests { #[test] fn remove_and_replace_member_works() { let setup = || { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); assert_ok!(vote(Origin::signed(5), vec![5], 50)); assert_ok!(vote(Origin::signed(4), vec![4], 40)); @@ -3402,9 +3537,9 @@ mod tests { .build_and_execute(|| { assert_eq!(Elections::candidates().len(), 0); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_eq!(Elections::candidates().len(), 3); @@ -3428,9 +3563,9 @@ mod tests { .build_and_execute(|| { assert_eq!(Elections::candidates().len(), 0); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_eq!(Elections::candidates().len(), 3); @@ -3454,9 +3589,9 @@ mod tests { .build_and_execute(|| { assert_eq!(Elections::candidates().len(), 0); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); assert_eq!(Elections::candidates().len(), 3); @@ -3479,11 +3614,11 @@ mod tests { ExtBuilder::default() .desired_members(1) .build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); - assert_ok!(submit_candidacy(Origin::signed(2))); - assert_ok!(submit_candidacy(Origin::signed(1))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(2))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(1))); // all these duplicate votes will not cause 2 to win. assert_ok!(vote(Origin::signed(1), vec![2, 2, 2, 2], 5)); @@ -3501,9 +3636,9 @@ mod tests { #[test] fn remove_defunct_voter_works() { ExtBuilder::default().build_and_execute(|| { - assert_ok!(submit_candidacy(Origin::signed(5))); - assert_ok!(submit_candidacy(Origin::signed(4))); - assert_ok!(submit_candidacy(Origin::signed(3))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(5))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(4))); + assert_ok!(approve_and_submit_candidacy(Origin::signed(3))); // defunct assert_ok!(vote(Origin::signed(5), vec![5, 4], 5)); From 9e225847c752903f7ec077c56413b6afd14e21a4 Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:05:16 +0900 Subject: [PATCH 02/20] Use 1.75 --- .github/workflows/basic.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index abcb95a..612afad 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -10,11 +10,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.75 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.75 override: true - name: Run cargo check @@ -30,13 +30,13 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.75 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly override: true - + - name: Install WASM run: rustup target add wasm32-unknown-unknown --toolchain nightly @@ -53,11 +53,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.75 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.75 override: true - name: Run cargo test @@ -73,11 +73,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.75 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.75 override: true components: rustfmt, clippy @@ -90,4 +90,4 @@ jobs: - name: Run cargo clippy uses: actions-rs/cargo@v1 with: - command: clippy \ No newline at end of file + command: clippy From 7e407daf923ae140ca82f45d19ea448c01a81e4e Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:10:11 +0900 Subject: [PATCH 03/20] 1.74 --- .github/workflows/basic.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 612afad..07b8d2e 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -10,11 +10,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.75 toolchain + - name: Install 1.74 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75 + toolchain: 1.74 override: true - name: Run cargo check @@ -30,7 +30,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.75 toolchain + - name: Install 1.74 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -53,11 +53,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.75 toolchain + - name: Install 1.74 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75 + toolchain: 1.74 override: true - name: Run cargo test @@ -73,11 +73,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.75 toolchain + - name: Install 1.74 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75 + toolchain: 1.74 override: true components: rustfmt, clippy From 0fb967d359c45a04cca385352c4bbc11731fe24f Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:12:46 +0900 Subject: [PATCH 04/20] Updated weights --- substrate/frame/elections-phragmen/src/lib.rs | 4 +- .../frame/elections-phragmen/src/weights.rs | 532 +++++++----------- 2 files changed, 219 insertions(+), 317 deletions(-) diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 46aa305..3ef1dbe 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -636,7 +636,7 @@ pub mod pallet { } /// Approves supplied candidacy. This method must be called before a new candidate will call `submit_candidacy`. - #[pallet::weight(T::DbWeight::get().reads(10))] + #[pallet::weight(T::WeightInfo::approve_candidacy())] pub fn approve_candidacy(origin: OriginFor, candidacy: T::AccountId) -> DispatchResult { T::CandidatesApproverOrigin::ensure_origin(origin)?; @@ -650,7 +650,7 @@ pub mod pallet { } /// Removes an approval for the supplied candidacy. - #[pallet::weight(T::DbWeight::get().reads(10))] + #[pallet::weight(T::WeightInfo::disapprove_candidacy())] pub fn disapprove_candidacy( origin: OriginFor, candidacy: T::AccountId, diff --git a/substrate/frame/elections-phragmen/src/weights.rs b/substrate/frame/elections-phragmen/src/weights.rs index 1f8f397..509dace 100644 --- a/substrate/frame/elections-phragmen/src/weights.rs +++ b/substrate/frame/elections-phragmen/src/weights.rs @@ -1,342 +1,244 @@ -// This file is part of Substrate. - -// Copyright (C) 2022 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Autogenerated weights for pallet_elections_phragmen //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-08-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: 2024-04-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 // Executed Command: -// /home/benchbot/cargo_target_dir/production/substrate +// ./target/release/dock-node // benchmark // pallet -// --steps=50 -// --repeat=20 -// --extrinsic=* -// --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --pallet=pallet_elections_phragmen -// --chain=dev -// --output=./frame/elections-phragmen/src/weights.rs -// --template=./.maintain/frame-weight-template.hbs +// --extra +// --repeat=20 +// --extrinsic=* +// --steps=50 +// --template=node/module-weight-template.hbs +// --output=./tmp -#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame_support::{ + traits::Get, + weights::{constants::RocksDbWeight, Weight}, +}; use sp_std::marker::PhantomData; /// Weight functions needed for pallet_elections_phragmen. pub trait WeightInfo { - fn vote_equal(v: u32, ) -> Weight; - fn vote_more(v: u32, ) -> Weight; - fn vote_less(v: u32, ) -> Weight; - fn remove_voter() -> Weight; - fn submit_candidacy(c: u32, ) -> Weight; - fn renounce_candidacy_candidate(c: u32, ) -> Weight; - fn renounce_candidacy_members() -> Weight; - fn renounce_candidacy_runners_up() -> Weight; - fn remove_member_without_replacement() -> Weight; - fn remove_member_with_replacement() -> Weight; - fn clean_defunct_voters(v: u32, d: u32, ) -> Weight; - fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight; + fn vote_equal(v: u32) -> Weight; + fn vote_more(v: u32) -> Weight; + fn vote_less(v: u32) -> Weight; + fn remove_voter() -> Weight; + fn submit_candidacy(c: u32) -> Weight; + fn approve_candidacy() -> Weight; + fn disapprove_candidacy() -> Weight; + fn renounce_candidacy_candidate(c: u32) -> Weight; + fn renounce_candidacy_members() -> Weight; + fn renounce_candidacy_runners_up() -> Weight; + fn remove_member_without_replacement() -> Weight; + fn remove_member_with_replacement() -> Weight; + fn clean_defunct_voters(v: u32, d: u32) -> Weight; + fn election_phragmen(c: u32, v: u32, e: u32) -> Weight; + fn election_phragmen_c_e(c: u32, e: u32) -> Weight; + fn election_phragmen_v(v: u32) -> Weight; } /// Weights for pallet_elections_phragmen using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - // Storage: Elections Candidates (r:1 w:0) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - /// The range of component `v` is `[1, 16]`. - fn vote_equal(v: u32, ) -> Weight { - Weight::from_ref_time(27_011_000_u64) - // Standard Error: 3_000 - .saturating_add(Weight::from_ref_time(214_000_u64).saturating_mul(v as u64)) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - // Storage: Elections Candidates (r:1 w:0) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - /// The range of component `v` is `[2, 16]`. - fn vote_more(v: u32, ) -> Weight { - Weight::from_ref_time(40_240_000_u64) - // Standard Error: 5_000 - .saturating_add(Weight::from_ref_time(244_000_u64).saturating_mul(v as u64)) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - // Storage: Elections Candidates (r:1 w:0) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - /// The range of component `v` is `[2, 16]`. - fn vote_less(v: u32, ) -> Weight { - Weight::from_ref_time(40_394_000_u64) - // Standard Error: 5_000 - .saturating_add(Weight::from_ref_time(217_000_u64).saturating_mul(v as u64)) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - fn remove_voter() -> Weight { - Weight::from_ref_time(37_651_000_u64) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - // Storage: Elections Candidates (r:1 w:1) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - /// The range of component `c` is `[1, 1000]`. - fn submit_candidacy(c: u32, ) -> Weight { - Weight::from_ref_time(42_217_000_u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(50_000_u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - // Storage: Elections Candidates (r:1 w:1) - /// The range of component `c` is `[1, 1000]`. - fn renounce_candidacy_candidate(c: u32, ) -> Weight { - Weight::from_ref_time(46_459_000_u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(26_000_u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - // Storage: Elections Members (r:1 w:1) - // Storage: Elections RunnersUp (r:1 w:1) - // Storage: Council Prime (r:1 w:1) - // Storage: Council Proposals (r:1 w:0) - // Storage: Council Members (r:0 w:1) - fn renounce_candidacy_members() -> Weight { - Weight::from_ref_time(45_189_000_u64) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } - // Storage: Elections RunnersUp (r:1 w:1) - fn renounce_candidacy_runners_up() -> Weight { - Weight::from_ref_time(34_516_000_u64) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - // Storage: Benchmark Override (r:0 w:0) - fn remove_member_without_replacement() -> Weight { - Weight::from_ref_time(2_000_000_000_000_u64) - } - // Storage: Elections Members (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: Elections RunnersUp (r:1 w:1) - // Storage: Council Prime (r:1 w:1) - // Storage: Council Proposals (r:1 w:0) - // Storage: Council Members (r:0 w:1) - fn remove_member_with_replacement() -> Weight { - Weight::from_ref_time(51_838_000_u64) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(5_u64)) - } - // Storage: Elections Voting (r:5001 w:5000) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Candidates (r:1 w:0) - // Storage: Balances Locks (r:5000 w:5000) - // Storage: System Account (r:5000 w:5000) - /// The range of component `v` is `[5000, 10000]`. - /// The range of component `d` is `[1, 5000]`. - fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { - Weight::from_ref_time(0_u64) - // Standard Error: 76_000 - .saturating_add(Weight::from_ref_time(63_721_000_u64).saturating_mul(v as u64)) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().reads(3_u64.saturating_mul(v as u64))) - .saturating_add(T::DbWeight::get().writes(3_u64.saturating_mul(v as u64))) - } - // Storage: Elections Candidates (r:1 w:1) - // Storage: Elections Members (r:1 w:1) - // Storage: Elections RunnersUp (r:1 w:1) - // Storage: Elections Voting (r:10001 w:0) - // Storage: Council Proposals (r:1 w:0) - // Storage: Elections ElectionRounds (r:1 w:1) - // Storage: Council Members (r:0 w:1) - // Storage: Council Prime (r:0 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `c` is `[1, 1000]`. - /// The range of component `v` is `[1, 10000]`. - /// The range of component `e` is `[10000, 160000]`. - fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { - Weight::from_ref_time(0_u64) - // Standard Error: 773_000 - .saturating_add(Weight::from_ref_time(81_534_000_u64).saturating_mul(v as u64)) - // Standard Error: 51_000 - .saturating_add(Weight::from_ref_time(4_453_000_u64).saturating_mul(e as u64)) - .saturating_add(T::DbWeight::get().reads(280_u64)) - .saturating_add(T::DbWeight::get().reads(1_u64.saturating_mul(c as u64))) - .saturating_add(T::DbWeight::get().reads(1_u64.saturating_mul(v as u64))) - .saturating_add(T::DbWeight::get().writes(1_u64.saturating_mul(c as u64))) - } + fn vote_equal(_v: u32) -> Weight { + Weight::from_ref_time(26_184_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + fn vote_more(v: u32) -> Weight { + Weight::from_ref_time(31_243_000) // Standard Error: 7_000 + .saturating_add(Weight::from_ref_time(121_000).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + fn vote_less(v: u32) -> Weight { + Weight::from_ref_time(31_556_000) // Standard Error: 9_000 + .saturating_add(Weight::from_ref_time(133_000).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + fn remove_voter() -> Weight { + Weight::from_ref_time(30_000_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + fn submit_candidacy(c: u32) -> Weight { + Weight::from_ref_time(29_742_000) // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(87_000).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn approve_candidacy() -> Weight { + Weight::from_ref_time(7_000_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn disapprove_candidacy() -> Weight { + Weight::from_ref_time(7_000_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn renounce_candidacy_candidate(c: u32) -> Weight { + Weight::from_ref_time(24_084_000) // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(63_000).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn renounce_candidacy_members() -> Weight { + Weight::from_ref_time(36_000_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + fn renounce_candidacy_runners_up() -> Weight { + Weight::from_ref_time(29_000_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_member_without_replacement() -> Weight { + Weight::from_ref_time(1_000_000_000_000) + } + fn remove_member_with_replacement() -> Weight { + Weight::from_ref_time(38_000_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + fn clean_defunct_voters(v: u32, _d: u32) -> Weight { + Weight::from_ref_time(303_135_000) // Standard Error: 239_000 + .saturating_add(Weight::from_ref_time(29_141_000).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(v as u64))) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(v as u64))) + } + fn election_phragmen(c: u32, v: u32, e: u32) -> Weight { + Weight::from_ref_time(0) // Standard Error: 275_000 + .saturating_add(Weight::from_ref_time(3_751_000).saturating_mul(c as u64)) // Standard Error: 68_000 + .saturating_add(Weight::from_ref_time(9_459_000).saturating_mul(v as u64)) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(191_000).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(116)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64))) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) + } + fn election_phragmen_c_e(c: u32, e: u32) -> Weight { + Weight::from_ref_time(5_386_658_000) // Standard Error: 288_000 + .saturating_add(Weight::from_ref_time(7_112_000).saturating_mul(c as u64)) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(151_000).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(798)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) + } + fn election_phragmen_v(v: u32) -> Weight { + Weight::from_ref_time(241_417_000) // Standard Error: 75_000 + .saturating_add(Weight::from_ref_time(6_432_000).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(37)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64))) + .saturating_add(T::DbWeight::get().writes(17)) + } } // For backwards compatibility and tests impl WeightInfo for () { - // Storage: Elections Candidates (r:1 w:0) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - /// The range of component `v` is `[1, 16]`. - fn vote_equal(v: u32, ) -> Weight { - Weight::from_ref_time(27_011_000_u64) - // Standard Error: 3_000 - .saturating_add(Weight::from_ref_time(214_000_u64).saturating_mul(v as u64)) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - // Storage: Elections Candidates (r:1 w:0) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - /// The range of component `v` is `[2, 16]`. - fn vote_more(v: u32, ) -> Weight { - Weight::from_ref_time(40_240_000_u64) - // Standard Error: 5_000 - .saturating_add(Weight::from_ref_time(244_000_u64).saturating_mul(v as u64)) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - // Storage: Elections Candidates (r:1 w:0) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - /// The range of component `v` is `[2, 16]`. - fn vote_less(v: u32, ) -> Weight { - Weight::from_ref_time(40_394_000_u64) - // Standard Error: 5_000 - .saturating_add(Weight::from_ref_time(217_000_u64).saturating_mul(v as u64)) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - // Storage: Elections Voting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - fn remove_voter() -> Weight { - Weight::from_ref_time(37_651_000_u64) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - // Storage: Elections Candidates (r:1 w:1) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - /// The range of component `c` is `[1, 1000]`. - fn submit_candidacy(c: u32, ) -> Weight { - Weight::from_ref_time(42_217_000_u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(50_000_u64).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - // Storage: Elections Candidates (r:1 w:1) - /// The range of component `c` is `[1, 1000]`. - fn renounce_candidacy_candidate(c: u32, ) -> Weight { - Weight::from_ref_time(46_459_000_u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(26_000_u64).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - // Storage: Elections Members (r:1 w:1) - // Storage: Elections RunnersUp (r:1 w:1) - // Storage: Council Prime (r:1 w:1) - // Storage: Council Proposals (r:1 w:0) - // Storage: Council Members (r:0 w:1) - fn renounce_candidacy_members() -> Weight { - Weight::from_ref_time(45_189_000_u64) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } - // Storage: Elections RunnersUp (r:1 w:1) - fn renounce_candidacy_runners_up() -> Weight { - Weight::from_ref_time(34_516_000_u64) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - // Storage: Benchmark Override (r:0 w:0) - fn remove_member_without_replacement() -> Weight { - Weight::from_ref_time(2_000_000_000_000_u64) - } - // Storage: Elections Members (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: Elections RunnersUp (r:1 w:1) - // Storage: Council Prime (r:1 w:1) - // Storage: Council Proposals (r:1 w:0) - // Storage: Council Members (r:0 w:1) - fn remove_member_with_replacement() -> Weight { - Weight::from_ref_time(51_838_000_u64) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(5_u64)) - } - // Storage: Elections Voting (r:5001 w:5000) - // Storage: Elections Members (r:1 w:0) - // Storage: Elections RunnersUp (r:1 w:0) - // Storage: Elections Candidates (r:1 w:0) - // Storage: Balances Locks (r:5000 w:5000) - // Storage: System Account (r:5000 w:5000) - /// The range of component `v` is `[5000, 10000]`. - /// The range of component `d` is `[1, 5000]`. - fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { - Weight::from_ref_time(0_u64) - // Standard Error: 76_000 - .saturating_add(Weight::from_ref_time(63_721_000_u64).saturating_mul(v as u64)) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().reads(3_u64.saturating_mul(v as u64))) - .saturating_add(RocksDbWeight::get().writes(3_u64.saturating_mul(v as u64))) - } - // Storage: Elections Candidates (r:1 w:1) - // Storage: Elections Members (r:1 w:1) - // Storage: Elections RunnersUp (r:1 w:1) - // Storage: Elections Voting (r:10001 w:0) - // Storage: Council Proposals (r:1 w:0) - // Storage: Elections ElectionRounds (r:1 w:1) - // Storage: Council Members (r:0 w:1) - // Storage: Council Prime (r:0 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `c` is `[1, 1000]`. - /// The range of component `v` is `[1, 10000]`. - /// The range of component `e` is `[10000, 160000]`. - fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { - Weight::from_ref_time(0_u64) - // Standard Error: 773_000 - .saturating_add(Weight::from_ref_time(81_534_000_u64).saturating_mul(v as u64)) - // Standard Error: 51_000 - .saturating_add(Weight::from_ref_time(4_453_000_u64).saturating_mul(e as u64)) - .saturating_add(RocksDbWeight::get().reads(280_u64)) - .saturating_add(RocksDbWeight::get().reads(1_u64.saturating_mul(c as u64))) - .saturating_add(RocksDbWeight::get().reads(1_u64.saturating_mul(v as u64))) - .saturating_add(RocksDbWeight::get().writes(1_u64.saturating_mul(c as u64))) - } + fn vote_equal(_v: u32) -> Weight { + Weight::from_ref_time(26_184_000) + .saturating_add(RocksDbWeight::get().reads(5)) + .saturating_add(RocksDbWeight::get().writes(2)) + } + fn vote_more(v: u32) -> Weight { + Weight::from_ref_time(31_243_000) // Standard Error: 7_000 + .saturating_add(Weight::from_ref_time(121_000).saturating_mul(v as u64)) + .saturating_add(RocksDbWeight::get().reads(5)) + .saturating_add(RocksDbWeight::get().writes(2)) + } + fn vote_less(v: u32) -> Weight { + Weight::from_ref_time(31_556_000) // Standard Error: 9_000 + .saturating_add(Weight::from_ref_time(133_000).saturating_mul(v as u64)) + .saturating_add(RocksDbWeight::get().reads(5)) + .saturating_add(RocksDbWeight::get().writes(2)) + } + fn remove_voter() -> Weight { + Weight::from_ref_time(30_000_000) + .saturating_add(RocksDbWeight::get().reads(2)) + .saturating_add(RocksDbWeight::get().writes(2)) + } + fn submit_candidacy(c: u32) -> Weight { + Weight::from_ref_time(29_742_000) // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(87_000).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(4)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + fn approve_candidacy() -> Weight { + Weight::from_ref_time(7_000_000) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + fn disapprove_candidacy() -> Weight { + Weight::from_ref_time(7_000_000) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + fn renounce_candidacy_candidate(c: u32) -> Weight { + Weight::from_ref_time(24_084_000) // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(63_000).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + fn renounce_candidacy_members() -> Weight { + Weight::from_ref_time(36_000_000) + .saturating_add(RocksDbWeight::get().reads(4)) + .saturating_add(RocksDbWeight::get().writes(4)) + } + fn renounce_candidacy_runners_up() -> Weight { + Weight::from_ref_time(29_000_000) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + fn remove_member_without_replacement() -> Weight { + Weight::from_ref_time(1_000_000_000_000) + } + fn remove_member_with_replacement() -> Weight { + Weight::from_ref_time(38_000_000) + .saturating_add(RocksDbWeight::get().reads(5)) + .saturating_add(RocksDbWeight::get().writes(5)) + } + fn clean_defunct_voters(v: u32, _d: u32) -> Weight { + Weight::from_ref_time(303_135_000) // Standard Error: 239_000 + .saturating_add(Weight::from_ref_time(29_141_000).saturating_mul(v as u64)) + .saturating_add(RocksDbWeight::get().reads(4)) + .saturating_add(RocksDbWeight::get().reads((3 as u64).saturating_mul(v as u64))) + .saturating_add(RocksDbWeight::get().writes((3 as u64).saturating_mul(v as u64))) + } + fn election_phragmen(c: u32, v: u32, e: u32) -> Weight { + Weight::from_ref_time(0) // Standard Error: 275_000 + .saturating_add(Weight::from_ref_time(3_751_000).saturating_mul(c as u64)) // Standard Error: 68_000 + .saturating_add(Weight::from_ref_time(9_459_000).saturating_mul(v as u64)) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(191_000).saturating_mul(e as u64)) + .saturating_add(RocksDbWeight::get().reads(116)) + .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(v as u64))) + .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(c as u64))) + } + fn election_phragmen_c_e(c: u32, e: u32) -> Weight { + Weight::from_ref_time(5_386_658_000) // Standard Error: 288_000 + .saturating_add(Weight::from_ref_time(7_112_000).saturating_mul(c as u64)) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(151_000).saturating_mul(e as u64)) + .saturating_add(RocksDbWeight::get().reads(798)) + .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(c as u64))) + } + fn election_phragmen_v(v: u32) -> Weight { + Weight::from_ref_time(241_417_000) // Standard Error: 75_000 + .saturating_add(Weight::from_ref_time(6_432_000).saturating_mul(v as u64)) + .saturating_add(RocksDbWeight::get().reads(37)) + .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(v as u64))) + .saturating_add(RocksDbWeight::get().writes(17)) + } } From 455053903db6f305adf7909c7c65371e5cf35b2b Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:13:15 +0900 Subject: [PATCH 05/20] 1.72 --- .github/workflows/basic.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 07b8d2e..eba4a41 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -10,11 +10,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.74 toolchain + - name: Install 1.72 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.74 + toolchain: 1.72 override: true - name: Run cargo check @@ -30,7 +30,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.74 toolchain + - name: Install 1.72 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -53,11 +53,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.74 toolchain + - name: Install 1.72 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.74 + toolchain: 1.72 override: true - name: Run cargo test @@ -73,11 +73,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.74 toolchain + - name: Install 1.72 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.74 + toolchain: 1.72 override: true components: rustfmt, clippy From 8b62ad141197778768ff9f15d602a6c011d26b7a Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:15:19 +0900 Subject: [PATCH 06/20] Back to `stable` --- .github/workflows/basic.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index eba4a41..69ade9d 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -10,11 +10,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.72 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.72 + toolchain: stable override: true - name: Run cargo check @@ -30,7 +30,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.72 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -53,11 +53,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.72 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.72 + toolchain: stable override: true - name: Run cargo test @@ -73,11 +73,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.72 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.72 + toolchain: stable override: true components: rustfmt, clippy From 4d772ba4259b59b17017009b09c5fb962c506c67 Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:16:53 +0900 Subject: [PATCH 07/20] 1.76 --- .github/workflows/basic.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 69ade9d..693809e 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -10,11 +10,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.76 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.76 override: true - name: Run cargo check @@ -30,7 +30,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.76 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -53,11 +53,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.76 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.76 override: true - name: Run cargo test @@ -73,11 +73,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install 1.76 toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.76 override: true components: rustfmt, clippy From 0cd08ad13189c5a3c07d52a649b5885f2f3d472d Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:23:05 +0900 Subject: [PATCH 08/20] Restore `Cargo.lock` --- .github/workflows/basic.yml | 14 +- .gitignore | 1 - Cargo.lock | 3882 +++++++++++++++++++++++++++++++++++ 3 files changed, 3889 insertions(+), 8 deletions(-) create mode 100644 Cargo.lock diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 693809e..69ade9d 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -10,11 +10,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.76 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.76 + toolchain: stable override: true - name: Run cargo check @@ -30,7 +30,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.76 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -53,11 +53,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.76 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.76 + toolchain: stable override: true - name: Run cargo test @@ -73,11 +73,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Install 1.76 toolchain + - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.76 + toolchain: stable override: true components: rustfmt, clippy diff --git a/.gitignore b/.gitignore index 4fffb2f..ea8c4bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /target -/Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..921acf0 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3882 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.9", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "aho-corasick" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "async-trait" +version = "0.1.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +dependencies = [ + "arrayvec 0.4.12", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "bstr" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-expr" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +dependencies = [ + "iana-time-zone", + "num-integer", + "num-traits", + "winapi", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "const-oid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.7", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.7", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array 0.14.7", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" +dependencies = [ + "byteorder", + "digest 0.8.1", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "cxx" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn 2.0.50", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "der" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +dependencies = [ + "const-oid", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "digest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "dock-price-feed" +version = "0.2.1" +dependencies = [ + "frame-support", + "frame-system", + "hex", + "pallet-balances", + "pallet-timestamp", + "parity-scale-codec", + "price-provider", + "scale-info", + "serde", + "sp-api", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "dock-price-feed-rpc" +version = "0.2.1" +dependencies = [ + "dock-price-feed", + "jsonrpsee", + "parity-scale-codec", + "serde", + "sp-api", + "sp-blockchain", + "sp-rpc", + "sp-runtime", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dyn-clone" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" + +[[package]] +name = "ecdsa" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" + +[[package]] +name = "elliptic-curve" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +dependencies = [ + "base16ct", + "crypto-bigint", + "der", + "ff", + "generic-array 0.14.7", + "group", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "ff" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "frame-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-support", + "frame-system", + "linregress", + "log", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", + "sp-storage", +] + +[[package]] +name = "frame-election-provider-solution-type" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "frame-election-provider-support" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-election-provider-solution-type", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-npos-elections", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "frame-metadata" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "frame-support" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "bitflags", + "frame-metadata", + "frame-support-procedural", + "impl-trait-for-tuples", + "k256", + "log", + "once_cell", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "smallvec", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-core-hashing-proc-macro", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-state-machine", + "sp-std", + "sp-tracing", + "tt-call", +] + +[[package]] +name = "frame-support-procedural" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "Inflector", + "cfg-expr", + "frame-support-procedural-tools", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-support-procedural-tools-derive", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "frame-system" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-support", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-version", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" + +[[package]] +name = "globset" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +dependencies = [ + "aho-corasick 0.7.20", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "group" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.7", + "hmac 0.8.1", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-serde" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" + +[[package]] +name = "js-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonrpsee" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bd0d559d5e679b1ab2f869b486a11182923863b1b3ee8b421763cdd707b783a" +dependencies = [ + "jsonrpsee-core", + "jsonrpsee-http-server", + "jsonrpsee-proc-macros", + "jsonrpsee-types", + "jsonrpsee-ws-server", + "tracing", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" +dependencies = [ + "anyhow", + "arrayvec 0.7.2", + "async-trait", + "beef", + "futures-channel", + "futures-util", + "globset", + "http", + "hyper", + "jsonrpsee-types", + "lazy_static", + "parking_lot", + "rand 0.8.5", + "rustc-hash", + "serde", + "serde_json", + "soketto", + "thiserror", + "tokio", + "tracing", + "unicase", +] + +[[package]] +name = "jsonrpsee-http-server" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03802f0373a38c2420c70b5144742d800b509e2937edc4afb116434f07120117" +dependencies = [ + "futures-channel", + "futures-util", + "hyper", + "jsonrpsee-core", + "jsonrpsee-types", + "serde", + "serde_json", + "tokio", + "tracing", + "tracing-futures", +] + +[[package]] +name = "jsonrpsee-proc-macros" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd67957d4280217247588ac86614ead007b301ca2fa9f19c19f880a536f029e3" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e290bba767401b646812f608c099b922d8142603c9e73a50fb192d3ac86f4a0d" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "jsonrpsee-ws-server" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d488ba74fb369e5ab68926feb75a483458b88e768d44319f37e4ecad283c7325" +dependencies = [ + "futures-channel", + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "serde_json", + "soketto", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", + "tracing-futures", +] + +[[package]] +name = "k256" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sec1", +] + +[[package]] +name = "keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kvdb" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" +dependencies = [ + "parity-util-mem", + "smallvec", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.142" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" + +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.8.5", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + +[[package]] +name = "linregress" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" +dependencies = [ + "nalgebra", + "statrs", +] + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matrixmultiply" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcce854c9e76cfd191182c280eb5460cb8efd2cb4e58a1fd56bc41102d7e5802" +dependencies = [ + "autocfg", + "rawpointer", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memory-db" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +dependencies = [ + "hash-db", + "hashbrown", + "parity-util-mem", +] + +[[package]] +name = "memory_units" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" + +[[package]] +name = "merlin" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", +] + +[[package]] +name = "nalgebra" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" +dependencies = [ + "approx", + "matrixmultiply", + "nalgebra-macros", + "num-complex", + "num-rational 0.4.1", + "num-traits", + "rand 0.8.5", + "rand_distr", + "simba", + "typenum", +] + +[[package]] +name = "nalgebra-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec 0.7.2", + "itoa", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "pallet-authorship" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-authorship", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-bags-list" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", +] + +[[package]] +name = "pallet-balances" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-collective" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-democracy" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "hex-literal", + "pallet-balances", + "pallet-scheduler", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-elections-phragmen" +version = "5.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-std", + "sp-tracing", + "substrate-test-utils", +] + +[[package]] +name = "pallet-scheduler" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-session" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-trie", +] + +[[package]] +name = "pallet-staking" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-bags-list", + "pallet-balances", + "pallet-session", + "pallet-staking-reward-curve", + "pallet-timestamp", + "parity-scale-codec", + "rand_chacha 0.2.2", + "scale-info", + "serde", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-staking", + "sp-std", + "sp-tracing", + "substrate-test-utils", +] + +[[package]] +name = "pallet-staking-reward-curve" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pallet-timestamp" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-inherents", + "sp-runtime", + "sp-std", + "sp-timestamp", +] + +[[package]] +name = "parity-scale-codec" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" +dependencies = [ + "arrayvec 0.7.2", + "bitvec", + "byte-slice-cast", + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parity-util-mem" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +dependencies = [ + "cfg-if", + "hashbrown", + "impl-trait-for-tuples", + "parity-util-mem-derive", + "parking_lot", + "primitive-types", + "winapi", +] + +[[package]] +name = "parity-util-mem-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" +dependencies = [ + "proc-macro2", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "parity-wasm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.45.0", +] + +[[package]] +name = "paste" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac 0.8.0", +] + +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac 0.11.1", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "price-provider" +version = "0.4.1" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "utils", +] + +[[package]] +name = "primitive-types" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.9", +] + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "regex" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +dependencies = [ + "aho-corasick 1.0.1", + "memchr", + "regex-syntax 0.7.1", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" + +[[package]] +name = "rfc6979" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +dependencies = [ + "crypto-bigint", + "hmac 0.11.0", + "zeroize", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "ryu" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" + +[[package]] +name = "scale-info" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfdef77228a4c05dc94211441595746732131ad7f6530c6c18f045da7b7ab937" +dependencies = [ + "bitvec", + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.3", + "getrandom 0.1.16", + "merlin", + "rand 0.7.3", + "rand_core 0.5.1", + "sha2 0.8.2", + "subtle", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "scratch" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" + +[[package]] +name = "sec1" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +dependencies = [ + "der", + "generic-array 0.14.7", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +dependencies = [ + "cc", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "serde" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "serde_json" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + +[[package]] +name = "sha3" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54c2bb1a323307527314a36bfb73f24febb08ce2b8a554bf4ffd6f51ad15198c" +dependencies = [ + "digest 0.10.6", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signature" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +dependencies = [ + "digest 0.9.0", + "rand_core 0.6.4", +] + +[[package]] +name = "simba" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", +] + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64", + "bytes", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", +] + +[[package]] +name = "sp-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "sp-api-proc-macro", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-api-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "blake2", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "sp-application-crypto" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-arithmetic" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-debug-derive", + "sp-std", + "static_assertions", +] + +[[package]] +name = "sp-authorship" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "async-trait", + "parity-scale-codec", + "sp-inherents", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-blockchain" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "futures", + "log", + "lru", + "parity-scale-codec", + "parking_lot", + "sp-api", + "sp-consensus", + "sp-database", + "sp-runtime", + "sp-state-machine", + "thiserror", +] + +[[package]] +name = "sp-consensus" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-core" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "base58", + "bitflags", + "blake2-rfc", + "byteorder", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "hex", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot", + "primitive-types", + "rand 0.7.3", + "regex", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-core-hashing", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "wasmi", + "zeroize", +] + +[[package]] +name = "sp-core-hashing" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "proc-macro2", + "quote", + "sp-core-hashing", + "syn 1.0.109", +] + +[[package]] +name = "sp-database" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "kvdb", + "parking_lot", +] + +[[package]] +name = "sp-debug-derive" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "sp-externalities" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-inherents" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-core", + "sp-runtime", + "sp-std", + "thiserror", +] + +[[package]] +name = "sp-io" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "bytes", + "futures", + "hash-db", + "libsecp256k1", + "log", + "parity-scale-codec", + "parking_lot", + "secp256k1", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", + "sp-wasm-interface", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keystore" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "async-trait", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot", + "schnorrkel", + "sp-core", + "sp-externalities", + "thiserror", +] + +[[package]] +name = "sp-npos-elections" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-panic-handler" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + +[[package]] +name = "sp-rpc" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "rustc-hash", + "serde", + "sp-core", +] + +[[package]] +name = "sp-runtime" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "parity-util-mem", + "paste", + "rand 0.7.3", + "scale-info", + "serde", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-runtime-interface" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "sp-session" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "sp-staking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-state-machine" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "hash-db", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot", + "rand 0.7.3", + "smallvec", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-std", + "sp-trie", + "thiserror", + "tracing", + "trie-root", +] + +[[package]] +name = "sp-std" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" + +[[package]] +name = "sp-storage" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-timestamp" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "async-trait", + "futures-timer", + "log", + "parity-scale-codec", + "sp-api", + "sp-inherents", + "sp-runtime", + "sp-std", + "thiserror", +] + +[[package]] +name = "sp-tracing" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "parity-scale-codec", + "sp-std", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-trie" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "ahash", + "hash-db", + "hashbrown", + "lazy_static", + "lru", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "scale-info", + "sp-core", + "sp-std", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-version" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-core-hashing-proc-macro", + "sp-runtime", + "sp-std", + "sp-version-proc-macro", + "thiserror", +] + +[[package]] +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "sp-wasm-interface" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std", + "wasmi", +] + +[[package]] +name = "ss58-registry" +version = "1.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "statrs" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" +dependencies = [ + "approx", + "lazy_static", + "nalgebra", + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "substrate-bip39" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" +dependencies = [ + "hmac 0.11.0", + "pbkdf2 0.8.0", + "schnorrkel", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "substrate-test-utils" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "futures", + "substrate-test-utils-derive", + "tokio", +] + +[[package]] +name = "substrate-test-utils-derive" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" +dependencies = [ + "autocfg", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" + +[[package]] +name = "toml_edit" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "trie-db" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" +dependencies = [ + "hash-db", + "hashbrown", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-root" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" +dependencies = [ + "hash-db", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tt-call" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "digest 0.10.6", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "utils" +version = "0.4.0" +dependencies = [ + "frame-support", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "serde_json", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 1.0.109", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" + +[[package]] +name = "wasmi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +dependencies = [ + "downcast-rs", + "libc", + "memory_units", + "num-rational 0.2.4", + "num-traits", + "parity-wasm", + "wasmi-validation", +] + +[[package]] +name = "wasmi-validation" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69af645a61644c6dd379ade8b77cc87efb5393c988707bad12d3c8e00c50f669" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] From 4f2cb506d22e314842ce371468514c3c6b3a5914 Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 18:25:36 +0900 Subject: [PATCH 09/20] `assert` --- substrate/frame/elections-phragmen/src/benchmarking.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/substrate/frame/elections-phragmen/src/benchmarking.rs b/substrate/frame/elections-phragmen/src/benchmarking.rs index 51418e1..77e19bb 100644 --- a/substrate/frame/elections-phragmen/src/benchmarking.rs +++ b/substrate/frame/elections-phragmen/src/benchmarking.rs @@ -291,7 +291,7 @@ benchmarks! { }: _(T::CandidatesApproverOrigin::successful_origin(), candidacy.clone()) verify { - ApprovedCandidates::::get(&candidacy).is_some() + assert!(ApprovedCandidates::::get(&candidacy).is_some()); } disapprove_candidacy { @@ -301,7 +301,7 @@ benchmarks! { }: _(T::CandidatesApproverOrigin::successful_origin(), candidacy.clone()) verify { - ApprovedCandidates::::get(&candidacy).is_none() + assert!(ApprovedCandidates::::get(&candidacy).is_none()); } renounce_candidacy_candidate { From eecb1119822ac6e2567706f4fdec9a5e6c6e5a0a Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 20:54:35 +0900 Subject: [PATCH 10/20] Doc tweaks --- libs/price-provider/Cargo.toml | 8 ++------ libs/price-provider/src/currency_pair.rs | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libs/price-provider/Cargo.toml b/libs/price-provider/Cargo.toml index 7ba69e0..fd3dbad 100644 --- a/libs/price-provider/Cargo.toml +++ b/libs/price-provider/Cargo.toml @@ -6,12 +6,8 @@ edition = "2021" [dependencies] utils = { package = "utils", path = "../utils", default-features = false } -codec = { package = "parity-scale-codec", version = "3.0.0", features = [ - "derive", -], default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { version = "1.0", features = ["derive"], optional = true } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } diff --git a/libs/price-provider/src/currency_pair.rs b/libs/price-provider/src/currency_pair.rs index cea7cb9..1181a0c 100644 --- a/libs/price-provider/src/currency_pair.rs +++ b/libs/price-provider/src/currency_pair.rs @@ -96,12 +96,12 @@ impl CurrencySymbolPair { } impl CurrencySymbolPair { - /// Maps given currency pair over `from`/`to` members and attempts to create a new `CurrencySymbolPair`. + /// Maps given currency pair over `from`/`to` members and creates a new `CurrencySymbolPair`. pub fn map_pair R>(self, mut map: F) -> CurrencySymbolPair { self.map_over_from(&mut map).map_over_to(map) } - /// Maps given currency pair over `from`/`to` members and attempts to create a new `CurrencySymbolPair`. + /// Translates given currency pair over `from`/`to` members and attempts to create a new `CurrencySymbolPair`. pub fn translate_pair Result>( self, mut translate: F, From 25a38b51ff76b37fece4ebc4c7881503782ecd44 Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 10 Apr 2024 21:19:53 +0900 Subject: [PATCH 11/20] Several tweaks for currency pair --- libs/price-provider/src/currency_pair.rs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/libs/price-provider/src/currency_pair.rs b/libs/price-provider/src/currency_pair.rs index 1181a0c..8a35242 100644 --- a/libs/price-provider/src/currency_pair.rs +++ b/libs/price-provider/src/currency_pair.rs @@ -118,13 +118,10 @@ impl, - ) -> Result { - let bounded_from = BoundedString::new(from)?; - let bounded_to = BoundedString::new(to)?; - - Ok(Self(CurrencySymbolPair::from((bounded_from, bounded_to)))) + fn try_from(pair: CurrencySymbolPair) -> Result { + pair.translate_over_from(BoundedString::new)? + .translate_over_to(BoundedString::new) + .map(Self) } } @@ -177,14 +174,9 @@ where MaxSymBytesLen: Get, { fn from( - BoundedCurrencySymbolPair(currency_pair): BoundedCurrencySymbolPair< - FromTy, - To, - MaxSymBytesLen, - >, + BoundedCurrencySymbolPair(pair): BoundedCurrencySymbolPair, ) -> Self { - currency_pair - .map_over_from(BoundedString::into_inner) + pair.map_over_from(BoundedString::into_inner) .map_over_to(BoundedString::into_inner) } } From ec2fe5552d1757ef4281bd647ecfb57c790ce303 Mon Sep 17 00:00:00 2001 From: olegnn Date: Fri, 12 Apr 2024 23:12:08 +0900 Subject: [PATCH 12/20] Add trait and modify pallet to check candidate's identity --- Cargo.lock | 4 +- libs/utils/Cargo.toml | 4 +- libs/utils/src/identity_provider.rs | 21 +++ libs/utils/src/lib.rs | 2 + substrate/frame/elections-phragmen/Cargo.toml | 2 + .../elections-phragmen/src/benchmarking.rs | 24 +-- substrate/frame/elections-phragmen/src/lib.rs | 174 +++++++++--------- 7 files changed, 119 insertions(+), 112 deletions(-) create mode 100644 libs/utils/src/identity_provider.rs diff --git a/Cargo.lock b/Cargo.lock index 921acf0..cd3676b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1835,6 +1835,7 @@ dependencies = [ "sp-std", "sp-tracing", "substrate-test-utils", + "utils", ] [[package]] @@ -3546,9 +3547,10 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "utils" -version = "0.4.0" +version = "0.5.0" dependencies = [ "frame-support", + "frame-system", "num-traits", "parity-scale-codec", "scale-info", diff --git a/libs/utils/Cargo.toml b/libs/utils/Cargo.toml index e01dbd4..bce32ca 100644 --- a/libs/utils/Cargo.toml +++ b/libs/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "utils" -version = "0.4.0" +version = "0.5.0" authors = ["Dock.io"] edition = "2021" @@ -16,6 +16,7 @@ serde = { version = "1.0", features = ["derive"], optional = true } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } [features] @@ -28,6 +29,7 @@ std = [ "sp-std/std", "scale-info/std", "frame-support/std", + "frame-system/std", "num-traits/std", ] diff --git a/libs/utils/src/identity_provider.rs b/libs/utils/src/identity_provider.rs new file mode 100644 index 0000000..22a7bad --- /dev/null +++ b/libs/utils/src/identity_provider.rs @@ -0,0 +1,21 @@ +use sp_runtime::DispatchResult; + +/// Provides methods to work with an account's identity. +pub trait IdentityProvider { + /// Stored account's identity. + type Identity: Default; + + /// Returns identity for the supplied account [if it exists]. + fn identity(who: &T::AccountId) -> Option; + + /// Returns `true` if the supplied account has an identity. + fn has_identity(who: &T::AccountId) -> bool { + Self::identity(who).is_some() + } + + /// Attempts to set identity for the account. + fn set_identity(account: T::AccountId, identity: Self::Identity) -> DispatchResult; + + /// Attempts to remove identity of the account. + fn remove_identity(account: &T::AccountId) -> DispatchResult; +} diff --git a/libs/utils/src/lib.rs b/libs/utils/src/lib.rs index 7cf0981..72072cb 100644 --- a/libs/utils/src/lib.rs +++ b/libs/utils/src/lib.rs @@ -5,6 +5,8 @@ extern crate alloc; pub mod bounded_string; pub mod div_ceil; +pub mod identity_provider; pub use bounded_string::*; pub use div_ceil::*; +pub use identity_provider::*; diff --git a/substrate/frame/elections-phragmen/Cargo.toml b/substrate/frame/elections-phragmen/Cargo.toml index 5915572..94b9c4d 100644 --- a/substrate/frame/elections-phragmen/Cargo.toml +++ b/substrate/frame/elections-phragmen/Cargo.toml @@ -26,6 +26,7 @@ sp-io = { version = "6.0.0", default-features = false, git = "https://github.co sp-npos-elections = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +utils = { package = "utils", path = "../../../libs/utils", default-features = false } [dev-dependencies] pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } @@ -46,6 +47,7 @@ std = [ "sp-npos-elections/std", "sp-runtime/std", "sp-std/std", + "utils/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/elections-phragmen/src/benchmarking.rs b/substrate/frame/elections-phragmen/src/benchmarking.rs index 77e19bb..0ea6b83 100644 --- a/substrate/frame/elections-phragmen/src/benchmarking.rs +++ b/substrate/frame/elections-phragmen/src/benchmarking.rs @@ -65,10 +65,7 @@ fn candidate_count() -> u32 { } fn approve(account: &T::AccountId) -> DispatchResult { - Elections::::approve_candidacy( - T::CandidatesApproverOrigin::successful_origin(), - account.clone(), - ) + T::CandidacyVerifier::set_identity(account.clone(), Default::default()) } /// Add `c` new candidates. @@ -285,25 +282,6 @@ benchmarks! { } } - approve_candidacy { - clean::(); - let candidacy = endowed_account::("approved_candidacy", 0); - - }: _(T::CandidatesApproverOrigin::successful_origin(), candidacy.clone()) - verify { - assert!(ApprovedCandidates::::get(&candidacy).is_some()); - } - - disapprove_candidacy { - clean::(); - let candidacy = endowed_account::("approved_candidacy", 0); - assert_ok!(approve::(&candidacy)); - - }: _(T::CandidatesApproverOrigin::successful_origin(), candidacy.clone()) - verify { - assert!(ApprovedCandidates::::get(&candidacy).is_none()); - } - renounce_candidacy_candidate { // this will check members, runners-up and candidate for removal. Members and runners-up are // limited by the runtime bound, nonetheless we fill them by `m`. diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 3ef1dbe..1c65646 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -114,6 +114,7 @@ use sp_runtime::{ DispatchError, Perbill, RuntimeDebug, }; use sp_std::{cmp::Ordering, prelude::*}; +use utils::IdentityProvider; mod benchmarking; pub mod weights; @@ -201,7 +202,7 @@ type AccountIdLookupOf = <::Lookup as StaticLookup pub mod pallet { use super::*; use frame_support::{ - pallet_prelude::{OptionQuery, StorageMap, ValueQuery, *}, + pallet_prelude::{StorageMap, ValueQuery, *}, Twox64Concat, }; use frame_system::pallet_prelude::*; @@ -294,8 +295,8 @@ pub mod pallet { /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; - /// An origin that can approve candidates. - type CandidatesApproverOrigin: EnsureOrigin; + /// Verifies account submitted as a candidate. + type CandidacyVerifier: IdentityProvider; } #[pallet::hooks] @@ -465,8 +466,8 @@ pub mod pallet { let who = ensure_signed(origin)?; ensure!( - ApprovedCandidates::::contains_key(&who), - Error::::CandidacyMustBeApproved + T::CandidacyVerifier::has_identity(&who), + Error::::CandidateMustHaveVerifiedIdentity ); let actual_count = >::decode_len().unwrap_or(0) as u32; @@ -634,36 +635,6 @@ pub mod pallet { Ok(()) } - - /// Approves supplied candidacy. This method must be called before a new candidate will call `submit_candidacy`. - #[pallet::weight(T::WeightInfo::approve_candidacy())] - pub fn approve_candidacy(origin: OriginFor, candidacy: T::AccountId) -> DispatchResult { - T::CandidatesApproverOrigin::ensure_origin(origin)?; - - ensure!( - !ApprovedCandidates::::contains_key(&candidacy), - Error::::CandidacyIsAlreadyApproved - ); - ApprovedCandidates::::insert(candidacy, ()); - - Ok(()) - } - - /// Removes an approval for the supplied candidacy. - #[pallet::weight(T::WeightInfo::disapprove_candidacy())] - pub fn disapprove_candidacy( - origin: OriginFor, - candidacy: T::AccountId, - ) -> DispatchResult { - T::CandidatesApproverOrigin::ensure_origin(origin)?; - - ensure!( - ApprovedCandidates::::take(candidacy).is_some(), - Error::::CandidacyIsNotApproved - ); - - Ok(()) - } } #[pallet::event] @@ -742,12 +713,8 @@ pub mod pallet { InvalidRenouncing, /// Prediction regarding replacement after member removal is wrong. InvalidReplacement, - /// Supplied candidacy is already approved. - CandidacyIsAlreadyApproved, - /// Supplied candidacy isn't approved. - CandidacyIsNotApproved, - /// Before submitting a candidacy, make sure it was approved. - CandidacyMustBeApproved, + /// Supplied candidacy must have an identity verified. + CandidateMustHaveVerifiedIdentity, } /// The current elected members. @@ -791,14 +758,6 @@ pub mod pallet { pub type Voting = StorageMap<_, Twox64Concat, T::AccountId, Voter>, ValueQuery>; - /// Map containing approved candidates. - /// - /// TWOX-NOTE: SAFE as `AccountId` is a crypto hash. - #[pallet::storage] - #[pallet::getter(fn approved_candidates)] - pub type ApprovedCandidates = - StorageMap<_, Twox64Concat, T::AccountId, (), OptionQuery>; - #[pallet::storage] #[pallet::getter(fn version)] pub type Version = StorageValue<_, PalletStorageVersion, ValueQuery>; @@ -1345,20 +1304,25 @@ impl ContainsLengthBound for Pallet { #[cfg(test)] mod tests { + use core::marker::PhantomData; + use super::*; use crate as elections_phragmen; use frame_support::{ assert_noop, assert_ok, dispatch::DispatchResultWithPostInfo, - ord_parameter_types, parameter_types, + ensure, ord_parameter_types, + pallet_prelude::{OptionQuery, ValueQuery}, + parameter_types, storage_alias, traits::{ConstU32, ConstU64, OnInitialize}, + Twox64Concat, }; - use frame_system::{ensure_signed, EnsureSignedBy, RawOrigin}; + use frame_system::{ensure_signed, RawOrigin}; use sp_core::H256; use sp_runtime::{ testing::Header, traits::{BadOrigin, BlakeTwo256, IdentityLookup}, - BuildStorage, + BuildStorage, DispatchResult, }; use substrate_test_utils::assert_eq_uvec; @@ -1472,22 +1436,74 @@ mod tests { } - ord_parameter_types! { - pub const CandidacyApprover: u64 = 10; + type AccountId = ::AccountId; + + #[derive(Copy, Clone, Default, Debug)] + pub struct CandidacyVerifier(PhantomData); + + #[derive(Copy, Clone, Debug, PartialEq, Eq)] + enum ApprovalError { + CandidateIsAlreadyApproved, + CandidateIsNotApproved, + } + + impl From for DispatchError { + fn from(error: ApprovalError) -> Self { + match error { + ApprovalError::CandidateIsAlreadyApproved => { + DispatchError::Other("Candidate is already approved") + } + ApprovalError::CandidateIsNotApproved => { + DispatchError::Other("Candidate is not approved") + } + } + } } - impl CandidacyApprover { - fn signed() -> Origin { - Origin::signed(Self::get()) + impl CandidacyVerifier {} + + impl IdentityProvider for CandidacyVerifier { + type Identity = (); + + fn identity(account: &AccountId) -> Option { + ValidCandidates::::get(account) + } + + fn set_identity(account: AccountId, identity: ()) -> DispatchResult { + ensure!( + !ValidCandidates::::contains_key(account), + ApprovalError::CandidateIsAlreadyApproved + ); + ValidCandidates::::insert(account, ()); + + Ok(()) + } + + fn remove_identity(account: &AccountId) -> DispatchResult { + ensure!( + ValidCandidates::::take(account).is_some(), + ApprovalError::CandidateIsNotApproved + ); + + Ok(()) } } + #[storage_alias] + pub type ValidCandidates = StorageMap< + Pallet, + Twox64Concat, + ::AccountId, + (), + OptionQuery, + >; + impl Config for Test { type CandidacyDelay = CandidacyDelay; type PalletId = ElectionsPhragmenPalletId; type Event = Event; type Currency = Balances; - type CandidatesApproverOrigin = EnsureSignedBy; + type CandidacyVerifier = CandidacyVerifier; type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote; type ChangeMembers = TestChangeMembers; type InitializeMembers = (); @@ -1713,7 +1729,7 @@ mod tests { RawOrigin::Signed(acc) => Some(acc), _ => None, }) { - Elections::approve_candidacy(Origin::signed(10), account) + CandidacyVerifier::::set_identity(account, ()).map_err(Into::into) } else { Err(BadOrigin.into()) } @@ -1743,50 +1759,34 @@ mod tests { #[test] fn candidacy_approval_works() { ExtBuilder::default().build_and_execute(|| { - assert!(Elections::approved_candidates(2).is_none()); - assert_noop!( - Elections::approve_candidacy(Origin::signed(1), 2), - DispatchError::BadOrigin - ); - assert_noop!( - Elections::approve_candidacy(Origin::signed(2), 2), - DispatchError::BadOrigin - ); - assert_noop!( - Elections::approve_candidacy(Origin::root(), 2), - DispatchError::BadOrigin - ); - assert!(Elections::approved_candidates(2).is_none()); + assert!(!CandidacyVerifier::has_identity(&2)); + assert!(!CandidacyVerifier::has_identity(&3)); assert_noop!( Elections::submit_candidacy(Origin::signed(2), 1), - Error::::CandidacyMustBeApproved + Error::::CandidateMustHaveVerifiedIdentity ); assert_noop!( Elections::submit_candidacy(Origin::signed(3), 1), - Error::::CandidacyMustBeApproved + Error::::CandidateMustHaveVerifiedIdentity ); - assert_ok!(Elections::approve_candidacy(CandidacyApprover::signed(), 2)); - assert!(Elections::approved_candidates(2).is_some()); - assert_ok!(Elections::approve_candidacy(CandidacyApprover::signed(), 3)); - assert!(Elections::approved_candidates(3).is_some()); - + assert_ok!(CandidacyVerifier::set_identity(2, ())); + assert!(CandidacyVerifier::has_identity(&2)); assert_ok!(Elections::submit_candidacy(Origin::signed(2), 1),); - assert_ok!(Elections::disapprove_candidacy( - CandidacyApprover::signed(), - 3 - )); + assert_ok!(CandidacyVerifier::set_identity(3, ())); + assert!(CandidacyVerifier::has_identity(&3)); + assert_ok!(CandidacyVerifier::remove_identity(&3)); assert_noop!( Elections::submit_candidacy(Origin::signed(3), 1), - Error::::CandidacyMustBeApproved + Error::::CandidateMustHaveVerifiedIdentity ); assert_noop!( - Elections::disapprove_candidacy(CandidacyApprover::signed(), 3), - Error::::CandidacyIsNotApproved + CandidacyVerifier::remove_identity(&3), + ApprovalError::CandidateIsNotApproved ); }) } From 7a4cc5a8165c066a5f106806d822a02dc6da3d22 Mon Sep 17 00:00:00 2001 From: olegnn Date: Fri, 12 Apr 2024 23:42:40 +0900 Subject: [PATCH 13/20] Simplifications --- .../elections-phragmen/src/benchmarking.rs | 8 +-- substrate/frame/elections-phragmen/src/lib.rs | 63 +++++++------------ 2 files changed, 25 insertions(+), 46 deletions(-) diff --git a/substrate/frame/elections-phragmen/src/benchmarking.rs b/substrate/frame/elections-phragmen/src/benchmarking.rs index 0ea6b83..7091e9d 100644 --- a/substrate/frame/elections-phragmen/src/benchmarking.rs +++ b/substrate/frame/elections-phragmen/src/benchmarking.rs @@ -22,11 +22,7 @@ use super::*; use frame_benchmarking::{account, benchmarks, whitelist, BenchmarkError, BenchmarkResult}; -use frame_support::{ - assert_ok, - dispatch::DispatchResultWithPostInfo, - traits::{EnsureOrigin, OnInitialize}, -}; +use frame_support::{assert_ok, dispatch::DispatchResultWithPostInfo, traits::OnInitialize}; use frame_system::RawOrigin; use sp_runtime::DispatchResult; @@ -65,7 +61,7 @@ fn candidate_count() -> u32 { } fn approve(account: &T::AccountId) -> DispatchResult { - T::CandidacyVerifier::set_identity(account.clone(), Default::default()) + T::CandidateIdentityProvider::set_identity(account.clone(), Default::default()) } /// Add `c` new candidates. diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 1c65646..4d15826 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -296,7 +296,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// Verifies account submitted as a candidate. - type CandidacyVerifier: IdentityProvider; + type CandidateIdentityProvider: IdentityProvider; } #[pallet::hooks] @@ -466,7 +466,7 @@ pub mod pallet { let who = ensure_signed(origin)?; ensure!( - T::CandidacyVerifier::has_identity(&who), + T::CandidateIdentityProvider::has_identity(&who), Error::::CandidateMustHaveVerifiedIdentity ); @@ -1311,8 +1311,8 @@ mod tests { use frame_support::{ assert_noop, assert_ok, dispatch::DispatchResultWithPostInfo, - ensure, ord_parameter_types, - pallet_prelude::{OptionQuery, ValueQuery}, + ensure, + pallet_prelude::OptionQuery, parameter_types, storage_alias, traits::{ConstU32, ConstU64, OnInitialize}, Twox64Concat, @@ -1439,41 +1439,24 @@ mod tests { type AccountId = ::AccountId; #[derive(Copy, Clone, Default, Debug)] - pub struct CandidacyVerifier(PhantomData); + pub struct CandidateIdentityProvider(PhantomData); - #[derive(Copy, Clone, Debug, PartialEq, Eq)] - enum ApprovalError { - CandidateIsAlreadyApproved, - CandidateIsNotApproved, - } + struct IdentityDoestExist; - impl From for DispatchError { - fn from(error: ApprovalError) -> Self { - match error { - ApprovalError::CandidateIsAlreadyApproved => { - DispatchError::Other("Candidate is already approved") - } - ApprovalError::CandidateIsNotApproved => { - DispatchError::Other("Candidate is not approved") - } - } + impl From for DispatchError { + fn from(IdentityDoestExist: IdentityDoestExist) -> Self { + Self::Other("Identity doesnt exist") } } - impl CandidacyVerifier {} - - impl IdentityProvider for CandidacyVerifier { + impl IdentityProvider for CandidateIdentityProvider { type Identity = (); fn identity(account: &AccountId) -> Option { ValidCandidates::::get(account) } - fn set_identity(account: AccountId, identity: ()) -> DispatchResult { - ensure!( - !ValidCandidates::::contains_key(account), - ApprovalError::CandidateIsAlreadyApproved - ); + fn set_identity(account: AccountId, (): ()) -> DispatchResult { ValidCandidates::::insert(account, ()); Ok(()) @@ -1482,7 +1465,7 @@ mod tests { fn remove_identity(account: &AccountId) -> DispatchResult { ensure!( ValidCandidates::::take(account).is_some(), - ApprovalError::CandidateIsNotApproved + IdentityDoestExist ); Ok(()) @@ -1503,7 +1486,7 @@ mod tests { type PalletId = ElectionsPhragmenPalletId; type Event = Event; type Currency = Balances; - type CandidacyVerifier = CandidacyVerifier; + type CandidateIdentityProvider = CandidateIdentityProvider; type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote; type ChangeMembers = TestChangeMembers; type InitializeMembers = (); @@ -1729,7 +1712,7 @@ mod tests { RawOrigin::Signed(acc) => Some(acc), _ => None, }) { - CandidacyVerifier::::set_identity(account, ()).map_err(Into::into) + CandidateIdentityProvider::::set_identity(account, ()).map_err(Into::into) } else { Err(BadOrigin.into()) } @@ -1759,8 +1742,8 @@ mod tests { #[test] fn candidacy_approval_works() { ExtBuilder::default().build_and_execute(|| { - assert!(!CandidacyVerifier::has_identity(&2)); - assert!(!CandidacyVerifier::has_identity(&3)); + assert!(!CandidateIdentityProvider::has_identity(&2)); + assert!(!CandidateIdentityProvider::has_identity(&3)); assert_noop!( Elections::submit_candidacy(Origin::signed(2), 1), @@ -1771,13 +1754,13 @@ mod tests { Error::::CandidateMustHaveVerifiedIdentity ); - assert_ok!(CandidacyVerifier::set_identity(2, ())); - assert!(CandidacyVerifier::has_identity(&2)); + assert_ok!(CandidateIdentityProvider::set_identity(2, ())); + assert!(CandidateIdentityProvider::has_identity(&2)); assert_ok!(Elections::submit_candidacy(Origin::signed(2), 1),); - assert_ok!(CandidacyVerifier::set_identity(3, ())); - assert!(CandidacyVerifier::has_identity(&3)); - assert_ok!(CandidacyVerifier::remove_identity(&3)); + assert_ok!(CandidateIdentityProvider::set_identity(3, ())); + assert!(CandidateIdentityProvider::has_identity(&3)); + assert_ok!(CandidateIdentityProvider::remove_identity(&3)); assert_noop!( Elections::submit_candidacy(Origin::signed(3), 1), @@ -1785,8 +1768,8 @@ mod tests { ); assert_noop!( - CandidacyVerifier::remove_identity(&3), - ApprovalError::CandidateIsNotApproved + CandidateIdentityProvider::remove_identity(&3), + IdentityDoestExist ); }) } From b0a9b03291caccb5ffb42948542122cbd64c65d5 Mon Sep 17 00:00:00 2001 From: olegnn Date: Sat, 13 Apr 2024 00:23:06 +0900 Subject: [PATCH 14/20] `IdentitySetter` --- libs/utils/src/identity_provider.rs | 12 +++++++++--- substrate/frame/elections-phragmen/src/lib.rs | 10 +++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libs/utils/src/identity_provider.rs b/libs/utils/src/identity_provider.rs index 22a7bad..b6f0f94 100644 --- a/libs/utils/src/identity_provider.rs +++ b/libs/utils/src/identity_provider.rs @@ -1,9 +1,9 @@ use sp_runtime::DispatchResult; -/// Provides methods to work with an account's identity. +/// Provides methods to retrieve an account's identity. pub trait IdentityProvider { /// Stored account's identity. - type Identity: Default; + type Identity; /// Returns identity for the supplied account [if it exists]. fn identity(who: &T::AccountId) -> Option; @@ -12,9 +12,15 @@ pub trait IdentityProvider { fn has_identity(who: &T::AccountId) -> bool { Self::identity(who).is_some() } +} + +/// Provides methods to set an account's identity. +pub trait IdentitySetter { + /// Idenity information to be associated with the account. + type IdentityInfo: Default; /// Attempts to set identity for the account. - fn set_identity(account: T::AccountId, identity: Self::Identity) -> DispatchResult; + fn set_identity(account: T::AccountId, identity: Self::IdentityInfo) -> DispatchResult; /// Attempts to remove identity of the account. fn remove_identity(account: &T::AccountId) -> DispatchResult; diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 4d15826..f61ce21 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -114,7 +114,7 @@ use sp_runtime::{ DispatchError, Perbill, RuntimeDebug, }; use sp_std::{cmp::Ordering, prelude::*}; -use utils::IdentityProvider; +use utils::*; mod benchmarking; pub mod weights; @@ -296,7 +296,10 @@ pub mod pallet { type WeightInfo: WeightInfo; /// Verifies account submitted as a candidate. + #[cfg(not(any(test, feature = "runtime-benchmarks")))] type CandidateIdentityProvider: IdentityProvider; + #[cfg(any(test, feature = "runtime-benchmarks"))] + type CandidateIdentityProvider: IdentityProvider + IdentitySetter; } #[pallet::hooks] @@ -1325,6 +1328,7 @@ mod tests { BuildStorage, DispatchResult, }; use substrate_test_utils::assert_eq_uvec; + use utils::IdentitySetter; parameter_types! { pub BlockWeights: frame_system::limits::BlockWeights = @@ -1455,6 +1459,10 @@ mod tests { fn identity(account: &AccountId) -> Option { ValidCandidates::::get(account) } + } + + impl IdentitySetter for CandidateIdentityProvider { + type IdentityInfo = (); fn set_identity(account: AccountId, (): ()) -> DispatchResult { ValidCandidates::::insert(account, ()); From 2721b7b2327e3d563bdec5ffb4ff4a52ded21e87 Mon Sep 17 00:00:00 2001 From: olegnn Date: Sat, 13 Apr 2024 01:07:43 +0900 Subject: [PATCH 15/20] Update weights + tweaks --- .../elections-phragmen/src/benchmarking.rs | 6 +- substrate/frame/elections-phragmen/src/lib.rs | 6 +- .../frame/elections-phragmen/src/weights.rs | 122 ++++++++---------- 3 files changed, 57 insertions(+), 77 deletions(-) diff --git a/substrate/frame/elections-phragmen/src/benchmarking.rs b/substrate/frame/elections-phragmen/src/benchmarking.rs index 7091e9d..2e6ca61 100644 --- a/substrate/frame/elections-phragmen/src/benchmarking.rs +++ b/substrate/frame/elections-phragmen/src/benchmarking.rs @@ -60,7 +60,7 @@ fn candidate_count() -> u32 { >::decode_len().unwrap_or(0usize) as u32 } -fn approve(account: &T::AccountId) -> DispatchResult { +fn init_identity(account: &T::AccountId) -> DispatchResult { T::CandidateIdentityProvider::set_identity(account.clone(), Default::default()) } @@ -72,7 +72,7 @@ fn submit_candidates( (0..c) .map(|i| { let account = endowed_account::(prefix, i); - approve::(&account).map_err(|_| "failed to approve candidacy")?; + init_identity::(&account).map_err(|_| "failed to init_identity candidacy")?; >::submit_candidacy( RawOrigin::Signed(account.clone()).into(), @@ -266,7 +266,7 @@ benchmarks! { // we assume worse case that: extrinsic is successful and candidate is not duplicate. let candidate_account = endowed_account::("caller", 0); - assert_ok!(approve::(&candidate_account)); + assert_ok!(init_identity::(&candidate_account)); whitelist!(candidate_account); }: _(RawOrigin::Signed(candidate_account.clone()), candidate_count::()) verify { diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index f61ce21..ae034c6 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -1715,7 +1715,7 @@ mod tests { ensure_members_has_approval_stake(); } - fn approve_candidacy(origin: Origin) -> sp_runtime::DispatchResult { + fn init_candidate_identity(origin: Origin) -> sp_runtime::DispatchResult { if let Some(account) = Result::from(origin).ok().and_then(|o| match o { RawOrigin::Signed(acc) => Some(acc), _ => None, @@ -1727,7 +1727,7 @@ mod tests { } fn approve_and_submit_candidacy(origin: Origin) -> sp_runtime::DispatchResult { - approve_candidacy(origin.clone())?; + init_candidate_identity(origin.clone())?; submit_candidacy(origin) } @@ -2137,7 +2137,7 @@ mod tests { fn poor_candidate_submission_should_not_work() { ExtBuilder::default().build_and_execute(|| { assert_eq!(candidate_ids(), Vec::::new()); - assert_ok!(approve_candidacy(Origin::signed(7))); + assert_ok!(init_candidate_identity(Origin::signed(7))); assert_noop!( submit_candidacy(Origin::signed(7)), Error::::InsufficientCandidateFunds, diff --git a/substrate/frame/elections-phragmen/src/weights.rs b/substrate/frame/elections-phragmen/src/weights.rs index 509dace..4167696 100644 --- a/substrate/frame/elections-phragmen/src/weights.rs +++ b/substrate/frame/elections-phragmen/src/weights.rs @@ -1,7 +1,7 @@ //! Autogenerated weights for pallet_elections_phragmen //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-04-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-12, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 // Executed Command: @@ -33,8 +33,6 @@ pub trait WeightInfo { fn vote_less(v: u32) -> Weight; fn remove_voter() -> Weight; fn submit_candidacy(c: u32) -> Weight; - fn approve_candidacy() -> Weight; - fn disapprove_candidacy() -> Weight; fn renounce_candidacy_candidate(c: u32) -> Weight; fn renounce_candidacy_members() -> Weight; fn renounce_candidacy_runners_up() -> Weight; @@ -49,20 +47,21 @@ pub trait WeightInfo { /// Weights for pallet_elections_phragmen using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - fn vote_equal(_v: u32) -> Weight { - Weight::from_ref_time(26_184_000) + fn vote_equal(v: u32) -> Weight { + Weight::from_ref_time(24_712_000) // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(78_000).saturating_mul(v as u64)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } fn vote_more(v: u32) -> Weight { - Weight::from_ref_time(31_243_000) // Standard Error: 7_000 - .saturating_add(Weight::from_ref_time(121_000).saturating_mul(v as u64)) + Weight::from_ref_time(31_266_000) // Standard Error: 9_000 + .saturating_add(Weight::from_ref_time(103_000).saturating_mul(v as u64)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } fn vote_less(v: u32) -> Weight { - Weight::from_ref_time(31_556_000) // Standard Error: 9_000 - .saturating_add(Weight::from_ref_time(133_000).saturating_mul(v as u64)) + Weight::from_ref_time(30_689_000) // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(169_000).saturating_mul(v as u64)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -72,34 +71,24 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes(2)) } fn submit_candidacy(c: u32) -> Weight { - Weight::from_ref_time(29_742_000) // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(87_000).saturating_mul(c as u64)) + Weight::from_ref_time(26_966_000) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(179_000).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } - fn approve_candidacy() -> Weight { - Weight::from_ref_time(7_000_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn disapprove_candidacy() -> Weight { - Weight::from_ref_time(7_000_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } fn renounce_candidacy_candidate(c: u32) -> Weight { - Weight::from_ref_time(24_084_000) // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(63_000).saturating_mul(c as u64)) + Weight::from_ref_time(27_349_000) // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(54_000).saturating_mul(c as u64)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } fn renounce_candidacy_members() -> Weight { - Weight::from_ref_time(36_000_000) + Weight::from_ref_time(33_000_000) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } fn renounce_candidacy_runners_up() -> Weight { - Weight::from_ref_time(29_000_000) + Weight::from_ref_time(25_000_000) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,38 +96,38 @@ impl WeightInfo for SubstrateWeight { Weight::from_ref_time(1_000_000_000_000) } fn remove_member_with_replacement() -> Weight { - Weight::from_ref_time(38_000_000) + Weight::from_ref_time(39_000_000) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) } fn clean_defunct_voters(v: u32, _d: u32) -> Weight { - Weight::from_ref_time(303_135_000) // Standard Error: 239_000 - .saturating_add(Weight::from_ref_time(29_141_000).saturating_mul(v as u64)) + Weight::from_ref_time(0) // Standard Error: 231_000 + .saturating_add(Weight::from_ref_time(30_349_000).saturating_mul(v as u64)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(v as u64))) .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(v as u64))) } fn election_phragmen(c: u32, v: u32, e: u32) -> Weight { - Weight::from_ref_time(0) // Standard Error: 275_000 - .saturating_add(Weight::from_ref_time(3_751_000).saturating_mul(c as u64)) // Standard Error: 68_000 - .saturating_add(Weight::from_ref_time(9_459_000).saturating_mul(v as u64)) // Standard Error: 4_000 - .saturating_add(Weight::from_ref_time(191_000).saturating_mul(e as u64)) + Weight::from_ref_time(0) // Standard Error: 305_000 + .saturating_add(Weight::from_ref_time(8_185_000).saturating_mul(c as u64)) // Standard Error: 76_000 + .saturating_add(Weight::from_ref_time(10_602_000).saturating_mul(v as u64)) // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(175_000).saturating_mul(e as u64)) .saturating_add(T::DbWeight::get().reads(116)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64))) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) } fn election_phragmen_c_e(c: u32, e: u32) -> Weight { - Weight::from_ref_time(5_386_658_000) // Standard Error: 288_000 - .saturating_add(Weight::from_ref_time(7_112_000).saturating_mul(c as u64)) // Standard Error: 4_000 - .saturating_add(Weight::from_ref_time(151_000).saturating_mul(e as u64)) + Weight::from_ref_time(5_716_841_000) // Standard Error: 293_000 + .saturating_add(Weight::from_ref_time(7_402_000).saturating_mul(c as u64)) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(159_000).saturating_mul(e as u64)) .saturating_add(T::DbWeight::get().reads(798)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) } fn election_phragmen_v(v: u32) -> Weight { - Weight::from_ref_time(241_417_000) // Standard Error: 75_000 - .saturating_add(Weight::from_ref_time(6_432_000).saturating_mul(v as u64)) + Weight::from_ref_time(222_054_000) // Standard Error: 197_000 + .saturating_add(Weight::from_ref_time(9_600_000).saturating_mul(v as u64)) .saturating_add(T::DbWeight::get().reads(37)) .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64))) .saturating_add(T::DbWeight::get().writes(17)) @@ -147,20 +136,21 @@ impl WeightInfo for SubstrateWeight { // For backwards compatibility and tests impl WeightInfo for () { - fn vote_equal(_v: u32) -> Weight { - Weight::from_ref_time(26_184_000) + fn vote_equal(v: u32) -> Weight { + Weight::from_ref_time(24_712_000) // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(78_000).saturating_mul(v as u64)) .saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().writes(2)) } fn vote_more(v: u32) -> Weight { - Weight::from_ref_time(31_243_000) // Standard Error: 7_000 - .saturating_add(Weight::from_ref_time(121_000).saturating_mul(v as u64)) + Weight::from_ref_time(31_266_000) // Standard Error: 9_000 + .saturating_add(Weight::from_ref_time(103_000).saturating_mul(v as u64)) .saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().writes(2)) } fn vote_less(v: u32) -> Weight { - Weight::from_ref_time(31_556_000) // Standard Error: 9_000 - .saturating_add(Weight::from_ref_time(133_000).saturating_mul(v as u64)) + Weight::from_ref_time(30_689_000) // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(169_000).saturating_mul(v as u64)) .saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().writes(2)) } @@ -170,34 +160,24 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(2)) } fn submit_candidacy(c: u32) -> Weight { - Weight::from_ref_time(29_742_000) // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(87_000).saturating_mul(c as u64)) + Weight::from_ref_time(26_966_000) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(179_000).saturating_mul(c as u64)) .saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().writes(1)) } - fn approve_candidacy() -> Weight { - Weight::from_ref_time(7_000_000) - .saturating_add(RocksDbWeight::get().reads(1)) - .saturating_add(RocksDbWeight::get().writes(1)) - } - fn disapprove_candidacy() -> Weight { - Weight::from_ref_time(7_000_000) - .saturating_add(RocksDbWeight::get().reads(1)) - .saturating_add(RocksDbWeight::get().writes(1)) - } fn renounce_candidacy_candidate(c: u32) -> Weight { - Weight::from_ref_time(24_084_000) // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(63_000).saturating_mul(c as u64)) + Weight::from_ref_time(27_349_000) // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(54_000).saturating_mul(c as u64)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } fn renounce_candidacy_members() -> Weight { - Weight::from_ref_time(36_000_000) + Weight::from_ref_time(33_000_000) .saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().writes(4)) } fn renounce_candidacy_runners_up() -> Weight { - Weight::from_ref_time(29_000_000) + Weight::from_ref_time(25_000_000) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -205,38 +185,38 @@ impl WeightInfo for () { Weight::from_ref_time(1_000_000_000_000) } fn remove_member_with_replacement() -> Weight { - Weight::from_ref_time(38_000_000) + Weight::from_ref_time(39_000_000) .saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().writes(5)) } fn clean_defunct_voters(v: u32, _d: u32) -> Weight { - Weight::from_ref_time(303_135_000) // Standard Error: 239_000 - .saturating_add(Weight::from_ref_time(29_141_000).saturating_mul(v as u64)) + Weight::from_ref_time(0) // Standard Error: 231_000 + .saturating_add(Weight::from_ref_time(30_349_000).saturating_mul(v as u64)) .saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().reads((3 as u64).saturating_mul(v as u64))) .saturating_add(RocksDbWeight::get().writes((3 as u64).saturating_mul(v as u64))) } fn election_phragmen(c: u32, v: u32, e: u32) -> Weight { - Weight::from_ref_time(0) // Standard Error: 275_000 - .saturating_add(Weight::from_ref_time(3_751_000).saturating_mul(c as u64)) // Standard Error: 68_000 - .saturating_add(Weight::from_ref_time(9_459_000).saturating_mul(v as u64)) // Standard Error: 4_000 - .saturating_add(Weight::from_ref_time(191_000).saturating_mul(e as u64)) + Weight::from_ref_time(0) // Standard Error: 305_000 + .saturating_add(Weight::from_ref_time(8_185_000).saturating_mul(c as u64)) // Standard Error: 76_000 + .saturating_add(Weight::from_ref_time(10_602_000).saturating_mul(v as u64)) // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(175_000).saturating_mul(e as u64)) .saturating_add(RocksDbWeight::get().reads(116)) .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(c as u64))) .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(v as u64))) .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(c as u64))) } fn election_phragmen_c_e(c: u32, e: u32) -> Weight { - Weight::from_ref_time(5_386_658_000) // Standard Error: 288_000 - .saturating_add(Weight::from_ref_time(7_112_000).saturating_mul(c as u64)) // Standard Error: 4_000 - .saturating_add(Weight::from_ref_time(151_000).saturating_mul(e as u64)) + Weight::from_ref_time(5_716_841_000) // Standard Error: 293_000 + .saturating_add(Weight::from_ref_time(7_402_000).saturating_mul(c as u64)) // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(159_000).saturating_mul(e as u64)) .saturating_add(RocksDbWeight::get().reads(798)) .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(c as u64))) .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(c as u64))) } fn election_phragmen_v(v: u32) -> Weight { - Weight::from_ref_time(241_417_000) // Standard Error: 75_000 - .saturating_add(Weight::from_ref_time(6_432_000).saturating_mul(v as u64)) + Weight::from_ref_time(222_054_000) // Standard Error: 197_000 + .saturating_add(Weight::from_ref_time(9_600_000).saturating_mul(v as u64)) .saturating_add(RocksDbWeight::get().reads(37)) .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(v as u64))) .saturating_add(RocksDbWeight::get().writes(17)) From 5add9aa149f32bd83ba34e0eb3ed51c3be442875 Mon Sep 17 00:00:00 2001 From: olegnn Date: Sat, 13 Apr 2024 01:09:25 +0900 Subject: [PATCH 16/20] Naming --- substrate/frame/elections-phragmen/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index ae034c6..9c66351 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -1457,7 +1457,7 @@ mod tests { type Identity = (); fn identity(account: &AccountId) -> Option { - ValidCandidates::::get(account) + CandidateIdentities::::get(account) } } @@ -1465,14 +1465,14 @@ mod tests { type IdentityInfo = (); fn set_identity(account: AccountId, (): ()) -> DispatchResult { - ValidCandidates::::insert(account, ()); + CandidateIdentities::::insert(account, ()); Ok(()) } fn remove_identity(account: &AccountId) -> DispatchResult { ensure!( - ValidCandidates::::take(account).is_some(), + CandidateIdentities::::take(account).is_some(), IdentityDoestExist ); @@ -1481,7 +1481,7 @@ mod tests { } #[storage_alias] - pub type ValidCandidates = StorageMap< + pub type CandidateIdentities = StorageMap< Pallet, Twox64Concat, ::AccountId, From 715552be537bb299cac93ebcfb6edba2801c7e26 Mon Sep 17 00:00:00 2001 From: olegnn Date: Thu, 18 Apr 2024 22:35:43 +0900 Subject: [PATCH 17/20] PR tweaks --- Cargo.lock | 100 +++++++++--------- libs/utils/src/identity_provider.rs | 3 + substrate/frame/elections-phragmen/src/lib.rs | 14 ++- 3 files changed, 62 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cd3676b..e51e40b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -688,7 +688,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -711,7 +711,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -722,7 +722,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -750,7 +750,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bitflags", "frame-metadata", @@ -781,7 +781,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "Inflector", "cfg-expr", @@ -795,7 +795,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -807,7 +807,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -817,7 +817,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "log", @@ -1735,7 +1735,7 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -1750,7 +1750,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -1770,7 +1770,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -1841,7 +1841,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -1857,7 +1857,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -1908,7 +1908,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1919,7 +1919,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -2592,7 +2592,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "hash-db", "log", @@ -2610,7 +2610,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "blake2", "proc-macro-crate", @@ -2622,7 +2622,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2635,7 +2635,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "integer-sqrt", "num-traits", @@ -2650,7 +2650,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "parity-scale-codec", @@ -2662,7 +2662,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "log", @@ -2680,7 +2680,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -2699,7 +2699,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "base58", "bitflags", @@ -2745,7 +2745,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "blake2", "byteorder", @@ -2759,7 +2759,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -2770,7 +2770,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "kvdb", "parking_lot", @@ -2779,7 +2779,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "environmental", "parity-scale-codec", @@ -2800,7 +2800,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -2814,7 +2814,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bytes", "futures", @@ -2840,7 +2840,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -2856,7 +2856,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2870,7 +2870,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "backtrace", "lazy_static", @@ -2880,7 +2880,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "rustc-hash", "serde", @@ -2890,7 +2890,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "either", "hash256-std-hasher", @@ -2912,7 +2912,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -2930,7 +2930,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "Inflector", "proc-macro-crate", @@ -2942,7 +2942,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2956,7 +2956,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2967,7 +2967,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "hash-db", "log", @@ -2989,12 +2989,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3007,7 +3007,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures-timer", @@ -3023,7 +3023,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "sp-std", @@ -3035,7 +3035,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ahash", "hash-db", @@ -3058,7 +3058,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3075,7 +3075,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-trait-for-tuples", "log", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "substrate-test-utils-derive", @@ -3155,7 +3155,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/libs/utils/src/identity_provider.rs b/libs/utils/src/identity_provider.rs index b6f0f94..5192506 100644 --- a/libs/utils/src/identity_provider.rs +++ b/libs/utils/src/identity_provider.rs @@ -12,6 +12,9 @@ pub trait IdentityProvider { fn has_identity(who: &T::AccountId) -> bool { Self::identity(who).is_some() } + + /// Returns `true` if the supplied account has a verified identity. + fn has_verified_identity(who: &T::AccountId) -> bool; } /// Provides methods to set an account's identity. diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 9c66351..1c6aeb0 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -469,7 +469,7 @@ pub mod pallet { let who = ensure_signed(origin)?; ensure!( - T::CandidateIdentityProvider::has_identity(&who), + T::CandidateIdentityProvider::has_verified_identity(&who), Error::::CandidateMustHaveVerifiedIdentity ); @@ -1459,6 +1459,10 @@ mod tests { fn identity(account: &AccountId) -> Option { CandidateIdentities::::get(account) } + + fn has_verified_identity(account: &AccountId) -> bool { + Self::has_identity(account) + } } impl IdentitySetter for CandidateIdentityProvider { @@ -1750,8 +1754,8 @@ mod tests { #[test] fn candidacy_approval_works() { ExtBuilder::default().build_and_execute(|| { - assert!(!CandidateIdentityProvider::has_identity(&2)); - assert!(!CandidateIdentityProvider::has_identity(&3)); + assert!(!CandidateIdentityProvider::has_verified_identity(&2)); + assert!(!CandidateIdentityProvider::has_verified_identity(&3)); assert_noop!( Elections::submit_candidacy(Origin::signed(2), 1), @@ -1763,11 +1767,11 @@ mod tests { ); assert_ok!(CandidateIdentityProvider::set_identity(2, ())); - assert!(CandidateIdentityProvider::has_identity(&2)); + assert!(CandidateIdentityProvider::has_verified_identity(&2)); assert_ok!(Elections::submit_candidacy(Origin::signed(2), 1),); assert_ok!(CandidateIdentityProvider::set_identity(3, ())); - assert!(CandidateIdentityProvider::has_identity(&3)); + assert!(CandidateIdentityProvider::has_verified_identity(&3)); assert_ok!(CandidateIdentityProvider::remove_identity(&3)); assert_noop!( From 52f68d65e2b9923c1cb73cfa0de264a64c8d96a4 Mon Sep 17 00:00:00 2001 From: olegnn Date: Thu, 18 Apr 2024 22:37:31 +0900 Subject: [PATCH 18/20] Typo --- Cargo.lock | 100 ++++++++++++++-------------- libs/utils/src/identity_provider.rs | 2 +- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e51e40b..cd3676b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -688,7 +688,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -711,7 +711,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -722,7 +722,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -750,7 +750,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bitflags", "frame-metadata", @@ -781,7 +781,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "Inflector", "cfg-expr", @@ -795,7 +795,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -807,7 +807,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -817,7 +817,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "log", @@ -1735,7 +1735,7 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -1750,7 +1750,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -1770,7 +1770,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -1841,7 +1841,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -1857,7 +1857,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -1908,7 +1908,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1919,7 +1919,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -2592,7 +2592,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "hash-db", "log", @@ -2610,7 +2610,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "blake2", "proc-macro-crate", @@ -2622,7 +2622,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2635,7 +2635,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "integer-sqrt", "num-traits", @@ -2650,7 +2650,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "parity-scale-codec", @@ -2662,7 +2662,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "log", @@ -2680,7 +2680,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -2699,7 +2699,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "base58", "bitflags", @@ -2745,7 +2745,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "blake2", "byteorder", @@ -2759,7 +2759,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -2770,7 +2770,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "kvdb", "parking_lot", @@ -2779,7 +2779,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "environmental", "parity-scale-codec", @@ -2800,7 +2800,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -2814,7 +2814,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bytes", "futures", @@ -2840,7 +2840,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -2856,7 +2856,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2870,7 +2870,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "backtrace", "lazy_static", @@ -2880,7 +2880,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "rustc-hash", "serde", @@ -2890,7 +2890,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "either", "hash256-std-hasher", @@ -2912,7 +2912,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -2930,7 +2930,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "Inflector", "proc-macro-crate", @@ -2942,7 +2942,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2956,7 +2956,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -2967,7 +2967,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "hash-db", "log", @@ -2989,12 +2989,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3007,7 +3007,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures-timer", @@ -3023,7 +3023,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "sp-std", @@ -3035,7 +3035,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ahash", "hash-db", @@ -3058,7 +3058,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3075,7 +3075,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-trait-for-tuples", "log", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "substrate-test-utils-derive", @@ -3155,7 +3155,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/libs/utils/src/identity_provider.rs b/libs/utils/src/identity_provider.rs index 5192506..0f0cd77 100644 --- a/libs/utils/src/identity_provider.rs +++ b/libs/utils/src/identity_provider.rs @@ -19,7 +19,7 @@ pub trait IdentityProvider { /// Provides methods to set an account's identity. pub trait IdentitySetter { - /// Idenity information to be associated with the account. + /// Identity information to be associated with the account. type IdentityInfo: Default; /// Attempts to set identity for the account. From 4244c645750f34067db7826f8863e79e5391bd6e Mon Sep 17 00:00:00 2001 From: Oleg Nosov Date: Mon, 22 Apr 2024 04:51:12 +0000 Subject: [PATCH 19/20] Improve identity traits --- libs/utils/src/identity_provider.rs | 45 +++++++---- .../elections-phragmen/src/benchmarking.rs | 3 +- substrate/frame/elections-phragmen/src/lib.rs | 76 +++++++++++++++---- 3 files changed, 93 insertions(+), 31 deletions(-) diff --git a/libs/utils/src/identity_provider.rs b/libs/utils/src/identity_provider.rs index 0f0cd77..9cdecfe 100644 --- a/libs/utils/src/identity_provider.rs +++ b/libs/utils/src/identity_provider.rs @@ -1,30 +1,45 @@ use sp_runtime::DispatchResult; +/// Identity-related operations. +pub trait Identity { + /// Identity information excluding the verification state. + type Info: Default; + /// Single part of the verification. + type Justification: Default; + + /// Returns `true` if the underlying identity is verified. + fn verified(&self) -> bool; + + /// Returns underlying identity information. + fn info(&self) -> &Self::Info; + + /// Adds justification for the underlying identity. + fn verify(&mut self, justification: Self::Justification); +} + /// Provides methods to retrieve an account's identity. pub trait IdentityProvider { /// Stored account's identity. - type Identity; + type Identity: Identity; /// Returns identity for the supplied account [if it exists]. fn identity(who: &T::AccountId) -> Option; - - /// Returns `true` if the supplied account has an identity. - fn has_identity(who: &T::AccountId) -> bool { - Self::identity(who).is_some() - } - - /// Returns `true` if the supplied account has a verified identity. - fn has_verified_identity(who: &T::AccountId) -> bool; } /// Provides methods to set an account's identity. -pub trait IdentitySetter { - /// Identity information to be associated with the account. - type IdentityInfo: Default; - +pub trait IdentitySetter: IdentityProvider { /// Attempts to set identity for the account. - fn set_identity(account: T::AccountId, identity: Self::IdentityInfo) -> DispatchResult; + fn set_identity( + who: T::AccountId, + identity: ::Info, + ) -> DispatchResult; + + /// Verifies identity for the provided account. + fn verify_identity( + who: &T::AccountId, + justification: ::Justification, + ) -> DispatchResult; /// Attempts to remove identity of the account. - fn remove_identity(account: &T::AccountId) -> DispatchResult; + fn remove_identity(who: &T::AccountId) -> DispatchResult; } diff --git a/substrate/frame/elections-phragmen/src/benchmarking.rs b/substrate/frame/elections-phragmen/src/benchmarking.rs index 2e6ca61..d56f060 100644 --- a/substrate/frame/elections-phragmen/src/benchmarking.rs +++ b/substrate/frame/elections-phragmen/src/benchmarking.rs @@ -61,7 +61,8 @@ fn candidate_count() -> u32 { } fn init_identity(account: &T::AccountId) -> DispatchResult { - T::CandidateIdentityProvider::set_identity(account.clone(), Default::default()) + T::CandidateIdentityProvider::set_identity(account.clone(), Default::default())?; + T::CandidateIdentityProvider::verify_identity(account, Default::default()) } /// Add `c` new candidates. diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 1c6aeb0..34f2882 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -469,7 +469,9 @@ pub mod pallet { let who = ensure_signed(origin)?; ensure!( - T::CandidateIdentityProvider::has_verified_identity(&who), + T::CandidateIdentityProvider::identity(&who) + .as_ref() + .map_or(false, |identity| identity.verified()), Error::::CandidateMustHaveVerifiedIdentity ); @@ -1311,6 +1313,7 @@ mod tests { use super::*; use crate as elections_phragmen; + use codec::MaxEncodedLen; use frame_support::{ assert_noop, assert_ok, dispatch::DispatchResultWithPostInfo, @@ -1453,27 +1456,51 @@ mod tests { } } + #[derive(Encode, Decode, MaxEncodedLen, Clone, Default, Debug)] + pub struct DummyIdentity { + verified: bool, + } + + impl Identity for DummyIdentity { + type Info = (); + type Justification = (); + + fn verified(&self) -> bool { + self.verified + } + + fn info(&self) -> &() { + &() + } + + fn verify(&mut self, (): ()) { + self.verified = true; + } + } + impl IdentityProvider for CandidateIdentityProvider { - type Identity = (); + type Identity = DummyIdentity; fn identity(account: &AccountId) -> Option { CandidateIdentities::::get(account) } - - fn has_verified_identity(account: &AccountId) -> bool { - Self::has_identity(account) - } } impl IdentitySetter for CandidateIdentityProvider { - type IdentityInfo = (); - fn set_identity(account: AccountId, (): ()) -> DispatchResult { - CandidateIdentities::::insert(account, ()); + CandidateIdentities::::insert(account, DummyIdentity::default()); Ok(()) } + fn verify_identity(account: &AccountId, (): ()) -> DispatchResult { + CandidateIdentities::::try_mutate(account, |identity| { + identity.as_mut().ok_or(IdentityDoestExist)?.verified = true; + + Ok(()) + }) + } + fn remove_identity(account: &AccountId) -> DispatchResult { ensure!( CandidateIdentities::::take(account).is_some(), @@ -1489,7 +1516,7 @@ mod tests { Pallet, Twox64Concat, ::AccountId, - (), + DummyIdentity, OptionQuery, >; @@ -1724,7 +1751,10 @@ mod tests { RawOrigin::Signed(acc) => Some(acc), _ => None, }) { - CandidateIdentityProvider::::set_identity(account, ()).map_err(Into::into) + CandidateIdentityProvider::::set_identity(account, ())?; + CandidateIdentityProvider::::verify_identity(&account, ())?; + + Ok(()) } else { Err(BadOrigin.into()) } @@ -1754,8 +1784,12 @@ mod tests { #[test] fn candidacy_approval_works() { ExtBuilder::default().build_and_execute(|| { - assert!(!CandidateIdentityProvider::has_verified_identity(&2)); - assert!(!CandidateIdentityProvider::has_verified_identity(&3)); + assert!(!CandidateIdentityProvider::identity(&2) + .as_ref() + .map_or(false, Identity::verified)); + assert!(!CandidateIdentityProvider::identity(&3) + .as_ref() + .map_or(false, Identity::verified)); assert_noop!( Elections::submit_candidacy(Origin::signed(2), 1), @@ -1767,11 +1801,23 @@ mod tests { ); assert_ok!(CandidateIdentityProvider::set_identity(2, ())); - assert!(CandidateIdentityProvider::has_verified_identity(&2)); + assert!(!CandidateIdentityProvider::identity(&2) + .as_ref() + .map_or(false, Identity::verified)); + assert_ok!(CandidateIdentityProvider::verify_identity(&2, ())); + assert!(CandidateIdentityProvider::identity(&2) + .as_ref() + .map_or(false, Identity::verified)); assert_ok!(Elections::submit_candidacy(Origin::signed(2), 1),); assert_ok!(CandidateIdentityProvider::set_identity(3, ())); - assert!(CandidateIdentityProvider::has_verified_identity(&3)); + assert!(!CandidateIdentityProvider::identity(&3) + .as_ref() + .map_or(false, Identity::verified)); + assert_ok!(CandidateIdentityProvider::verify_identity(&3, ())); + assert!(CandidateIdentityProvider::identity(&3) + .as_ref() + .map_or(false, Identity::verified)); assert_ok!(CandidateIdentityProvider::remove_identity(&3)); assert_noop!( From 3d0216469d6a2c5823d10ec7706dee05035519a4 Mon Sep 17 00:00:00 2001 From: olegnn Date: Mon, 22 Apr 2024 23:29:22 +0900 Subject: [PATCH 20/20] `verify` returning `DispatchResult` --- libs/utils/src/identity_provider.rs | 4 ++-- substrate/frame/elections-phragmen/src/lib.rs | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libs/utils/src/identity_provider.rs b/libs/utils/src/identity_provider.rs index 9cdecfe..6f24745 100644 --- a/libs/utils/src/identity_provider.rs +++ b/libs/utils/src/identity_provider.rs @@ -11,10 +11,10 @@ pub trait Identity { fn verified(&self) -> bool; /// Returns underlying identity information. - fn info(&self) -> &Self::Info; + fn info(&self) -> Self::Info; /// Adds justification for the underlying identity. - fn verify(&mut self, justification: Self::Justification); + fn verify(&mut self, justification: Self::Justification) -> DispatchResult; } /// Provides methods to retrieve an account's identity. diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 34f2882..1906413 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -1456,6 +1456,14 @@ mod tests { } } + struct IdentityIsAlreadyVerified; + + impl From for DispatchError { + fn from(IdentityIsAlreadyVerified: IdentityIsAlreadyVerified) -> Self { + Self::Other("Identity is already verified") + } + } + #[derive(Encode, Decode, MaxEncodedLen, Clone, Default, Debug)] pub struct DummyIdentity { verified: bool, @@ -1469,12 +1477,15 @@ mod tests { self.verified } - fn info(&self) -> &() { - &() + fn info(&self) -> () { + () } - fn verify(&mut self, (): ()) { + fn verify(&mut self, (): ()) -> DispatchResult { + ensure!(!self.verified, IdentityIsAlreadyVerified); self.verified = true; + + Ok(()) } }