Skip to content

Commit

Permalink
Merge branch 'master' into dedupe-public-inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Feb 17, 2023
2 parents a17b693 + 4d3d35b commit 8e01812
Show file tree
Hide file tree
Showing 12 changed files with 342 additions and 282 deletions.
157 changes: 112 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/nargo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[package]
name = "nargo"
description = "Noir's package manager"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand All @@ -24,7 +25,7 @@ cfg-if.workspace = true
toml.workspace = true
serde.workspace = true
thiserror.workspace = true
clap = "2.33.3"
clap = { version = "4.1.4", features = ["derive"]}
const_format = "0.2.30"
hex = "0.4.2"
termcolor = "1.1.2"
Expand Down
20 changes: 11 additions & 9 deletions crates/nargo/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
use crate::{errors::CliError, resolver::Resolver};
use acvm::ProofSystemCompiler;
use clap::ArgMatches;
use clap::Args;
use iter_extended::btree_map;
use noirc_abi::{Abi, AbiParameter, AbiType};
use std::{
collections::BTreeMap,
path::{Path, PathBuf},
};

use super::{add_std_lib, write_to_file};
use super::{add_std_lib, write_to_file, NargoConfig};
use crate::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE};

pub(crate) fn run(args: ArgMatches) -> Result<(), CliError> {
let args = args.subcommand_matches("check").unwrap();
let allow_warnings = args.is_present("allow-warnings");

let program_dir =
args.value_of("path").map_or_else(|| std::env::current_dir().unwrap(), PathBuf::from);
/// Checks the constraint system for errors
#[derive(Debug, Clone, Args)]
pub(crate) struct CheckCommand {
/// Issue a warning for each unused variable instead of an error
#[arg(short, long)]
allow_warnings: bool,
}

check_from_path(program_dir, allow_warnings)?;
pub(crate) fn run(args: CheckCommand, config: NargoConfig) -> Result<(), CliError> {
check_from_path(config.program_dir, args.allow_warnings)?;
println!("Constraint system successfully built!");
Ok(())
}
Expand Down
40 changes: 25 additions & 15 deletions crates/nargo/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
use acvm::ProofSystemCompiler;
use acvm::{acir::circuit::Circuit, hash_constraint_system};
use clap::ArgMatches;
use noirc_abi::input_parser::Format;
use std::path::{Path, PathBuf};

use super::{add_std_lib, create_named_dir, read_inputs_from_file, write_to_file};
use clap::Args;

use crate::{
cli::execute_cmd::save_witness_to_dir,
cli::{execute_cmd::save_witness_to_dir, read_inputs_from_file},
constants::{ACIR_EXT, PK_EXT, PROVER_INPUT_FILE, TARGET_DIR, VK_EXT},
errors::CliError,
resolver::Resolver,
};

pub(crate) fn run(args: ArgMatches) -> Result<(), CliError> {
let args = args.subcommand_matches("compile").unwrap();
let circuit_name = args.value_of("circuit_name").unwrap();
let witness = args.is_present("witness");
let allow_warnings = args.is_present("allow-warnings");
let program_dir =
args.value_of("path").map_or_else(|| std::env::current_dir().unwrap(), PathBuf::from);
use super::{add_std_lib, create_named_dir, write_to_file, NargoConfig};

/// Compile the program and its secret execution trace into ACIR format
#[derive(Debug, Clone, Args)]
pub(crate) struct CompileCommand {
/// The name of the ACIR file
circuit_name: String,

/// Solve the witness and write it to file along with the ACIR
#[arg(short, long)]
witness: bool,

/// Issue a warning for each unused variable instead of an error
#[arg(short, long)]
allow_warnings: bool,
}

let mut circuit_path = program_dir.clone();
pub(crate) fn run(args: CompileCommand, config: NargoConfig) -> Result<(), CliError> {
let mut circuit_path = config.program_dir.clone();
circuit_path.push(TARGET_DIR);

generate_circuit_and_witness_to_disk(
circuit_name,
program_dir,
&args.circuit_name,
config.program_dir,
circuit_path,
witness,
allow_warnings,
args.witness,
args.allow_warnings,
)
.map(|_| ())
}
Expand Down
Loading

0 comments on commit 8e01812

Please sign in to comment.