Skip to main content

sl_mpc_vrf/
types.rs

1// Copyright (c) Silence Laboratories Pte. Ltd. All Rights Reserved.
2// This software is licensed under the Silence Laboratories License Agreement.
3
4use thiserror::Error;
5
6pub type SessionId = [u8; 32];
7
8/// MPC VRF evaluation errors.
9#[derive(Error, Debug, PartialEq, Eq)]
10pub enum VrfError {
11    #[error("Invalid party ids on messages list")]
12    InvalidParticipantSet,
13    #[error("Invalid input message count")]
14    InvalidMsgCount,
15    #[error("Received duplicate party id")]
16    DuplicatePartyId,
17    #[error("Invalid party id, message from party not in id list")]
18    InvalidMsgPartyId,
19    #[error("Malformed VRF keyshare (party id or public shares length)")]
20    InvalidKeyshare,
21    #[error("Local VRF key validation failed")]
22    InvalidLocalKey,
23    #[error("Party public shares do not sum to K")]
24    InvalidPublicShares,
25    #[error("Consistency hash mismatch from party {0}")]
26    ConsistencyHashMismatch(u8),
27    #[error("Invalid Z point from party {0}")]
28    InvalidZ(u8),
29    #[error("Invalid DH-tuple proof from party {0}")]
30    InvalidDhProof(u8),
31    #[error("Hash-to-curve failed")]
32    HashToCurve,
33    #[error("protocol called out of phase")]
34    InvalidState,
35}