Skip to content

Commit

Permalink
fix comment + clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthDesai committed Sep 6, 2024
1 parent e1406bc commit fc5f31b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions pallets/collator-assignment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"tp-traits/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"sp-runtime/try-runtime",
]
11 changes: 6 additions & 5 deletions pallets/collator-assignment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,17 @@ pub mod pallet {
.max_parachain_percentage
.mul(core_count);

let enough_cores_for_all_bulk_paras =
let enough_cores_for_bulk_paras =
bulk_paras.len() <= ideal_number_of_bulk_paras as usize;

// Currently, we are sorting both bulk and pool paras by tip, even when for example
// only number of bulk paras are restricted due to core availability.
// only number of bulk paras are restricted due to core availability since we deduct tip from
// all paras.
// We need to sort both separately as we have fixed space for parachains at the moment
// which means even when we have some parathread cores empty we cannot schedule parachain there.
// We need to change this once other part of algorithm start to differentiate between
// bulk and pool paras.
if !enough_cores_for_all_bulk_paras {
// bulk and pool paras while deducting the tip amount.
if !enough_cores_for_bulk_paras {
bulk_paras.sort_by(|a, b| {
T::CollatorAssignmentTip::get_para_tip(b.para_id)
.cmp(&T::CollatorAssignmentTip::get_para_tip(a.para_id))
Expand Down Expand Up @@ -220,7 +221,7 @@ pub mod pallet {
// We should charge tip if either this method or the order_para method has sorted chains based on tip
(
ordered_chains,
sorted_chains_based_on_tip || !enough_cores_for_all_bulk_paras,
sorted_chains_based_on_tip || !enough_cores_for_bulk_paras,
)
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-assignment/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ impl CollatorAssignmentHook<u32> for MockCollatorAssignmentHook {
pub struct GetCoreAllocationConfigurationImpl;

impl GetCoreAllocationConfigurationImpl {
pub(crate) fn set(config: Option<CoreAllocationConfiguration>) {
pub fn set(config: Option<CoreAllocationConfiguration>) {
let encoded_data = config.encode();
sp_io::storage::set(b"___TEST_CONFIG", &encoded_data);
}
Expand Down
2 changes: 1 addition & 1 deletion solo-chains/runtime/starlight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ use {
},
tp_traits::{
apply, derive_storage_traits, GetHostConfiguration, GetSessionContainerChains,
GetSessionIndex, RegistrarHandler, RemoveParaIdsWithNoCredits, Slot, SlotFrequency,
RegistrarHandler, RemoveParaIdsWithNoCredits, Slot, SlotFrequency,
},
};

Expand Down

0 comments on commit fc5f31b

Please sign in to comment.