jf_relation/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2022 Espresso Systems (espressosys.com)
// This file is part of the Jellyfish library.

// You should have received a copy of the MIT License
// along with the Jellyfish library. If not, see <https://mit-license.org/>.

//! Interfaces for Plonk-based constraint systems

#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
pub mod constants;
pub mod gadgets;
pub mod gates;

pub mod constraint_system;
pub use constraint_system::*;

use ark_std::string::String;
use displaydoc::Display;
/// A `enum` specifying the possible failure modes of the circuit.
#[derive(Display, Debug)]
pub enum CircuitError {
    /// Failed to create domain
    DomainCreationError,
    /// Variable index {0} is larger than the bound {1}.
    VarIndexOutOfBound(usize, usize),
    /// Public input length {0} doesn't match num_inputs = {1}.
    PubInputLenMismatch(usize, usize),
    /// The {0}-th gate failed: {1}
    GateCheckFailure(usize, String),
    /// Invalid parameters: {0}
    ParameterError(String),
    /// The circuit is not finalized before doing arithmetization
    UnfinalizedCircuit,
    /// Attempt to modify the finalized circuit
    ModifyFinalizedCircuit,
    /// The circuit has wrong Plonk type
    WrongPlonkType,
    /// The circuit does not support lookup
    LookupUnsupported,
    /// Failed to get array value by index
    IndexError,
    /// Algebra over field failed: {0}
    FieldAlgebraError(String),
    #[rustfmt::skip]
    /// Unexpected field for elliptic curve operation, currently only support Bn254, BLS12-381/377 scalar field
    UnsupportedCurve,
    #[rustfmt::skip]
    /// ‼ ️Internal error! Please report to Crypto Team immediately!\n\Message: {0}
    InternalError(String),
    /// Feature not supported: {0}
    NotSupported(String),
}

impl ark_std::error::Error for CircuitError {}