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

[Collator Selection] Fix weight refund for set_candidacy_bond #3643

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cumulus/pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,11 @@ pub mod pallet {
})
.unwrap_or_default();
Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond });
Ok(Some(T::WeightInfo::set_candidacy_bond(initial_len as u32, kicked as u32)).into())
Ok(Some(T::WeightInfo::set_candidacy_bond(
bond_increased.then(|| initial_len as u32).unwrap_or_default(),
kicked as u32,
))
.into())
}

/// Register this account as a collator candidate. The account must (a) already have
Expand Down
12 changes: 12 additions & 0 deletions prdoc/pr_3643.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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: Fix weight refund for `pallet_collator_selection::set_candidacy_bond`

doc:
- audience: Runtime Dev
description: |
This PR implements the weight refund of `pallet_collator_selection::set_candidacy_bond` to
account for no iterations over the candidate list when the candidacy bond is decreased.
crates:
- name: pallet-collator-selection
Loading