dispute-coordinator: past session dispute slashing (#6811)

* 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

* dispute-coordinator: past session dispute slashing

* encapsule runtime api call for submitting report

* prettify: extract into a function

* do not exit on runtime api error

* fix tests

* try initial zombienet test

* try something

* fix a typo

* try cumulus-based collator

* fix clippy

* build polkadot-debug images with fast-runtime enabled

* wip

* runtime/inclusion: fix availability_threshold

* fix wip

* fix wip II

* revert native provider

* propagate tx submission error

* DEBUG: sync=trace

* print key ownership proof len

* panic repro

* log validator index in panic message

* post merge fixes

* replace debug assertion with a log

* fix compilation

* Let's log the dispatch info in validate block.

* fix double encoding

* Revert "Let's log the dispatch info in validate block."

This reverts commit a70fbc51b464d7f4355dbada5e16cd83cf71eab4.

* Revert "Let's log the dispatch info in validate block."

This reverts commit a70fbc51b464d7f4355dbada5e16cd83cf71eab4.

* fix compilation

* update to latest zombienet and fix test

* lower finality lag to 11

* bump zombienet again

* add a workaround, but still does not work

* Update .gitlab-ci.yml

bump zombienet.

* add a comment and search logs on all nodes

---------

Co-authored-by: Marcin S. <marcin@bytedude.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: Javier Viola <javier@parity.io>
This commit is contained in:
ordian
2023-06-05 18:21:42 +02:00
committed by GitHub
parent f2fe05a757
commit 01a19b45e3
12 changed files with 407 additions and 46 deletions
@@ -27,14 +27,16 @@ use sp_keystore::{Keystore, KeystorePtr};
use polkadot_node_subsystem::{messages::RuntimeApiMessage, overseer, SubsystemSender};
use polkadot_primitives::{
CandidateEvent, CoreState, EncodeAs, GroupIndex, GroupRotationInfo, Hash, IndexedVec,
OccupiedCore, ScrapedOnChainVotes, SessionIndex, SessionInfo, Signed, SigningContext,
UncheckedSigned, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
vstaging, CandidateEvent, CandidateHash, CoreState, EncodeAs, GroupIndex, GroupRotationInfo,
Hash, IndexedVec, OccupiedCore, ScrapedOnChainVotes, SessionIndex, SessionInfo, Signed,
SigningContext, UncheckedSigned, ValidationCode, ValidationCodeHash, ValidatorId,
ValidatorIndex,
};
use crate::{
request_availability_cores, request_candidate_events, request_on_chain_votes,
request_session_index_for_child, request_session_info, request_validation_code_by_hash,
request_availability_cores, request_candidate_events, request_key_ownership_proof,
request_on_chain_votes, request_session_index_for_child, request_session_info,
request_submit_report_dispute_lost, request_unapplied_slashes, request_validation_code_by_hash,
request_validator_groups,
};
@@ -343,3 +345,51 @@ where
recv_runtime(request_validation_code_by_hash(relay_parent, validation_code_hash, sender).await)
.await
}
/// Fetch a list of `PendingSlashes` from the runtime.
pub async fn get_unapplied_slashes<Sender>(
sender: &mut Sender,
relay_parent: Hash,
) -> Result<Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
recv_runtime(request_unapplied_slashes(relay_parent, sender).await).await
}
/// Generate validator key ownership proof.
///
/// Note: The choice of `relay_parent` is important here, it needs to match
/// the desired session index of the validator set in question.
pub async fn key_ownership_proof<Sender>(
sender: &mut Sender,
relay_parent: Hash,
validator_id: ValidatorId,
) -> Result<Option<vstaging::slashing::OpaqueKeyOwnershipProof>>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
recv_runtime(request_key_ownership_proof(relay_parent, validator_id, sender).await).await
}
/// Submit a past-session dispute slashing report.
pub async fn submit_report_dispute_lost<Sender>(
sender: &mut Sender,
relay_parent: Hash,
dispute_proof: vstaging::slashing::DisputeProof,
key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof,
) -> Result<Option<()>>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
recv_runtime(
request_submit_report_dispute_lost(
relay_parent,
dispute_proof,
key_ownership_proof,
sender,
)
.await,
)
.await
}