Closed bkontur closed 3 months ago
It's a normal increase because now the extrinsic iterates over the candidate list and kicks candidates which don't meet the new bond requirement. Previously the function only did a storage write and candidates were grandfathered into the list through this loophole.
However, when the bond decreases there are no iterations, 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
.
The weight increase isn't too much of a concern because the extrinsic is guarded by a privileged origin pallet_collator_selection::Config::UpdateOrigin
and it's called very rarely.
However, when the bond decreases there are no iterations, 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.
Proposed fix https://github.com/paritytech/polkadot-sdk/pull/3643
@georgepisaltu thank you, closing this
Regenerated weights here: https://github.com/polkadot-fellows/runtimes/pull/223. Runtimes diff here: https://github.com/polkadot-fellows/runtimes/compare/release-v1.1.2...bkontur:runtimes:bko-weights AssetHubKusama
pallet_colator_selection.rs
weights diff: https://github.com/polkadot-fellows/runtimes/compare/release-v1.1.2...bkontur:runtimes:bko-weights#diff-fc25abf846969ae26257408784cdbc5c82c0b701bd859d06a26e99ef33c7bfcdL122-R147TODO