Skip to content

Commit

Permalink
pallet-collator-selection: correctly register weight in new_session (
Browse files Browse the repository at this point in the history
…paritytech#5430)

The `pallet-collator-selection` is not correctly using the weight for
the
[new_session](https://github.com/blockdeep/pallet-collator-staking/blob/main/src/benchmarking.rs#L350-L353)
function.

The first parameter is the removed candidates, and the second one the
original number of candidates before the removal, but both values are
swapped.
  • Loading branch information
Moliholy authored Aug 24, 2024
1 parent 13d43bb commit 475432f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cumulus/pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ pub mod pallet {
let result = Self::assemble_collators();

frame_system::Pallet::<T>::register_extra_weight_unchecked(
T::WeightInfo::new_session(candidates_len_before, removed),
T::WeightInfo::new_session(removed, candidates_len_before),
DispatchClass::Mandatory,
);
Some(result)
Expand Down
13 changes: 13 additions & 0 deletions prdoc/pr_5430.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: "pallet-collator-selection: correctly register weight in `new_session`"

doc:
- audience: Runtime Dev
description: |
- Fixes an incorrect usage of the `WeightInfo` trait for `new_session`.

crates:
- name: pallet-collator-selection
bump: patch

0 comments on commit 475432f

Please sign in to comment.