[][src]Trait hbbft::ConsensusProtocol

pub trait ConsensusProtocol: Send + Sync {
    type NodeId: NodeIdT;
    type Input;
    type Output;
    type Message: Message;
    type Error: Fail;
    type FaultKind: FaultT;
    fn handle_input<R: Rng>(
        &mut self,
        input: Self::Input,
        rng: &mut R
    ) -> Result<CpStep<Self>, Self::Error>
    where
        Self: Sized
;
fn handle_message<R: Rng>(
        &mut self,
        sender_id: &Self::NodeId,
        message: Self::Message,
        rng: &mut R
    ) -> Result<CpStep<Self>, Self::Error>
    where
        Self: Sized
;
fn terminated(&self) -> bool;
fn our_id(&self) -> &Self::NodeId; }

A consensus protocol that defines a message flow.

Many algorithms require an RNG which must be supplied on each call. It is up to the caller to ensure that this random number generator is cryptographically secure.

Associated Types

type NodeId: NodeIdT

Unique node identifier.

type Input

The input provided by the user.

type Output

The output type. Some algorithms return an output exactly once, others return multiple times.

type Message: Message

The messages that need to be exchanged between the instances in the participating nodes.

type Error: Fail

The errors that can occur during execution.

type FaultKind: FaultT

The kinds of message faults that can be detected during execution.

Loading content...

Required methods

fn handle_input<R: Rng>(
    &mut self,
    input: Self::Input,
    rng: &mut R
) -> Result<CpStep<Self>, Self::Error> where
    Self: Sized

Handles an input provided by the user, and returns

fn handle_message<R: Rng>(
    &mut self,
    sender_id: &Self::NodeId,
    message: Self::Message,
    rng: &mut R
) -> Result<CpStep<Self>, Self::Error> where
    Self: Sized

Handles a message received from node sender_id.

fn terminated(&self) -> bool

Returns true if execution has completed and this instance can be dropped.

fn our_id(&self) -> &Self::NodeId

Returns this node's own ID.

Loading content...

Implementors

impl<C, N> ConsensusProtocol for DynamicHoneyBadger<C, N> where
    C: Contribution + Serialize + DeserializeOwned,
    N: NodeIdT + Serialize + DeserializeOwned
[src]

type NodeId = N

type Input = Input<C, N>

type Output = Batch<C, N>

type Message = Message<N>

type Error = Error

type FaultKind = FaultKind

impl<C, N> ConsensusProtocol for HoneyBadger<C, N> where
    C: Contribution + Serialize + DeserializeOwned,
    N: NodeIdT
[src]

type NodeId = N

type Input = C

type Output = Batch<C, N>

type Message = Message<N>

type Error = Error

type FaultKind = FaultKind

impl<D> ConsensusProtocol for SenderQueue<D> where
    D: SenderQueueableConsensusProtocol + Debug,
    D::Message: Clone + SenderQueueableMessage<Epoch = D::Epoch>,
    D::NodeId: NodeIdT,
    D::Output: SenderQueueableOutput<D::NodeId, D::Epoch>, 
[src]

type NodeId = D::NodeId

type Input = D::Input

type Output = D::Output

type Message = Message<D::Message>

type Error = Error<D::Error>

type FaultKind = D::FaultKind

impl<N: NodeIdT> ConsensusProtocol for Broadcast<N>[src]

type NodeId = N

type Input = Vec<u8>

type Output = Self::Input

type Message = Message

type Error = Error

type FaultKind = FaultKind

impl<N: NodeIdT> ConsensusProtocol for ThresholdDecrypt<N>[src]

type NodeId = N

type Input = ()

type Output = Vec<u8>

type Message = Message

type Error = Error

type FaultKind = FaultKind

impl<N: NodeIdT> ConsensusProtocol for ThresholdSign<N>[src]

type NodeId = N

type Input = ()

type Output = Signature

type Message = Message

type Error = Error

type FaultKind = FaultKind

fn handle_input<R: Rng>(&mut self, _input: (), _rng: &mut R) -> Result<Step<N>>[src]

Sends our threshold signature share if not yet sent.

fn handle_message<R: Rng>(
    &mut self,
    sender_id: &Self::NodeId,
    message: Message,
    _rng: &mut R
) -> Result<Step<N>>
[src]

Receives input from a remote node.

fn terminated(&self) -> bool[src]

Whether the algorithm has terminated.

impl<N: NodeIdT, S: SessionIdT> ConsensusProtocol for BinaryAgreement<N, S>[src]

type NodeId = N

type Input = bool

type Output = bool

type Message = Message

type Error = Error

type FaultKind = FaultKind

fn handle_message<R: Rng>(
    &mut self,
    sender_id: &Self::NodeId,
    message: Message,
    _rng: &mut R
) -> Result<Step<N>>
[src]

Receive input from a remote node.

fn terminated(&self) -> bool[src]

Whether the algorithm has terminated.

impl<N: NodeIdT, S: SessionIdT> ConsensusProtocol for Subset<N, S>[src]

type NodeId = N

type Input = Vec<u8>

type Output = SubsetOutput<N>

type Message = Message<N>

type Error = Error

type FaultKind = FaultKind

impl<T, N, Q> ConsensusProtocol for QueueingHoneyBadger<T, N, Q> where
    T: Contribution + Serialize + DeserializeOwned + Clone,
    N: NodeIdT + Serialize + DeserializeOwned,
    Q: TransactionQueue<T>,
    Standard: Distribution<N>, 
[src]

type NodeId = N

type Input = Input<T, N>

type Output = Batch<T, N>

type Message = Message<N>

type Error = Error

type FaultKind = FaultKind

Loading content...