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
+14 -15
View File
@@ -30,16 +30,16 @@ use polkadot_node_subsystem::{
};
use polkadot_node_subsystem_types::UnpinHandle;
use polkadot_primitives::{
vstaging, CandidateEvent, CandidateHash, CoreState, EncodeAs, ExecutorParams, GroupIndex,
GroupRotationInfo, Hash, IndexedVec, OccupiedCore, ScrapedOnChainVotes, SessionIndex,
SessionInfo, Signed, SigningContext, UncheckedSigned, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex, LEGACY_MIN_BACKING_VOTES,
slashing, AsyncBackingParams, CandidateEvent, CandidateHash, CoreState, EncodeAs,
ExecutorParams, GroupIndex, GroupRotationInfo, Hash, IndexedVec, OccupiedCore,
ScrapedOnChainVotes, SessionIndex, SessionInfo, Signed, SigningContext, UncheckedSigned,
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, LEGACY_MIN_BACKING_VOTES,
};
use crate::{
request_availability_cores, request_candidate_events, request_from_runtime,
request_key_ownership_proof, request_on_chain_votes, request_session_executor_params,
request_session_index_for_child, request_session_info, request_staging_async_backing_params,
request_async_backing_params, request_availability_cores, request_candidate_events,
request_from_runtime, request_key_ownership_proof, request_on_chain_votes,
request_session_executor_params, request_session_index_for_child, request_session_info,
request_submit_report_dispute_lost, request_unapplied_slashes, request_validation_code_by_hash,
request_validator_groups,
};
@@ -377,7 +377,7 @@ where
pub async fn get_unapplied_slashes<Sender>(
sender: &mut Sender,
relay_parent: Hash,
) -> Result<Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>>
) -> Result<Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)>>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
@@ -392,7 +392,7 @@ pub async fn key_ownership_proof<Sender>(
sender: &mut Sender,
relay_parent: Hash,
validator_id: ValidatorId,
) -> Result<Option<vstaging::slashing::OpaqueKeyOwnershipProof>>
) -> Result<Option<slashing::OpaqueKeyOwnershipProof>>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
@@ -403,8 +403,8 @@ where
pub async fn submit_report_dispute_lost<Sender>(
sender: &mut Sender,
relay_parent: Hash,
dispute_proof: vstaging::slashing::DisputeProof,
key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof,
dispute_proof: slashing::DisputeProof,
key_ownership_proof: slashing::OpaqueKeyOwnershipProof,
) -> Result<Option<()>>
where
Sender: SubsystemSender<RuntimeApiMessage>,
@@ -429,7 +429,7 @@ where
pub enum ProspectiveParachainsMode {
/// Runtime API without support of `async_backing_params`: no prospective parachains.
Disabled,
/// vstaging runtime API: prospective parachains.
/// v6 runtime API: prospective parachains.
Enabled {
/// The maximum number of para blocks between the para head in a relay parent
/// and a new candidate. Restricts nodes from building arbitrary long chains
@@ -457,8 +457,7 @@ pub async fn prospective_parachains_mode<Sender>(
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
let result =
recv_runtime(request_staging_async_backing_params(relay_parent, sender).await).await;
let result = recv_runtime(request_async_backing_params(relay_parent, sender).await).await;
if let Err(error::Error::RuntimeRequest(RuntimeApiError::NotSupported { runtime_api_name })) =
&result
@@ -472,7 +471,7 @@ where
Ok(ProspectiveParachainsMode::Disabled)
} else {
let vstaging::AsyncBackingParams { max_candidate_depth, allowed_ancestry_len } = result?;
let AsyncBackingParams { max_candidate_depth, allowed_ancestry_len } = result?;
Ok(ProspectiveParachainsMode::Enabled {
max_candidate_depth: max_candidate_depth as _,
allowed_ancestry_len: allowed_ancestry_len as _,