From c261fcdecf403417bb598320426d8bf3a01e0acd Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Mon, 31 Jul 2023 10:03:16 -0700 Subject: [PATCH 01/11] feat!: Require package type be specified in Nargo.toml --- crates/lsp/src/lib.rs | 9 +-- crates/lsp/src/lib_hacky.rs | 6 +- crates/nargo/src/package.rs | 43 +++++++++++++- crates/nargo_cli/src/cli/check_cmd.rs | 52 +++++++++-------- .../nargo_cli/src/cli/codegen_verifier_cmd.rs | 26 +++++---- crates/nargo_cli/src/cli/compile_cmd.rs | 29 +++++----- crates/nargo_cli/src/cli/execute_cmd.rs | 7 +-- crates/nargo_cli/src/cli/info_cmd.rs | 7 +-- crates/nargo_cli/src/cli/init_cmd.rs | 39 +++++++++++-- crates/nargo_cli/src/cli/mod.rs | 7 +-- crates/nargo_cli/src/cli/new_cmd.rs | 15 ++++- crates/nargo_cli/src/cli/prove_cmd.rs | 7 +-- crates/nargo_cli/src/cli/verify_cmd.rs | 25 ++++---- crates/nargo_cli/src/errors.rs | 57 ++++++++++++------- crates/nargo_cli/src/lib.rs | 29 +--------- crates/nargo_cli/src/manifest.rs | 57 +++++++++++++++---- .../target_tests_data/fail/basic/Nargo.toml | 1 + .../fail/dup_func/Nargo.toml | 1 + .../target_tests_data/pass/basic/Nargo.toml | 1 + .../target_tests_data/pass/import/Nargo.toml | 1 + .../pass_dev_mode/unused/Nargo.toml | 1 + .../1327_concrete_in_generic/Nargo.toml | 1 + .../tests/test_data/1_mul/Nargo.toml | 1 + .../tests/test_data/2_div/Nargo.toml | 1 + .../tests/test_data/3_add/Nargo.toml | 1 + .../tests/test_data/4_sub/Nargo.toml | 1 + .../tests/test_data/5_over/Nargo.toml | 1 + crates/nargo_cli/tests/test_data/6/Nargo.toml | 1 + .../tests/test_data/6_array/Nargo.toml | 1 + crates/nargo_cli/tests/test_data/7/Nargo.toml | 1 + .../tests/test_data/7_function/Nargo.toml | 1 + .../tests/test_data/8_integration/Nargo.toml | 1 + .../tests/test_data/9_conditional/Nargo.toml | 1 + .../arithmetic_binary_operations/Nargo.toml | 1 + .../tests/test_data/array_dynamic/Nargo.toml | 1 + .../tests/test_data/array_len/Nargo.toml | 1 + .../tests/test_data/array_neq/Nargo.toml | 1 + .../tests/test_data/array_sort/Nargo.toml | 1 + .../tests/test_data/assert/Nargo.toml | 1 + .../test_data/assert_statement/Nargo.toml | 1 + .../tests/test_data/assign_ex/Nargo.toml | 1 + .../tests/test_data/bit_and/Nargo.toml | 1 + .../test_data/bit_shifts_comptime/Nargo.toml | 1 + .../test_data/bit_shifts_runtime/Nargo.toml | 1 + .../blackbox_func_simple_call/Nargo.toml | 1 + .../tests/test_data/bool_not/Nargo.toml | 1 + .../tests/test_data/bool_or/Nargo.toml | 1 + .../brillig_acir_as_brillig/Nargo.toml | 1 + .../tests/test_data/brillig_arrays/Nargo.toml | 1 + .../tests/test_data/brillig_assert/Nargo.toml | 1 + .../test_data/brillig_assert_fail/Nargo.toml | 1 + .../test_data/brillig_blake2s/Nargo.toml | 1 + .../tests/test_data/brillig_calls/Nargo.toml | 1 + .../test_data/brillig_calls_array/Nargo.toml | 1 + .../brillig_calls_conditionals/Nargo.toml | 1 + .../tests/test_data/brillig_cast/Nargo.toml | 1 + .../test_data/brillig_conditional/Nargo.toml | 1 + .../tests/test_data/brillig_ecdsa/Nargo.toml | 1 + .../Nargo.toml | 1 + .../brillig_fns_as_values/Nargo.toml | 1 + .../brillig_hash_to_field/Nargo.toml | 1 + .../brillig_identity_function/Nargo.toml | 1 + .../Nargo.toml | 1 + .../tests/test_data/brillig_keccak/Nargo.toml | 1 + .../tests/test_data/brillig_loop/Nargo.toml | 1 + .../tests/test_data/brillig_modulo/Nargo.toml | 1 + .../brillig_nested_arrays/Nargo.toml | 1 + .../tests/test_data/brillig_not/Nargo.toml | 1 + .../tests/test_data/brillig_oracle/Nargo.toml | 1 + .../test_data/brillig_pedersen/Nargo.toml | 1 + .../test_data/brillig_recursion/Nargo.toml | 1 + .../test_data/brillig_references/Nargo.toml | 1 + .../test_data/brillig_scalar_mul/Nargo.toml | 1 + .../test_data/brillig_schnorr/Nargo.toml | 1 + .../tests/test_data/brillig_sha256/Nargo.toml | 1 + .../tests/test_data/brillig_slices/Nargo.toml | 1 + .../test_data/brillig_to_be_bytes/Nargo.toml | 1 + .../test_data/brillig_to_bits/Nargo.toml | 1 + .../brillig_to_bytes_integration/Nargo.toml | 1 + .../test_data/brillig_to_le_bytes/Nargo.toml | 1 + .../test_data/brillig_top_level/Nargo.toml | 1 + .../tests/test_data/cast_bool/Nargo.toml | 1 + .../comptime_array_access/Nargo.toml | 1 + .../comptime_recursion_regression/Nargo.toml | 1 + crates/nargo_cli/tests/test_data/config.toml | 8 ++- .../test_data/constant_return/Nargo.toml | 1 + .../tests/test_data/contracts/Nargo.toml | 1 + .../tests/test_data/debug_logs/Nargo.toml | 1 + .../test_data/dep_impl_primitive/Nargo.toml | 1 + .../tests/test_data/depend_on_bin/Nargo.toml | 8 +++ .../tests/test_data/depend_on_bin/Prover.toml | 1 + .../tests/test_data/depend_on_bin/src/main.nr | 5 ++ .../tests/test_data/diamond_deps_0/Nargo.toml | 1 + .../test_data/distinct_keyword/Nargo.toml | 1 + .../tests/test_data/ec_baby_jubjub/Nargo.toml | 1 + .../test_data/ecdsa_secp256k1/Nargo.toml | 1 + .../test_data/ecdsa_secp256r1/Nargo.toml | 1 + .../tests/test_data/generics/Nargo.toml | 1 + .../tests/test_data/global_consts/Nargo.toml | 1 + .../tests/test_data/hash_to_field/Nargo.toml | 1 + .../tests/test_data/if_else_chain/Nargo.toml | 1 + .../integer_array_indexing/Nargo.toml | 1 + .../tests/test_data/keccak256/Nargo.toml | 1 + .../tests/test_data/let_stmt/Nargo.toml | 1 + .../tests/test_data/main_bool_arg/Nargo.toml | 1 + .../tests/test_data/main_return/Nargo.toml | 1 + .../tests/test_data/merkle_insert/Nargo.toml | 1 + .../tests/test_data/modules/Nargo.toml | 1 + .../tests/test_data/modules_more/Nargo.toml | 1 + .../tests/test_data/modulus/Nargo.toml | 1 + .../nested_arrays_from_brillig/Nargo.toml | 1 + .../test_data/numeric_generics/Nargo.toml | 1 + .../tests/test_data/option/Nargo.toml | 1 + .../tests/test_data/pedersen_check/Nargo.toml | 1 + .../test_data/poseidon_bn254_hash/Nargo.toml | 1 + .../poseidonsponge_x5_254/Nargo.toml | 1 + .../tests/test_data/pred_eq/Nargo.toml | 1 + .../tests/test_data/references/Nargo.toml | 1 + .../tests/test_data/regression/Nargo.toml | 1 + .../test_data/regression_2099/Nargo.toml | 3 +- .../Nargo.toml | 1 + .../tests/test_data/scalar_mul/Nargo.toml | 1 + .../tests/test_data/schnorr/Nargo.toml | 1 + .../tests/test_data/sha256/Nargo.toml | 1 + .../tests/test_data/sha2_blocks/Nargo.toml | 1 + .../tests/test_data/sha2_byte/Nargo.toml | 1 + .../test_data/signed_division/Nargo.toml | 1 + .../simple_add_and_ret_arr/Nargo.toml | 1 + .../test_data/simple_array_param/Nargo.toml | 1 + .../tests/test_data/simple_bitwise/Nargo.toml | 1 + .../test_data/simple_comparison/Nargo.toml | 1 + .../tests/test_data/simple_mut/Nargo.toml | 1 + .../tests/test_data/simple_not/Nargo.toml | 1 + .../tests/test_data/simple_print/Nargo.toml | 1 + .../simple_program_addition/Nargo.toml | 1 + .../simple_program_no_body/Nargo.toml | 1 + .../tests/test_data/simple_radix/Nargo.toml | 1 + .../tests/test_data/simple_range/Nargo.toml | 1 + .../tests/test_data/simple_shield/Nargo.toml | 1 + .../simple_shift_left_right/Nargo.toml | 1 + .../tests/test_data/slices/Nargo.toml | 1 + .../tests/test_data/strings/Nargo.toml | 1 + .../tests/test_data/struct/Nargo.toml | 1 + .../test_data/struct_array_inputs/Nargo.toml | 1 + .../struct_fields_ordering/Nargo.toml | 1 + .../tests/test_data/struct_inputs/Nargo.toml | 1 + .../tests/test_data/submodules/Nargo.toml | 1 + .../tests/test_data/to_be_bytes/Nargo.toml | 1 + .../tests/test_data/to_bits/Nargo.toml | 1 + .../test_data/to_bytes_integration/Nargo.toml | 1 + .../tests/test_data/to_le_bytes/Nargo.toml | 1 + .../tests/test_data/tuples/Nargo.toml | 1 + .../tests/test_data/type_aliases/Nargo.toml | 1 + .../test_data/unconstrained_empty/Nargo.toml | 1 + .../nargo_cli/tests/test_data/unit/Nargo.toml | 1 + .../tests/test_data/vectors/Nargo.toml | 1 + .../test_data/workspace/crates/a/Nargo.toml | 3 +- .../test_data/workspace/crates/b/Nargo.toml | 3 +- .../workspace_default_member/a/Nargo.toml | 3 +- .../workspace_default_member/b/Nargo.toml | 1 + .../workspace_fail/crates/a/Nargo.toml | 3 +- .../workspace_fail/crates/b/Nargo.toml | 3 +- .../crates/b/Nargo.toml | 3 +- .../nargo_cli/tests/test_data/xor/Nargo.toml | 1 + .../tests/test_libraries/bad_impl/Nargo.toml | 1 + .../tests/test_libraries/bin_dep/Nargo.toml | 7 +++ .../tests/test_libraries/bin_dep/src/main.nr | 4 ++ .../test_libraries/diamond_deps_1/Nargo.toml | 1 + .../test_libraries/diamond_deps_2/Nargo.toml | 1 + crates/noirc_driver/src/lib.rs | 24 ++++---- crates/noirc_frontend/src/graph/mod.rs | 41 +++++-------- crates/noirc_frontend/src/hir/mod.rs | 12 +--- crates/wasm/src/compile.rs | 9 +-- 173 files changed, 479 insertions(+), 216 deletions(-) create mode 100644 crates/nargo_cli/tests/test_data/depend_on_bin/Nargo.toml create mode 100644 crates/nargo_cli/tests/test_data/depend_on_bin/Prover.toml create mode 100644 crates/nargo_cli/tests/test_data/depend_on_bin/src/main.nr create mode 100644 crates/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml create mode 100644 crates/nargo_cli/tests/test_libraries/bin_dep/src/main.nr diff --git a/crates/lsp/src/lib.rs b/crates/lsp/src/lib.rs index 1c02c802808..df43dac4df7 100644 --- a/crates/lsp/src/lib.rs +++ b/crates/lsp/src/lib.rs @@ -24,10 +24,7 @@ use lsp_types::{ }; use noirc_driver::{check_crate, prepare_crate}; use noirc_errors::{DiagnosticKind, FileDiagnostic}; -use noirc_frontend::{ - graph::{CrateGraph, CrateType}, - hir::Context, -}; +use noirc_frontend::{graph::CrateGraph, hir::Context}; use serde_json::Value as JsonValue; use tower::Service; @@ -190,7 +187,7 @@ fn on_code_lens_request( } }; - let crate_id = prepare_crate(&mut context, file_path, CrateType::Binary); + let crate_id = prepare_crate(&mut context, file_path); // We ignore the warnings and errors produced by compilation for producing codelenses // because we can still get the test functions even if compilation fails @@ -283,7 +280,7 @@ fn on_did_save_text_document( } }; - let crate_id = prepare_crate(&mut context, file_path, CrateType::Binary); + let crate_id = prepare_crate(&mut context, file_path); let mut diagnostics = Vec::new(); diff --git a/crates/lsp/src/lib_hacky.rs b/crates/lsp/src/lib_hacky.rs index 13bb2b82847..2705c61238b 100644 --- a/crates/lsp/src/lib_hacky.rs +++ b/crates/lsp/src/lib_hacky.rs @@ -22,7 +22,7 @@ use lsp_types::{ use noirc_driver::{check_crate, prepare_crate, propagate_dep}; use noirc_errors::{DiagnosticKind, FileDiagnostic}; use noirc_frontend::{ - graph::{CrateGraph, CrateId, CrateType}, + graph::{CrateGraph, CrateId}, hir::Context, }; @@ -286,7 +286,7 @@ fn create_context_at_path( } let nargo_toml_path = find_nearest_parent_file(&file_path, &["Nargo.toml"]); - let current_crate_id = prepare_crate(&mut context, &file_path, CrateType::Binary); + let current_crate_id = prepare_crate(&mut context, &file_path); // TODO(AD): undo hacky dependency resolution if let Some(nargo_toml_path) = nargo_toml_path { @@ -297,7 +297,7 @@ fn create_context_at_path( .parent() .unwrap() // TODO .join(PathBuf::from(&dependency_path).join("src").join("lib.nr")); - let library_crate = prepare_crate(&mut context, &path_to_lib, CrateType::Library); + let library_crate = prepare_crate(&mut context, &path_to_lib); propagate_dep(&mut context, library_crate, &crate_name.parse().unwrap()); } } diff --git a/crates/nargo/src/package.rs b/crates/nargo/src/package.rs index 20c662b69f4..cfed3476d3a 100644 --- a/crates/nargo/src/package.rs +++ b/crates/nargo/src/package.rs @@ -1,19 +1,48 @@ -use std::{collections::BTreeMap, path::PathBuf}; +use std::{collections::BTreeMap, fmt::Display, path::PathBuf}; -use noirc_frontend::graph::{CrateName, CrateType}; +use noirc_frontend::graph::CrateName; use crate::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE}; +#[derive(Debug, Copy, Clone)] +pub enum PackageType { + Library, + Binary, +} + +impl Display for PackageType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Library => write!(f, "lib"), + Self::Binary => write!(f, "bin"), + } + } +} + #[derive(Clone)] pub enum Dependency { Local { package: Package }, Remote { package: Package }, } +impl Dependency { + pub fn is_binary(&self) -> bool { + match self { + Self::Local { package } | Self::Remote { package } => package.is_binary(), + } + } + + pub fn package_name(&self) -> CrateName { + match self { + Self::Local { package } | Self::Remote { package } => package.name.clone(), + } + } +} + #[derive(Clone)] pub struct Package { pub root_dir: PathBuf, - pub crate_type: CrateType, + pub package_type: PackageType, pub entry_path: PathBuf, pub name: CrateName, pub dependencies: BTreeMap, @@ -30,4 +59,12 @@ impl Package { // For now it is hard-coded to be toml. self.root_dir.join(format!("{VERIFIER_INPUT_FILE}.toml")) } + + pub fn is_binary(&self) -> bool { + matches!(self.package_type, PackageType::Binary) + } + + pub fn is_library(&self) -> bool { + matches!(self.package_type, PackageType::Library) + } } diff --git a/crates/nargo_cli/src/cli/check_cmd.rs b/crates/nargo_cli/src/cli/check_cmd.rs index 8f2e23ed750..1d292fbf188 100644 --- a/crates/nargo_cli/src/cli/check_cmd.rs +++ b/crates/nargo_cli/src/cli/check_cmd.rs @@ -1,5 +1,8 @@ use crate::{ - errors::CliError, find_package_manifest, manifest::resolve_workspace_from_toml, prepare_package, + errors::{CliError, CompileError}, + find_package_manifest, + manifest::resolve_workspace_from_toml, + prepare_package, }; use acvm::Backend; use clap::Args; @@ -7,7 +10,6 @@ use iter_extended::btree_map; use nargo::package::Package; use noirc_abi::{AbiParameter, AbiType, MAIN_RETURN_NAME}; use noirc_driver::{check_crate, compute_function_signature, CompileOptions}; -use noirc_errors::reporter::ReportedErrors; use noirc_frontend::{ graph::{CrateId, CrateName}, hir::Context, @@ -42,33 +44,37 @@ pub(crate) fn run( Ok(()) } -fn check_package( - package: &Package, - compile_options: &CompileOptions, -) -> Result<(), ReportedErrors> { +fn check_package(package: &Package, compile_options: &CompileOptions) -> Result<(), CompileError> { let (mut context, crate_id) = prepare_package(package); check_crate_and_report_errors(&mut context, crate_id, compile_options.deny_warnings)?; - // XXX: We can have a --overwrite flag to determine if you want to overwrite the Prover/Verifier.toml files - if let Some((parameters, return_type)) = compute_function_signature(&context, &crate_id) { - let path_to_prover_input = package.prover_input_path(); - let path_to_verifier_input = package.verifier_input_path(); + if package.is_library() { + // Libraries do not have ABIs. + Ok(()) + } else { + // XXX: We can have a --overwrite flag to determine if you want to overwrite the Prover/Verifier.toml files + if let Some((parameters, return_type)) = compute_function_signature(&context, &crate_id) { + let path_to_prover_input = package.prover_input_path(); + let path_to_verifier_input = package.verifier_input_path(); + + // If they are not available, then create them and populate them based on the ABI + if !path_to_prover_input.exists() { + let prover_toml = create_input_toml_template(parameters.clone(), None); + write_to_file(prover_toml.as_bytes(), &path_to_prover_input); + } + if !path_to_verifier_input.exists() { + let public_inputs = + parameters.into_iter().filter(|param| param.is_public()).collect(); - // If they are not available, then create them and populate them based on the ABI - if !path_to_prover_input.exists() { - let prover_toml = create_input_toml_template(parameters.clone(), None); - write_to_file(prover_toml.as_bytes(), &path_to_prover_input); - } - if !path_to_verifier_input.exists() { - let public_inputs = parameters.into_iter().filter(|param| param.is_public()).collect(); + let verifier_toml = create_input_toml_template(public_inputs, return_type); + write_to_file(verifier_toml.as_bytes(), &path_to_verifier_input); + } - let verifier_toml = create_input_toml_template(public_inputs, return_type); - write_to_file(verifier_toml.as_bytes(), &path_to_verifier_input); + Ok(()) + } else { + Err(CompileError::MissingMainFunction(package.name.clone())) } - } else { - // This means that this is a library. Libraries do not have ABIs. } - Ok(()) } /// Generates the contents of a toml file with fields for each of the passed parameters. @@ -223,7 +229,7 @@ pub(crate) fn check_crate_and_report_errors( context: &mut Context, crate_id: CrateId, deny_warnings: bool, -) -> Result<(), ReportedErrors> { +) -> Result<(), CompileError> { let result = check_crate(context, crate_id, deny_warnings).map(|warnings| ((), warnings)); super::compile_cmd::report_errors(result, context, deny_warnings) } diff --git a/crates/nargo_cli/src/cli/codegen_verifier_cmd.rs b/crates/nargo_cli/src/cli/codegen_verifier_cmd.rs index 0c01f8d5dc8..297b54fddb1 100644 --- a/crates/nargo_cli/src/cli/codegen_verifier_cmd.rs +++ b/crates/nargo_cli/src/cli/codegen_verifier_cmd.rs @@ -1,17 +1,20 @@ use std::path::PathBuf; -use super::fs::{ - common_reference_string::{ - read_cached_common_reference_string, update_common_reference_string, - write_cached_common_reference_string, +use super::NargoConfig; +use super::{ + compile_cmd::compile_package, + fs::{ + common_reference_string::{ + read_cached_common_reference_string, update_common_reference_string, + write_cached_common_reference_string, + }, + create_named_dir, + program::read_program_from_file, + write_to_file, }, - create_named_dir, - program::read_program_from_file, - write_to_file, }; -use super::NargoConfig; -use crate::{cli::compile_cmd::compile_circuit, errors::CliError}; -use crate::{find_package_manifest, manifest::resolve_workspace_from_toml, prepare_package}; +use crate::errors::CliError; +use crate::{find_package_manifest, manifest::resolve_workspace_from_toml}; use acvm::Backend; use clap::Args; use nargo::{ @@ -75,8 +78,7 @@ fn smart_contract_for_package( .map_err(CliError::CommonReferenceStringError)?; (common_reference_string, program) } else { - let (mut context, crate_id) = prepare_package(package); - let program = compile_circuit(backend, &mut context, crate_id, compile_options)?; + let (_, program) = compile_package(backend, package, compile_options)?; let common_reference_string = update_common_reference_string(backend, &common_reference_string, &program.circuit) .map_err(CliError::CommonReferenceStringError)?; diff --git a/crates/nargo_cli/src/cli/compile_cmd.rs b/crates/nargo_cli/src/cli/compile_cmd.rs index 2d59667e7ff..651992f0fd9 100644 --- a/crates/nargo_cli/src/cli/compile_cmd.rs +++ b/crates/nargo_cli/src/cli/compile_cmd.rs @@ -2,19 +2,19 @@ use acvm::acir::circuit::OpcodeLabel; use acvm::{acir::circuit::Circuit, Backend}; use iter_extended::try_vecmap; use iter_extended::vecmap; +use nargo::package::Package; use nargo::{artifacts::contract::PreprocessedContract, NargoError}; use noirc_driver::{ compile_contracts, compile_main, CompileOptions, CompiledProgram, ErrorsAndWarnings, Warnings, }; -use noirc_errors::reporter::ReportedErrors; -use noirc_frontend::graph::{CrateId, CrateName}; +use noirc_frontend::graph::CrateName; use noirc_frontend::hir::Context; use clap::Args; use nargo::ops::{preprocess_contract_function, preprocess_program}; -use crate::errors::CliError; +use crate::errors::{CliError, CompileError}; use crate::manifest::resolve_workspace_from_toml; use crate::{find_package_manifest, prepare_package}; @@ -108,8 +108,7 @@ pub(crate) fn run( } } else { for package in &workspace { - let (mut context, crate_id) = prepare_package(package); - let program = compile_circuit(backend, &mut context, crate_id, &args.compile_options)?; + let (_, program) = compile_package(backend, package, &args.compile_options)?; common_reference_string = update_common_reference_string(backend, &common_reference_string, &program.circuit) @@ -127,14 +126,18 @@ pub(crate) fn run( Ok(()) } -pub(crate) fn compile_circuit( +pub(crate) fn compile_package( backend: &B, - context: &mut Context, - crate_id: CrateId, + package: &Package, compile_options: &CompileOptions, -) -> Result { - let result = compile_main(context, crate_id, compile_options); - let mut program = report_errors(result, context, compile_options.deny_warnings)?; +) -> Result<(Context, CompiledProgram), CompileError> { + if package.is_library() { + return Err(CompileError::LibraryCrate(package.name.clone())); + } + + let (mut context, crate_id) = prepare_package(package); + let result = compile_main(&mut context, crate_id, compile_options); + let mut program = report_errors(result, &context, compile_options.deny_warnings)?; // Apply backend specific optimizations. let (optimized_circuit, opcode_labels) = optimize_circuit(backend, program.circuit) .expect("Backend does not support an opcode that is in the IR"); @@ -150,7 +153,7 @@ pub(crate) fn compile_circuit( }); program.debug.update_acir(opcode_ids); - Ok(program) + Ok((context, program)) } pub(super) fn optimize_circuit( @@ -171,7 +174,7 @@ pub(crate) fn report_errors( result: Result<(T, Warnings), ErrorsAndWarnings>, context: &Context, deny_warnings: bool, -) -> Result { +) -> Result { let (t, warnings) = result.map_err(|errors| { noirc_errors::reporter::report_all(&context.file_manager, &errors, deny_warnings) })?; diff --git a/crates/nargo_cli/src/cli/execute_cmd.rs b/crates/nargo_cli/src/cli/execute_cmd.rs index a2700caee0f..fa6b13a5134 100644 --- a/crates/nargo_cli/src/cli/execute_cmd.rs +++ b/crates/nargo_cli/src/cli/execute_cmd.rs @@ -12,12 +12,12 @@ use noirc_errors::{debug_info::DebugInfo, CustomDiagnostic}; use noirc_frontend::graph::CrateName; use noirc_frontend::hir::Context; -use super::compile_cmd::compile_circuit; +use super::compile_cmd::compile_package; use super::fs::{inputs::read_inputs_from_file, witness::save_witness_to_dir}; use super::NargoConfig; use crate::errors::CliError; +use crate::find_package_manifest; use crate::manifest::resolve_workspace_from_toml; -use crate::{find_package_manifest, prepare_package}; /// Executes a circuit to calculate its return value #[derive(Debug, Clone, Args)] @@ -69,8 +69,7 @@ fn execute_package( prover_name: &str, compile_options: &CompileOptions, ) -> Result<(Option, WitnessMap), CliError> { - let (mut context, crate_id) = prepare_package(package); - let compiled_program = compile_circuit(backend, &mut context, crate_id, compile_options)?; + let (context, compiled_program) = compile_package(backend, package, compile_options)?; let CompiledProgram { abi, circuit, debug } = compiled_program; // Parse the initial witness values from Prover.toml diff --git a/crates/nargo_cli/src/cli/info_cmd.rs b/crates/nargo_cli/src/cli/info_cmd.rs index 1a834bdd78e..bfa0e7985db 100644 --- a/crates/nargo_cli/src/cli/info_cmd.rs +++ b/crates/nargo_cli/src/cli/info_cmd.rs @@ -5,8 +5,8 @@ use noirc_driver::CompileOptions; use noirc_frontend::graph::CrateName; use crate::{ - cli::compile_cmd::compile_circuit, errors::CliError, find_package_manifest, - manifest::resolve_workspace_from_toml, prepare_package, + cli::compile_cmd::compile_package, errors::CliError, find_package_manifest, + manifest::resolve_workspace_from_toml, }; use super::NargoConfig; @@ -46,8 +46,7 @@ fn count_opcodes_and_gates_in_package( package: &Package, compile_options: &CompileOptions, ) -> Result<(), CliError> { - let (mut context, crate_id) = prepare_package(package); - let compiled_program = compile_circuit(backend, &mut context, crate_id, compile_options)?; + let (_, compiled_program) = compile_package(backend, package, compile_options)?; let num_opcodes = compiled_program.circuit.opcodes.len(); diff --git a/crates/nargo_cli/src/cli/init_cmd.rs b/crates/nargo_cli/src/cli/init_cmd.rs index a1d4576758a..e7e13672f66 100644 --- a/crates/nargo_cli/src/cli/init_cmd.rs +++ b/crates/nargo_cli/src/cli/init_cmd.rs @@ -5,6 +5,7 @@ use super::{NargoConfig, CARGO_PKG_VERSION}; use acvm::Backend; use clap::Args; use nargo::constants::{PKG_FILE, SRC_DIR}; +use nargo::package::PackageType; use std::path::PathBuf; /// Create a Noir project in the current directory. @@ -14,8 +15,16 @@ pub(crate) struct InitCommand { #[clap(long)] name: Option, } + /// Use a library template + #[clap(long)] + pub(crate) lib: bool, + + /// Use a binary template [default] + #[clap(long)] + pub(crate) bin: bool, +} -const EXAMPLE: &str = r#"fn main(x : Field, y : pub Field) { +const BIN_EXAMPLE: &str = r#"fn main(x : Field, y : pub Field) { assert(x != y); } @@ -28,6 +37,19 @@ fn test_main() { } "#; +const LIB_EXAMPLE: &str = r#"fn my_util(x : Field, y : Field) -> bool { + x != y +} + +#[test] +fn test_main() { + assert(my_util(1, 2)); + + // Uncomment to make test fail + // assert(my_util(1, 1)); +} +"#; + pub(crate) fn run( // Backend is currently unused, but we might want to use it to inform the "new" template in the future _backend: &B, @@ -38,19 +60,22 @@ pub(crate) fn run( .name .unwrap_or_else(|| config.program_dir.file_name().unwrap().to_str().unwrap().to_owned()); - initialize_project(config.program_dir, &package_name); + let package_type = if args.lib { PackageType::Library } else { PackageType::Binary }; + initialize_project(config.program_dir, &package_name, package_type); Ok(()) } /// Initializes a new Noir project in `package_dir`. -pub(crate) fn initialize_project(package_dir: PathBuf, package_name: &str) { +pub(crate) fn initialize_project(package_dir: PathBuf, package_name: &str, package_type: PackageType) { // TODO: Should this reject if we have non-Unicode filepaths? let src_dir = package_dir.join(SRC_DIR); create_named_dir(&src_dir, "src"); + // TODO: Need to make type configurable let toml_contents = format!( r#"[package] name = "{package_name}" +type = "{package_type}" authors = [""] compiler_version = "{CARGO_PKG_VERSION}" @@ -58,6 +83,10 @@ compiler_version = "{CARGO_PKG_VERSION}" ); write_to_file(toml_contents.as_bytes(), &package_dir.join(PKG_FILE)); - write_to_file(EXAMPLE.as_bytes(), &src_dir.join("main.nr")); - println!("Project successfully created! Binary located at {}", package_dir.display()); + // This is a match so we get a compile error when we add to the package types + match package_type { + PackageType::Binary => write_to_file(BIN_EXAMPLE.as_bytes(), &src_dir.join("main.nr")), + PackageType::Library => write_to_file(LIB_EXAMPLE.as_bytes(), &src_dir.join("lib.nr")), + }; + println!("Project successfully created! It is located at {}", package_dir.display()); } diff --git a/crates/nargo_cli/src/cli/mod.rs b/crates/nargo_cli/src/cli/mod.rs index 9d494b21e6a..3ec23d8ed58 100644 --- a/crates/nargo_cli/src/cli/mod.rs +++ b/crates/nargo_cli/src/cli/mod.rs @@ -94,10 +94,7 @@ mod tests { use fm::FileManager; use noirc_driver::{check_crate, prepare_crate}; use noirc_errors::reporter; - use noirc_frontend::{ - graph::{CrateGraph, CrateType}, - hir::Context, - }; + use noirc_frontend::{graph::CrateGraph, hir::Context}; use std::path::{Path, PathBuf}; @@ -110,7 +107,7 @@ mod tests { let fm = FileManager::new(root_dir); let graph = CrateGraph::default(); let mut context = Context::new(fm, graph); - let crate_id = prepare_crate(&mut context, root_file, CrateType::Binary); + let crate_id = prepare_crate(&mut context, root_file); let result = check_crate(&mut context, crate_id, false); let success = result.is_ok(); diff --git a/crates/nargo_cli/src/cli/new_cmd.rs b/crates/nargo_cli/src/cli/new_cmd.rs index a792e752a51..617fb2fc583 100644 --- a/crates/nargo_cli/src/cli/new_cmd.rs +++ b/crates/nargo_cli/src/cli/new_cmd.rs @@ -1,8 +1,12 @@ use crate::errors::CliError; -use super::{init_cmd::initialize_project, NargoConfig}; +use super::{ + init_cmd::{initialize_project, InitCommand}, + NargoConfig, +}; use acvm::Backend; use clap::Args; +use nargo::package::PackageType; use std::path::PathBuf; /// Create a Noir project in a new directory. @@ -13,7 +17,10 @@ pub(crate) struct NewCommand { /// Name of the package [default: package directory name] #[clap(long)] - name: Option, + path: Option, + + #[clap(flatten)] + init_config: InitCommand, } pub(crate) fn run( @@ -30,6 +37,8 @@ pub(crate) fn run( let package_name = args.name.unwrap_or_else(|| args.path.file_name().unwrap().to_str().unwrap().to_owned()); - initialize_project(package_dir, &package_name); + let package_type = + if args.init_config.lib { PackageType::Library } else { PackageType::Binary }; + initialize_project(package_dir, &package_name, package_type); Ok(()) } diff --git a/crates/nargo_cli/src/cli/prove_cmd.rs b/crates/nargo_cli/src/cli/prove_cmd.rs index cdf83f9759b..d7eaf2d1405 100644 --- a/crates/nargo_cli/src/cli/prove_cmd.rs +++ b/crates/nargo_cli/src/cli/prove_cmd.rs @@ -10,7 +10,7 @@ use noirc_abi::input_parser::Format; use noirc_driver::CompileOptions; use noirc_frontend::graph::CrateName; -use super::compile_cmd::compile_circuit; +use super::compile_cmd::compile_package; use super::fs::{ common_reference_string::{ read_cached_common_reference_string, update_common_reference_string, @@ -21,9 +21,9 @@ use super::fs::{ proof::save_proof_to_dir, }; use super::NargoConfig; +use crate::find_package_manifest; use crate::manifest::resolve_workspace_from_toml; use crate::{cli::execute_cmd::execute_program, errors::CliError}; -use crate::{find_package_manifest, prepare_package}; /// Create proof for this program. The proof is returned as a hex encoded string. #[derive(Debug, Clone, Args)] @@ -96,8 +96,7 @@ pub(crate) fn prove_package( .map_err(CliError::CommonReferenceStringError)?; (common_reference_string, program, None) } else { - let (mut context, crate_id) = prepare_package(package); - let program = compile_circuit(backend, &mut context, crate_id, compile_options)?; + let (context, program) = compile_package(backend, package, compile_options)?; let common_reference_string = update_common_reference_string(backend, &common_reference_string, &program.circuit) .map_err(CliError::CommonReferenceStringError)?; diff --git a/crates/nargo_cli/src/cli/verify_cmd.rs b/crates/nargo_cli/src/cli/verify_cmd.rs index 78b23a0612d..cceaf997af7 100644 --- a/crates/nargo_cli/src/cli/verify_cmd.rs +++ b/crates/nargo_cli/src/cli/verify_cmd.rs @@ -1,17 +1,19 @@ -use super::compile_cmd::compile_circuit; -use super::fs::{ - common_reference_string::{ - read_cached_common_reference_string, update_common_reference_string, - write_cached_common_reference_string, +use super::NargoConfig; +use super::{ + compile_cmd::compile_package, + fs::{ + common_reference_string::{ + read_cached_common_reference_string, update_common_reference_string, + write_cached_common_reference_string, + }, + inputs::read_inputs_from_file, + load_hex_data, + program::read_program_from_file, }, - inputs::read_inputs_from_file, - load_hex_data, - program::read_program_from_file, }; -use super::NargoConfig; use crate::errors::CliError; +use crate::find_package_manifest; use crate::manifest::resolve_workspace_from_toml; -use crate::{find_package_manifest, prepare_package}; use acvm::Backend; use clap::Args; @@ -82,8 +84,7 @@ fn verify_package( .map_err(CliError::CommonReferenceStringError)?; (common_reference_string, program) } else { - let (mut context, crate_id) = prepare_package(package); - let program = compile_circuit(backend, &mut context, crate_id, compile_options)?; + let (_, program) = compile_package(backend, package, compile_options)?; let common_reference_string = update_common_reference_string(backend, &common_reference_string, &program.circuit) .map_err(CliError::CommonReferenceStringError)?; diff --git a/crates/nargo_cli/src/errors.rs b/crates/nargo_cli/src/errors.rs index 00a84ff2964..ea536d8bb0d 100644 --- a/crates/nargo_cli/src/errors.rs +++ b/crates/nargo_cli/src/errors.rs @@ -3,9 +3,10 @@ use acvm::{ SmartContract, }; use hex::FromHexError; -use nargo::NargoError; +use nargo::{package::PackageType, NargoError}; use noirc_abi::errors::{AbiError, InputParserError}; use noirc_errors::reporter::ReportedErrors; +use noirc_frontend::graph::CrateName; use std::path::PathBuf; use thiserror::Error; @@ -39,11 +40,6 @@ pub(crate) enum CliError { #[error("Failed to verify proof {}", .0.display())] InvalidProof(PathBuf), - /// Errors encountered while compiling the noir program. - /// These errors are already written to stderr. - #[error("Aborting due to {} previous error{}", .0.error_count, if .0.error_count == 1 { "" } else { "s" })] - ReportedErrors(ReportedErrors), - /// ABI encoding/decoding error #[error(transparent)] AbiError(#[from] AbiError), @@ -63,6 +59,10 @@ pub(crate) enum CliError { #[error(transparent)] ManifestError(#[from] ManifestError), + /// Error from the compilation pipeline + #[error(transparent)] + CompileError(#[from] CompileError), + /// Backend error caused by a function on the SmartContract trait #[error(transparent)] SmartContractError(::Error), // Unfortunately, Rust won't let us `impl From` over an Associated Type on a generic @@ -76,7 +76,22 @@ pub(crate) enum CliError { CommonReferenceStringError(::Error), // Unfortunately, Rust won't let us `impl From` over an Associated Type on a generic } -impl From for CliError { +/// Errors covering situations where a package cannot be compiled. +#[derive(Debug, Error)] +pub(crate) enum CompileError { + #[error("Package `{0}` has type `lib` but only `bin` types can be compiled")] + LibraryCrate(CrateName), + + #[error("Package `{0}` is expected to have a `main` function but it does not")] + MissingMainFunction(CrateName), + + /// Errors encountered while compiling the noir program. + /// These errors are already written to stderr. + #[error("Aborting due to {} previous error{}", .0.error_count, if .0.error_count == 1 { "" } else { "s" })] + ReportedErrors(ReportedErrors), +} + +impl From for CompileError { fn from(errors: ReportedErrors) -> Self { Self::ReportedErrors(errors) } @@ -89,12 +104,18 @@ pub(crate) enum ManifestError { #[error("cannot find a Nargo.toml in {}", .0.display())] MissingFile(PathBuf), - #[error("Cannot read file {0}. Does it exist?")] + #[error("Cannot read file {0} - does it exist?")] ReadFailed(PathBuf), #[error("Nargo.toml is missing a parent directory")] MissingParent, + #[error("Missing `type` field in {0}")] + MissingPackageType(PathBuf), + + #[error("Cannot use `{1}` for `type` field in {0}")] + InvalidPackageType(PathBuf, String), + /// Package manifest is unreadable. #[error("Nargo.toml is badly formed, could not parse.\n\n {0}")] MalformedFile(#[from] toml::de::Error), @@ -102,17 +123,8 @@ pub(crate) enum ManifestError { #[error("Unxpected workspace definition found in {0}")] UnexpectedWorkspace(PathBuf), - /// Package does not contain Noir source files. - #[error("cannot find src directory in path {0}")] - NoSourceDir(PathBuf), - - /// Package has neither of `main.nr` and `lib.nr`. - #[error("package must contain either a `lib.nr`(Library) or a `main.nr`(Binary).")] - ContainsZeroCrates, - - /// Package has both a `main.nr` (for binaries) and `lib.nr` (for libraries) - #[error("package cannot contain both a `lib.nr` and a `main.nr`")] - ContainsMultipleCrates, + #[error("Cannot find file {0} which is required due to specifying the `{1}` package type")] + MissingEntryFile(PathBuf, PackageType), /// Invalid character `-` in package name #[error("invalid character `-` in package name")] @@ -122,9 +134,12 @@ pub(crate) enum ManifestError { #[error("{0}")] GitError(String), - #[error("Selected package ({0}) was not found")] - MissingSelectedPackage(String), + #[error("Selected package `{0}` was not found")] + MissingSelectedPackage(CrateName), #[error("Default package was not found. Does {0} exist in your workspace?")] MissingDefaultPackage(PathBuf), + + #[error("Package `{0}` has type `bin` but you cannot depend on binary packages")] + BinaryDependency(CrateName), } diff --git a/crates/nargo_cli/src/lib.rs b/crates/nargo_cli/src/lib.rs index 05753f7f3d8..b9f60875b1b 100644 --- a/crates/nargo_cli/src/lib.rs +++ b/crates/nargo_cli/src/lib.rs @@ -11,7 +11,7 @@ use fm::FileManager; use nargo::package::{Dependency, Package}; use noirc_driver::{add_dep, prepare_crate}; use noirc_frontend::{ - graph::{CrateGraph, CrateId, CrateName, CrateType}, + graph::{CrateGraph, CrateId, CrateName}, hir::Context, }; use std::{ @@ -54,23 +54,6 @@ fn find_package_manifest(current_path: &Path) -> Result .ok_or_else(|| ManifestError::MissingFile(current_path.to_path_buf())) } -fn lib_or_bin(root_dir: impl AsRef) -> Result<(PathBuf, CrateType), ManifestError> { - let current_path = root_dir.as_ref(); - // A library has a lib.nr and a binary has a main.nr - // You cannot have both. - let src_path = find_dir(current_path, "src") - .ok_or_else(|| ManifestError::NoSourceDir(current_path.to_path_buf()))?; - - let lib_nr_path = find_file(&src_path, "lib", "nr"); - let bin_nr_path = find_file(&src_path, "main", "nr"); - match (lib_nr_path, bin_nr_path) { - (Some(_), Some(_)) => Err(ManifestError::ContainsMultipleCrates), - (None, Some(path)) => Ok((path, CrateType::Binary)), - (Some(path), None) => Ok((path, CrateType::Library)), - (None, None) => Err(ManifestError::ContainsZeroCrates), - } -} - // Looks for file named `file_name` in path fn find_file>(path: P, file_name: &str, extension: &str) -> Option { let entries = list_files_and_folders_in(path)?; @@ -79,12 +62,6 @@ fn find_file>(path: P, file_name: &str, extension: &str) -> Optio find_artifact(entries, &file_name) } -// Looks for directory named `dir_name` in path -fn find_dir>(path: P, dir_name: &str) -> Option { - let entries = list_files_and_folders_in(path)?; - find_artifact(entries, dir_name) -} - // There is no distinction between files and folders fn find_artifact(entries: ReadDir, artifact_name: &str) -> Option { let entry = entries @@ -107,7 +84,7 @@ fn prepare_dependencies( for (dep_name, dep) in dependencies.into_iter() { match dep { Dependency::Remote { package } | Dependency::Local { package } => { - let crate_id = prepare_crate(context, &package.entry_path, package.crate_type); + let crate_id = prepare_crate(context, &package.entry_path); add_dep(context, parent_crate, crate_id, dep_name); prepare_dependencies(context, crate_id, package.dependencies.to_owned()); } @@ -120,7 +97,7 @@ fn prepare_package(package: &Package) -> (Context, CrateId) { let graph = CrateGraph::default(); let mut context = Context::new(fm, graph); - let crate_id = prepare_crate(&mut context, &package.entry_path, package.crate_type); + let crate_id = prepare_crate(&mut context, &package.entry_path); prepare_dependencies(&mut context, crate_id, package.dependencies.to_owned()); diff --git a/crates/nargo_cli/src/manifest.rs b/crates/nargo_cli/src/manifest.rs index e1da57c0c2b..079ba2a03fd 100644 --- a/crates/nargo_cli/src/manifest.rs +++ b/crates/nargo_cli/src/manifest.rs @@ -3,8 +3,9 @@ use std::{ path::{Path, PathBuf}, }; +use fm::{NormalizePath, FILE_EXTENSION}; use nargo::{ - package::{Dependency, Package}, + package::{Dependency, Package, PackageType}, workspace::Workspace, }; use noirc_frontend::graph::CrateName; @@ -30,9 +31,34 @@ impl PackageConfig { dependencies.insert(name, resolved_dep); } - let (entry_path, crate_type) = crate::lib_or_bin(root_dir)?; - - Ok(Package { root_dir: root_dir.to_path_buf(), entry_path, crate_type, name, dependencies }) + let package_type = match self.package.package_type.as_deref() { + Some("lib") => PackageType::Library, + Some("bin") => PackageType::Binary, + Some(invalid) => { + return Err(ManifestError::InvalidPackageType( + root_dir.join("Nargo.toml"), + invalid.to_string(), + )) + } + None => return Err(ManifestError::MissingPackageType(root_dir.join("Nargo.toml"))), + }; + + let entry_path = match package_type { + PackageType::Library => root_dir.join("src").join("lib").with_extension(FILE_EXTENSION), + PackageType::Binary => root_dir.join("src").join("main").with_extension(FILE_EXTENSION), + }; + + if entry_path.exists() { + Ok(Package { + root_dir: root_dir.to_path_buf(), + entry_path, + package_type, + name, + dependencies, + }) + } else { + Err(ManifestError::MissingEntryFile(entry_path, package_type)) + } } } @@ -88,6 +114,8 @@ struct WorkspaceConfig { struct PackageMetadata { #[serde(default = "panic_missing_name")] name: String, + #[serde(alias = "type")] + package_type: Option, description: Option, authors: Option>, // If not compiler version is supplied, the latest is used @@ -131,19 +159,27 @@ enum DependencyConfig { impl DependencyConfig { fn resolve_to_dependency(&self, pkg_root: &Path) -> Result { - match self { + let dep = match self { Self::Github { git, tag } => { let dir_path = clone_git_repo(git, tag).map_err(ManifestError::GitError)?; let toml_path = dir_path.join("Nargo.toml"); let package = resolve_package_from_toml(&toml_path)?; - Ok(Dependency::Remote { package }) + Dependency::Remote { package } } Self::Path { path } => { let dir_path = pkg_root.join(path); let toml_path = dir_path.join("Nargo.toml"); let package = resolve_package_from_toml(&toml_path)?; - Ok(Dependency::Local { package }) + Dependency::Local { package } } + }; + + // Cannot depend on a binary + // TODO: Can we depend upon contracts? + if dep.is_binary() { + Err(ManifestError::BinaryDependency(dep.package_name())) + } else { + Ok(dep) } } } @@ -162,7 +198,7 @@ fn toml_to_workspace( members: vec![member], } } else { - return Err(ManifestError::MissingSelectedPackage(member.name.into())); + return Err(ManifestError::MissingSelectedPackage(member.name)); } } Config::Workspace { workspace_config } => { @@ -193,7 +229,7 @@ fn toml_to_workspace( // we want to present an error to users if selected_package_index.is_none() { if let Some(selected_name) = selected_package { - return Err(ManifestError::MissingSelectedPackage(selected_name.into())); + return Err(ManifestError::MissingSelectedPackage(selected_name)); } if let Some(default_path) = workspace_config.default_member { return Err(ManifestError::MissingDefaultPackage(default_path)); @@ -208,7 +244,8 @@ fn toml_to_workspace( } fn read_toml(toml_path: &Path) -> Result { - let toml_as_string = std::fs::read_to_string(toml_path) + let toml_path = toml_path.normalize(); + let toml_as_string = std::fs::read_to_string(&toml_path) .map_err(|_| ManifestError::ReadFailed(toml_path.to_path_buf()))?; let root_dir = toml_path.parent().ok_or(ManifestError::MissingParent)?; let nargo_toml = diff --git a/crates/nargo_cli/tests/target_tests_data/fail/basic/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/fail/basic/Nargo.toml index a4994991fcc..f87e0b49bde 100644 --- a/crates/nargo_cli/tests/target_tests_data/fail/basic/Nargo.toml +++ b/crates/nargo_cli/tests/target_tests_data/fail/basic/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "fail_basic" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/target_tests_data/fail/dup_func/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/fail/dup_func/Nargo.toml index 625528a8c75..449a8fd7f73 100644 --- a/crates/nargo_cli/tests/target_tests_data/fail/dup_func/Nargo.toml +++ b/crates/nargo_cli/tests/target_tests_data/fail/dup_func/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "fail_dup_func" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/target_tests_data/pass/basic/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/pass/basic/Nargo.toml index 6c64f17234f..8c9a08e4d19 100644 --- a/crates/nargo_cli/tests/target_tests_data/pass/basic/Nargo.toml +++ b/crates/nargo_cli/tests/target_tests_data/pass/basic/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "pass_basic" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/target_tests_data/pass/import/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/pass/import/Nargo.toml index 87856bfb269..e6ba22f9b14 100644 --- a/crates/nargo_cli/tests/target_tests_data/pass/import/Nargo.toml +++ b/crates/nargo_cli/tests/target_tests_data/pass/import/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "pass_import" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml index f25b40c494d..f076963a94e 100644 --- a/crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml +++ b/crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "pass_dev_mode_unused" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/1327_concrete_in_generic/Nargo.toml b/crates/nargo_cli/tests/test_data/1327_concrete_in_generic/Nargo.toml index 84bcfa59445..0ccf7ff8c9c 100644 --- a/crates/nargo_cli/tests/test_data/1327_concrete_in_generic/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/1327_concrete_in_generic/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "1327_concrete_in_generic" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/1_mul/Nargo.toml b/crates/nargo_cli/tests/test_data/1_mul/Nargo.toml index 3a08d792ed5..29053e36f7c 100644 --- a/crates/nargo_cli/tests/test_data/1_mul/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/1_mul/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "1_mul" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/2_div/Nargo.toml b/crates/nargo_cli/tests/test_data/2_div/Nargo.toml index 3ddfc94b016..6b28c58bea2 100644 --- a/crates/nargo_cli/tests/test_data/2_div/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/2_div/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "2_div" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/3_add/Nargo.toml b/crates/nargo_cli/tests/test_data/3_add/Nargo.toml index dd2b3ff8b0e..dca0a0d9931 100644 --- a/crates/nargo_cli/tests/test_data/3_add/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/3_add/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "3_add" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/4_sub/Nargo.toml b/crates/nargo_cli/tests/test_data/4_sub/Nargo.toml index 481edc68308..149c3a6f7e5 100644 --- a/crates/nargo_cli/tests/test_data/4_sub/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/4_sub/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "4_sub" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/5_over/Nargo.toml b/crates/nargo_cli/tests/test_data/5_over/Nargo.toml index 8d54313a873..a59347066c9 100644 --- a/crates/nargo_cli/tests/test_data/5_over/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/5_over/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "5_over" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/6/Nargo.toml b/crates/nargo_cli/tests/test_data/6/Nargo.toml index 7ef042e85cf..b0353fb6ae5 100644 --- a/crates/nargo_cli/tests/test_data/6/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/6/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "6" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/6_array/Nargo.toml b/crates/nargo_cli/tests/test_data/6_array/Nargo.toml index ad8fc83dbd7..4a6d8e1f401 100644 --- a/crates/nargo_cli/tests/test_data/6_array/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/6_array/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "6_array" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/7/Nargo.toml b/crates/nargo_cli/tests/test_data/7/Nargo.toml index cd5a4d21b38..9321253ec03 100644 --- a/crates/nargo_cli/tests/test_data/7/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/7/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "7" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/7_function/Nargo.toml b/crates/nargo_cli/tests/test_data/7_function/Nargo.toml index 42672a980c8..ea899378643 100644 --- a/crates/nargo_cli/tests/test_data/7_function/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/7_function/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "7_function" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/8_integration/Nargo.toml b/crates/nargo_cli/tests/test_data/8_integration/Nargo.toml index ca21221bc78..56a156ee1d7 100644 --- a/crates/nargo_cli/tests/test_data/8_integration/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/8_integration/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "8_integration" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/9_conditional/Nargo.toml b/crates/nargo_cli/tests/test_data/9_conditional/Nargo.toml index 7c447ce2f0a..3aa36068cf2 100644 --- a/crates/nargo_cli/tests/test_data/9_conditional/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/9_conditional/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "9_conditional" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/arithmetic_binary_operations/Nargo.toml b/crates/nargo_cli/tests/test_data/arithmetic_binary_operations/Nargo.toml index 4fde96957fc..7bacc45d7d1 100644 --- a/crates/nargo_cli/tests/test_data/arithmetic_binary_operations/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/arithmetic_binary_operations/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "arithmetic_binary_operations" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/array_dynamic/Nargo.toml b/crates/nargo_cli/tests/test_data/array_dynamic/Nargo.toml index c5e05dfc6d7..17b38706704 100644 --- a/crates/nargo_cli/tests/test_data/array_dynamic/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/array_dynamic/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "array_dynamic" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/array_len/Nargo.toml b/crates/nargo_cli/tests/test_data/array_len/Nargo.toml index 9e417be06ee..b54cea7cc17 100644 --- a/crates/nargo_cli/tests/test_data/array_len/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/array_len/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "array_len" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/array_neq/Nargo.toml b/crates/nargo_cli/tests/test_data/array_neq/Nargo.toml index a697bd06f0d..0539cceb542 100644 --- a/crates/nargo_cli/tests/test_data/array_neq/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/array_neq/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "array_neq" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/array_sort/Nargo.toml b/crates/nargo_cli/tests/test_data/array_sort/Nargo.toml index 7adf0793369..f5f469c5a5f 100644 --- a/crates/nargo_cli/tests/test_data/array_sort/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/array_sort/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "array_sort" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/assert/Nargo.toml b/crates/nargo_cli/tests/test_data/assert/Nargo.toml index 238d13b2fd0..17ed9362bef 100644 --- a/crates/nargo_cli/tests/test_data/assert/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/assert/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "assert" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/assert_statement/Nargo.toml b/crates/nargo_cli/tests/test_data/assert_statement/Nargo.toml index 6910160df8a..641cb1b00e0 100644 --- a/crates/nargo_cli/tests/test_data/assert_statement/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/assert_statement/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "assert_statement" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/assign_ex/Nargo.toml b/crates/nargo_cli/tests/test_data/assign_ex/Nargo.toml index 626db95708d..2ca969eeb93 100644 --- a/crates/nargo_cli/tests/test_data/assign_ex/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/assign_ex/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "assign_ex" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/bit_and/Nargo.toml b/crates/nargo_cli/tests/test_data/bit_and/Nargo.toml index 85fa0fe68bf..71a98db6635 100644 --- a/crates/nargo_cli/tests/test_data/bit_and/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/bit_and/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "bit_and" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/bit_shifts_comptime/Nargo.toml b/crates/nargo_cli/tests/test_data/bit_shifts_comptime/Nargo.toml index ee49e18e2fa..9b7aa319406 100644 --- a/crates/nargo_cli/tests/test_data/bit_shifts_comptime/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/bit_shifts_comptime/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "bit_shifts_comptime" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/bit_shifts_runtime/Nargo.toml b/crates/nargo_cli/tests/test_data/bit_shifts_runtime/Nargo.toml index 661f4f937d5..3f9058f1946 100644 --- a/crates/nargo_cli/tests/test_data/bit_shifts_runtime/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/bit_shifts_runtime/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "bit_shifts_runtime" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/blackbox_func_simple_call/Nargo.toml b/crates/nargo_cli/tests/test_data/blackbox_func_simple_call/Nargo.toml index 83ef3cb9f72..75c652d2f50 100644 --- a/crates/nargo_cli/tests/test_data/blackbox_func_simple_call/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/blackbox_func_simple_call/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "blackbox_func_simple_call" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/bool_not/Nargo.toml b/crates/nargo_cli/tests/test_data/bool_not/Nargo.toml index bb778dbd2b2..c2521450344 100644 --- a/crates/nargo_cli/tests/test_data/bool_not/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/bool_not/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "bool_not" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/bool_or/Nargo.toml b/crates/nargo_cli/tests/test_data/bool_or/Nargo.toml index 7f59fb62cbc..a878c1acb38 100644 --- a/crates/nargo_cli/tests/test_data/bool_or/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/bool_or/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "bool_or" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_acir_as_brillig/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_acir_as_brillig/Nargo.toml index 162794d7c5c..42b3c71aad3 100644 --- a/crates/nargo_cli/tests/test_data/brillig_acir_as_brillig/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_acir_as_brillig/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_acir_as_brillig" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_arrays/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_arrays/Nargo.toml index be36814c2b3..abaa6680f84 100644 --- a/crates/nargo_cli/tests/test_data/brillig_arrays/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_arrays/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_arrays" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_assert/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_assert/Nargo.toml index 0b21db6224a..c6a27b47e79 100644 --- a/crates/nargo_cli/tests/test_data/brillig_assert/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_assert/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_assert" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_assert_fail/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_assert_fail/Nargo.toml index eed13cc504f..181af302d8f 100644 --- a/crates/nargo_cli/tests/test_data/brillig_assert_fail/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_assert_fail/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_assert_fail" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_blake2s/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_blake2s/Nargo.toml index 25457595d0e..8fc7df96fc3 100644 --- a/crates/nargo_cli/tests/test_data/brillig_blake2s/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_blake2s/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_blake2s" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_calls/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_calls/Nargo.toml index 3a9f6752568..9b6b4bd357b 100644 --- a/crates/nargo_cli/tests/test_data/brillig_calls/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_calls/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_calls" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_calls_array/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_calls_array/Nargo.toml index 38e1bc8d076..0c60f6218eb 100644 --- a/crates/nargo_cli/tests/test_data/brillig_calls_array/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_calls_array/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_calls_array" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_calls_conditionals/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_calls_conditionals/Nargo.toml index 771d014c490..f99445381d3 100644 --- a/crates/nargo_cli/tests/test_data/brillig_calls_conditionals/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_calls_conditionals/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_calls_conditionals" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_cast/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_cast/Nargo.toml index dc6b7bff66c..7c5aebabb95 100644 --- a/crates/nargo_cli/tests/test_data/brillig_cast/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_cast/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_cast" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_conditional/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_conditional/Nargo.toml index bb54f910f77..7432f303349 100644 --- a/crates/nargo_cli/tests/test_data/brillig_conditional/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_conditional/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_conditional" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_ecdsa/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_ecdsa/Nargo.toml index 855646aec2c..96ffe8f1c92 100644 --- a/crates/nargo_cli/tests/test_data/brillig_ecdsa/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_ecdsa/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_ecdsa" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_field_binary_operations/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_field_binary_operations/Nargo.toml index 632b97a07bc..a8e7cd167d2 100644 --- a/crates/nargo_cli/tests/test_data/brillig_field_binary_operations/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_field_binary_operations/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_field_binary_operations" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_fns_as_values/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_fns_as_values/Nargo.toml index 3586fbf4dc0..fd94bfb3a60 100644 --- a/crates/nargo_cli/tests/test_data/brillig_fns_as_values/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_fns_as_values/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_fns_as_values" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_hash_to_field/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_hash_to_field/Nargo.toml index d04836585d4..a7d75459f7e 100644 --- a/crates/nargo_cli/tests/test_data/brillig_hash_to_field/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_hash_to_field/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_hash_to_field" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_identity_function/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_identity_function/Nargo.toml index c7af537cbde..1c7603a5660 100644 --- a/crates/nargo_cli/tests/test_data/brillig_identity_function/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_identity_function/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_identity_function" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_integer_binary_operations/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_integer_binary_operations/Nargo.toml index 11360984c59..09b851e7c5c 100644 --- a/crates/nargo_cli/tests/test_data/brillig_integer_binary_operations/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_integer_binary_operations/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_integer_binary_operations" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_keccak/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_keccak/Nargo.toml index f247567f4ee..358c7c63a60 100644 --- a/crates/nargo_cli/tests/test_data/brillig_keccak/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_keccak/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_keccak" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_loop/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_loop/Nargo.toml index 5a9ae5eabd7..c43a806784a 100644 --- a/crates/nargo_cli/tests/test_data/brillig_loop/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_loop/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_loop" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_modulo/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_modulo/Nargo.toml index 95aa9e7de29..b27417dba8f 100644 --- a/crates/nargo_cli/tests/test_data/brillig_modulo/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_modulo/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_modulo" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_nested_arrays/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_nested_arrays/Nargo.toml index d26a247aa98..4ce5518efb5 100644 --- a/crates/nargo_cli/tests/test_data/brillig_nested_arrays/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_nested_arrays/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_nested_arrays" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/brillig_not/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_not/Nargo.toml index 1a714218b06..38a0872adfb 100644 --- a/crates/nargo_cli/tests/test_data/brillig_not/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_not/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_not" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_oracle/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_oracle/Nargo.toml index 647a37e0b9e..0b03be79ef8 100644 --- a/crates/nargo_cli/tests/test_data/brillig_oracle/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_oracle/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_oracle" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_pedersen/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_pedersen/Nargo.toml index f36c705654a..f6f34dcc650 100644 --- a/crates/nargo_cli/tests/test_data/brillig_pedersen/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_pedersen/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_pedersen" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_recursion/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_recursion/Nargo.toml index 60baa6b4d71..32dd1a6c858 100644 --- a/crates/nargo_cli/tests/test_data/brillig_recursion/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_recursion/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_recursion" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_references/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_references/Nargo.toml index a636a71aead..7f47fab9d9a 100644 --- a/crates/nargo_cli/tests/test_data/brillig_references/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_references/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_references" +type = "bin" authors = [""] compiler_version = "0.5.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_scalar_mul/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_scalar_mul/Nargo.toml index 50793a51e41..a580584f7f9 100644 --- a/crates/nargo_cli/tests/test_data/brillig_scalar_mul/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_scalar_mul/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_scalar_mul" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_schnorr/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_schnorr/Nargo.toml index 15f6ad5004e..3defa68f561 100644 --- a/crates/nargo_cli/tests/test_data/brillig_schnorr/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_schnorr/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_schnorr" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_sha256/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_sha256/Nargo.toml index 78fe4cf5c7b..6aebe1ed5ad 100644 --- a/crates/nargo_cli/tests/test_data/brillig_sha256/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_sha256/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_sha256" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_slices/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_slices/Nargo.toml index 3bf54c7d667..51d81efb6ae 100644 --- a/crates/nargo_cli/tests/test_data/brillig_slices/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_slices/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_slices" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/brillig_to_be_bytes/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_to_be_bytes/Nargo.toml index dafefbfe266..21c5104e6a8 100644 --- a/crates/nargo_cli/tests/test_data/brillig_to_be_bytes/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_to_be_bytes/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_to_be_bytes" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_to_bits/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_to_bits/Nargo.toml index b6d1c94d830..6c62900468a 100644 --- a/crates/nargo_cli/tests/test_data/brillig_to_bits/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_to_bits/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_to_bits" +type = "bin" authors = [""] compiler_version = "0.7.0" diff --git a/crates/nargo_cli/tests/test_data/brillig_to_bytes_integration/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_to_bytes_integration/Nargo.toml index 75085d945c5..10c2abeee29 100644 --- a/crates/nargo_cli/tests/test_data/brillig_to_bytes_integration/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_to_bytes_integration/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_to_bytes_integration" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_to_le_bytes/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_to_le_bytes/Nargo.toml index 16954f119d5..e1ba633bff1 100644 --- a/crates/nargo_cli/tests/test_data/brillig_to_le_bytes/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_to_le_bytes/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_to_le_bytes" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/brillig_top_level/Nargo.toml b/crates/nargo_cli/tests/test_data/brillig_top_level/Nargo.toml index e1779a1d3b2..79686cab2ea 100644 --- a/crates/nargo_cli/tests/test_data/brillig_top_level/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/brillig_top_level/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "brillig_top_level" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/cast_bool/Nargo.toml b/crates/nargo_cli/tests/test_data/cast_bool/Nargo.toml index 0f7103580df..65a878d776a 100644 --- a/crates/nargo_cli/tests/test_data/cast_bool/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/cast_bool/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "cast_bool" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/comptime_array_access/Nargo.toml b/crates/nargo_cli/tests/test_data/comptime_array_access/Nargo.toml index c0f183dd74e..794702bbeaa 100644 --- a/crates/nargo_cli/tests/test_data/comptime_array_access/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/comptime_array_access/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "comptime_array_access" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/comptime_recursion_regression/Nargo.toml b/crates/nargo_cli/tests/test_data/comptime_recursion_regression/Nargo.toml index b0fa20dec39..6ded8f92d55 100644 --- a/crates/nargo_cli/tests/test_data/comptime_recursion_regression/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/comptime_recursion_regression/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "comptime_recursion_regression" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/config.toml b/crates/nargo_cli/tests/test_data/config.toml index 6fe6c7897e1..4f09fe87b12 100644 --- a/crates/nargo_cli/tests/test_data/config.toml +++ b/crates/nargo_cli/tests/test_data/config.toml @@ -2,4 +2,10 @@ exclude = [] # List of tests (as their directory name) expecting to fail: if the test pass, we report an error. -fail = ["brillig_assert_fail", "dep_impl_primitive", "workspace_fail", "workspace_missing_toml"] +fail = [ + "brillig_assert_fail", + "dep_impl_primitive", + "depend_on_bin", + "workspace_fail", + "workspace_missing_toml" +] diff --git a/crates/nargo_cli/tests/test_data/constant_return/Nargo.toml b/crates/nargo_cli/tests/test_data/constant_return/Nargo.toml index 00772d41ef0..d74eea4d3a7 100644 --- a/crates/nargo_cli/tests/test_data/constant_return/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/constant_return/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "constant_return" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/contracts/Nargo.toml b/crates/nargo_cli/tests/test_data/contracts/Nargo.toml index 08f5ea12655..cca289aa4fd 100644 --- a/crates/nargo_cli/tests/test_data/contracts/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/contracts/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "contracts" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/debug_logs/Nargo.toml b/crates/nargo_cli/tests/test_data/debug_logs/Nargo.toml index 9c8a7404060..edc03c152cf 100644 --- a/crates/nargo_cli/tests/test_data/debug_logs/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/debug_logs/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "debug_logs" +type = "bin" authors = [""] compiler_version = "0.8.0" diff --git a/crates/nargo_cli/tests/test_data/dep_impl_primitive/Nargo.toml b/crates/nargo_cli/tests/test_data/dep_impl_primitive/Nargo.toml index 946d14cf275..6a49afec2c4 100644 --- a/crates/nargo_cli/tests/test_data/dep_impl_primitive/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/dep_impl_primitive/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "dep_impl_primitive" +type = "bin" authors = [""] compiler_version = "0.8.0" diff --git a/crates/nargo_cli/tests/test_data/depend_on_bin/Nargo.toml b/crates/nargo_cli/tests/test_data/depend_on_bin/Nargo.toml new file mode 100644 index 00000000000..2404e68e180 --- /dev/null +++ b/crates/nargo_cli/tests/test_data/depend_on_bin/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "depend_on_bin" +type = "bin" +authors = [""] +compiler_version = "0.8.0" + +[dependencies] +bin_dep = { path = "../../test_libraries/bin_dep" } diff --git a/crates/nargo_cli/tests/test_data/depend_on_bin/Prover.toml b/crates/nargo_cli/tests/test_data/depend_on_bin/Prover.toml new file mode 100644 index 00000000000..7d4290a117a --- /dev/null +++ b/crates/nargo_cli/tests/test_data/depend_on_bin/Prover.toml @@ -0,0 +1 @@ +x = 1 diff --git a/crates/nargo_cli/tests/test_data/depend_on_bin/src/main.nr b/crates/nargo_cli/tests/test_data/depend_on_bin/src/main.nr new file mode 100644 index 00000000000..4e03e8eb41e --- /dev/null +++ b/crates/nargo_cli/tests/test_data/depend_on_bin/src/main.nr @@ -0,0 +1,5 @@ +use dep::bin_dep; + +fn main(x : Field) { + assert(x == 1); +} diff --git a/crates/nargo_cli/tests/test_data/diamond_deps_0/Nargo.toml b/crates/nargo_cli/tests/test_data/diamond_deps_0/Nargo.toml index ae9457e2286..6b1dd65ba32 100644 --- a/crates/nargo_cli/tests/test_data/diamond_deps_0/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/diamond_deps_0/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "diamond_deps_0" +type = "bin" authors = [""] compiler_version = "0.7.1" diff --git a/crates/nargo_cli/tests/test_data/distinct_keyword/Nargo.toml b/crates/nargo_cli/tests/test_data/distinct_keyword/Nargo.toml index e843cdfb74c..b7de54ea5cc 100644 --- a/crates/nargo_cli/tests/test_data/distinct_keyword/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/distinct_keyword/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "distinct_keyword" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/ec_baby_jubjub/Nargo.toml b/crates/nargo_cli/tests/test_data/ec_baby_jubjub/Nargo.toml index 41f8cb35a32..178be37f780 100644 --- a/crates/nargo_cli/tests/test_data/ec_baby_jubjub/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/ec_baby_jubjub/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "ec_baby_jubjub" description = "Baby Jubjub sanity checks" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/ecdsa_secp256k1/Nargo.toml b/crates/nargo_cli/tests/test_data/ecdsa_secp256k1/Nargo.toml index 19d9a69f5e3..0f8111dc9f6 100644 --- a/crates/nargo_cli/tests/test_data/ecdsa_secp256k1/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/ecdsa_secp256k1/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "ecdsa_secp256k1" description = "ECDSA secp256k1 verification" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/ecdsa_secp256r1/Nargo.toml b/crates/nargo_cli/tests/test_data/ecdsa_secp256r1/Nargo.toml index 7d45332ae49..738b049060a 100644 --- a/crates/nargo_cli/tests/test_data/ecdsa_secp256r1/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/ecdsa_secp256r1/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "ecdsa_secp256r1" description = "ECDSA secp256r1 verification" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/generics/Nargo.toml b/crates/nargo_cli/tests/test_data/generics/Nargo.toml index 32fc2017336..18bdae1ab08 100644 --- a/crates/nargo_cli/tests/test_data/generics/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/generics/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "generics" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/global_consts/Nargo.toml b/crates/nargo_cli/tests/test_data/global_consts/Nargo.toml index 2338ec92e6b..2452ad8edb3 100644 --- a/crates/nargo_cli/tests/test_data/global_consts/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/global_consts/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "global_consts" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/hash_to_field/Nargo.toml b/crates/nargo_cli/tests/test_data/hash_to_field/Nargo.toml index 9e490846dc4..d78b59118f9 100644 --- a/crates/nargo_cli/tests/test_data/hash_to_field/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/hash_to_field/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "hash_to_field" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/if_else_chain/Nargo.toml b/crates/nargo_cli/tests/test_data/if_else_chain/Nargo.toml index e9b51315c84..fc5fffa2185 100644 --- a/crates/nargo_cli/tests/test_data/if_else_chain/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/if_else_chain/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "if_else_chain" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/integer_array_indexing/Nargo.toml b/crates/nargo_cli/tests/test_data/integer_array_indexing/Nargo.toml index 23dd9997c90..3cec63d465b 100644 --- a/crates/nargo_cli/tests/test_data/integer_array_indexing/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/integer_array_indexing/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "integer_array_indexing" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/keccak256/Nargo.toml b/crates/nargo_cli/tests/test_data/keccak256/Nargo.toml index 6e2db010876..ab1a04b7c07 100644 --- a/crates/nargo_cli/tests/test_data/keccak256/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/keccak256/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "keccak256" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/let_stmt/Nargo.toml b/crates/nargo_cli/tests/test_data/let_stmt/Nargo.toml index 448e473f2ed..45f9a53edeb 100644 --- a/crates/nargo_cli/tests/test_data/let_stmt/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/let_stmt/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "let_stmt" +type = "bin" authors = [""] compiler_version = "0.8.0" diff --git a/crates/nargo_cli/tests/test_data/main_bool_arg/Nargo.toml b/crates/nargo_cli/tests/test_data/main_bool_arg/Nargo.toml index b80dc750c15..1a4e3657464 100644 --- a/crates/nargo_cli/tests/test_data/main_bool_arg/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/main_bool_arg/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "main_bool_arg" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/main_return/Nargo.toml b/crates/nargo_cli/tests/test_data/main_return/Nargo.toml index c5df18dc4ad..c4224b7e23c 100644 --- a/crates/nargo_cli/tests/test_data/main_return/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/main_return/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "main_return" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/merkle_insert/Nargo.toml b/crates/nargo_cli/tests/test_data/merkle_insert/Nargo.toml index b1a7456b26e..3eb97c30cac 100644 --- a/crates/nargo_cli/tests/test_data/merkle_insert/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/merkle_insert/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "merkle_insert" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/modules/Nargo.toml b/crates/nargo_cli/tests/test_data/modules/Nargo.toml index eaa0a3a1b4b..b4f9b469ea8 100644 --- a/crates/nargo_cli/tests/test_data/modules/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/modules/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "modules" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/modules_more/Nargo.toml b/crates/nargo_cli/tests/test_data/modules_more/Nargo.toml index cc60838dbb0..5acf61a71a7 100644 --- a/crates/nargo_cli/tests/test_data/modules_more/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/modules_more/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "modules_more" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/modulus/Nargo.toml b/crates/nargo_cli/tests/test_data/modulus/Nargo.toml index 895b2af6ac0..5a1309a2a9d 100644 --- a/crates/nargo_cli/tests/test_data/modulus/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/modulus/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "modulus" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/nested_arrays_from_brillig/Nargo.toml b/crates/nargo_cli/tests/test_data/nested_arrays_from_brillig/Nargo.toml index 01273040d31..bd5dfb8bef4 100644 --- a/crates/nargo_cli/tests/test_data/nested_arrays_from_brillig/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/nested_arrays_from_brillig/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "nested_arrays_from_brillig" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/numeric_generics/Nargo.toml b/crates/nargo_cli/tests/test_data/numeric_generics/Nargo.toml index 199ec161f74..c8a3ce73a5e 100644 --- a/crates/nargo_cli/tests/test_data/numeric_generics/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/numeric_generics/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "numeric_generics" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/option/Nargo.toml b/crates/nargo_cli/tests/test_data/option/Nargo.toml index 2248e9c06dd..553efccd746 100644 --- a/crates/nargo_cli/tests/test_data/option/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/option/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "option" +type = "bin" authors = [""] compiler_version = "0.7.0" diff --git a/crates/nargo_cli/tests/test_data/pedersen_check/Nargo.toml b/crates/nargo_cli/tests/test_data/pedersen_check/Nargo.toml index c4fbf2407a7..3fc0bd9b79e 100644 --- a/crates/nargo_cli/tests/test_data/pedersen_check/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/pedersen_check/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "pedersen_check" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/poseidon_bn254_hash/Nargo.toml b/crates/nargo_cli/tests/test_data/poseidon_bn254_hash/Nargo.toml index 49f60c86aee..d23bb7cb919 100644 --- a/crates/nargo_cli/tests/test_data/poseidon_bn254_hash/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/poseidon_bn254_hash/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "poseidon_bn254_hash" description = "Poseidon 254-bit permutation test on 3 elements with alpha = 5" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/poseidonsponge_x5_254/Nargo.toml b/crates/nargo_cli/tests/test_data/poseidonsponge_x5_254/Nargo.toml index 4577f31236c..df1da360206 100644 --- a/crates/nargo_cli/tests/test_data/poseidonsponge_x5_254/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/poseidonsponge_x5_254/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "poseidonsponge_x5_254" description = "Variable-length Poseidon-128 sponge test on 7 elements with alpha = 5" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/pred_eq/Nargo.toml b/crates/nargo_cli/tests/test_data/pred_eq/Nargo.toml index ffa0d440f4a..ee6f7a28e0f 100644 --- a/crates/nargo_cli/tests/test_data/pred_eq/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/pred_eq/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "pred_eq" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/references/Nargo.toml b/crates/nargo_cli/tests/test_data/references/Nargo.toml index 83fc1fd3811..b52fdcf77f0 100644 --- a/crates/nargo_cli/tests/test_data/references/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/references/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "references" +type = "bin" authors = [""] compiler_version = "0.5.1" diff --git a/crates/nargo_cli/tests/test_data/regression/Nargo.toml b/crates/nargo_cli/tests/test_data/regression/Nargo.toml index 0f60b2c20ee..91497e10342 100644 --- a/crates/nargo_cli/tests/test_data/regression/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/regression/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "regression" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/regression_2099/Nargo.toml b/crates/nargo_cli/tests/test_data/regression_2099/Nargo.toml index ca96e7164a5..3e995a0acd6 100644 --- a/crates/nargo_cli/tests/test_data/regression_2099/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/regression_2099/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "regression_2099" +type = "bin" authors = [""] compiler_version = "0.9.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/regression_method_cannot_be_found/Nargo.toml b/crates/nargo_cli/tests/test_data/regression_method_cannot_be_found/Nargo.toml index fc1dc4d4ce2..9d9bb35778d 100644 --- a/crates/nargo_cli/tests/test_data/regression_method_cannot_be_found/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/regression_method_cannot_be_found/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "regression_method_cannot_be_found" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/scalar_mul/Nargo.toml b/crates/nargo_cli/tests/test_data/scalar_mul/Nargo.toml index eb1abb258ed..55bf6395b34 100644 --- a/crates/nargo_cli/tests/test_data/scalar_mul/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/scalar_mul/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "scalar_mul" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/schnorr/Nargo.toml b/crates/nargo_cli/tests/test_data/schnorr/Nargo.toml index f6f45f983f5..3ba59b7010e 100644 --- a/crates/nargo_cli/tests/test_data/schnorr/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/schnorr/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "schnorr" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/sha256/Nargo.toml b/crates/nargo_cli/tests/test_data/sha256/Nargo.toml index d29e88bc237..97ca07f03d4 100644 --- a/crates/nargo_cli/tests/test_data/sha256/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/sha256/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "sha256" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/sha2_blocks/Nargo.toml b/crates/nargo_cli/tests/test_data/sha2_blocks/Nargo.toml index 5ba3d3dc6db..9aa46c465e9 100644 --- a/crates/nargo_cli/tests/test_data/sha2_blocks/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/sha2_blocks/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "sha2_blocks" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/sha2_byte/Nargo.toml b/crates/nargo_cli/tests/test_data/sha2_byte/Nargo.toml index 8759ff064f3..849b6220db7 100644 --- a/crates/nargo_cli/tests/test_data/sha2_byte/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/sha2_byte/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "sha2_byte" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/signed_division/Nargo.toml b/crates/nargo_cli/tests/test_data/signed_division/Nargo.toml index b4ec731ad08..c1dacecae02 100644 --- a/crates/nargo_cli/tests/test_data/signed_division/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/signed_division/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "signed_division" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/simple_add_and_ret_arr/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_add_and_ret_arr/Nargo.toml index 67826a05fea..9afb8c5fd5b 100644 --- a/crates/nargo_cli/tests/test_data/simple_add_and_ret_arr/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_add_and_ret_arr/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_add_and_ret_arr" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/simple_array_param/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_array_param/Nargo.toml index f92a75d2cb8..9874c8cb6a8 100644 --- a/crates/nargo_cli/tests/test_data/simple_array_param/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_array_param/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_array_param" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/simple_bitwise/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_bitwise/Nargo.toml index 12f2b6989ec..c8fe1e06b4c 100644 --- a/crates/nargo_cli/tests/test_data/simple_bitwise/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_bitwise/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_bitwise" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/simple_comparison/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_comparison/Nargo.toml index 0af7070d974..840eb0a7e0b 100644 --- a/crates/nargo_cli/tests/test_data/simple_comparison/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_comparison/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_comparison" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/simple_mut/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_mut/Nargo.toml index 2d92d708f8d..b7b5c5d3dcc 100644 --- a/crates/nargo_cli/tests/test_data/simple_mut/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_mut/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_mut" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/simple_not/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_not/Nargo.toml index d64ccb54191..0ca112cf4b3 100644 --- a/crates/nargo_cli/tests/test_data/simple_not/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_not/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_not" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/simple_print/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_print/Nargo.toml index 85429d3a080..d154fbc47f2 100644 --- a/crates/nargo_cli/tests/test_data/simple_print/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_print/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_print" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/simple_program_addition/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_program_addition/Nargo.toml index 98fbb603178..8cf28eb45a7 100644 --- a/crates/nargo_cli/tests/test_data/simple_program_addition/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_program_addition/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_program_addition" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/simple_program_no_body/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_program_no_body/Nargo.toml index 4c0150d0472..f35a196ab59 100644 --- a/crates/nargo_cli/tests/test_data/simple_program_no_body/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_program_no_body/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_program_no_body" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/simple_radix/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_radix/Nargo.toml index 85eb02f85b9..6c208c1645c 100644 --- a/crates/nargo_cli/tests/test_data/simple_radix/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_radix/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_radix" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/simple_range/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_range/Nargo.toml index dafaddbb146..864cd03beb3 100644 --- a/crates/nargo_cli/tests/test_data/simple_range/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_range/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_range" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/simple_shield/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_shield/Nargo.toml index 8b22da7ef10..b710f38d826 100644 --- a/crates/nargo_cli/tests/test_data/simple_shield/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_shield/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_shield" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/simple_shift_left_right/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_shift_left_right/Nargo.toml index 7d1e4cf39c0..09eb46d547e 100644 --- a/crates/nargo_cli/tests/test_data/simple_shift_left_right/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/simple_shift_left_right/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "simple_shift_left_right" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/slices/Nargo.toml b/crates/nargo_cli/tests/test_data/slices/Nargo.toml index 0b6a804ea1d..bc9dcc7729a 100644 --- a/crates/nargo_cli/tests/test_data/slices/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/slices/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "slices" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/strings/Nargo.toml b/crates/nargo_cli/tests/test_data/strings/Nargo.toml index 9b29990eb35..30df1a2f27e 100644 --- a/crates/nargo_cli/tests/test_data/strings/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/strings/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "strings" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/struct/Nargo.toml b/crates/nargo_cli/tests/test_data/struct/Nargo.toml index 949d3e860b3..34c3d838538 100644 --- a/crates/nargo_cli/tests/test_data/struct/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/struct/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "struct" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/struct_array_inputs/Nargo.toml b/crates/nargo_cli/tests/test_data/struct_array_inputs/Nargo.toml index 040b5359f33..7be5ccbb99f 100644 --- a/crates/nargo_cli/tests/test_data/struct_array_inputs/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/struct_array_inputs/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "struct_array_inputs" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/struct_fields_ordering/Nargo.toml b/crates/nargo_cli/tests/test_data/struct_fields_ordering/Nargo.toml index 5d2e0d8d9d1..2e886f62689 100644 --- a/crates/nargo_cli/tests/test_data/struct_fields_ordering/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/struct_fields_ordering/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "struct_fields_ordering" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/struct_inputs/Nargo.toml b/crates/nargo_cli/tests/test_data/struct_inputs/Nargo.toml index ee51fec2bcd..455a7b28ddb 100644 --- a/crates/nargo_cli/tests/test_data/struct_inputs/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/struct_inputs/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "struct_inputs" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/submodules/Nargo.toml b/crates/nargo_cli/tests/test_data/submodules/Nargo.toml index f38965dfa11..a98eda3cd89 100644 --- a/crates/nargo_cli/tests/test_data/submodules/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/submodules/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "submodules" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/to_be_bytes/Nargo.toml b/crates/nargo_cli/tests/test_data/to_be_bytes/Nargo.toml index 7c9cbc964c1..c0837a335f8 100644 --- a/crates/nargo_cli/tests/test_data/to_be_bytes/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/to_be_bytes/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "to_be_bytes" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/to_bits/Nargo.toml b/crates/nargo_cli/tests/test_data/to_bits/Nargo.toml index 3cd694dac88..9fe822eca93 100644 --- a/crates/nargo_cli/tests/test_data/to_bits/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/to_bits/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "to_bits" +type = "bin" authors = [""] compiler_version = "0.7.0" diff --git a/crates/nargo_cli/tests/test_data/to_bytes_integration/Nargo.toml b/crates/nargo_cli/tests/test_data/to_bytes_integration/Nargo.toml index 40da1e922ae..fd1c714b123 100644 --- a/crates/nargo_cli/tests/test_data/to_bytes_integration/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/to_bytes_integration/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "to_bytes_integration" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/to_le_bytes/Nargo.toml b/crates/nargo_cli/tests/test_data/to_le_bytes/Nargo.toml index 1ad2aac253d..34cf8a5afc7 100644 --- a/crates/nargo_cli/tests/test_data/to_le_bytes/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/to_le_bytes/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "to_le_bytes" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/tuples/Nargo.toml b/crates/nargo_cli/tests/test_data/tuples/Nargo.toml index 1377570c1a4..54603e9a96b 100644 --- a/crates/nargo_cli/tests/test_data/tuples/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/tuples/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "tuples" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/type_aliases/Nargo.toml b/crates/nargo_cli/tests/test_data/type_aliases/Nargo.toml index a797cb0bbe2..e828f6913e0 100644 --- a/crates/nargo_cli/tests/test_data/type_aliases/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/type_aliases/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "type_aliases" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/unconstrained_empty/Nargo.toml b/crates/nargo_cli/tests/test_data/unconstrained_empty/Nargo.toml index 63689725523..a42660e8bb7 100644 --- a/crates/nargo_cli/tests/test_data/unconstrained_empty/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/unconstrained_empty/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "unconstrained_empty" +type = "bin" authors = [""] compiler_version = "0.6.0" diff --git a/crates/nargo_cli/tests/test_data/unit/Nargo.toml b/crates/nargo_cli/tests/test_data/unit/Nargo.toml index 433e130173e..35fcd4bf339 100644 --- a/crates/nargo_cli/tests/test_data/unit/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/unit/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "unit" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_data/vectors/Nargo.toml b/crates/nargo_cli/tests/test_data/vectors/Nargo.toml index 7f768c1fd23..f628d5e27e1 100644 --- a/crates/nargo_cli/tests/test_data/vectors/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/vectors/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "vectors" +type = "bin" authors = [""] compiler_version = "0.7.1" diff --git a/crates/nargo_cli/tests/test_data/workspace/crates/a/Nargo.toml b/crates/nargo_cli/tests/test_data/workspace/crates/a/Nargo.toml index 5ff1a743e3d..411f048a93b 100644 --- a/crates/nargo_cli/tests/test_data/workspace/crates/a/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/workspace/crates/a/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "a" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/workspace/crates/b/Nargo.toml b/crates/nargo_cli/tests/test_data/workspace/crates/b/Nargo.toml index 8ae69a781eb..1af8ef961cc 100644 --- a/crates/nargo_cli/tests/test_data/workspace/crates/b/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/workspace/crates/b/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "b" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/workspace_default_member/a/Nargo.toml b/crates/nargo_cli/tests/test_data/workspace_default_member/a/Nargo.toml index 5ff1a743e3d..411f048a93b 100644 --- a/crates/nargo_cli/tests/test_data/workspace_default_member/a/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/workspace_default_member/a/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "a" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/workspace_default_member/b/Nargo.toml b/crates/nargo_cli/tests/test_data/workspace_default_member/b/Nargo.toml index 85c6119c62c..1af8ef961cc 100644 --- a/crates/nargo_cli/tests/test_data/workspace_default_member/b/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/workspace_default_member/b/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "b" +type = "bin" authors = [""] compiler_version = "0.8.0" diff --git a/crates/nargo_cli/tests/test_data/workspace_fail/crates/a/Nargo.toml b/crates/nargo_cli/tests/test_data/workspace_fail/crates/a/Nargo.toml index 5ff1a743e3d..411f048a93b 100644 --- a/crates/nargo_cli/tests/test_data/workspace_fail/crates/a/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/workspace_fail/crates/a/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "a" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/workspace_fail/crates/b/Nargo.toml b/crates/nargo_cli/tests/test_data/workspace_fail/crates/b/Nargo.toml index 8ae69a781eb..1af8ef961cc 100644 --- a/crates/nargo_cli/tests/test_data/workspace_fail/crates/b/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/workspace_fail/crates/b/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "b" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/workspace_missing_toml/crates/b/Nargo.toml b/crates/nargo_cli/tests/test_data/workspace_missing_toml/crates/b/Nargo.toml index 8ae69a781eb..1af8ef961cc 100644 --- a/crates/nargo_cli/tests/test_data/workspace_missing_toml/crates/b/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/workspace_missing_toml/crates/b/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "b" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/xor/Nargo.toml b/crates/nargo_cli/tests/test_data/xor/Nargo.toml index b1bc5f3a4dd..ea15f5eb6c5 100644 --- a/crates/nargo_cli/tests/test_data/xor/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/xor/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "xor" +type = "bin" authors = [""] compiler_version = "0.1" diff --git a/crates/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml b/crates/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml index 8e64e10fc64..ccb03576323 100644 --- a/crates/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml +++ b/crates/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "bad_impl" +type = "lib" authors = [""] compiler_version = "0.7.1" diff --git a/crates/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml b/crates/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml new file mode 100644 index 00000000000..aa7125bf5b5 --- /dev/null +++ b/crates/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "bin_dep" +type = "bin" +authors = [""] +compiler_version = "0.7.1" + +[dependencies] diff --git a/crates/nargo_cli/tests/test_libraries/bin_dep/src/main.nr b/crates/nargo_cli/tests/test_libraries/bin_dep/src/main.nr new file mode 100644 index 00000000000..882a9c70056 --- /dev/null +++ b/crates/nargo_cli/tests/test_libraries/bin_dep/src/main.nr @@ -0,0 +1,4 @@ + +fn call_dep1_then_dep2(x : Field, y : Field) { + assert(x == y); +} diff --git a/crates/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml b/crates/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml index 7e8927d3907..7069390334c 100644 --- a/crates/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml +++ b/crates/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "diamond_deps_1" +type = "lib" authors = [""] compiler_version = "0.7.1" diff --git a/crates/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml b/crates/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml index 7b5fd01b8d6..4b8ece297d3 100644 --- a/crates/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml +++ b/crates/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml @@ -1,5 +1,6 @@ [package] name = "diamond_deps_2" +type = "lib" authors = [""] compiler_version = "0.7.1" diff --git a/crates/noirc_driver/src/lib.rs b/crates/noirc_driver/src/lib.rs index c624dda2fce..2f68b99f8ab 100644 --- a/crates/noirc_driver/src/lib.rs +++ b/crates/noirc_driver/src/lib.rs @@ -8,7 +8,7 @@ use fm::FileId; use noirc_abi::FunctionSignature; use noirc_errors::{CustomDiagnostic, FileDiagnostic}; use noirc_evaluator::create_circuit; -use noirc_frontend::graph::{CrateId, CrateName, CrateType}; +use noirc_frontend::graph::{CrateId, CrateName}; use noirc_frontend::hir::def_map::{Contract, CrateDefMap}; use noirc_frontend::hir::Context; use noirc_frontend::monomorphization::monomorphize; @@ -52,15 +52,15 @@ pub fn compile_file( context: &mut Context, root_file: &Path, ) -> Result<(CompiledProgram, Warnings), ErrorsAndWarnings> { - let crate_id = prepare_crate(context, root_file, CrateType::Binary); + let crate_id = prepare_crate(context, root_file); compile_main(context, crate_id, &CompileOptions::default()) } /// Adds the file from the file system at `Path` to the crate graph -pub fn prepare_crate(context: &mut Context, file_name: &Path, crate_type: CrateType) -> CrateId { +pub fn prepare_crate(context: &mut Context, file_name: &Path) -> CrateId { let root_file_id = context.file_manager.add_file(file_name).unwrap(); - context.crate_graph.add_crate_root(crate_type, root_file_id) + context.crate_graph.add_crate_root(root_file_id) } /// Adds a edge in the crate graph for two crates @@ -70,11 +70,6 @@ pub fn add_dep( depends_on: CrateId, crate_name: CrateName, ) { - // Cannot depend on a binary - if context.crate_graph.crate_type(depends_on) == CrateType::Binary { - panic!("crates cannot depend on binaries. {crate_name:?} is a binary crate") - } - context .crate_graph .add_dep(this_crate, crate_name, depends_on) @@ -117,7 +112,7 @@ pub fn check_crate( // You can add any crate type to the crate graph // but you cannot depend on Binaries - let std_crate = context.crate_graph.add_stdlib(CrateType::Library, root_file_id); + let std_crate = context.crate_graph.add_stdlib(root_file_id); propagate_dep(context, std_crate, &std_crate_name.parse().unwrap()); let mut errors = vec![]; @@ -155,10 +150,13 @@ pub fn compile_main( let main = match context.get_main_function(&crate_id) { Some(m) => m, None => { + // TODO: This error might be a better to exist in Nargo let err = FileDiagnostic { - file_id: FileId::default(), - diagnostic: CustomDiagnostic::from_message("cannot compile crate into a program as the local crate is not a binary. For libraries, please use the check command") - }; + file_id: FileId::default(), + diagnostic: CustomDiagnostic::from_message( + "cannot compile crate into a program as it does not contain a `main` function", + ), + }; return Err(vec![err]); } }; diff --git a/crates/noirc_frontend/src/graph/mod.rs b/crates/noirc_frontend/src/graph/mod.rs index af9216071e6..2c251432e9b 100644 --- a/crates/noirc_frontend/src/graph/mod.rs +++ b/crates/noirc_frontend/src/graph/mod.rs @@ -73,16 +73,9 @@ pub struct CrateGraph { /// and we do not want names that differ by a hyphen pub const CHARACTER_BLACK_LIST: [char; 1] = ['-']; -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum CrateType { - Library, - Binary, -} - #[derive(Debug, Clone, PartialEq, Eq)] pub struct CrateData { pub root_file_id: FileId, - pub crate_type: CrateType, pub dependencies: Vec, } @@ -101,7 +94,7 @@ impl Dependency { } impl CrateGraph { - pub fn add_crate_root(&mut self, crate_type: CrateType, file_id: FileId) -> CrateId { + pub fn add_crate_root(&mut self, file_id: FileId) -> CrateId { let mut roots_with_file_id = self.arena.iter().filter(|(_, crate_data)| crate_data.root_file_id == file_id); @@ -110,14 +103,14 @@ impl CrateGraph { return *file_id.0; } - let data = CrateData { root_file_id: file_id, crate_type, dependencies: Vec::new() }; + let data = CrateData { root_file_id: file_id, dependencies: Vec::new() }; let crate_id = CrateId::Crate(self.arena.len()); let prev = self.arena.insert(crate_id, data); assert!(prev.is_none()); crate_id } - pub fn add_stdlib(&mut self, crate_type: CrateType, file_id: FileId) -> CrateId { + pub fn add_stdlib(&mut self, file_id: FileId) -> CrateId { let mut roots_with_file_id = self.arena.iter().filter(|(_, crate_data)| crate_data.root_file_id == file_id); @@ -126,17 +119,13 @@ impl CrateGraph { return *file_id.0; } - let data = CrateData { root_file_id: file_id, crate_type, dependencies: Vec::new() }; + let data = CrateData { root_file_id: file_id, dependencies: Vec::new() }; let crate_id = CrateId::Stdlib(self.arena.len()); let prev = self.arena.insert(crate_id, data); assert!(prev.is_none()); crate_id } - pub fn crate_type(&self, crate_id: CrateId) -> CrateType { - self.arena.get(&crate_id).unwrap().crate_type - } - pub fn iter_keys(&self) -> impl Iterator + '_ { self.arena.keys().copied() } @@ -228,7 +217,7 @@ pub struct CyclicDependenciesError { mod tests { use std::path::PathBuf; - use super::{CrateGraph, CrateType, FileId}; + use super::{CrateGraph, FileId}; fn dummy_file_ids(n: usize) -> Vec { use fm::{FileMap, FILE_EXTENSION}; @@ -250,9 +239,9 @@ mod tests { let file_ids = dummy_file_ids(3); let mut graph = CrateGraph::default(); - let crate1 = graph.add_crate_root(CrateType::Library, file_ids[0]); - let crate2 = graph.add_crate_root(CrateType::Library, file_ids[1]); - let crate3 = graph.add_crate_root(CrateType::Library, file_ids[2]); + let crate1 = graph.add_crate_root(file_ids[0]); + let crate2 = graph.add_crate_root(file_ids[1]); + let crate3 = graph.add_crate_root(file_ids[2]); assert!(graph.add_dep(crate1, "crate2".parse().unwrap(), crate2).is_ok()); assert!(graph.add_dep(crate2, "crate3".parse().unwrap(), crate3).is_ok()); @@ -266,9 +255,9 @@ mod tests { let file_id_1 = file_ids[1]; let file_id_2 = file_ids[2]; let mut graph = CrateGraph::default(); - let crate1 = graph.add_crate_root(CrateType::Library, file_id_0); - let crate2 = graph.add_crate_root(CrateType::Library, file_id_1); - let crate3 = graph.add_crate_root(CrateType::Library, file_id_2); + let crate1 = graph.add_crate_root(file_id_0); + let crate2 = graph.add_crate_root(file_id_1); + let crate3 = graph.add_crate_root(file_id_2); assert!(graph.add_dep(crate1, "crate2".parse().unwrap(), crate2).is_ok()); assert!(graph.add_dep(crate2, "crate3".parse().unwrap(), crate3).is_ok()); } @@ -279,12 +268,12 @@ mod tests { let file_id_1 = file_ids[1]; let file_id_2 = file_ids[2]; let mut graph = CrateGraph::default(); - let _crate1 = graph.add_crate_root(CrateType::Library, file_id_0); - let _crate2 = graph.add_crate_root(CrateType::Library, file_id_1); + let _crate1 = graph.add_crate_root(file_id_0); + let _crate2 = graph.add_crate_root(file_id_1); // Adding the same file, so the crate should be the same. - let crate3 = graph.add_crate_root(CrateType::Library, file_id_2); - let crate3_2 = graph.add_crate_root(CrateType::Library, file_id_2); + let crate3 = graph.add_crate_root(file_id_2); + let crate3_2 = graph.add_crate_root(file_id_2); assert_eq!(crate3, crate3_2); } } diff --git a/crates/noirc_frontend/src/hir/mod.rs b/crates/noirc_frontend/src/hir/mod.rs index d6f98e112af..a87a7eef319 100644 --- a/crates/noirc_frontend/src/hir/mod.rs +++ b/crates/noirc_frontend/src/hir/mod.rs @@ -4,7 +4,7 @@ pub mod resolution; pub mod scope; pub mod type_check; -use crate::graph::{CrateGraph, CrateId, CrateType}; +use crate::graph::{CrateGraph, CrateId}; use crate::hir_def::function::FuncMeta; use crate::node_interner::{FuncId, NodeInterner}; use def_map::{Contract, CrateDefMap}; @@ -67,14 +67,8 @@ impl Context { // Find the local crate, one should always be present let local_crate = self.def_map(crate_id).unwrap(); - // Check the crate type - // We don't panic here to allow users to `evaluate` libraries which will do nothing - if matches!(self.crate_graph[*crate_id].crate_type, CrateType::Binary) { - // All Binaries should have a main function - local_crate.main_function() - } else { - None - } + // All Binaries should have a main function + local_crate.main_function() } /// Returns a list of all functions in the current crate marked with #[test] diff --git a/crates/wasm/src/compile.rs b/crates/wasm/src/compile.rs index 4254110b849..2e923574bbf 100644 --- a/crates/wasm/src/compile.rs +++ b/crates/wasm/src/compile.rs @@ -6,10 +6,7 @@ use noirc_driver::{ check_crate, compile_contracts, compile_no_check, prepare_crate, propagate_dep, CompileOptions, CompiledContract, }; -use noirc_frontend::{ - graph::{CrateGraph, CrateType}, - hir::Context, -}; +use noirc_frontend::{graph::CrateGraph, hir::Context}; use serde::{Deserialize, Serialize}; use std::path::Path; use wasm_bindgen::prelude::*; @@ -63,7 +60,7 @@ impl Default for WASMCompileOptions { fn add_noir_lib(context: &mut Context, crate_name: &str) { let path_to_lib = Path::new(&crate_name).join("lib.nr"); - let library_crate = prepare_crate(context, &path_to_lib, CrateType::Library); + let library_crate = prepare_crate(context, &path_to_lib); propagate_dep(context, library_crate, &crate_name.parse().unwrap()); } @@ -87,7 +84,7 @@ pub fn compile(args: JsValue) -> JsValue { let mut context = Context::new(fm, graph); let path = Path::new(&options.entry_point); - let crate_id = prepare_crate(&mut context, path, CrateType::Binary); + let crate_id = prepare_crate(&mut context, path); for dependency in options.optional_dependencies_set { add_noir_lib(&mut context, dependency.as_str()); From d565babb0fd1928cd334f4a5fda02e64c649bdbd Mon Sep 17 00:00:00 2001 From: Tom French Date: Thu, 3 Aug 2023 09:57:11 +0100 Subject: [PATCH 02/11] chore: add package type to new test cases --- crates/nargo_cli/tests/test_data/closures_mut_ref/Nargo.toml | 3 ++- .../tests/test_data/higher_order_fn_selector/Nargo.toml | 3 ++- .../tests/test_data/higher_order_functions/Nargo.toml | 3 ++- crates/nargo_cli/tests/test_data/inner_outer_cl/Nargo.toml | 3 ++- crates/nargo_cli/tests/test_data/ret_fn_ret_cl/Nargo.toml | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/nargo_cli/tests/test_data/closures_mut_ref/Nargo.toml b/crates/nargo_cli/tests/test_data/closures_mut_ref/Nargo.toml index c829bb160b1..f70cde6f878 100644 --- a/crates/nargo_cli/tests/test_data/closures_mut_ref/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/closures_mut_ref/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "closures_mut_ref" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/higher_order_fn_selector/Nargo.toml b/crates/nargo_cli/tests/test_data/higher_order_fn_selector/Nargo.toml index 3c2277e35a5..09a0e342a71 100644 --- a/crates/nargo_cli/tests/test_data/higher_order_fn_selector/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/higher_order_fn_selector/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "higher_order_fn_selector" +type = "bin" authors = [""] compiler_version = "0.8.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/higher_order_functions/Nargo.toml b/crates/nargo_cli/tests/test_data/higher_order_functions/Nargo.toml index cf7526abc7f..9dc419d1678 100644 --- a/crates/nargo_cli/tests/test_data/higher_order_functions/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/higher_order_functions/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "higher_order_functions" +type = "bin" authors = [""] compiler_version = "0.1" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/inner_outer_cl/Nargo.toml b/crates/nargo_cli/tests/test_data/inner_outer_cl/Nargo.toml index 1470053df2f..25722866d9b 100644 --- a/crates/nargo_cli/tests/test_data/inner_outer_cl/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/inner_outer_cl/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "inner_outer_cl" +type = "bin" authors = [""] compiler_version = "0.7.1" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/crates/nargo_cli/tests/test_data/ret_fn_ret_cl/Nargo.toml b/crates/nargo_cli/tests/test_data/ret_fn_ret_cl/Nargo.toml index 3e411b2849b..4e1b06d927f 100644 --- a/crates/nargo_cli/tests/test_data/ret_fn_ret_cl/Nargo.toml +++ b/crates/nargo_cli/tests/test_data/ret_fn_ret_cl/Nargo.toml @@ -1,6 +1,7 @@ [package] name = "ret_fn_ret_cl" +type = "bin" authors = [""] compiler_version = "0.7.1" -[dependencies] \ No newline at end of file +[dependencies] From ba011e3dfc337103fdd577050e36746bceb963e6 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Thu, 3 Aug 2023 10:49:51 +0100 Subject: [PATCH 03/11] Update crates/nargo_cli/src/cli/init_cmd.rs --- crates/nargo_cli/src/cli/init_cmd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nargo_cli/src/cli/init_cmd.rs b/crates/nargo_cli/src/cli/init_cmd.rs index e7e13672f66..f7e09cc5a5e 100644 --- a/crates/nargo_cli/src/cli/init_cmd.rs +++ b/crates/nargo_cli/src/cli/init_cmd.rs @@ -42,7 +42,7 @@ const LIB_EXAMPLE: &str = r#"fn my_util(x : Field, y : Field) -> bool { } #[test] -fn test_main() { +fn test_my_util() { assert(my_util(1, 2)); // Uncomment to make test fail From c002c8639ba4c1c609f42c91090da68a412ef56e Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 3 Aug 2023 11:02:13 -0700 Subject: [PATCH 04/11] Add conflicts_with to flags Co-authored-by: Koby Hall <102518238+kobyhallx@users.noreply.github.com> --- crates/nargo_cli/src/cli/init_cmd.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/nargo_cli/src/cli/init_cmd.rs b/crates/nargo_cli/src/cli/init_cmd.rs index f7e09cc5a5e..bf7a54478a7 100644 --- a/crates/nargo_cli/src/cli/init_cmd.rs +++ b/crates/nargo_cli/src/cli/init_cmd.rs @@ -16,11 +16,11 @@ pub(crate) struct InitCommand { name: Option, } /// Use a library template - #[clap(long)] + #[arg(long, conflicts_with="bin")] pub(crate) lib: bool, /// Use a binary template [default] - #[clap(long)] + #[arg(long, conflicts_with="lib")] pub(crate) bin: bool, } From 6747fd84cfde11bd14959b5e977b478a5bbe02cc Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 3 Aug 2023 11:04:17 -0700 Subject: [PATCH 05/11] Comment cleanup Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> --- crates/nargo_cli/src/cli/init_cmd.rs | 3 +-- crates/noirc_frontend/src/hir/mod.rs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/nargo_cli/src/cli/init_cmd.rs b/crates/nargo_cli/src/cli/init_cmd.rs index bf7a54478a7..5e38d99430e 100644 --- a/crates/nargo_cli/src/cli/init_cmd.rs +++ b/crates/nargo_cli/src/cli/init_cmd.rs @@ -71,7 +71,6 @@ pub(crate) fn initialize_project(package_dir: PathBuf, package_name: &str, packa let src_dir = package_dir.join(SRC_DIR); create_named_dir(&src_dir, "src"); - // TODO: Need to make type configurable let toml_contents = format!( r#"[package] name = "{package_name}" @@ -83,7 +82,7 @@ compiler_version = "{CARGO_PKG_VERSION}" ); write_to_file(toml_contents.as_bytes(), &package_dir.join(PKG_FILE)); - // This is a match so we get a compile error when we add to the package types + // This uses the `match` syntax instead of `if` so we get a compile error when we add new package types (which likely need new template files) match package_type { PackageType::Binary => write_to_file(BIN_EXAMPLE.as_bytes(), &src_dir.join("main.nr")), PackageType::Library => write_to_file(LIB_EXAMPLE.as_bytes(), &src_dir.join("lib.nr")), diff --git a/crates/noirc_frontend/src/hir/mod.rs b/crates/noirc_frontend/src/hir/mod.rs index a87a7eef319..91a6006d096 100644 --- a/crates/noirc_frontend/src/hir/mod.rs +++ b/crates/noirc_frontend/src/hir/mod.rs @@ -67,7 +67,6 @@ impl Context { // Find the local crate, one should always be present let local_crate = self.def_map(crate_id).unwrap(); - // All Binaries should have a main function local_crate.main_function() } From c38c1526db9bc743e769945c282137b7c48b897f Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 3 Aug 2023 11:12:29 -0700 Subject: [PATCH 06/11] defer clone --- crates/nargo/src/package.rs | 4 ++-- crates/nargo_cli/src/manifest.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/nargo/src/package.rs b/crates/nargo/src/package.rs index cfed3476d3a..ed675b07028 100644 --- a/crates/nargo/src/package.rs +++ b/crates/nargo/src/package.rs @@ -32,9 +32,9 @@ impl Dependency { } } - pub fn package_name(&self) -> CrateName { + pub fn package_name(&self) -> &CrateName { match self { - Self::Local { package } | Self::Remote { package } => package.name.clone(), + Self::Local { package } | Self::Remote { package } => &package.name, } } } diff --git a/crates/nargo_cli/src/manifest.rs b/crates/nargo_cli/src/manifest.rs index 079ba2a03fd..a01fbe15c4c 100644 --- a/crates/nargo_cli/src/manifest.rs +++ b/crates/nargo_cli/src/manifest.rs @@ -177,7 +177,7 @@ impl DependencyConfig { // Cannot depend on a binary // TODO: Can we depend upon contracts? if dep.is_binary() { - Err(ManifestError::BinaryDependency(dep.package_name())) + Err(ManifestError::BinaryDependency(dep.package_name().clone())) } else { Ok(dep) } From b3c25cc7361169b12a6412c13dbf3b8a761864a2 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 3 Aug 2023 11:14:32 -0700 Subject: [PATCH 07/11] derive eq --- crates/nargo/src/package.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/nargo/src/package.rs b/crates/nargo/src/package.rs index ed675b07028..6c690fe9caf 100644 --- a/crates/nargo/src/package.rs +++ b/crates/nargo/src/package.rs @@ -4,7 +4,7 @@ use noirc_frontend::graph::CrateName; use crate::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE}; -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum PackageType { Library, Binary, @@ -61,10 +61,10 @@ impl Package { } pub fn is_binary(&self) -> bool { - matches!(self.package_type, PackageType::Binary) + self.package_type == PackageType::Binary } pub fn is_library(&self) -> bool { - matches!(self.package_type, PackageType::Library) + self.package_type == PackageType::Library } } From 5b620363e5f8a16804ad2d479d9547ad8f72669e Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 3 Aug 2023 11:33:02 -0700 Subject: [PATCH 08/11] Update crates/noirc_driver/src/lib.rs --- crates/noirc_driver/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/noirc_driver/src/lib.rs b/crates/noirc_driver/src/lib.rs index 2f68b99f8ab..6b9ab2c996d 100644 --- a/crates/noirc_driver/src/lib.rs +++ b/crates/noirc_driver/src/lib.rs @@ -150,7 +150,7 @@ pub fn compile_main( let main = match context.get_main_function(&crate_id) { Some(m) => m, None => { - // TODO: This error might be a better to exist in Nargo + // TODO(#2155): This error might be a better to exist in Nargo let err = FileDiagnostic { file_id: FileId::default(), diagnostic: CustomDiagnostic::from_message( From 27bc8b4e9f6658c084786c07dbadbb44db1c37bc Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Fri, 4 Aug 2023 08:04:28 -0700 Subject: [PATCH 09/11] fix rebase problems --- crates/nargo_cli/src/cli/init_cmd.rs | 13 ++++++++----- crates/nargo_cli/src/cli/new_cmd.rs | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/nargo_cli/src/cli/init_cmd.rs b/crates/nargo_cli/src/cli/init_cmd.rs index 5e38d99430e..edfb9c3410c 100644 --- a/crates/nargo_cli/src/cli/init_cmd.rs +++ b/crates/nargo_cli/src/cli/init_cmd.rs @@ -14,13 +14,13 @@ pub(crate) struct InitCommand { /// Name of the package [default: current directory name] #[clap(long)] name: Option, -} + /// Use a library template - #[arg(long, conflicts_with="bin")] + #[arg(long, conflicts_with = "bin")] pub(crate) lib: bool, /// Use a binary template [default] - #[arg(long, conflicts_with="lib")] + #[arg(long, conflicts_with = "lib")] pub(crate) bin: bool, } @@ -66,8 +66,11 @@ pub(crate) fn run( } /// Initializes a new Noir project in `package_dir`. -pub(crate) fn initialize_project(package_dir: PathBuf, package_name: &str, package_type: PackageType) { - // TODO: Should this reject if we have non-Unicode filepaths? +pub(crate) fn initialize_project( + package_dir: PathBuf, + package_name: &str, + package_type: PackageType, +) { let src_dir = package_dir.join(SRC_DIR); create_named_dir(&src_dir, "src"); diff --git a/crates/nargo_cli/src/cli/new_cmd.rs b/crates/nargo_cli/src/cli/new_cmd.rs index 617fb2fc583..e67a046293d 100644 --- a/crates/nargo_cli/src/cli/new_cmd.rs +++ b/crates/nargo_cli/src/cli/new_cmd.rs @@ -17,7 +17,7 @@ pub(crate) struct NewCommand { /// Name of the package [default: package directory name] #[clap(long)] - path: Option, + name: Option, #[clap(flatten)] init_config: InitCommand, From 35b4cdb2abdb1eeccba2abc4a90b0c81ea005843 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:33:57 +0100 Subject: [PATCH 10/11] Update crates/nargo_cli/src/errors.rs --- crates/nargo_cli/src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nargo_cli/src/errors.rs b/crates/nargo_cli/src/errors.rs index ea536d8bb0d..45d2dbae827 100644 --- a/crates/nargo_cli/src/errors.rs +++ b/crates/nargo_cli/src/errors.rs @@ -85,7 +85,7 @@ pub(crate) enum CompileError { #[error("Package `{0}` is expected to have a `main` function but it does not")] MissingMainFunction(CrateName), - /// Errors encountered while compiling the noir program. + /// Errors encountered while compiling the Noir program. /// These errors are already written to stderr. #[error("Aborting due to {} previous error{}", .0.error_count, if .0.error_count == 1 { "" } else { "s" })] ReportedErrors(ReportedErrors), From f5ce815898cdb95cb288d7177fa6235616bce43e Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 4 Aug 2023 17:52:33 +0100 Subject: [PATCH 11/11] chore: remove newlines in config.toml --- crates/nargo_cli/tests/test_data/config.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/nargo_cli/tests/test_data/config.toml b/crates/nargo_cli/tests/test_data/config.toml index 4f09fe87b12..61178563154 100644 --- a/crates/nargo_cli/tests/test_data/config.toml +++ b/crates/nargo_cli/tests/test_data/config.toml @@ -2,10 +2,4 @@ exclude = [] # List of tests (as their directory name) expecting to fail: if the test pass, we report an error. -fail = [ - "brillig_assert_fail", - "dep_impl_primitive", - "depend_on_bin", - "workspace_fail", - "workspace_missing_toml" -] +fail = ["brillig_assert_fail", "dep_impl_primitive", "depend_on_bin", "workspace_fail", "workspace_missing_toml"]