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

Enforce MaxEncodedLen impl for NposSolution #11092

Closed
kianenigma opened this issue Mar 22, 2022 · 0 comments · Fixed by #11103
Closed

Enforce MaxEncodedLen impl for NposSolution #11092

kianenigma opened this issue Mar 22, 2022 · 0 comments · Fixed by #11103
Labels
Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.

Comments

@kianenigma
Copy link
Contributor

kianenigma commented Mar 22, 2022

See: https://github.com/paritytech/substrate/pull/11032/files#r832354293 (#11032)

okay, so about these, we need a follow up issue to try and actually enforce this bound.

It should not be too hard, we only ever create this type in a single function, from_assignments, and in there, we need to sum up all the fields (votes1, votes2, ...) and make sure they are less than MaxVoters::len().

I will make a new issue for this so you can do it as a follow-up.

@kianenigma kianenigma added Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. labels Mar 22, 2022
paritytech-processbot bot pushed a commit that referenced this issue Aug 14, 2022
…Fix: #11092 (#11908)

* make MAX_VOTERS and MAX_CANDIDATES in elections-phragmen configurable

* Configure election-phragmen in node bin configuring max candidates & voters

* Add document comment for added Config parameter

* Incorporate suggestion

* fix benchmarks

* Update frame/elections-phragmen/src/lib.rs

* Update frame/elections-phragmen/src/lib.rs

* fix wrong values

* fix typo

* docs

* more detailed docs

* fmt

* ".git/.scripts/bench-bot.sh" pallet dev pallet_elections_phragmen

Co-authored-by: Szegoo <sakacszergej@gmail.com>
Co-authored-by: Sergej Sakac <73715684+Szegoo@users.noreply.github.com>
Co-authored-by: command-bot <>
ark0f pushed a commit to gear-tech/substrate that referenced this issue Feb 27, 2023
…Fix: paritytech#11092 (paritytech#11908)

* make MAX_VOTERS and MAX_CANDIDATES in elections-phragmen configurable

* Configure election-phragmen in node bin configuring max candidates & voters

* Add document comment for added Config parameter

* Incorporate suggestion

* fix benchmarks

* Update frame/elections-phragmen/src/lib.rs

* Update frame/elections-phragmen/src/lib.rs

* fix wrong values

* fix typo

* docs

* more detailed docs

* fmt

* ".git/.scripts/bench-bot.sh" pallet dev pallet_elections_phragmen

Co-authored-by: Szegoo <sakacszergej@gmail.com>
Co-authored-by: Sergej Sakac <73715684+Szegoo@users.noreply.github.com>
Co-authored-by: command-bot <>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant