Return fault on duplicate broadcast values. Remove obsolete TODOs.

This commit is contained in:
Andreas Fackler 2018-10-24 14:48:21 +02:00 committed by Andreas Fackler
parent 493b946a4a
commit 26ef33e4d1
4 changed files with 9 additions and 6 deletions

View File

@ -191,9 +191,11 @@ impl<N: NodeIdT> Broadcast<N> {
}
if self.echo_sent {
info!("Node {:?} received multiple Values.", self.netinfo.our_id());
// TODO: should receiving two Values from a node be considered
// a fault? If so, return a `Fault` here. For now, ignore.
return Ok(Step::default());
if self.echos.get(self.our_id()) == Some(&p) {
return Ok(Step::default());
} else {
return Ok(Fault::new(sender_id.clone(), FaultKind::MultipleValues).into());
}
}
// If the proof is invalid, log the faulty node behavior and ignore.

View File

@ -92,7 +92,8 @@ where
})
}
// TODO: Document and return fault logs?
/// Inserts committed votes into the counter, if they have higher numbers than the existing
/// ones.
pub fn add_committed_votes<I>(
&mut self,
proposer_id: &N,

View File

@ -37,6 +37,8 @@ pub enum FaultKind {
MultipleDecryptionShares,
/// `Broadcast` received a `Value` from a node other than the proposer.
ReceivedValueFromNonProposer,
/// `Broadcast` received multiple different `Value`s from the proposer.
MultipleValues,
/// `Broadcast` recevied an Echo message containing an invalid proof.
InvalidProof,
/// `HoneyBadger` could not deserialize bytes (i.e. a serialized Batch)

View File

@ -112,8 +112,6 @@
//! `Deserialize` traits so they can be easily serialized or included as part of other serializable
//! types.
// TODO: Remove this once https://github.com/rust-lang-nursery/error-chain/issues/245 is resolved.
#![allow(renamed_and_removed_lints)]
// We put algorithm structs in `src/algorithm/algorithm.rs`.
#![cfg_attr(feature = "cargo-clippy", allow(module_inception))]