[−][src]Trait hbbft::ConsensusProtocol
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.
Required methods
fn handle_input<R: Rng>(
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<CpStep<Self>, Self::Error> where
Self: Sized,
&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,
&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.
Implementors
impl<C, N> ConsensusProtocol for DynamicHoneyBadger<C, N> where
C: Contribution + Serialize + DeserializeOwned,
N: NodeIdT + Serialize + DeserializeOwned,
[src]
C: Contribution + Serialize + DeserializeOwned,
N: NodeIdT + Serialize + DeserializeOwned,
type NodeId = N
type Input = Input<C, N>
type Output = Batch<C, N>
type Message = Message<N>
type Error = Error
type FaultKind = FaultKind
fn handle_input<R: Rng>(
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<Step<C, N>>
[src]
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<Step<C, N>>
fn handle_message<R: Rng>(
&mut self,
sender_id: &Self::NodeId,
msg: Self::Message,
rng: &mut R
) -> Result<Step<C, N>>
[src]
&mut self,
sender_id: &Self::NodeId,
msg: Self::Message,
rng: &mut R
) -> Result<Step<C, N>>
fn terminated(&self) -> bool
[src]
fn our_id(&self) -> &N
[src]
impl<C, N> ConsensusProtocol for HoneyBadger<C, N> where
C: Contribution + Serialize + DeserializeOwned,
N: NodeIdT,
[src]
C: Contribution + Serialize + DeserializeOwned,
N: NodeIdT,
type NodeId = N
type Input = C
type Output = Batch<C, N>
type Message = Message<N>
type Error = Error
type FaultKind = FaultKind
fn handle_input<R: Rng>(
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<Step<C, N>>
[src]
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<Step<C, N>>
fn handle_message<R: Rng>(
&mut self,
sender_id: &Self::NodeId,
message: Self::Message,
_rng: &mut R
) -> Result<Step<C, N>>
[src]
&mut self,
sender_id: &Self::NodeId,
message: Self::Message,
_rng: &mut R
) -> Result<Step<C, N>>
fn terminated(&self) -> bool
[src]
fn our_id(&self) -> &N
[src]
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]
D: SenderQueueableConsensusProtocol + Debug,
D::Message: Clone + SenderQueueableMessage<Epoch = D::Epoch>,
D::NodeId: NodeIdT,
D::Output: SenderQueueableOutput<D::NodeId, D::Epoch>,
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
fn handle_input<R: Rng>(
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<CpStep<Self>, Error<D::Error>>
[src]
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<CpStep<Self>, Error<D::Error>>
fn handle_message<R: Rng>(
&mut self,
sender_id: &D::NodeId,
message: Self::Message,
rng: &mut R
) -> Result<CpStep<Self>, Error<D::Error>>
[src]
&mut self,
sender_id: &D::NodeId,
message: Self::Message,
rng: &mut R
) -> Result<CpStep<Self>, Error<D::Error>>
fn terminated(&self) -> bool
[src]
fn our_id(&self) -> &D::NodeId
[src]
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
fn handle_input<R: Rng>(
&mut self,
input: Self::Input,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
input: Self::Input,
_rng: &mut R
) -> Result<Step<N>>
fn handle_message<R: Rng>(
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
fn terminated(&self) -> bool
[src]
fn our_id(&self) -> &N
[src]
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
fn handle_input<R: Rng>(&mut self, _input: (), _rng: &mut R) -> Result<Step<N>>
[src]
fn handle_message<R: Rng>(
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
fn terminated(&self) -> bool
[src]
fn our_id(&self) -> &N
[src]
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]
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
Receives input from a remote node.
fn terminated(&self) -> bool
[src]
Whether the algorithm has terminated.
fn our_id(&self) -> &Self::NodeId
[src]
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_input<R: Rng>(
&mut self,
input: Self::Input,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
input: Self::Input,
_rng: &mut R
) -> Result<Step<N>>
fn handle_message<R: Rng>(
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
Receive input from a remote node.
fn terminated(&self) -> bool
[src]
Whether the algorithm has terminated.
fn our_id(&self) -> &Self::NodeId
[src]
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
fn handle_input<R: Rng>(
&mut self,
input: Self::Input,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
input: Self::Input,
_rng: &mut R
) -> Result<Step<N>>
fn handle_message<R: Rng>(
&mut self,
sender_id: &N,
message: Message<N>,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
sender_id: &N,
message: Message<N>,
_rng: &mut R
) -> Result<Step<N>>
fn terminated(&self) -> bool
[src]
fn our_id(&self) -> &Self::NodeId
[src]
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]
T: Contribution + Serialize + DeserializeOwned + Clone,
N: NodeIdT + Serialize + DeserializeOwned,
Q: TransactionQueue<T>,
Standard: Distribution<N>,
type NodeId = N
type Input = Input<T, N>
type Output = Batch<T, N>
type Message = Message<N>
type Error = Error
type FaultKind = FaultKind
fn handle_input<R: Rng>(
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<Step<T, N>>
[src]
&mut self,
input: Self::Input,
rng: &mut R
) -> Result<Step<T, N>>
fn handle_message<R: Rng>(
&mut self,
sender_id: &N,
message: Self::Message,
rng: &mut R
) -> Result<Step<T, N>>
[src]
&mut self,
sender_id: &N,
message: Self::Message,
rng: &mut R
) -> Result<Step<T, N>>