jf_relation/
lib.rs

1// Copyright (c) 2022 Espresso Systems (espressosys.com)
2// This file is part of the Jellyfish library.
3
4// You should have received a copy of the MIT License
5// along with the Jellyfish library. If not, see <https://mit-license.org/>.
6
7//! Interfaces for Plonk-based constraint systems
8
9#![cfg_attr(not(feature = "std"), no_std)]
10#![warn(missing_docs)]
11pub mod constants;
12pub mod gadgets;
13pub mod gates;
14
15pub mod constraint_system;
16pub use constraint_system::*;
17
18use ark_std::string::String;
19use displaydoc::Display;
20/// A `enum` specifying the possible failure modes of the circuit.
21#[derive(Display, Debug)]
22pub enum CircuitError {
23    /// Failed to create domain
24    DomainCreationError,
25    /// Variable index {0} is larger than the bound {1}.
26    VarIndexOutOfBound(usize, usize),
27    /// Public input length {0} doesn't match num_inputs = {1}.
28    PubInputLenMismatch(usize, usize),
29    /// The {0}-th gate failed: {1}
30    GateCheckFailure(usize, String),
31    /// Invalid parameters: {0}
32    ParameterError(String),
33    /// The circuit is not finalized before doing arithmetization
34    UnfinalizedCircuit,
35    /// Attempt to modify the finalized circuit
36    ModifyFinalizedCircuit,
37    /// The circuit has wrong Plonk type
38    WrongPlonkType,
39    /// The circuit does not support lookup
40    LookupUnsupported,
41    /// Failed to get array value by index
42    IndexError,
43    /// Algebra over field failed: {0}
44    FieldAlgebraError(String),
45    #[rustfmt::skip]
46    /// Unexpected field for elliptic curve operation, currently only support Bn254, BLS12-381/377 scalar field
47    UnsupportedCurve,
48    #[rustfmt::skip]
49    /// ‼ ️Internal error! Please report to Crypto Team immediately!\n\Message: {0}
50    InternalError(String),
51    /// Feature not supported: {0}
52    NotSupported(String),
53}
54
55impl ark_std::error::Error for CircuitError {}