-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
@@ -109,9 +108,8 @@ pub fn elect<T: Trait + 'static, FR, FN, FV, FS>( | |||
>>, | |||
for <'r> FS: Fn(&'r T::AccountId) -> BalanceOf<T>, | |||
{ | |||
let expand = |b: BalanceOf<T>| <T::CurrencyToVote as Convert<BalanceOf<T>, u64>>::convert(b) as ExtendedBalance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @kianenigma : No extraneous whitespace within code.
minimum_validator_count: usize, | ||
config: ElectionConfig<BalanceOf<T>>, | ||
pub fn elect<T: Trait + 'static, FN, FV, FS>( | ||
validator_count: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename rounds
to validator_count
- to minimise use of jargon.
also wtf is this passing in a closure only to call it immediately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the open discussions here. #1915 (comment)
I would personally not do that and pre-process the data in lib.rs
and pass everything in as a vectors.
If you mean only validator_count
; it was still a storage item and wanted to keep it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apologies for the typo fair
. Rest looks ok. I would open a ticket to remove the closures compleatly. This could leas us into turning the phragmen impl a separate crate that is actually reusable, not something tailored to work with what the staking module is providing.
done. |
* Bump versionb globally * Rebuild and fix * Rename fixes * Rebuild * Minor fix and code formatting for validator election * Fix tests * More test fixes * Fix several bugs in phragmen elections. * Rebuild, remove pointless closures
Also some minor changes to staking/phragmen:
Fn()->usize
, only to always call it once: just pass ausize
!rounds
(which is incredibly opaque jargon taking from Phragmen's original context) tovalidator_count
.min_validator_count
represents the minimum number of validators we need, not one-less, so we require the number of validators to be>=
before we declare code-red, not>
.validator_count
represents the ideal validator count. We only need to do candidate selection if we have more than that, so the comparison there should be>
, not>=
.