use thiserror::Error;
#[derive(Clone, PartialEq, Eq, Debug, Error)]
pub enum Error {
#[error("Number of participants must be between 1 and 256")]
InvalidNodeCount,
#[error("Instance cannot propose")]
InstanceCannotPropose,
#[error("Multiple inputs received")]
MultipleInputs,
#[error("Proof construction failed")]
ProofConstructionFailed,
#[error("Unknown sender")]
UnknownSender,
}
pub type Result<T> = ::std::result::Result<T, Error>;
#[derive(Clone, Debug, Error, PartialEq, Eq)]
pub enum FaultKind {
#[error("`Broadcast` received a `Value` from a node other than the proposer.")]
ReceivedValueFromNonProposer,
#[error("`Broadcast` received multiple different `Value`s from the proposer.")]
MultipleValues,
#[error("`Broadcast` received multiple different `Echo`s from the same sender.")]
MultipleEchos,
#[error("`Broadcast` received multiple different `EchoHash`s from the same sender.")]
MultipleEchoHashes,
#[error("`Broadcast` received multiple different `Ready`s from the same sender.")]
MultipleReadys,
#[error("`Broadcast` recevied an Echo message containing an invalid proof.")]
InvalidProof,
#[error("`Broadcast` received shards with valid proofs, that couldn't be decoded.")]
BroadcastDecoding,
}