mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 18:35:41 +00:00
Expose ClaimQueue via a runtime api and use it in collation-generation (#3580)
The PR adds two things: 1. Runtime API exposing the whole claim queue 2. Consumes the API in `collation-generation` to fetch the next scheduled `ParaEntry` for an occupied core. Related to https://github.com/paritytech/polkadot-sdk/issues/1797
This commit is contained in:
committed by
GitHub
parent
e659c4b3f7
commit
e58e854a32
@@ -45,7 +45,7 @@ use polkadot_primitives::{
|
||||
async_backing, slashing,
|
||||
vstaging::{ApprovalVotingParams, NodeFeatures},
|
||||
AuthorityDiscoveryId, BackedCandidate, BlockNumber, CandidateEvent, CandidateHash,
|
||||
CandidateIndex, CandidateReceipt, CollatorId, CommittedCandidateReceipt, CoreState,
|
||||
CandidateIndex, CandidateReceipt, CollatorId, CommittedCandidateReceipt, CoreIndex, CoreState,
|
||||
DisputeState, ExecutorParams, GroupIndex, GroupRotationInfo, Hash, HeadData,
|
||||
Header as BlockHeader, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
|
||||
MultiDisputeStatementSet, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
|
||||
@@ -55,7 +55,7 @@ use polkadot_primitives::{
|
||||
};
|
||||
use polkadot_statement_table::v2::Misbehavior;
|
||||
use std::{
|
||||
collections::{BTreeMap, HashMap, HashSet},
|
||||
collections::{BTreeMap, HashMap, HashSet, VecDeque},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
@@ -729,6 +729,9 @@ pub enum RuntimeApiRequest {
|
||||
/// Approval voting params
|
||||
/// `V10`
|
||||
ApprovalVotingParams(SessionIndex, RuntimeApiSender<ApprovalVotingParams>),
|
||||
/// Fetch the `ClaimQueue` from scheduler pallet
|
||||
/// `V11`
|
||||
ClaimQueue(RuntimeApiSender<BTreeMap<CoreIndex, VecDeque<ParaId>>>),
|
||||
}
|
||||
|
||||
impl RuntimeApiRequest {
|
||||
@@ -763,6 +766,9 @@ impl RuntimeApiRequest {
|
||||
|
||||
/// `approval_voting_params`
|
||||
pub const APPROVAL_VOTING_PARAMS_REQUIREMENT: u32 = 10;
|
||||
|
||||
/// `ClaimQueue`
|
||||
pub const CLAIM_QUEUE_RUNTIME_REQUIREMENT: u32 = 11;
|
||||
}
|
||||
|
||||
/// A message to the Runtime API subsystem.
|
||||
|
||||
@@ -21,10 +21,11 @@ use polkadot_primitives::{
|
||||
slashing,
|
||||
vstaging::{self, ApprovalVotingParams},
|
||||
Block, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
|
||||
CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupRotationInfo, Hash,
|
||||
Header, Id, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption,
|
||||
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
|
||||
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
CommittedCandidateReceipt, CoreIndex, CoreState, DisputeState, ExecutorParams,
|
||||
GroupRotationInfo, Hash, Header, Id, InboundDownwardMessage, InboundHrmpMessage,
|
||||
OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes,
|
||||
SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
|
||||
ValidatorSignature,
|
||||
};
|
||||
use sc_client_api::{AuxStore, HeaderBackend};
|
||||
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
|
||||
@@ -33,7 +34,10 @@ use sp_authority_discovery::AuthorityDiscoveryApi;
|
||||
use sp_blockchain::{BlockStatus, Info};
|
||||
use sp_consensus_babe::{BabeApi, Epoch};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use std::{collections::BTreeMap, sync::Arc};
|
||||
use std::{
|
||||
collections::{BTreeMap, VecDeque},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
/// Offers header utilities.
|
||||
///
|
||||
@@ -329,6 +333,10 @@ pub trait RuntimeApiSubsystemClient {
|
||||
at: Hash,
|
||||
session_index: SessionIndex,
|
||||
) -> Result<ApprovalVotingParams, ApiError>;
|
||||
|
||||
// == v11: Claim queue ==
|
||||
/// Fetch the `ClaimQueue` from scheduler pallet
|
||||
async fn claim_queue(&self, at: Hash) -> Result<BTreeMap<CoreIndex, VecDeque<Id>>, ApiError>;
|
||||
}
|
||||
|
||||
/// Default implementation of [`RuntimeApiSubsystemClient`] using the client.
|
||||
@@ -594,6 +602,10 @@ where
|
||||
) -> Result<ApprovalVotingParams, ApiError> {
|
||||
self.client.runtime_api().approval_voting_params(at)
|
||||
}
|
||||
|
||||
async fn claim_queue(&self, at: Hash) -> Result<BTreeMap<CoreIndex, VecDeque<Id>>, ApiError> {
|
||||
self.client.runtime_api().claim_queue(at)
|
||||
}
|
||||
}
|
||||
|
||||
impl<Client, Block> HeaderBackend<Block> for DefaultSubsystemClient<Client>
|
||||
|
||||
Reference in New Issue
Block a user