mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 00:28:01 +00:00
polkompanion 6667: past session slashing (#2160)
* polkompanion 6667: past session slashing
* fix imports
* fix incorrect merge
* implement staging methods on RPC client
* update lockfile for {"polkadot", "substrate"}
---------
Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+263
-269
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@ use cumulus_relay_chain_rpc_interface::RelayChainRpcClient;
|
||||
use futures::{Stream, StreamExt};
|
||||
use polkadot_core_primitives::{Block, BlockNumber, Hash, Header};
|
||||
use polkadot_overseer::RuntimeApiSubsystemClient;
|
||||
use polkadot_primitives::vstaging;
|
||||
use sc_authority_discovery::{AuthorityDiscovery, Error as AuthorityDiscoveryError};
|
||||
use sp_api::{ApiError, RuntimeApiInfo};
|
||||
|
||||
@@ -297,7 +298,41 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
|
||||
)>,
|
||||
ApiError,
|
||||
> {
|
||||
Ok(self.rpc_client.parachain_host_staging_get_disputes(at).await?)
|
||||
Ok(self.rpc_client.parachain_host_disputes(at).await?)
|
||||
}
|
||||
|
||||
async fn unapplied_slashes(
|
||||
&self,
|
||||
at: Hash,
|
||||
) -> Result<
|
||||
Vec<(
|
||||
polkadot_primitives::SessionIndex,
|
||||
polkadot_primitives::CandidateHash,
|
||||
vstaging::slashing::PendingSlashes,
|
||||
)>,
|
||||
ApiError,
|
||||
> {
|
||||
Ok(self.rpc_client.parachain_host_unapplied_slashes(at).await?)
|
||||
}
|
||||
|
||||
async fn key_ownership_proof(
|
||||
&self,
|
||||
at: Hash,
|
||||
validator_id: polkadot_primitives::ValidatorId,
|
||||
) -> Result<Option<vstaging::slashing::OpaqueKeyOwnershipProof>, ApiError> {
|
||||
Ok(self.rpc_client.parachain_host_key_ownership_proof(at, validator_id).await?)
|
||||
}
|
||||
|
||||
async fn submit_report_dispute_lost(
|
||||
&self,
|
||||
at: Hash,
|
||||
dispute_proof: vstaging::slashing::DisputeProof,
|
||||
key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof,
|
||||
) -> Result<Option<()>, ApiError> {
|
||||
Ok(self
|
||||
.rpc_client
|
||||
.parachain_host_submit_report_dispute_lost(at, dispute_proof, key_ownership_proof)
|
||||
.await?)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ use sp_storage::StorageKey;
|
||||
|
||||
use cumulus_primitives_core::{
|
||||
relay_chain::{
|
||||
BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
|
||||
vstaging, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
|
||||
CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupRotationInfo,
|
||||
Hash as RelayHash, Header as RelayHeader, InboundHrmpMessage, OccupiedCoreAssumption,
|
||||
PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode,
|
||||
@@ -320,15 +320,62 @@ impl RelayChainRpcClient {
|
||||
}
|
||||
|
||||
/// Returns all onchain disputes.
|
||||
/// This is a staging method! Do not use on production runtimes!
|
||||
pub async fn parachain_host_staging_get_disputes(
|
||||
pub async fn parachain_host_disputes(
|
||||
&self,
|
||||
at: RelayHash,
|
||||
) -> Result<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>, RelayChainError> {
|
||||
self.call_remote_runtime_function("ParachainHost_staging_get_disputes", at, None::<()>)
|
||||
self.call_remote_runtime_function("ParachainHost_disputes", at, None::<()>)
|
||||
.await
|
||||
}
|
||||
|
||||
/// Returns a list of validators that lost a past session dispute and need to be slashed.
|
||||
///
|
||||
/// This is a staging method! Do not use on production runtimes!
|
||||
pub async fn parachain_host_unapplied_slashes(
|
||||
&self,
|
||||
at: RelayHash,
|
||||
) -> Result<
|
||||
Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>,
|
||||
RelayChainError,
|
||||
> {
|
||||
self.call_remote_runtime_function("ParachainHost_unapplied_slashes", at, None::<()>)
|
||||
.await
|
||||
}
|
||||
|
||||
/// Returns a merkle proof of a validator session key in a past session.
|
||||
///
|
||||
/// This is a staging method! Do not use on production runtimes!
|
||||
pub async fn parachain_host_key_ownership_proof(
|
||||
&self,
|
||||
at: RelayHash,
|
||||
validator_id: ValidatorId,
|
||||
) -> Result<Option<vstaging::slashing::OpaqueKeyOwnershipProof>, RelayChainError> {
|
||||
self.call_remote_runtime_function(
|
||||
"ParachainHost_key_ownership_proof",
|
||||
at,
|
||||
Some(validator_id),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
/// Submits an unsigned extrinsic to slash validators who lost a dispute about
|
||||
/// a candidate of a past session.
|
||||
///
|
||||
/// This is a staging method! Do not use on production runtimes!
|
||||
pub async fn parachain_host_submit_report_dispute_lost(
|
||||
&self,
|
||||
at: RelayHash,
|
||||
dispute_proof: vstaging::slashing::DisputeProof,
|
||||
key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof,
|
||||
) -> Result<Option<()>, RelayChainError> {
|
||||
self.call_remote_runtime_function(
|
||||
"ParachainHost_submit_report_dispute_lost",
|
||||
at,
|
||||
Some((dispute_proof, key_ownership_proof)),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn authority_discovery_authorities(
|
||||
&self,
|
||||
at: RelayHash,
|
||||
|
||||
Reference in New Issue
Block a user