Skip to main content

noirc_driver/
program.rs

1use std::collections::BTreeMap;
2
3use acvm::{FieldElement, acir::circuit::Program};
4use fm::FileId;
5
6use noirc_errors::debug_info::DebugInfo;
7use noirc_evaluator::errors::SsaReport;
8use serde::{Deserialize, Serialize};
9
10use super::debug::DebugFile;
11
12#[derive(Debug, Serialize, Deserialize, Clone, Hash)]
13pub struct CompiledProgram {
14    pub noir_version: String,
15    /// Hash of the [`Program`][noirc_frontend::monomorphization::ast::Program] from which this [`CompiledProgram`]
16    /// was compiled.
17    ///
18    /// Used to short-circuit compilation in the case of the source code not changing since the last compilation.
19    pub hash: u64,
20
21    #[serde(
22        serialize_with = "Program::serialize_program_base64",
23        deserialize_with = "Program::deserialize_program_base64"
24    )]
25    pub program: Program<FieldElement>,
26    pub abi: noirc_abi::Abi,
27    pub debug: Vec<DebugInfo>,
28    pub file_map: BTreeMap<FileId, DebugFile>,
29    pub warnings: Vec<SsaReport>,
30    /// Names of the functions in the program. These are used for more informative debugging and benchmarking.
31    pub names: Vec<String>,
32    /// Names of the unconstrained functions in the program.
33    pub brillig_names: Vec<String>,
34}