Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete weight refund for set_candidacy_bond in pallet_collator_selection #3642

Closed
georgepisaltu opened this issue Mar 11, 2024 · 0 comments · Fixed by #3643
Closed

Incomplete weight refund for set_candidacy_bond in pallet_collator_selection #3642

georgepisaltu opened this issue Mar 11, 2024 · 0 comments · Fixed by #3643

Comments

@georgepisaltu
Copy link
Contributor

The current impl of pallet_collator_selection::set_candidacy_bond charges for both the length of the candidate list as well as the number of candidates kicked as a result of a higher bond being imposed on them and their existing bonds not meeting the new requirements.

However, when the candidacy bond decreases, there are no iterations on the list, but we still charge for the length of the candidate list as if we iterated over all the candidates but kicked none. In this particular case, we should refund weight as if the list was empty. This needs to be fixed in pallet_collator_selection::set_candidacy_bond.

github-merge-queue bot pushed a commit that referenced this issue Mar 11, 2024
Fixes #3642 

This PR implements the weight refund of
`pallet_collator_selection::set_candidacy_bond` to account for no
iterations when the bond is decreased.

---------

Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this issue Mar 24, 2024
…tytech#3643)

Fixes paritytech#3642 

This PR implements the weight refund of
`pallet_collator_selection::set_candidacy_bond` to account for no
iterations when the bond is decreased.

---------

Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant