You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB

  1. //! Error module.
  2. use crate::pcs::prelude::PCSError;
  3. use arithmetic::ArithErrors;
  4. use ark_std::string::String;
  5. use displaydoc::Display;
  6. use transcript::TranscriptError;
  7. /// A `enum` specifying the possible failure modes of the PolyIOP.
  8. #[derive(Display, Debug)]
  9. pub enum PolyIOPErrors {
  10. /// Invalid Prover: {0}
  11. InvalidProver(String),
  12. /// Invalid Verifier: {0}
  13. InvalidVerifier(String),
  14. /// Invalid Proof: {0}
  15. InvalidProof(String),
  16. /// Invalid parameters: {0}
  17. InvalidParameters(String),
  18. /// Invalid challenge: {0}
  19. InvalidChallenge(String),
  20. /// Should not arrive to this point
  21. ShouldNotArrive,
  22. /// An error during (de)serialization: {0}
  23. SerializationErrors(ark_serialize::SerializationError),
  24. /// Transcript Error: {0}
  25. TranscriptErrors(TranscriptError),
  26. /// Arithmetic Error: {0}
  27. ArithmeticErrors(ArithErrors),
  28. /// PCS error {0}
  29. PCSErrors(PCSError),
  30. }
  31. impl From<ark_serialize::SerializationError> for PolyIOPErrors {
  32. fn from(e: ark_serialize::SerializationError) -> Self {
  33. Self::SerializationErrors(e)
  34. }
  35. }
  36. impl From<TranscriptError> for PolyIOPErrors {
  37. fn from(e: TranscriptError) -> Self {
  38. Self::TranscriptErrors(e)
  39. }
  40. }
  41. impl From<ArithErrors> for PolyIOPErrors {
  42. fn from(e: ArithErrors) -> Self {
  43. Self::ArithmeticErrors(e)
  44. }
  45. }
  46. impl From<PCSError> for PolyIOPErrors {
  47. fn from(e: PCSError) -> Self {
  48. Self::PCSErrors(e)
  49. }
  50. }