Migrate polkadot-primitives to v6 (#1543)

- Async-backing related primitives are stable `primitives::v6`
- Async-backing API is now part of `api_version(7)`
- It's enabled on Rococo and Westend runtimes

---------

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
Chris Sosnin
2023-09-27 13:32:02 +03:00
committed by GitHub
parent 5a2833cceb
commit 7cbe0c76ef
107 changed files with 2410 additions and 2792 deletions
@@ -96,10 +96,10 @@ use std::{
use super::LOG_TARGET;
use bitvec::prelude::*;
use polkadot_node_subsystem_util::inclusion_emulator::staging::{
use polkadot_node_subsystem_util::inclusion_emulator::{
ConstraintModifications, Constraints, Fragment, ProspectiveCandidate, RelayChainBlockInfo,
};
use polkadot_primitives::vstaging::{
use polkadot_primitives::{
BlockNumber, CandidateHash, CommittedCandidateReceipt, Hash, HeadData, Id as ParaId,
PersistedValidationData,
};
@@ -981,10 +981,8 @@ impl FragmentNode {
mod tests {
use super::*;
use assert_matches::assert_matches;
use polkadot_node_subsystem_util::inclusion_emulator::staging::InboundHrmpLimitations;
use polkadot_primitives::vstaging::{
BlockNumber, CandidateCommitments, CandidateDescriptor, HeadData,
};
use polkadot_node_subsystem_util::inclusion_emulator::InboundHrmpLimitations;
use polkadot_primitives::{BlockNumber, CandidateCommitments, CandidateDescriptor, HeadData};
use polkadot_primitives_test_helpers as test_helpers;
fn make_constraints(
@@ -22,7 +22,7 @@
//! backing phases of parachain consensus.
//!
//! This is primarily an implementation of "Fragment Trees", as described in
//! [`polkadot_node_subsystem_util::inclusion_emulator::staging`].
//! [`polkadot_node_subsystem_util::inclusion_emulator`].
//!
//! This subsystem also handles concerns such as the relay-chain being forkful and session changes.
@@ -42,13 +42,14 @@ use polkadot_node_subsystem::{
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
};
use polkadot_node_subsystem_util::{
inclusion_emulator::staging::{Constraints, RelayChainBlockInfo},
inclusion_emulator::{Constraints, RelayChainBlockInfo},
request_session_index_for_child,
runtime::{prospective_parachains_mode, ProspectiveParachainsMode},
};
use polkadot_primitives::vstaging::{
BlockNumber, CandidateHash, CandidatePendingAvailability, CommittedCandidateReceipt, CoreState,
Hash, HeadData, Header, Id as ParaId, PersistedValidationData,
use polkadot_primitives::{
async_backing::CandidatePendingAvailability, BlockNumber, CandidateHash,
CommittedCandidateReceipt, CoreState, Hash, HeadData, Header, Id as ParaId,
PersistedValidationData,
};
use crate::{
@@ -792,7 +793,7 @@ async fn fetch_backing_state<Context>(
let (tx, rx) = oneshot::channel();
ctx.send_message(RuntimeApiMessage::Request(
relay_parent,
RuntimeApiRequest::StagingParaBackingState(para_id, tx),
RuntimeApiRequest::ParaBackingState(para_id, tx),
))
.await;
@@ -25,7 +25,7 @@ use polkadot_node_subsystem::{
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_primitives::{
vstaging::{AsyncBackingParams, BackingState, Constraints, InboundHrmpLimitations},
async_backing::{AsyncBackingParams, BackingState, Constraints, InboundHrmpLimitations},
CommittedCandidateReceipt, HeadData, Header, PersistedValidationData, ScheduledCore,
ValidationCodeHash,
};
@@ -219,7 +219,7 @@ async fn handle_leaf_activation(
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == *hash => {
tx.send(Ok(async_backing_params)).unwrap();
}
@@ -284,7 +284,7 @@ async fn handle_leaf_activation(
let para_id = match message {
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
_,
RuntimeApiRequest::StagingParaBackingState(p_id, _),
RuntimeApiRequest::ParaBackingState(p_id, _),
)) => p_id,
_ => panic!("received unexpected message {:?}", message),
};
@@ -303,7 +303,7 @@ async fn handle_leaf_activation(
assert_matches!(
message,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingParaBackingState(p_id, tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::ParaBackingState(p_id, tx))
) if parent == *hash && p_id == para_id => {
tx.send(Ok(Some(backing_state))).unwrap();
}
@@ -499,7 +499,7 @@ fn should_do_no_work_if_async_backing_disabled_for_leaf() {
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == hash => {
tx.send(Err(ASYNC_BACKING_DISABLED_ERROR)).unwrap();
}
@@ -1569,7 +1569,7 @@ fn uses_ancestry_only_within_session() {
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == hash => {
tx.send(Ok(AsyncBackingParams { max_candidate_depth: 0, allowed_ancestry_len: ancestry_len })).unwrap();
}