Skip to content

Commit 4be1744

Browse files
committed
Add report validation logic
1 parent dca6470 commit 4be1744

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

crates/iota-core/src/authority/authority_per_epoch_store.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3934,10 +3934,24 @@ impl AuthorityPerEpochStore {
39343934
panic!("process_consensus_transaction called with end-of-publish transaction");
39353935
}
39363936
SequencedConsensusTransactionKind::External(ConsensusTransaction {
3937-
kind: ConsensusTransactionKind::MisbehaviorReport(_authority, _report, _),
3937+
kind: ConsensusTransactionKind::MisbehaviorReport(authority, report, _),
39383938
..
39393939
}) => {
3940-
// Validate report
3940+
let authority_index = self
3941+
.committee
3942+
.authority_index(authority)
3943+
.expect("authority in committee");
3944+
// Check validity of the report
3945+
if !report.verify(self.committee.num_members()) {
3946+
self.scorer.update_invalid_reports_count(authority_index);
3947+
warn!(
3948+
"Received invalid misbehavior report from {:?}",
3949+
authority.concise()
3950+
);
3951+
} else {
3952+
self.scorer
3953+
.update_received_reports_and_score(authority_index, report);
3954+
}
39413955
Ok(ConsensusCertificateResult::ConsensusMessage)
39423956
}
39433957
SequencedConsensusTransactionKind::External(ConsensusTransaction {

0 commit comments

Comments
 (0)