Max class voters for ranked collective vote tally
The implementation of VoteTally trait, uses Rank type where Class is supposed.
For Kusama runtime, this is not an issue. The Rank and Class is the same u16 type and mapped 1:1.
But if,
- the mapping is not 1:1, the max voters count might be wrong;
Classis any other type (e.g. enum), it wont compile.
// TODO tests
Looks ok in general, but are
RankandClassnot already defined as equivalent within ranked-collective'sVoteTallyimpl because itsClassgeneric parameter is provided asRank?
I see it now.
It not simple to read it like that. Here for example we access Class type throughout Polling trait, signaling its generic for the pallet -
https://github.com/paritytech/substrate/blob/37e3abd96c8dffccef9156d2be9302d876a72d10/frame/ranked-collective/src/lib.rs#L343
The signatures of the VoteTally funcs impls becomes confusing to me, the name of the arg is class, the type is Rank, but docs will help -
https://github.com/paritytech/substrate/blob/37e3abd96c8dffccef9156d2be9302d876a72d10/frame/ranked-collective/src/lib.rs#L140
I faced the issue, while trying to define the Class as enum.
We can go either way, generic class (like in the PR now) or class type is rank type, but I make it more explicit and add some docs.
bot rebase
Rebased
bot rebase
Rebased
bot merge
Waiting for commit status.