runtime: past session slashing runtime API (#6667)

* runtime/vstaging: unapplied_slashes runtime API

* runtime/vstaging: key_ownership_proof runtime API

* runtime/ParachainHost: submit_report_dispute_lost

* fix key_ownership_proof API

* runtime: submit_report_dispute_lost runtime API

* nits

* Update node/subsystem-types/src/messages.rs

Co-authored-by: Marcin S. <marcin@bytedude.com>

* revert unrelated fmt changes

* post merge fixes

* fix compilation

---------

Co-authored-by: Marcin S. <marcin@bytedude.com>
This commit is contained in:
ordian
2023-05-26 11:35:46 +02:00
committed by GitHub
parent 035b24866c
commit 9bc4f62eff
12 changed files with 441 additions and 96 deletions
+22 -4
View File
@@ -111,10 +111,10 @@
//! from the stable primitives.
use crate::{
BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash, CommittedCandidateReceipt,
CoreState, DisputeState, ExecutorParams, GroupRotationInfo, OccupiedCoreAssumption,
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
ValidatorId, ValidatorIndex, ValidatorSignature,
vstaging, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupRotationInfo,
OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes,
SessionIndex, SessionInfo, ValidatorId, ValidatorIndex, ValidatorSignature,
};
use parity_scale_codec::{Decode, Encode};
use polkadot_core_primitives as pcp;
@@ -218,5 +218,23 @@ sp_api::decl_runtime_apis! {
/// Returns execution parameters for the session.
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)]
fn unapplied_slashes() -> Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>;
/// Returns a merkle proof of a validator session key.
#[api_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)]
fn submit_report_dispute_lost(
dispute_proof: vstaging::slashing::DisputeProof,
key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof,
) -> Option<()>;
}
}