kyber_rs/share/dkg/
error.rs

1use thiserror::Error;
2
3use crate::{
4    dh::DhError,
5    encoding::MarshallingError,
6    share::{poly::PolyError, vss::VSSError},
7    sign::error::SignatureError,
8};
9
10#[derive(Debug, Error)]
11pub enum DKGError {
12    #[error("marshalling error")]
13    MarshallingError(#[from] MarshallingError),
14    #[error("dh error")]
15    DhError(#[from] DhError),
16    #[error("signature error")]
17    SignatureError(#[from] SignatureError),
18    #[error("polynomial error")]
19    PolyError(#[from] PolyError),
20    #[error("io error")]
21    IoError(#[from] std::io::Error),
22    #[error("vss error")]
23    VSSError(#[from] VSSError),
24    #[error("own public key not found in list of participants")]
25    MissingOwnPublicKey,
26    #[error("dist deal out of bounds index")]
27    DistDealIndexOutOfBounds,
28    #[error("already received dist deal from same index")]
29    DistDealAlreadyProcessed,
30    #[error("unexpected deal for unlisted dealer in new list")]
31    DistDealFromUnlistedDealer,
32    #[error("complaint received but no deal for it")]
33    ComplaintWithoutDeal,
34    #[error("justification received but no deal for it")]
35    JustificationWithoutDeal,
36    #[error("can't give secret commits if deal not certified")]
37    DealNotCertified,
38    #[error("commits should not be none")]
39    MissingCommits,
40    #[error("secret commits received with index out of bounds")]
41    SecretCommitsOutOfBound,
42    #[error("secret commits from a non QUAL member")]
43    SecretCommitsFromNonQUAL,
44    #[error("secret commits received with wrong session id")]
45    SecretCommitsWrongId,
46    #[error("verifier should exists")]
47    MissingVerifier,
48    #[error("deal should exists")]
49    MissingDeal,
50    #[error("commit complaint with unknown issuer")]
51    CommitComplaintUnknownIssuer,
52    #[error("commit complaint from non-qual member")]
53    CommitComplaintNonQUAL,
54    #[error("commit complaint linked to unknown verifier")]
55    CommitComplaintUnknownVerifier,
56    #[error("complaint about non received commitments")]
57    CommitComplaintNoCommits,
58    #[error("invalid complaint, deal verifying")]
59    CommitComplaintInvalid,
60    #[error("complaint linked to non certified deal")]
61    CommitComplaintUncertifiedDeal,
62    #[error("commitments not invalidated by any complaints")]
63    CommitmentsNotInvalidated,
64    #[error("reconstruct commits with invalid verifier index")]
65    ReconstructCommitsInvalidVerifierIndex,
66    #[error("reconstruct commits invalid session id")]
67    ReconstructCommitsInvalidId,
68    #[error("distributed key not certified")]
69    DistributedKeyNotCertified,
70    #[error("deals not found")]
71    DealsNotFound,
72    #[error("protocol not finished")]
73    ProtocolNotFinished(String),
74    #[error("can't run with empty node list")]
75    EmptyNodeList,
76    #[error("resharing config needs old nodes list")]
77    ReshareMissingOldNodes,
78    #[error("resharing case needs old threshold")]
79    ReshareMissingOldThreshold,
80    #[error("can't receive new shares without the public polynomial")]
81    NoPublicPolys,
82    #[error("public key not found in old list or new list")]
83    PublicKeyNotFound,
84    #[error("cannot process own deal")]
85    CannotProcessOwnDeal(String),
86    #[error("own deal gave a complaint")]
87    OwnDealComplaint,
88    #[error("responses received for unknown dealer")]
89    ResponseFromUnknownDealer,
90    #[error("should not expect to compute any dist. share")]
91    ShouldReceive,
92    #[error("share do not correspond to public polynomial")]
93    ShareDoesNotMatchPublicPoly,
94    #[error("duplicate public key in new nodes list")]
95    DuplicatePublicKeyInNewList,
96    #[error("wrong renewal function")]
97    WrongRenewal,
98    #[error("not the same party")]
99    DifferentParty,
100}