mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 15:37:56 +00:00
Deprecate para_id() from CoreState in polkadot primitives (#3979)
With Coretime enabled we can no longer assume there is a static 1:1 mapping between core index and para id. This mapping should be obtained from the scheduler/claimqueue on block by block basis. This PR modifies `para_id()` (from `CoreState`) to return the scheduled `ParaId` for occupied cores and removes its usages in the code. Closes https://github.com/paritytech/polkadot-sdk/issues/3948 --------- Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
bd4471b4fc
commit
59f868d1e9
@@ -1086,10 +1086,16 @@ pub enum CoreState<H = Hash, N = BlockNumber> {
|
||||
}
|
||||
|
||||
impl<N> CoreState<N> {
|
||||
/// If this core state has a `para_id`, return it.
|
||||
/// Returns the scheduled `ParaId` for the core or `None` if nothing is scheduled.
|
||||
///
|
||||
/// This function is deprecated. `ClaimQueue` should be used to obtain the scheduled `ParaId`s
|
||||
/// for each core.
|
||||
#[deprecated(
|
||||
note = "`para_id` will be removed. Use `ClaimQueue` to query the scheduled `para_id` instead."
|
||||
)]
|
||||
pub fn para_id(&self) -> Option<Id> {
|
||||
match self {
|
||||
Self::Occupied(ref core) => Some(core.para_id()),
|
||||
Self::Occupied(ref core) => core.next_up_on_available.as_ref().map(|n| n.para_id),
|
||||
Self::Scheduled(core) => Some(core.para_id),
|
||||
Self::Free => None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user