Add ClaimQueue wrapper (#3950)

Remove `fetch_next_scheduled_on_core` in favor of new wrapper and
methods for accessing it.

---------

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
Andrei Sandu
2024-04-03 18:01:34 +03:00
committed by GitHub
parent ecc51a2535
commit 0f4e849e0a
5 changed files with 55 additions and 32 deletions
@@ -45,13 +45,12 @@ use polkadot_node_subsystem::{
use polkadot_node_subsystem_util::{
request_async_backing_params, request_availability_cores, request_para_backing_state,
request_persisted_validation_data, request_validation_code, request_validation_code_hash,
request_validators,
vstaging::{fetch_claim_queue, fetch_next_scheduled_on_core},
request_validators, vstaging::fetch_claim_queue,
};
use polkadot_primitives::{
collator_signature_payload, CandidateCommitments, CandidateDescriptor, CandidateReceipt,
CollatorPair, CoreIndex, CoreState, Hash, Id as ParaId, OccupiedCoreAssumption,
PersistedValidationData, ValidationCodeHash,
PersistedValidationData, ScheduledCore, ValidationCodeHash,
};
use sp_core::crypto::Pair;
use std::sync::Arc;
@@ -245,11 +244,10 @@ async fn handle_new_activations<Context>(
// Use claim queue if available, or fallback to `next_up_on_available`
let res = match maybe_claim_queue {
Some(ref claim_queue) => {
// read what's in the claim queue for this core
fetch_next_scheduled_on_core(
claim_queue,
CoreIndex(core_idx as u32),
)
// read what's in the claim queue for this core at depth 0.
claim_queue
.get_claim_for(CoreIndex(core_idx as u32), 0)
.map(|para_id| ScheduledCore { para_id, collator: None })
},
None => {
// Runtime doesn't support claim queue runtime api. Fallback to