1use p256k1::{point::Error as PointError, scalar::Scalar};
2use thiserror::Error;
3
4#[derive(Error, Debug, Clone)]
5pub enum DkgError {
7 #[error("missing shares from {0:?}")]
8 MissingShares(Vec<usize>),
10 #[error("bad IDs {0:?}")]
11 BadIds(Vec<usize>),
13 #[error("not enough shares {0:?}")]
14 NotEnoughShares(Vec<usize>),
16 #[error("bad shares {0:?}")]
17 BadShares(Vec<usize>),
19 #[error("point error {0:?}")]
20 Point(PointError),
22}
23
24impl From<PointError> for DkgError {
25 fn from(e: PointError) -> Self {
26 DkgError::Point(e)
27 }
28}
29
30#[derive(Error, Debug, Clone)]
31pub enum AggregatorError {
33 #[error("bad poly commitment length (expected {0} got {1}")]
34 BadPolyCommitmentLen(usize, usize),
36 #[error("bad poly commitments {0:?}")]
37 BadPolyCommitments(Vec<Scalar>),
39 #[error("bad nonce length (expected {0} got {1}")]
40 BadNonceLen(usize, usize),
42 #[error("bad party keys from {0:?}")]
43 BadPartyKeys(Vec<usize>),
45 #[error("bad party sigs from {0:?}")]
46 BadPartySigs(Vec<usize>),
48 #[error("bad group sig")]
49 BadGroupSig,
51}