mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
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:
@@ -37,10 +37,10 @@ use polkadot_node_subsystem::{
|
||||
ApprovalVotingMessage, BlockDescription, ChainSelectionMessage, DisputeCoordinatorMessage,
|
||||
DisputeDistributionMessage, ImportStatementsResult,
|
||||
},
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, OverseerSignal,
|
||||
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, RuntimeApiError,
|
||||
};
|
||||
use polkadot_node_subsystem_util::runtime::{
|
||||
key_ownership_proof, submit_report_dispute_lost, RuntimeInfo,
|
||||
self, key_ownership_proof, submit_report_dispute_lost, RuntimeInfo,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
vstaging, BlockNumber, CandidateHash, CandidateReceipt, CompactStatement, DisputeStatement,
|
||||
@@ -424,8 +424,19 @@ impl Initialized {
|
||||
dispute_proofs.push(dispute_proof);
|
||||
},
|
||||
Ok(None) => {},
|
||||
Err(error) => {
|
||||
Err(runtime::Error::RuntimeRequest(RuntimeApiError::NotSupported {
|
||||
..
|
||||
})) => {
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?session_index,
|
||||
?candidate_hash,
|
||||
?validator_id,
|
||||
"Key ownership proof not yet supported.",
|
||||
);
|
||||
},
|
||||
Err(error) => {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
?error,
|
||||
?session_index,
|
||||
@@ -480,6 +491,16 @@ impl Initialized {
|
||||
.await;
|
||||
|
||||
match res {
|
||||
Err(runtime::Error::RuntimeRequest(RuntimeApiError::NotSupported {
|
||||
..
|
||||
})) => {
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?session_index,
|
||||
?candidate_hash,
|
||||
"Reporting pending slash not yet supported",
|
||||
);
|
||||
},
|
||||
Err(error) => {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
|
||||
@@ -25,13 +25,13 @@ use lru::LruCache;
|
||||
use polkadot_node_primitives::{DISPUTE_CANDIDATE_LIFETIME_AFTER_FINALIZATION, MAX_FINALITY_LAG};
|
||||
use polkadot_node_subsystem::{
|
||||
messages::ChainApiMessage, overseer, ActivatedLeaf, ActiveLeavesUpdate, ChainApiError,
|
||||
SubsystemSender,
|
||||
RuntimeApiError, SubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util::runtime::{
|
||||
get_candidate_events, get_on_chain_votes, get_unapplied_slashes,
|
||||
self, get_candidate_events, get_on_chain_votes, get_unapplied_slashes,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
vstaging, BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash,
|
||||
slashing::PendingSlashes, BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash,
|
||||
ScrapedOnChainVotes, SessionIndex,
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ const LRU_OBSERVED_BLOCKS_CAPACITY: NonZeroUsize = match NonZeroUsize::new(20) {
|
||||
pub struct ScrapedUpdates {
|
||||
pub on_chain_votes: Vec<ScrapedOnChainVotes>,
|
||||
pub included_receipts: Vec<CandidateReceipt>,
|
||||
pub unapplied_slashes: Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>,
|
||||
pub unapplied_slashes: Vec<(SessionIndex, CandidateHash, PendingSlashes)>,
|
||||
}
|
||||
|
||||
impl ScrapedUpdates {
|
||||
@@ -270,8 +270,15 @@ impl ChainScraper {
|
||||
Ok(unapplied_slashes) => {
|
||||
scraped_updates.unapplied_slashes = unapplied_slashes;
|
||||
},
|
||||
Err(error) => {
|
||||
Err(runtime::Error::RuntimeRequest(RuntimeApiError::NotSupported { .. })) => {
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
block_hash = ?activated.hash,
|
||||
"Fetching unapplied slashes not yet supported.",
|
||||
);
|
||||
},
|
||||
Err(error) => {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
block_hash = ?activated.hash,
|
||||
?error,
|
||||
|
||||
@@ -39,7 +39,7 @@ use polkadot_node_primitives::{
|
||||
SignedDisputeStatement, SignedFullStatement, ValidationResult,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
vstaging, AuthorityDiscoveryId, BackedCandidate, BlockNumber, CandidateEvent, CandidateHash,
|
||||
slashing, AuthorityDiscoveryId, BackedCandidate, BlockNumber, CandidateEvent, CandidateHash,
|
||||
CandidateIndex, CandidateReceipt, CollatorId, CommittedCandidateReceipt, CoreState,
|
||||
DisputeState, ExecutorParams, GroupIndex, GroupRotationInfo, Hash, Header as BlockHeader,
|
||||
Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, MultiDisputeStatementSet,
|
||||
@@ -607,21 +607,18 @@ pub enum RuntimeApiRequest {
|
||||
/// Returns all on-chain disputes at given block number. Available in `v3`.
|
||||
Disputes(RuntimeApiSender<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>>),
|
||||
/// Returns a list of validators that lost a past session dispute and need to be slashed.
|
||||
/// `VStaging`
|
||||
/// `V5`
|
||||
UnappliedSlashes(
|
||||
RuntimeApiSender<Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>>,
|
||||
RuntimeApiSender<Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)>>,
|
||||
),
|
||||
/// Returns a merkle proof of a validator session key.
|
||||
/// `VStaging`
|
||||
KeyOwnershipProof(
|
||||
ValidatorId,
|
||||
RuntimeApiSender<Option<vstaging::slashing::OpaqueKeyOwnershipProof>>,
|
||||
),
|
||||
/// `V5`
|
||||
KeyOwnershipProof(ValidatorId, RuntimeApiSender<Option<slashing::OpaqueKeyOwnershipProof>>),
|
||||
/// Submits an unsigned extrinsic to slash validator who lost a past session dispute.
|
||||
/// `VStaging`
|
||||
/// `V5`
|
||||
SubmitReportDisputeLost(
|
||||
vstaging::slashing::DisputeProof,
|
||||
vstaging::slashing::OpaqueKeyOwnershipProof,
|
||||
slashing::DisputeProof,
|
||||
slashing::OpaqueKeyOwnershipProof,
|
||||
RuntimeApiSender<Option<()>>,
|
||||
),
|
||||
}
|
||||
@@ -632,17 +629,17 @@ impl RuntimeApiRequest {
|
||||
/// `Disputes`
|
||||
pub const DISPUTES_RUNTIME_REQUIREMENT: u32 = 3;
|
||||
|
||||
/// `UnappliedSlashes`
|
||||
pub const UNAPPLIED_SLASHES_RUNTIME_REQUIREMENT: u32 = 4;
|
||||
|
||||
/// `ExecutorParams`
|
||||
pub const EXECUTOR_PARAMS_RUNTIME_REQUIREMENT: u32 = 4;
|
||||
|
||||
/// `UnappliedSlashes`
|
||||
pub const UNAPPLIED_SLASHES_RUNTIME_REQUIREMENT: u32 = 5;
|
||||
|
||||
/// `KeyOwnershipProof`
|
||||
pub const KEY_OWNERSHIP_PROOF_RUNTIME_REQUIREMENT: u32 = 4;
|
||||
pub const KEY_OWNERSHIP_PROOF_RUNTIME_REQUIREMENT: u32 = 5;
|
||||
|
||||
/// `SubmitReportDisputeLost`
|
||||
pub const SUBMIT_REPORT_DISPUTE_LOST_RUNTIME_REQUIREMENT: u32 = 4;
|
||||
pub const SUBMIT_REPORT_DISPUTE_LOST_RUNTIME_REQUIREMENT: u32 = 5;
|
||||
}
|
||||
|
||||
/// A message to the Runtime API subsystem.
|
||||
|
||||
@@ -29,7 +29,7 @@ use polkadot_node_subsystem::{
|
||||
messages::{RuntimeApiMessage, RuntimeApiRequest, RuntimeApiSender},
|
||||
overseer, SubsystemSender,
|
||||
};
|
||||
use polkadot_primitives::ExecutorParams;
|
||||
use polkadot_primitives::{slashing, ExecutorParams};
|
||||
|
||||
pub use overseer::{
|
||||
gen::{OrchestraError as OverseerError, Timeout},
|
||||
@@ -42,8 +42,8 @@ use futures::channel::{mpsc, oneshot};
|
||||
use parity_scale_codec::Encode;
|
||||
|
||||
use polkadot_primitives::{
|
||||
vstaging, AuthorityDiscoveryId, CandidateEvent, CandidateHash, CommittedCandidateReceipt,
|
||||
CoreState, EncodeAs, GroupIndex, GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
|
||||
AuthorityDiscoveryId, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState,
|
||||
EncodeAs, GroupIndex, GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
|
||||
PersistedValidationData, ScrapedOnChainVotes, SessionIndex, SessionInfo, Signed,
|
||||
SigningContext, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
|
||||
ValidatorSignature,
|
||||
@@ -212,9 +212,9 @@ specialize_requests! {
|
||||
-> Option<ValidationCodeHash>; ValidationCodeHash;
|
||||
fn request_on_chain_votes() -> Option<ScrapedOnChainVotes>; FetchOnChainVotes;
|
||||
fn request_session_executor_params(session_index: SessionIndex) -> Option<ExecutorParams>;SessionExecutorParams;
|
||||
fn request_unapplied_slashes() -> Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>; UnappliedSlashes;
|
||||
fn request_key_ownership_proof(validator_id: ValidatorId) -> Option<vstaging::slashing::OpaqueKeyOwnershipProof>; KeyOwnershipProof;
|
||||
fn request_submit_report_dispute_lost(dp: vstaging::slashing::DisputeProof, okop: vstaging::slashing::OpaqueKeyOwnershipProof) -> Option<()>; SubmitReportDisputeLost;
|
||||
fn request_unapplied_slashes() -> Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)>; UnappliedSlashes;
|
||||
fn request_key_ownership_proof(validator_id: ValidatorId) -> Option<slashing::OpaqueKeyOwnershipProof>; KeyOwnershipProof;
|
||||
fn request_submit_report_dispute_lost(dp: slashing::DisputeProof, okop: slashing::OpaqueKeyOwnershipProof) -> Option<()>; SubmitReportDisputeLost;
|
||||
}
|
||||
|
||||
/// Requests executor parameters from the runtime effective at given relay-parent. First obtains
|
||||
|
||||
Reference in New Issue
Block a user