Skip to main content

midnight_circuits/
lib.rs

1// This file is part of MIDNIGHT-ZK.
2// Copyright (C) Midnight Foundation
3// SPDX-License-Identifier: Apache-2.0
4// Licensed under the Apache License, Version 2.0 (the "License");
5// You may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7// http://www.apache.org/licenses/LICENSE-2.0
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14//! Halo2 gadgets implemented for Midnight.
15
16#![deny(rustdoc::broken_intra_doc_links)]
17#![deny(missing_debug_implementations)]
18#![deny(missing_docs)]
19
20#[doc = include_str!("../README.md")]
21extern crate core;
22
23mod circuit_field;
24pub mod instructions;
25mod utils;
26
27pub use circuit_field::CircuitField;
28
29pub mod biguint;
30pub mod ecc;
31pub mod field;
32pub mod hash;
33pub mod map;
34pub mod parsing;
35pub mod vec;
36pub mod verifier;
37
38// Re-exporting modules for convenience and usability.
39pub use midnight_proofs;
40
41// Useful for importing external circuits
42pub use crate::utils::ComposableChip;
43
44/// Tools useful for testing
45pub mod testing_utils {
46    pub use crate::utils::ecdsa;
47    #[cfg(any(test, feature = "testing"))]
48    pub use crate::{
49        instructions::hash::tests::test_hash,
50        utils::{
51            types::{Invertible, Sampleable},
52            util::FromScratch,
53        },
54    };
55}
56
57/// Types for assigned circuit values and non-assigned counterparts, and traits
58/// for treating with them generically.
59pub mod types {
60    pub use crate::{
61        biguint::AssignedBigUint,
62        ecc::{
63            foreign::weierstrass_chip::AssignedForeignPoint,
64            native::{AssignedNativePoint, AssignedScalarOfNativeCurve},
65        },
66        field::{
67            foreign::AssignedField,
68            native::{AssignedBit, AssignedByte},
69            AssignedNative,
70        },
71        utils::{
72            types::{InnerConstants, InnerValue, Instantiable},
73            ComposableChip,
74        },
75        vec::{AssignedVector, Vectorizable},
76    };
77}