Skip to main content

midnight_circuits/
lib.rs

1// This file is part of MIDNIGHT-ZK.
2// Copyright (C) 2025 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
23pub mod instructions;
24mod utils;
25
26pub mod biguint;
27pub mod ecc;
28pub mod external;
29pub mod field;
30pub mod hash;
31pub mod map;
32pub mod parsing;
33pub mod vec;
34pub mod verifier;
35
36// Re-exporting modules for convenience and usability.
37pub use midnight_proofs;
38
39/// Tools useful for testing
40pub mod testing_utils {
41    pub use crate::utils::ecdsa;
42    #[cfg(any(test, feature = "testing"))]
43    pub use crate::utils::{
44        types::{Invertible, Sampleable},
45        util::FromScratch,
46    };
47}
48
49/// Types for assigned circuit values and non-assigned counterparts, and traits
50/// for treating with them generically.
51pub mod types {
52    pub use crate::{
53        biguint::AssignedBigUint,
54        ecc::{
55            foreign::AssignedForeignPoint,
56            native::{AssignedNativePoint, AssignedScalarOfNativeCurve},
57        },
58        field::{
59            foreign::AssignedField,
60            native::{AssignedBit, AssignedByte},
61            AssignedNative,
62        },
63        utils::{
64            types::{InnerConstants, InnerValue, Instantiable},
65            ComposableChip,
66        },
67        vec::{AssignedVector, Vectorizable},
68    };
69}