mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +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
@@ -1797,7 +1797,10 @@ fn persists_pending_availability_candidate() {
|
||||
test_state.availability_cores = test_state
|
||||
.availability_cores
|
||||
.into_iter()
|
||||
.filter(|core| core.para_id().map_or(false, |id| id == para_id))
|
||||
.filter(|core| match core {
|
||||
CoreState::Scheduled(scheduled_core) => scheduled_core.para_id == para_id,
|
||||
_ => false,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(test_state.availability_cores.len(), 1);
|
||||
|
||||
@@ -1896,7 +1899,10 @@ fn backwards_compatible() {
|
||||
test_state.availability_cores = test_state
|
||||
.availability_cores
|
||||
.into_iter()
|
||||
.filter(|core| core.para_id().map_or(false, |id| id == para_id))
|
||||
.filter(|core| match core {
|
||||
CoreState::Scheduled(scheduled_core) => scheduled_core.para_id == para_id,
|
||||
_ => false,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(test_state.availability_cores.len(), 1);
|
||||
|
||||
|
||||
@@ -918,7 +918,11 @@ mod select_candidates {
|
||||
let committed_receipts: Vec<_> = (0..mock_cores.len())
|
||||
.map(|i| {
|
||||
let mut descriptor = dummy_candidate_descriptor(dummy_hash());
|
||||
descriptor.para_id = mock_cores[i].para_id().unwrap();
|
||||
descriptor.para_id = if let Scheduled(scheduled_core) = &mock_cores[i] {
|
||||
scheduled_core.para_id
|
||||
} else {
|
||||
panic!("`mock_cores` is not initialized with `Scheduled`?")
|
||||
};
|
||||
descriptor.persisted_validation_data_hash = empty_hash;
|
||||
descriptor.pov_hash = Hash::from_low_u64_be(i as u64);
|
||||
CommittedCandidateReceipt {
|
||||
|
||||
Reference in New Issue
Block a user