mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
approval votes checking logs (#3233)
* approval-voting: logs for invalid votes * proper errors for assignment checks * proper errors for approval checks
This commit is contained in:
@@ -624,13 +624,29 @@ impl State {
|
||||
if let Some(peer_knowledge) = entry.known_by.get_mut(&peer_id) {
|
||||
peer_knowledge.received.insert(fingerprint);
|
||||
}
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
?peer_id,
|
||||
"Got an `AcceptedDuplicate` assignment",
|
||||
);
|
||||
return;
|
||||
}
|
||||
AssignmentCheckResult::TooFarInFuture => {
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
?peer_id,
|
||||
"Got an assignment too far in the future",
|
||||
);
|
||||
modify_reputation(ctx, peer_id, COST_ASSIGNMENT_TOO_FAR_IN_THE_FUTURE).await;
|
||||
return;
|
||||
}
|
||||
AssignmentCheckResult::Bad => {
|
||||
AssignmentCheckResult::Bad(error) => {
|
||||
tracing::info!(
|
||||
target: LOG_TARGET,
|
||||
?peer_id,
|
||||
%error,
|
||||
"Got a bad assignment from peer",
|
||||
);
|
||||
modify_reputation(ctx, peer_id, COST_INVALID_MESSAGE).await;
|
||||
return;
|
||||
}
|
||||
@@ -844,11 +860,12 @@ impl State {
|
||||
peer_knowledge.received.insert(fingerprint.clone());
|
||||
}
|
||||
}
|
||||
ApprovalCheckResult::Bad => {
|
||||
ApprovalCheckResult::Bad(error) => {
|
||||
modify_reputation(ctx, peer_id, COST_INVALID_MESSAGE).await;
|
||||
tracing::info!(
|
||||
target: LOG_TARGET,
|
||||
?peer_id,
|
||||
%error,
|
||||
"Got a bad approval from peer",
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
use std::time::Duration;
|
||||
use futures::{future, Future, executor};
|
||||
use assert_matches::assert_matches;
|
||||
use polkadot_node_subsystem::messages::ApprovalCheckError;
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_node_subsystem_util::TimeoutExt as _;
|
||||
use polkadot_node_network_protocol::{view, ObservedRole};
|
||||
@@ -594,7 +595,7 @@ fn import_approval_bad() {
|
||||
tx,
|
||||
)) => {
|
||||
assert_eq!(vote, approval);
|
||||
tx.send(ApprovalCheckResult::Bad).unwrap();
|
||||
tx.send(ApprovalCheckResult::Bad(ApprovalCheckError::UnknownBlock(hash))).unwrap();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user