Move vstaging to production (#7341)

* Move vstaging to production (and thus past session slashing).

WIP: test-runtime still needs to be fixed.

* Fix test-runtime.

---------

Co-authored-by: eskimor <eskimor@no-such-url.com>
This commit is contained in:
eskimor
2023-06-12 13:15:37 +02:00
committed by GitHub
parent d90173e438
commit 4527f24735
21 changed files with 236 additions and 122 deletions
+14 -14
View File
@@ -19,8 +19,8 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
// `v4` is currently the latest stable version of the runtime API.
pub mod v4;
// `v5` is currently the latest stable version of the runtime API.
pub mod v5;
// The 'staging' version is special - it contains primitives which are
// still in development. Once they are considered stable, they will be
@@ -33,18 +33,18 @@ 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 v4::{
pub use v5::{
byzantine_threshold, check_candidate_backing, collator_signature_payload, metric_definitions,
supermajority_threshold, well_known_keys, AbridgedHostConfiguration, AbridgedHrmpChannel,
AccountId, AccountIndex, AccountPublic, ApprovalVote, AssignmentId, AuthorityDiscoveryId,
AvailabilityBitfield, BackedCandidate, Balance, BlakeTwo256, Block, BlockId, BlockNumber,
CandidateCommitments, CandidateDescriptor, CandidateEvent, CandidateHash, CandidateIndex,
CandidateReceipt, CheckedDisputeStatementSet, CheckedMultiDisputeStatementSet, CollatorId,
CollatorSignature, CommittedCandidateReceipt, CompactStatement, ConsensusLog, CoreIndex,
CoreOccupied, CoreState, DisputeState, DisputeStatement, DisputeStatementSet, DownwardMessage,
EncodeAs, ExecutorParam, ExecutorParams, ExecutorParamsHash, ExplicitDisputeStatement,
GroupIndex, GroupRotationInfo, Hash, HashT, HeadData, Header, HrmpChannelId, Id,
InboundDownwardMessage, InboundHrmpMessage, IndexedVec, InherentData,
slashing, supermajority_threshold, well_known_keys, AbridgedHostConfiguration,
AbridgedHrmpChannel, AccountId, AccountIndex, AccountPublic, ApprovalVote, AssignmentId,
AuthorityDiscoveryId, AvailabilityBitfield, BackedCandidate, Balance, BlakeTwo256, Block,
BlockId, BlockNumber, CandidateCommitments, CandidateDescriptor, CandidateEvent, CandidateHash,
CandidateIndex, CandidateReceipt, CheckedDisputeStatementSet, CheckedMultiDisputeStatementSet,
CollatorId, CollatorSignature, CommittedCandidateReceipt, CompactStatement, ConsensusLog,
CoreIndex, CoreOccupied, CoreState, DisputeState, DisputeStatement, DisputeStatementSet,
DownwardMessage, 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,
@@ -60,4 +60,4 @@ pub use v4::{
};
#[cfg(feature = "std")]
pub use v4::{AssignmentPair, CollatorPair, ValidatorPair};
pub use v5::{AssignmentPair, CollatorPair, ValidatorPair};
+4 -4
View File
@@ -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(4)]
#[api_version(5)]
pub trait ParachainHost<H: Encode + Decode = pcp::v2::Hash, N: Encode + Decode = pcp::v2::BlockNumber> {
/// Get the current validators.
fn validators() -> Vec<ValidatorId>;
@@ -220,18 +220,18 @@ sp_api::decl_runtime_apis! {
fn session_executor_params(session_index: SessionIndex) -> Option<ExecutorParams>;
/// Returns a list of validators that lost a past session dispute and need to be slashed.
#[api_version(5)]
/// NOTE: This function is only available since parachain host version 5.
fn unapplied_slashes() -> Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>;
/// Returns a merkle proof of a validator session key.
#[api_version(5)]
/// NOTE: This function is only available since parachain host version 5.
fn key_ownership_proof(
validator_id: ValidatorId,
) -> Option<vstaging::slashing::OpaqueKeyOwnershipProof>;
/// Submit an unsigned extrinsic to slash validators who lost a dispute about
/// a candidate of a past session.
#[api_version(5)]
/// NOTE: This function is only available since parachain host version 5.
fn submit_report_dispute_lost(
dispute_proof: vstaging::slashing::DisputeProof,
key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof,
@@ -57,6 +57,8 @@ pub use sp_staking::SessionIndex;
mod signed;
pub use signed::{EncodeAs, Signed, UncheckedSigned};
pub mod slashing;
mod metrics;
pub use metrics::{
metric_definitions, RuntimeMetricLabel, RuntimeMetricLabelValue, RuntimeMetricLabelValues,
@@ -16,7 +16,7 @@
//! Primitives types used for dispute slashing.
use crate::v4::{CandidateHash, SessionIndex, ValidatorId, ValidatorIndex};
use crate::{CandidateHash, SessionIndex, ValidatorId, ValidatorIndex};
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_std::{collections::btree_map::BTreeMap, vec::Vec};
+2 -2
View File
@@ -17,8 +17,7 @@
//! Staging Primitives.
// Put any primitives used by staging APIs functions here
pub use crate::v4::*;
pub mod slashing;
pub use crate::v5::*;
use sp_std::prelude::*;
use parity_scale_codec::{Decode, Encode};
@@ -37,6 +36,7 @@ use scale_info::TypeInfo;
serde::Serialize,
serde::Deserialize,
)]
pub struct AsyncBackingParams {
/// 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