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

Use the new desired_targets_checked method exposed by Election Provider #12756

Closed
Ank4n opened this issue Nov 22, 2022 · 0 comments · Fixed by #12826
Closed

Use the new desired_targets_checked method exposed by Election Provider #12756

Ank4n opened this issue Nov 22, 2022 · 0 comments · Fixed by #12826
Assignees
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder

Comments

@Ank4n
Copy link
Contributor

Ank4n commented Nov 22, 2022

Election Provider defines a bound MaxWinners which limits the size of winners it can elect. ElectionProvider also assumes ElectionDataProvider will respect this bound and return a desired_targets() that is lower than this. As such, this call is unsafe to use and caller is expected to handle the case when above assumption fails.

We can improve on this by introducing a desired_targets_checked() method on ElectionProvider which returns an error if the above assumption fails. This is already defined here but unused for now.

@Ank4n Ank4n added the Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder label Nov 22, 2022
@Ank4n Ank4n moved this to 📕 Backlog in (Nominated) Proof of Stake Nov 22, 2022
@Ank4n Ank4n self-assigned this Nov 22, 2022
@Ank4n Ank4n linked a pull request Dec 2, 2022 that will close this issue
@kianenigma kianenigma moved this from 📕 Backlog to ⌛️ Sometime-soon in (Nominated) Proof of Stake Dec 5, 2022
Repository owner moved this from ⌛️ Sometime-soon to ✅ Done in (Nominated) Proof of Stake Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant