Release parachain host API v4 (#6885)

This commit is contained in:
s0me0ne-unkn0wn
2023-03-15 18:06:18 +01:00
committed by GitHub
parent a715a33ab9
commit 27c9124411
30 changed files with 129 additions and 120 deletions
+9 -8
View File
@@ -19,8 +19,8 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
// `v2` is currently the latest stable version of the runtime API.
pub mod v2;
// `v4` is currently the latest stable version of the runtime API.
pub mod v4;
// The 'staging' version is special - it contains primitives which are
// still in development. Once they are considered stable, they will be
@@ -33,7 +33,7 @@ pub mod runtime_api;
// Current primitives not requiring versioning are exported here.
// Primitives requiring versioning must not be exported and must be referred by an exact version.
pub use v2::{
pub use v4::{
byzantine_threshold, check_candidate_backing, collator_signature_payload, metric_definitions,
supermajority_threshold, well_known_keys, AbridgedHostConfiguration, AbridgedHrmpChannel,
AccountId, AccountIndex, AccountPublic, ApprovalVote, AssignmentId, AuthorityDiscoveryId,
@@ -42,10 +42,11 @@ pub use v2::{
CandidateReceipt, CheckedDisputeStatementSet, CheckedMultiDisputeStatementSet, CollatorId,
CollatorSignature, CommittedCandidateReceipt, CompactStatement, ConsensusLog, CoreIndex,
CoreOccupied, CoreState, DisputeState, DisputeStatement, DisputeStatementSet, DownwardMessage,
EncodeAs, ExplicitDisputeStatement, GroupIndex, GroupRotationInfo, Hash, HashT, HeadData,
Header, HrmpChannelId, Id, InboundDownwardMessage, InboundHrmpMessage, IndexedVec,
InherentData, InvalidDisputeStatementKind, Moment, MultiDisputeStatementSet, Nonce,
OccupiedCore, OccupiedCoreAssumption, OutboundHrmpMessage, ParathreadClaim, ParathreadEntry,
EncodeAs, ExecutorParam, ExecutorParams, ExecutorParamsHash, ExplicitDisputeStatement,
GroupIndex, GroupRotationInfo, Hash, HashT, HeadData, Header, HrmpChannelId, Id,
InboundDownwardMessage, InboundHrmpMessage, IndexedVec, InherentData,
InvalidDisputeStatementKind, Moment, MultiDisputeStatementSet, Nonce, OccupiedCore,
OccupiedCoreAssumption, OutboundHrmpMessage, ParathreadClaim, ParathreadEntry,
PersistedValidationData, PvfCheckStatement, PvfExecTimeoutKind, PvfPrepTimeoutKind,
RuntimeMetricLabel, RuntimeMetricLabelValue, RuntimeMetricLabelValues, RuntimeMetricLabels,
RuntimeMetricOp, RuntimeMetricUpdate, ScheduledCore, ScrapedOnChainVotes, SessionIndex,
@@ -59,4 +60,4 @@ pub use v2::{
};
#[cfg(feature = "std")]
pub use v2::{AssignmentPair, CollatorPair, ValidatorPair};
pub use v4::{AssignmentPair, CollatorPair, ValidatorPair};
+4 -8
View File
@@ -111,8 +111,8 @@
//! from the stable primitives.
use crate::{
vstaging, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, OccupiedCoreAssumption,
BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash, CommittedCandidateReceipt,
CoreState, DisputeState, ExecutorParams, GroupRotationInfo, OccupiedCoreAssumption,
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
ValidatorId, ValidatorIndex, ValidatorSignature,
};
@@ -123,7 +123,7 @@ use sp_std::{collections::btree_map::BTreeMap, prelude::*};
sp_api::decl_runtime_apis! {
/// The API for querying the state of parachains on-chain.
#[api_version(2)]
#[api_version(4)]
pub trait ParachainHost<H: Encode + Decode = pcp::v2::Hash, N: Encode + Decode = pcp::v2::BlockNumber> {
/// Get the current validators.
fn validators() -> Vec<ValidatorId>;
@@ -213,14 +213,10 @@ sp_api::decl_runtime_apis! {
fn validation_code_hash(para_id: ppp::Id, assumption: OccupiedCoreAssumption)
-> Option<ppp::ValidationCodeHash>;
/***** STAGING *****/
/// Returns all onchain disputes.
#[api_version(3)]
fn disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>;
/// Returns execution parameters for the session.
#[api_version(4)]
fn session_executor_params(session_index: SessionIndex) -> Option<vstaging::ExecutorParams>;
fn session_executor_params(session_index: SessionIndex) -> Option<ExecutorParams>;
}
}
@@ -1716,6 +1716,9 @@ pub enum PvfExecTimeoutKind {
Approval,
}
pub mod executor_params;
pub use executor_params::{ExecutorParam, ExecutorParams, ExecutorParamsHash};
#[cfg(test)]
mod tests {
use super::*;
-3
View File
@@ -17,6 +17,3 @@
//! Staging Primitives.
// Put any primitives used by staging APIs functions here
pub mod executor_params;
pub use executor_params::{ExecutorParam, ExecutorParams, ExecutorParamsHash};