mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 19:45:41 +00:00
bounding staking: BoundedElectionProvider trait (#12362)
* add a bounded election provider trait * extract common trait election provider base * fmt * only bound the outer support vector * fix tests * docs * fix rust docs * fmt * fix rustdocs * docs * improve docs * small doc change
This commit is contained in:
@@ -74,17 +74,16 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_arithmetic::{traits::Zero, Normalizable, PerThing, Rational128, ThresholdOrd};
|
||||
use sp_core::RuntimeDebug;
|
||||
use sp_core::{bounded::BoundedVec, RuntimeDebug};
|
||||
use sp_std::{
|
||||
cell::RefCell, cmp::Ordering, collections::btree_map::BTreeMap, prelude::*, rc::Rc, vec,
|
||||
};
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
#[cfg(test)]
|
||||
@@ -451,6 +450,11 @@ impl<AccountId> Default for Support<AccountId> {
|
||||
/// The main advantage of this is that it is encodable.
|
||||
pub type Supports<A> = Vec<(A, Support<A>)>;
|
||||
|
||||
/// Same as `Supports` bounded by `MaxWinners`.
|
||||
///
|
||||
/// To note, the inner `Support` is still unbounded.
|
||||
pub type BoundedSupports<A, MaxWinners> = BoundedVec<(A, Support<A>), MaxWinners>;
|
||||
|
||||
/// Linkage from a winner to their [`Support`].
|
||||
///
|
||||
/// This is more helpful than a normal [`Supports`] as it allows faster error checking.
|
||||
|
||||
Reference in New Issue
Block a user