Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Rename all the election operations #6245

Merged
merged 5 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Line width
  • Loading branch information
kianenigma committed Jun 4, 2020
commit 356dcf6949b8f0647da166a7edbe256b4cc26f00
4 changes: 3 additions & 1 deletion primitives/npos-elections/compact/src/staked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ fn from_impl(count: usize) -> TokenStream2 {
let last = quote!(index_of_target(&distribution[#last_index].0).ok_or(_phragmen::Error::CompactInvalidIndex)?);

quote!(
#c => compact.#field_name.push((index_of_voter(&who).ok_or(_phragmen::Error::CompactInvalidIndex)?, [#inner], #last)),
#c => compact.#field_name.push(
(index_of_voter(&who).ok_or(_phragmen::Error::CompactInvalidIndex)?, [#inner], #last)
),
)
}).collect::<TokenStream2>();

Expand Down
5 changes: 4 additions & 1 deletion primitives/npos-elections/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ fn phragmen_accuracy_on_large_scale_only_validators() {
2,
2,
candidates.clone(),
auto_generate_self_voters(&candidates).iter().map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone())).collect::<Vec<_>>(),
auto_generate_self_voters(&candidates)
.iter()
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
.collect::<Vec<_>>(),
).unwrap();

assert_eq_uvec!(winners, vec![(1, 18446744073709551614u128), (5, 18446744073709551613u128)]);
Expand Down