Skip to content

Commit

Permalink
Test the reordering attack on BinaryAgreement using net framework
Browse files Browse the repository at this point in the history
  • Loading branch information
d33a94975ba60d59 committed Oct 27, 2018
1 parent 26e6590 commit 9f6a519
Show file tree
Hide file tree
Showing 5 changed files with 474 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/binary_agreement/binary_agreement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use super::bool_multimap::BoolMultimap;
use super::bool_set::BoolSet;
use super::sbv_broadcast::{self, SbvBroadcast};
use super::{Error, Message, MessageContent, Nonce, Result, Step};
use coin::{self, Coin, CoinMessage};
pub use coin::{self, Coin, CoinMessage};
use {DistAlgorithm, NetworkInfo, NodeIdT, Target};

/// The state of the current epoch's coin. In some epochs this is fixed, in others it starts
/// with in `InProgress`.
#[derive(Debug)]
enum CoinState<N> {
pub enum CoinState<N> {
/// The value was fixed in the current epoch, or the coin has already terminated.
Decided(bool),
/// The coin value is not known yet.
Expand All @@ -20,7 +20,7 @@ enum CoinState<N> {

impl<N> CoinState<N> {
/// Returns the value, if this coin has already decided.
fn value(&self) -> Option<bool> {
pub fn value(&self) -> Option<bool> {
match self {
CoinState::Decided(value) => Some(*value),
CoinState::InProgress(_) => None,
Expand Down
7 changes: 4 additions & 3 deletions src/binary_agreement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ mod sbv_broadcast;
use rand;

use self::bool_set::BoolSet;
use coin::{self, CoinMessage};
pub use coin::{self, Coin, CoinMessage};

pub use self::binary_agreement::BinaryAgreement;
pub use self::binary_agreement::{CoinState, BinaryAgreement};
pub use self::sbv_broadcast::Message as SbvMessage;

/// An Binary Agreement error.
#[derive(Clone, Eq, PartialEq, Debug, Fail)]
Expand Down Expand Up @@ -148,7 +149,7 @@ impl rand::Rand for MessageContent {
}

#[derive(Clone, Debug)]
struct Nonce(Vec<u8>);
pub struct Nonce(Vec<u8>);

impl Nonce {
pub fn new(
Expand Down
Loading

0 comments on commit 9f6a519

Please sign in to comment.