Skip to content

Commit

Permalink
More logs in is_potential_spam from dispute-coordinator (#5252)
Browse files Browse the repository at this point in the history
Add more logs in `is_potential_spam` revealing why a statement was
marked as a spam.

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
  • Loading branch information
tdimitrov and bkchr authored Aug 16, 2024
1 parent 80c3c1f commit dbd194a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
13 changes: 13 additions & 0 deletions polkadot/node/core/dispute-coordinator/src/initialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,12 @@ impl Initialized {
}
}
for validator_index in new_state.votes().invalid.keys() {
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
?validator_index,
"Disabled offchain for voting invalid against a valid candidate",
);
self.offchain_disabled_validators
.insert_against_valid(session, *validator_index);
}
Expand All @@ -1375,6 +1381,13 @@ impl Initialized {
}
for (validator_index, (kind, _sig)) in new_state.votes().valid.raw() {
let is_backer = kind.is_backing();
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
?validator_index,
?is_backer,
"Disabled offchain for voting valid for an invalid candidate",
);
self.offchain_disabled_validators.insert_for_invalid(
session,
*validator_index,
Expand Down
12 changes: 12 additions & 0 deletions polkadot/node/core/dispute-coordinator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,18 @@ pub fn is_potential_spam(
let all_invalid_votes_disabled = vote_state.invalid_votes_all_disabled(is_disabled);
let ignore_disabled = !is_confirmed && all_invalid_votes_disabled;

gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?is_disputed,
?is_included,
?is_backed,
?is_confirmed,
?all_invalid_votes_disabled,
?ignore_disabled,
"Checking for potential spam"
);

(is_disputed && !is_included && !is_backed && !is_confirmed) || ignore_disabled
}

Expand Down
11 changes: 11 additions & 0 deletions prdoc/pr_5252.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: Additional logging in `dispute-coordinator` subsystem

doc:
- audience: Node Dev
description: |
Additional logging in `dispute-coordinator` subsystem tracing the list of offchain disabled
validators and the reason why an import statement is considered spam.

crates:
- name: polkadot-node-core-dispute-coordinator
bump: patch

0 comments on commit dbd194a

Please sign in to comment.