mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Use proper bounded vector type for nominations (#10601)
* Use proper bounded vector type for nominations * add docs and tweak chill_other for cleanup purposes * Fix the build * remove TODO * add a bit more doc * even more docs gushc * Update frame/staking/src/pallet/mod.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Update frame/staking/src/pallet/mod.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Fix the nasty bug * also bound the Snapshot type * fix doc test * document bounded_vec * self-review * remove unused * Fix build * frame-support: repetition overload for bounded_vec Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fix * remove the need to allocate into unbounded voters etc etc * Don't expect * unbreal the build again * handle macro a bit better Co-authored-by: Zeke Mostov <z.mostov@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -47,11 +47,7 @@ pub(crate) const OFFCHAIN_CACHED_CALL: &[u8] = b"parity/multi-phase-unsigned-ele
|
||||
|
||||
/// A voter's fundamental data: their ID, their stake, and the list of candidates for whom they
|
||||
/// voted.
|
||||
pub type Voter<T> = (
|
||||
<T as frame_system::Config>::AccountId,
|
||||
sp_npos_elections::VoteWeight,
|
||||
Vec<<T as frame_system::Config>::AccountId>,
|
||||
);
|
||||
pub type VoterOf<T> = frame_election_provider_support::VoterOf<<T as Config>::DataProvider>;
|
||||
|
||||
/// The relative distribution of a voter's stake among the winning targets.
|
||||
pub type Assignment<T> =
|
||||
@@ -749,7 +745,9 @@ mod tests {
|
||||
};
|
||||
use codec::Decode;
|
||||
use frame_benchmarking::Zero;
|
||||
use frame_support::{assert_noop, assert_ok, dispatch::Dispatchable, traits::OffchainWorker};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, bounded_vec, dispatch::Dispatchable, traits::OffchainWorker,
|
||||
};
|
||||
use sp_npos_elections::IndexAssignment;
|
||||
use sp_runtime::{
|
||||
offchain::storage_lock::{BlockAndTime, StorageLock},
|
||||
@@ -1048,8 +1046,8 @@ mod tests {
|
||||
fn unsigned_per_dispatch_checks_can_only_submit_threshold_better() {
|
||||
ExtBuilder::default()
|
||||
.desired_targets(1)
|
||||
.add_voter(7, 2, vec![10])
|
||||
.add_voter(8, 5, vec![10])
|
||||
.add_voter(7, 2, bounded_vec![10])
|
||||
.add_voter(8, 5, bounded_vec![10])
|
||||
.solution_improvement_threshold(Perbill::from_percent(50))
|
||||
.build_and_execute(|| {
|
||||
roll_to(25);
|
||||
|
||||
Reference in New Issue
Block a user