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
@@ -462,16 +462,13 @@ pub mod pallet {
) -> DispatchResultWithPostInfo {
ensure_none(origin)?;
let validator_set_count = key_owner_proof.validator_count() as ValidatorSetCount;
// check the membership proof to extract the offender's id
let key = (primitives::PARACHAIN_KEY_TYPE_ID, dispute_proof.validator_id.clone());
let offender = T::KeyOwnerProofSystem::check_proof(key, key_owner_proof)
.ok_or(Error::<T>::InvalidKeyOwnershipProof)?;
let session_index = dispute_proof.time_slot.session_index;
let validator_set_count = crate::session_info::Pallet::<T>::session_info(session_index)
.ok_or(Error::<T>::InvalidSessionIndex)?
.discovery_keys
.len() as ValidatorSetCount;
// check that there is a pending slash for the given
// validator index and candidate hash
@@ -705,22 +702,26 @@ where
};
match SubmitTransaction::<T, Call<T>>::submit_unsigned_transaction(call.into()) {
Ok(()) => log::info!(
target: LOG_TARGET,
"Submitted dispute slashing report, session({}), index({}), kind({:?})",
session_index,
validator_index,
kind,
),
Err(()) => log::error!(
target: LOG_TARGET,
"Error submitting dispute slashing report, session({}), index({}), kind({:?})",
session_index,
validator_index,
kind,
),
Ok(()) => {
log::info!(
target: LOG_TARGET,
"Submitted dispute slashing report, session({}), index({}), kind({:?})",
session_index,
validator_index,
kind,
);
Ok(())
},
Err(()) => {
log::error!(
target: LOG_TARGET,
"Error submitting dispute slashing report, session({}), index({}), kind({:?})",
session_index,
validator_index,
kind,
);
Err(sp_runtime::DispatchError::Other(""))
},
}
Ok(())
}
}