mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 23:21:02 +00:00
Warn if participated in the losing side of a dispute (#7404)
* Warn if participated in the losing side of a dispute * Update naming * Additionally filter by candidate hash * Debug zombienet tests * Update 0002-parachains-disputes.zndsl * Debug zombienet * Update node/core/dispute-coordinator/src/initialized.rs Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> * Add checking to zombienet tests --------- Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
@@ -1003,6 +1003,16 @@ impl Initialized {
|
||||
|
||||
gum::trace!(target: LOG_TARGET, ?candidate_hash, ?session, "Loaded votes");
|
||||
|
||||
let controlled_indices = env.controlled_indices();
|
||||
let own_statements = statements
|
||||
.iter()
|
||||
.filter(|(statement, validator_index)| {
|
||||
controlled_indices.contains(validator_index) &&
|
||||
*statement.candidate_hash() == candidate_hash
|
||||
})
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let import_result = {
|
||||
let intermediate_result = old_state.import_statements(&env, statements, now);
|
||||
|
||||
@@ -1307,6 +1317,16 @@ impl Initialized {
|
||||
session,
|
||||
"Dispute on candidate concluded with 'valid' result",
|
||||
);
|
||||
for (statement, validator_index) in own_statements.iter() {
|
||||
if statement.statement().indicates_invalidity() {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
?candidate_hash,
|
||||
?validator_index,
|
||||
"Voted against a candidate that was concluded valid.",
|
||||
);
|
||||
}
|
||||
}
|
||||
self.metrics.on_concluded_valid();
|
||||
}
|
||||
if import_result.is_freshly_concluded_against() {
|
||||
@@ -1316,6 +1336,16 @@ impl Initialized {
|
||||
session,
|
||||
"Dispute on candidate concluded with 'invalid' result",
|
||||
);
|
||||
for (statement, validator_index) in own_statements.iter() {
|
||||
if statement.statement().indicates_validity() {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
?candidate_hash,
|
||||
?validator_index,
|
||||
"Voted for a candidate that was concluded invalid.",
|
||||
);
|
||||
}
|
||||
}
|
||||
self.metrics.on_concluded_invalid();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user