diff --git a/Cargo.lock b/Cargo.lock index b8f37714d27..2cee9e28c87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2243,21 +2243,32 @@ checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" [[package]] name = "nargo" version = "0.3.2" +dependencies = [ + "barretenberg_static_lib", + "barretenberg_wasm", + "cfg-if 1.0.0", + "marlin_arkworks_backend", + "rustc_version 0.4.0", + "serde", + "thiserror", + "toml", +] + +[[package]] +name = "nargo_cli" +version = "0.3.2" dependencies = [ "acvm 0.8.0", "assert_cmd", "assert_fs", - "barretenberg_static_lib", - "barretenberg_wasm", "build-data", - "cfg-if 1.0.0", "clap 4.1.8", "color-eyre", "const_format", "dirs 4.0.0", "hex", "iter-extended", - "marlin_arkworks_backend", + "nargo", "noirc_abi", "noirc_driver", "noirc_frontend", diff --git a/Cargo.toml b/Cargo.toml index aaa77ee4e7c..29ac590f6ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,13 +6,14 @@ members = [ "crates/noirc_errors", "crates/noirc_driver", "crates/nargo", + "crates/nargo_cli", "crates/fm", "crates/arena", "crates/noirc_abi", "crates/iter-extended", "crates/wasm", ] -default-members = ["crates/nargo"] +default-members = ["crates/nargo_cli"] [workspace.package] # x-release-please-start-version @@ -28,6 +29,7 @@ arena = { path = "crates/arena" } fm = { path = "crates/fm" } iter-extended = { path = "crates/iter-extended" } nargo = { path = "crates/nargo" } +nargo_cli = { path = "crates/nargo_cli" } noirc_abi = { path = "crates/noirc_abi" } noirc_driver = { path = "crates/noirc_driver" } noirc_errors = { path = "crates/noirc_errors" } diff --git a/crates/nargo/Cargo.toml b/crates/nargo/Cargo.toml index 469597036ee..1cf42c9ad22 100644 --- a/crates/nargo/Cargo.toml +++ b/crates/nargo/Cargo.toml @@ -9,39 +9,18 @@ edition.workspace = true [build-dependencies] rustc_version = "0.4.0" -build-data = "0.1.3" [dependencies] -clap.workspace = true -dirs.workspace = true -url.workspace = true -iter-extended.workspace = true -noirc_driver.workspace = true -noirc_frontend.workspace = true -noirc_abi.workspace = true -acvm.workspace = true cfg-if.workspace = true toml.workspace = true serde.workspace = true thiserror.workspace = true -const_format = "0.2.30" -hex = "0.4.2" -serde_json = "1.0" -termcolor = "1.1.2" -tempdir = "0.3.7" -color-eyre = "0.6.2" - # Backends aztec_backend = { optional = true, package = "barretenberg_static_lib", git = "https://github.com/noir-lang/aztec_backend", rev = "26178359a2251e885f15f0a4d1a686afda04aec9" } aztec_wasm_backend = { optional = true, package = "barretenberg_wasm", git = "https://github.com/noir-lang/aztec_backend", rev = "26178359a2251e885f15f0a4d1a686afda04aec9" } marlin_arkworks_backend = { optional = true, git = "https://github.com/noir-lang/marlin_arkworks_backend", rev = "144378edad821bfaa52bf2cacca8ecc87514a4fc" } -[dev-dependencies] -assert_cmd = "2.0.8" -assert_fs = "1.0.10" -predicates = "2.1.5" - [features] default = ["plonk_bn254"] # The plonk backend can only use bn254, so we do not specify the field diff --git a/crates/nargo/build.rs b/crates/nargo/build.rs index 0745d31840d..cf52e8b2627 100644 --- a/crates/nargo/build.rs +++ b/crates/nargo/build.rs @@ -9,8 +9,4 @@ fn check_rustc_version() { fn main() { check_rustc_version(); - - build_data::set_GIT_COMMIT(); - build_data::set_GIT_DIRTY(); - build_data::no_debug_rebuilds(); } diff --git a/crates/nargo/src/backends.rs b/crates/nargo/src/backends.rs index ff64931a0d9..85e94edda82 100644 --- a/crates/nargo/src/backends.rs +++ b/crates/nargo/src/backends.rs @@ -1,11 +1,11 @@ cfg_if::cfg_if! { if #[cfg(feature = "plonk_bn254")] { - pub(crate) use aztec_backend::Plonk as ConcreteBackend; + pub use aztec_backend::Plonk as ConcreteBackend; } else if #[cfg(feature = "plonk_bn254_wasm")] { - pub(crate) use aztec_wasm_backend::Plonk as ConcreteBackend; + pub use aztec_wasm_backend::Plonk as ConcreteBackend; } else if #[cfg(feature = "marlin")] { // R1CS_MARLIN_ARKWORKS - pub(crate) use marlin_arkworks_backend::Marlin as ConcreteBackend; + pub use marlin_arkworks_backend::Marlin as ConcreteBackend; } else { compile_error!("please specify a backend to compile with"); } diff --git a/crates/nargo/src/lib.rs b/crates/nargo/src/lib.rs index 6ea9fe46058..4a46a4af0e0 100644 --- a/crates/nargo/src/lib.rs +++ b/crates/nargo/src/lib.rs @@ -6,88 +6,5 @@ //! This name was used because it sounds like `cargo` and //! Noir Package Manager abbreviated is npm, which is already taken. -use noirc_frontend::graph::CrateType; -use std::{ - fs::ReadDir, - path::{Path, PathBuf}, -}; - -mod backends; -pub mod cli; -mod constants; -mod errors; -mod git; -mod manifest; -mod resolver; - -use manifest::InvalidPackageError; - -fn nargo_crates() -> PathBuf { - dirs::home_dir().unwrap().join("nargo") -} - -/// Returns the path of the root directory of the package containing `current_path`. -/// -/// Returns a `CliError` if no parent directories of `current_path` contain a manifest file. -fn find_package_root(current_path: &Path) -> Result { - let manifest_path = find_package_manifest(current_path)?; - - let package_root = - manifest_path.parent().expect("infallible: manifest file path can't be root directory"); - - Ok(package_root.to_path_buf()) -} - -/// Returns the path of the manifest file (`Nargo.toml`) of the package containing `current_path`. -/// -/// Returns a `CliError` if no parent directories of `current_path` contain a manifest file. -fn find_package_manifest(current_path: &Path) -> Result { - current_path - .ancestors() - .find_map(|dir| find_file(dir, "Nargo", "toml")) - .ok_or_else(|| InvalidPackageError::MissingManifestFile(current_path.to_path_buf())) -} - -fn lib_or_bin(current_path: &Path) -> Result<(PathBuf, CrateType), InvalidPackageError> { - // 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(|| InvalidPackageError::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(InvalidPackageError::ContainsMultipleCrates), - (None, Some(path)) => Ok((path, CrateType::Binary)), - (Some(path), None) => Ok((path, CrateType::Library)), - (None, None) => Err(InvalidPackageError::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)?; - let file_name = format!("{file_name}.{extension}"); - - 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 - .into_iter() - .flatten() - .find(|entry| entry.file_name().to_str() == Some(artifact_name))?; - - Some(entry.path()) -} - -fn list_files_and_folders_in>(path: P) -> Option { - std::fs::read_dir(path).ok() -} +pub mod backends; +pub mod manifest; diff --git a/crates/nargo/src/manifest.rs b/crates/nargo/src/manifest.rs deleted file mode 100644 index fcade061942..00000000000 --- a/crates/nargo/src/manifest.rs +++ /dev/null @@ -1,102 +0,0 @@ -use serde::Deserialize; -use std::collections::BTreeMap; -use std::path::{Path, PathBuf}; -use thiserror::Error; - -/// Errors covering situations where a package is either missing or malformed. -#[derive(Debug, Error)] -pub(crate) enum InvalidPackageError { - /// Package doesn't have a manifest file - #[error("cannot find a Nargo.toml in {}", .0.display())] - MissingManifestFile(PathBuf), - - /// Package manifest is unreadable. - #[error("Nargo.toml is badly formed, could not parse.\n\n {0}")] - MalformedManifestFile(toml::de::Error), - - /// Package does not contain Noir source files. - #[error("cannot find src directory in path {}", .0.display())] - 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, -} - -#[derive(Debug, Deserialize, Clone)] -pub(crate) struct PackageManifest { - #[allow(dead_code)] - pub(crate) package: PackageMetadata, - pub(crate) dependencies: BTreeMap, -} - -impl PackageManifest { - /// Returns whether the package has a local dependency. - // Local paths are usually relative and are discouraged when sharing libraries - // It is better to separate these into different packages. - pub(crate) fn has_local_dependency(&self) -> bool { - self.dependencies.values().any(|dep| matches!(dep, Dependency::Path { .. })) - } -} - -#[allow(dead_code)] -#[derive(Debug, Deserialize, Clone)] -pub(crate) struct PackageMetadata { - // Note: a package name is not needed unless there is a registry - authors: Vec, - // If not compiler version is supplied, the latest is used - // For now, we state that all packages must be compiled under the same - // compiler version. - // We also state that ACIR and the compiler will upgrade in lockstep. - // so you will not need to supply an ACIR and compiler version - compiler_version: Option, - backend: Option, - license: Option, -} - -#[derive(Debug, Deserialize, Clone)] -#[serde(untagged)] -/// Enum representing the different types of ways to -/// supply a source for the dependency -pub(crate) enum Dependency { - Github { git: String, tag: String }, - Path { path: String }, -} - -/// Parses a Nargo.toml file from it's path -/// The path to the toml file must be present. -/// Calling this function without this guarantee is an ICE. -pub(crate) fn parse>( - path_to_toml: P, -) -> Result { - let toml_as_string = - std::fs::read_to_string(&path_to_toml).expect("ice: path given for toml file is invalid"); - - parse_toml_str(&toml_as_string) -} - -fn parse_toml_str(toml_as_string: &str) -> Result { - toml::from_str::(toml_as_string) - .map_err(InvalidPackageError::MalformedManifestFile) -} - -#[test] -fn parse_standard_toml() { - let src = r#" - - [package] - authors = ["kev", "foo"] - compiler_version = "0.1" - - [dependencies] - rand = { tag = "next", git = "https://github.com/rust-lang-nursery/rand"} - cool = { tag = "next", git = "https://github.com/rust-lang-nursery/rand"} - hello = {path = "./noir_driver"} - "#; - - assert!(parse_toml_str(src).is_ok()); -} diff --git a/crates/nargo/src/manifest/errors.rs b/crates/nargo/src/manifest/errors.rs new file mode 100644 index 00000000000..250211de6fb --- /dev/null +++ b/crates/nargo/src/manifest/errors.rs @@ -0,0 +1,26 @@ +use std::path::PathBuf; +use thiserror::Error; + +/// Errors covering situations where a package is either missing or malformed. +#[derive(Debug, Error)] +pub enum InvalidPackageError { + /// Package doesn't have a manifest file + #[error("cannot find a Nargo.toml in {}", .0.display())] + MissingManifestFile(PathBuf), + + /// Package manifest is unreadable. + #[error("Nargo.toml is badly formed, could not parse.\n\n {0}")] + MalformedManifestFile(#[from] toml::de::Error), + + /// Package does not contain Noir source files. + #[error("cannot find src directory in path {}", .0.display())] + 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, +} diff --git a/crates/nargo/src/manifest/mod.rs b/crates/nargo/src/manifest/mod.rs new file mode 100644 index 00000000000..1640225d211 --- /dev/null +++ b/crates/nargo/src/manifest/mod.rs @@ -0,0 +1,66 @@ +use serde::Deserialize; +use std::collections::BTreeMap; + +mod errors; +pub use self::errors::InvalidPackageError; + +#[derive(Debug, Deserialize, Clone)] +pub struct PackageManifest { + pub package: PackageMetadata, + pub dependencies: BTreeMap, +} + +impl PackageManifest { + /// Returns whether the package has a local dependency. + // Local paths are usually relative and are discouraged when sharing libraries + // It is better to separate these into different packages. + pub fn has_local_dependency(&self) -> bool { + self.dependencies.values().any(|dep| matches!(dep, Dependency::Path { .. })) + } + + pub fn from_toml_str(toml_as_string: &str) -> Result { + let manifest = toml::from_str::(toml_as_string)?; + Ok(manifest) + } +} + +#[allow(dead_code)] +#[derive(Debug, Deserialize, Clone)] +pub struct PackageMetadata { + // Note: a package name is not needed unless there is a registry + authors: Vec, + // If not compiler version is supplied, the latest is used + // For now, we state that all packages must be compiled under the same + // compiler version. + // We also state that ACIR and the compiler will upgrade in lockstep. + // so you will not need to supply an ACIR and compiler version + compiler_version: Option, + backend: Option, + license: Option, +} + +#[derive(Debug, Deserialize, Clone)] +#[serde(untagged)] +/// Enum representing the different types of ways to +/// supply a source for the dependency +pub enum Dependency { + Github { git: String, tag: String }, + Path { path: String }, +} + +#[test] +fn parse_standard_toml() { + let src = r#" + + [package] + authors = ["kev", "foo"] + compiler_version = "0.1" + + [dependencies] + rand = { tag = "next", git = "https://github.com/rust-lang-nursery/rand"} + cool = { tag = "next", git = "https://github.com/rust-lang-nursery/rand"} + hello = {path = "./noir_driver"} + "#; + + assert!(PackageManifest::from_toml_str(src).is_ok()); +} diff --git a/crates/nargo_cli/Cargo.toml b/crates/nargo_cli/Cargo.toml new file mode 100644 index 00000000000..35f9d3e7da1 --- /dev/null +++ b/crates/nargo_cli/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "nargo_cli" +description = "Noir's package manager" +version.workspace = true +authors.workspace = true +edition.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +# Rename binary from `nargo_cli` to `nargo` +[[bin]] +name = "nargo" +path = "src/main.rs" + +[build-dependencies] +rustc_version = "0.4.0" +build-data = "0.1.3" + +[dependencies] +clap.workspace = true +dirs.workspace = true +url.workspace = true +iter-extended.workspace = true +nargo.workspace = true +noirc_driver.workspace = true +noirc_frontend.workspace = true +noirc_abi.workspace = true +acvm.workspace = true +toml.workspace = true +serde.workspace = true +thiserror.workspace = true +const_format = "0.2.30" +hex = "0.4.2" +serde_json = "1.0" +termcolor = "1.1.2" +tempdir = "0.3.7" +color-eyre = "0.6.2" + +[dev-dependencies] +assert_cmd = "2.0.8" +assert_fs = "1.0.10" +predicates = "2.1.5" + +[features] +default = ["nargo/plonk_bn254"] + diff --git a/crates/nargo_cli/build.rs b/crates/nargo_cli/build.rs new file mode 100644 index 00000000000..0745d31840d --- /dev/null +++ b/crates/nargo_cli/build.rs @@ -0,0 +1,16 @@ +use rustc_version::{version, Version}; + +fn check_rustc_version() { + assert!( + version().unwrap() >= Version::parse("1.66.0").unwrap(), + "The minimal supported rustc version is 1.66.0." + ); +} + +fn main() { + check_rustc_version(); + + build_data::set_GIT_COMMIT(); + build_data::set_GIT_DIRTY(); + build_data::no_debug_rebuilds(); +} diff --git a/crates/nargo/src/cli/check_cmd.rs b/crates/nargo_cli/src/cli/check_cmd.rs similarity index 98% rename from crates/nargo/src/cli/check_cmd.rs rename to crates/nargo_cli/src/cli/check_cmd.rs index 464524b5a48..56f54347bd5 100644 --- a/crates/nargo/src/cli/check_cmd.rs +++ b/crates/nargo_cli/src/cli/check_cmd.rs @@ -27,7 +27,7 @@ pub(crate) fn run(args: CheckCommand, config: NargoConfig) -> Result<(), CliErro } fn check_from_path>(p: P, compile_options: &CompileOptions) -> Result<(), CliError> { - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let mut driver = Resolver::resolve_root_manifest(p.as_ref(), backend.np_language())?; diff --git a/crates/nargo/src/cli/codegen_verifier_cmd.rs b/crates/nargo_cli/src/cli/codegen_verifier_cmd.rs similarity index 95% rename from crates/nargo/src/cli/codegen_verifier_cmd.rs rename to crates/nargo_cli/src/cli/codegen_verifier_cmd.rs index b05626e4398..b03593ed4bb 100644 --- a/crates/nargo/src/cli/codegen_verifier_cmd.rs +++ b/crates/nargo_cli/src/cli/codegen_verifier_cmd.rs @@ -15,7 +15,7 @@ pub(crate) struct CodegenVerifierCommand { pub(crate) fn run(args: CodegenVerifierCommand, config: NargoConfig) -> Result<(), CliError> { let compiled_program = compile_circuit(&config.program_dir, &args.compile_options)?; - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; #[allow(deprecated)] let smart_contract_string = backend.eth_contract_from_cs(compiled_program.circuit); diff --git a/crates/nargo/src/cli/compile_cmd.rs b/crates/nargo_cli/src/cli/compile_cmd.rs similarity index 98% rename from crates/nargo/src/cli/compile_cmd.rs rename to crates/nargo_cli/src/cli/compile_cmd.rs index 1e9bd6be37a..6e593a57b0b 100644 --- a/crates/nargo/src/cli/compile_cmd.rs +++ b/crates/nargo_cli/src/cli/compile_cmd.rs @@ -42,7 +42,7 @@ pub(crate) fn run(args: CompileCommand, config: NargoConfig) -> Result<(), CliEr } fn setup_driver(program_dir: &Path) -> Result { - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; Resolver::resolve_root_manifest(program_dir, backend.np_language()) } diff --git a/crates/nargo/src/cli/execute_cmd.rs b/crates/nargo_cli/src/cli/execute_cmd.rs similarity index 98% rename from crates/nargo/src/cli/execute_cmd.rs rename to crates/nargo_cli/src/cli/execute_cmd.rs index 4a3d89585bf..508b72176e5 100644 --- a/crates/nargo/src/cli/execute_cmd.rs +++ b/crates/nargo_cli/src/cli/execute_cmd.rs @@ -67,7 +67,7 @@ pub(crate) fn execute_program( ) -> Result { let mut solved_witness = compiled_program.abi.encode(inputs_map, None)?; - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let mut blocks = Blocks::default(); let (unresolved_opcodes, oracles) = backend.solve( &mut solved_witness, diff --git a/crates/nargo/src/cli/fs/inputs.rs b/crates/nargo_cli/src/cli/fs/inputs.rs similarity index 100% rename from crates/nargo/src/cli/fs/inputs.rs rename to crates/nargo_cli/src/cli/fs/inputs.rs diff --git a/crates/nargo/src/cli/fs/keys.rs b/crates/nargo_cli/src/cli/fs/keys.rs similarity index 100% rename from crates/nargo/src/cli/fs/keys.rs rename to crates/nargo_cli/src/cli/fs/keys.rs diff --git a/crates/nargo/src/cli/fs/mod.rs b/crates/nargo_cli/src/cli/fs/mod.rs similarity index 100% rename from crates/nargo/src/cli/fs/mod.rs rename to crates/nargo_cli/src/cli/fs/mod.rs diff --git a/crates/nargo/src/cli/fs/program.rs b/crates/nargo_cli/src/cli/fs/program.rs similarity index 100% rename from crates/nargo/src/cli/fs/program.rs rename to crates/nargo_cli/src/cli/fs/program.rs diff --git a/crates/nargo/src/cli/fs/proof.rs b/crates/nargo_cli/src/cli/fs/proof.rs similarity index 100% rename from crates/nargo/src/cli/fs/proof.rs rename to crates/nargo_cli/src/cli/fs/proof.rs diff --git a/crates/nargo/src/cli/fs/witness.rs b/crates/nargo_cli/src/cli/fs/witness.rs similarity index 100% rename from crates/nargo/src/cli/fs/witness.rs rename to crates/nargo_cli/src/cli/fs/witness.rs diff --git a/crates/nargo/src/cli/gates_cmd.rs b/crates/nargo_cli/src/cli/gates_cmd.rs similarity index 95% rename from crates/nargo/src/cli/gates_cmd.rs rename to crates/nargo_cli/src/cli/gates_cmd.rs index 71edd4101fe..807ed56f336 100644 --- a/crates/nargo/src/cli/gates_cmd.rs +++ b/crates/nargo_cli/src/cli/gates_cmd.rs @@ -25,7 +25,7 @@ fn count_gates_with_path>( ) -> Result<(), CliError> { let compiled_program = compile_circuit(program_dir.as_ref(), compile_options)?; let num_opcodes = compiled_program.circuit.opcodes.len(); - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; println!( "Total ACIR opcodes generated for language {:?}: {}", diff --git a/crates/nargo/src/cli/mod.rs b/crates/nargo_cli/src/cli/mod.rs similarity index 100% rename from crates/nargo/src/cli/mod.rs rename to crates/nargo_cli/src/cli/mod.rs diff --git a/crates/nargo/src/cli/new_cmd.rs b/crates/nargo_cli/src/cli/new_cmd.rs similarity index 100% rename from crates/nargo/src/cli/new_cmd.rs rename to crates/nargo_cli/src/cli/new_cmd.rs diff --git a/crates/nargo/src/cli/preprocess_cmd.rs b/crates/nargo_cli/src/cli/preprocess_cmd.rs similarity index 96% rename from crates/nargo/src/cli/preprocess_cmd.rs rename to crates/nargo_cli/src/cli/preprocess_cmd.rs index 9023fffe1c6..73c8e56a351 100644 --- a/crates/nargo/src/cli/preprocess_cmd.rs +++ b/crates/nargo_cli/src/cli/preprocess_cmd.rs @@ -34,7 +34,7 @@ pub(crate) fn preprocess_with_path>( preprocess_dir: P, circuit: &Circuit, ) -> Result<(PathBuf, PathBuf), CliError> { - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let (proving_key, verification_key) = backend.preprocess(circuit); // Save a checksum of the circuit to compare against during proving and verification. diff --git a/crates/nargo/src/cli/print_acir_cmd.rs b/crates/nargo_cli/src/cli/print_acir_cmd.rs similarity index 100% rename from crates/nargo/src/cli/print_acir_cmd.rs rename to crates/nargo_cli/src/cli/print_acir_cmd.rs diff --git a/crates/nargo/src/cli/prove_cmd.rs b/crates/nargo_cli/src/cli/prove_cmd.rs similarity index 97% rename from crates/nargo/src/cli/prove_cmd.rs rename to crates/nargo_cli/src/cli/prove_cmd.rs index 5f0f9d831cf..fa34aa19443 100644 --- a/crates/nargo/src/cli/prove_cmd.rs +++ b/crates/nargo_cli/src/cli/prove_cmd.rs @@ -74,7 +74,7 @@ pub(crate) fn prove_with_path>( let compiled_program = super::compile_cmd::compile_circuit(program_dir.as_ref(), compile_options)?; - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let (proving_key, verification_key) = backend.preprocess(&compiled_program.circuit); (compiled_program, proving_key, verification_key) } @@ -102,7 +102,7 @@ pub(crate) fn prove_with_path>( Format::Toml, )?; - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let proof = backend.prove_with_pk(&compiled_program.circuit, solved_witness, &proving_key); if check_proof { diff --git a/crates/nargo/src/cli/test_cmd.rs b/crates/nargo_cli/src/cli/test_cmd.rs similarity index 97% rename from crates/nargo/src/cli/test_cmd.rs rename to crates/nargo_cli/src/cli/test_cmd.rs index 665591f188d..e7a436ee203 100644 --- a/crates/nargo/src/cli/test_cmd.rs +++ b/crates/nargo_cli/src/cli/test_cmd.rs @@ -31,7 +31,7 @@ fn run_tests( test_name: &str, compile_options: &CompileOptions, ) -> Result<(), CliError> { - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let mut driver = Resolver::resolve_root_manifest(program_dir, backend.np_language())?; @@ -78,7 +78,7 @@ fn run_test( driver: &Driver, config: &CompileOptions, ) -> Result<(), CliError> { - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let mut blocks = Blocks::default(); let program = driver diff --git a/crates/nargo/src/cli/verify_cmd.rs b/crates/nargo_cli/src/cli/verify_cmd.rs similarity index 96% rename from crates/nargo/src/cli/verify_cmd.rs rename to crates/nargo_cli/src/cli/verify_cmd.rs index 021b10c9404..848d4b1bd63 100644 --- a/crates/nargo/src/cli/verify_cmd.rs +++ b/crates/nargo_cli/src/cli/verify_cmd.rs @@ -54,7 +54,7 @@ fn verify_with_path>( None => { let compiled_program = compile_circuit(program_dir.as_ref(), &compile_options)?; - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let (_, verification_key) = backend.preprocess(&compiled_program.circuit); (compiled_program, verification_key) } @@ -86,7 +86,7 @@ pub(crate) fn verify_proof( let public_abi = compiled_program.abi.clone().public_abi(); let public_inputs = public_abi.encode(&public_inputs_map, return_value)?; - let backend = crate::backends::ConcreteBackend; + let backend = nargo::backends::ConcreteBackend; let valid_proof = backend.verify_with_vk(proof, public_inputs, &compiled_program.circuit, verification_key); diff --git a/crates/nargo/src/constants.rs b/crates/nargo_cli/src/constants.rs similarity index 100% rename from crates/nargo/src/constants.rs rename to crates/nargo_cli/src/constants.rs diff --git a/crates/nargo/src/errors.rs b/crates/nargo_cli/src/errors.rs similarity index 100% rename from crates/nargo/src/errors.rs rename to crates/nargo_cli/src/errors.rs diff --git a/crates/nargo/src/git.rs b/crates/nargo_cli/src/git.rs similarity index 100% rename from crates/nargo/src/git.rs rename to crates/nargo_cli/src/git.rs diff --git a/crates/nargo_cli/src/lib.rs b/crates/nargo_cli/src/lib.rs new file mode 100644 index 00000000000..bb29144b6cb --- /dev/null +++ b/crates/nargo_cli/src/lib.rs @@ -0,0 +1,92 @@ +#![forbid(unsafe_code)] +#![warn(unused_crate_dependencies, unused_extern_crates)] +#![warn(unreachable_pub)] + +//! Nargo is the package manager for Noir +//! This name was used because it sounds like `cargo` and +//! Noir Package Manager abbreviated is npm, which is already taken. + +use noirc_frontend::graph::CrateType; +use std::{ + fs::ReadDir, + path::{Path, PathBuf}, +}; + +pub mod cli; +mod constants; +mod errors; +mod git; +mod manifest; +mod resolver; + +use nargo::manifest::InvalidPackageError; + +fn nargo_crates() -> PathBuf { + dirs::home_dir().unwrap().join("nargo") +} + +/// Returns the path of the root directory of the package containing `current_path`. +/// +/// Returns a `CliError` if no parent directories of `current_path` contain a manifest file. +fn find_package_root(current_path: &Path) -> Result { + let manifest_path = find_package_manifest(current_path)?; + + let package_root = + manifest_path.parent().expect("infallible: manifest file path can't be root directory"); + + Ok(package_root.to_path_buf()) +} + +/// Returns the path of the manifest file (`Nargo.toml`) of the package containing `current_path`. +/// +/// Returns a `CliError` if no parent directories of `current_path` contain a manifest file. +fn find_package_manifest(current_path: &Path) -> Result { + current_path + .ancestors() + .find_map(|dir| find_file(dir, "Nargo", "toml")) + .ok_or_else(|| InvalidPackageError::MissingManifestFile(current_path.to_path_buf())) +} + +fn lib_or_bin(current_path: &Path) -> Result<(PathBuf, CrateType), InvalidPackageError> { + // 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(|| InvalidPackageError::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(InvalidPackageError::ContainsMultipleCrates), + (None, Some(path)) => Ok((path, CrateType::Binary)), + (Some(path), None) => Ok((path, CrateType::Library)), + (None, None) => Err(InvalidPackageError::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)?; + let file_name = format!("{file_name}.{extension}"); + + 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 + .into_iter() + .flatten() + .find(|entry| entry.file_name().to_str() == Some(artifact_name))?; + + Some(entry.path()) +} + +fn list_files_and_folders_in>(path: P) -> Option { + std::fs::read_dir(path).ok() +} diff --git a/crates/nargo/src/main.rs b/crates/nargo_cli/src/main.rs similarity index 94% rename from crates/nargo/src/main.rs rename to crates/nargo_cli/src/main.rs index 050ba54300a..bd3f1352bda 100644 --- a/crates/nargo/src/main.rs +++ b/crates/nargo_cli/src/main.rs @@ -1,7 +1,7 @@ #![forbid(unsafe_code)] use color_eyre::{config::HookBuilder, eyre}; -use nargo::cli::start_cli; +use nargo_cli::cli::start_cli; fn main() -> eyre::Result<()> { // Register a panic hook to display more readable panic messages to end-users diff --git a/crates/nargo_cli/src/manifest.rs b/crates/nargo_cli/src/manifest.rs new file mode 100644 index 00000000000..ef3d3e6e12d --- /dev/null +++ b/crates/nargo_cli/src/manifest.rs @@ -0,0 +1,15 @@ +use std::path::Path; + +use nargo::manifest::{InvalidPackageError, PackageManifest}; + +/// Parses a Nargo.toml file from it's path +/// The path to the toml file must be present. +/// Calling this function without this guarantee is an ICE. +pub(crate) fn parse>( + path_to_toml: P, +) -> Result { + let toml_as_string = + std::fs::read_to_string(&path_to_toml).expect("ice: path given for toml file is invalid"); + + PackageManifest::from_toml_str(&toml_as_string) +} diff --git a/crates/nargo/src/resolver.rs b/crates/nargo_cli/src/resolver.rs similarity index 98% rename from crates/nargo/src/resolver.rs rename to crates/nargo_cli/src/resolver.rs index 4ad102136ca..ddd607058ed 100644 --- a/crates/nargo/src/resolver.rs +++ b/crates/nargo_cli/src/resolver.rs @@ -4,15 +4,12 @@ use std::{ }; use acvm::Language; +use nargo::manifest::{Dependency, PackageManifest}; use noirc_driver::Driver; use noirc_frontend::graph::{CrateId, CrateName, CrateType}; use thiserror::Error; -use crate::{ - git::clone_git_repo, - manifest::{Dependency, PackageManifest}, - InvalidPackageError, -}; +use crate::{git::clone_git_repo, InvalidPackageError}; /// Creates a unique folder name for a GitHub repo /// by using it's URL and tag diff --git a/crates/nargo/tests/compile_tests_data/fail/basic.nr b/crates/nargo_cli/tests/compile_tests_data/fail/basic.nr similarity index 100% rename from crates/nargo/tests/compile_tests_data/fail/basic.nr rename to crates/nargo_cli/tests/compile_tests_data/fail/basic.nr diff --git a/crates/nargo/tests/compile_tests_data/fail/dup_func.nr b/crates/nargo_cli/tests/compile_tests_data/fail/dup_func.nr similarity index 100% rename from crates/nargo/tests/compile_tests_data/fail/dup_func.nr rename to crates/nargo_cli/tests/compile_tests_data/fail/dup_func.nr diff --git a/crates/nargo/tests/compile_tests_data/pass/basic.nr b/crates/nargo_cli/tests/compile_tests_data/pass/basic.nr similarity index 100% rename from crates/nargo/tests/compile_tests_data/pass/basic.nr rename to crates/nargo_cli/tests/compile_tests_data/pass/basic.nr diff --git a/crates/nargo/tests/compile_tests_data/pass/basic_import.nr b/crates/nargo_cli/tests/compile_tests_data/pass/basic_import.nr similarity index 100% rename from crates/nargo/tests/compile_tests_data/pass/basic_import.nr rename to crates/nargo_cli/tests/compile_tests_data/pass/basic_import.nr diff --git a/crates/nargo/tests/compile_tests_data/pass/import.nr b/crates/nargo_cli/tests/compile_tests_data/pass/import.nr similarity index 100% rename from crates/nargo/tests/compile_tests_data/pass/import.nr rename to crates/nargo_cli/tests/compile_tests_data/pass/import.nr diff --git a/crates/nargo/tests/hello_world.rs b/crates/nargo_cli/tests/hello_world.rs similarity index 100% rename from crates/nargo/tests/hello_world.rs rename to crates/nargo_cli/tests/hello_world.rs diff --git a/crates/nargo/tests/prove_and_verify.rs b/crates/nargo_cli/tests/prove_and_verify.rs similarity index 96% rename from crates/nargo/tests/prove_and_verify.rs rename to crates/nargo_cli/tests/prove_and_verify.rs index e62ca2a5186..0006dd1b986 100644 --- a/crates/nargo/tests/prove_and_verify.rs +++ b/crates/nargo_cli/tests/prove_and_verify.rs @@ -45,7 +45,7 @@ mod tests { println!("Running test {test_name:?}"); if c.path().is_dir() && !config_data["exclude"].contains(&test_name) { let verified = std::panic::catch_unwind(|| { - nargo::cli::prove_and_verify("pp", &c.path(), false) + nargo_cli::cli::prove_and_verify("pp", &c.path(), false) }); let r = match verified { diff --git a/crates/nargo/tests/target_tests_data/fail/basic/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/fail/basic/Nargo.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/fail/basic/Nargo.toml rename to crates/nargo_cli/tests/target_tests_data/fail/basic/Nargo.toml diff --git a/crates/nargo/tests/target_tests_data/fail/basic/src/main.nr b/crates/nargo_cli/tests/target_tests_data/fail/basic/src/main.nr similarity index 100% rename from crates/nargo/tests/target_tests_data/fail/basic/src/main.nr rename to crates/nargo_cli/tests/target_tests_data/fail/basic/src/main.nr diff --git a/crates/nargo/tests/target_tests_data/fail/dup_func/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/fail/dup_func/Nargo.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/fail/dup_func/Nargo.toml rename to crates/nargo_cli/tests/target_tests_data/fail/dup_func/Nargo.toml diff --git a/crates/nargo/tests/target_tests_data/fail/dup_func/src/main.nr b/crates/nargo_cli/tests/target_tests_data/fail/dup_func/src/main.nr similarity index 100% rename from crates/nargo/tests/target_tests_data/fail/dup_func/src/main.nr rename to crates/nargo_cli/tests/target_tests_data/fail/dup_func/src/main.nr diff --git a/crates/nargo/tests/target_tests_data/pass/basic/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/pass/basic/Nargo.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/pass/basic/Nargo.toml rename to crates/nargo_cli/tests/target_tests_data/pass/basic/Nargo.toml diff --git a/crates/nargo/tests/target_tests_data/pass/basic/Prover.toml b/crates/nargo_cli/tests/target_tests_data/pass/basic/Prover.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/pass/basic/Prover.toml rename to crates/nargo_cli/tests/target_tests_data/pass/basic/Prover.toml diff --git a/crates/nargo/tests/target_tests_data/pass/basic/src/main.nr b/crates/nargo_cli/tests/target_tests_data/pass/basic/src/main.nr similarity index 100% rename from crates/nargo/tests/target_tests_data/pass/basic/src/main.nr rename to crates/nargo_cli/tests/target_tests_data/pass/basic/src/main.nr diff --git a/crates/nargo/tests/target_tests_data/pass/import/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/pass/import/Nargo.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/pass/import/Nargo.toml rename to crates/nargo_cli/tests/target_tests_data/pass/import/Nargo.toml diff --git a/crates/nargo/tests/target_tests_data/pass/import/Prover.toml b/crates/nargo_cli/tests/target_tests_data/pass/import/Prover.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/pass/import/Prover.toml rename to crates/nargo_cli/tests/target_tests_data/pass/import/Prover.toml diff --git a/crates/nargo/tests/target_tests_data/pass/import/src/import.nr b/crates/nargo_cli/tests/target_tests_data/pass/import/src/import.nr similarity index 100% rename from crates/nargo/tests/target_tests_data/pass/import/src/import.nr rename to crates/nargo_cli/tests/target_tests_data/pass/import/src/import.nr diff --git a/crates/nargo/tests/target_tests_data/pass/import/src/main.nr b/crates/nargo_cli/tests/target_tests_data/pass/import/src/main.nr similarity index 100% rename from crates/nargo/tests/target_tests_data/pass/import/src/main.nr rename to crates/nargo_cli/tests/target_tests_data/pass/import/src/main.nr diff --git a/crates/nargo/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml b/crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml rename to crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Nargo.toml diff --git a/crates/nargo/tests/target_tests_data/pass_dev_mode/unused/Prover.toml b/crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Prover.toml similarity index 100% rename from crates/nargo/tests/target_tests_data/pass_dev_mode/unused/Prover.toml rename to crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/Prover.toml diff --git a/crates/nargo/tests/target_tests_data/pass_dev_mode/unused/src/main.nr b/crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/src/main.nr similarity index 100% rename from crates/nargo/tests/target_tests_data/pass_dev_mode/unused/src/main.nr rename to crates/nargo_cli/tests/target_tests_data/pass_dev_mode/unused/src/main.nr diff --git a/crates/nargo/tests/test_data/1_mul/Nargo.toml b/crates/nargo_cli/tests/test_data/1_mul/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/1_mul/Nargo.toml rename to crates/nargo_cli/tests/test_data/1_mul/Nargo.toml diff --git a/crates/nargo/tests/test_data/1_mul/Prover.toml b/crates/nargo_cli/tests/test_data/1_mul/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/1_mul/Prover.toml rename to crates/nargo_cli/tests/test_data/1_mul/Prover.toml diff --git a/crates/nargo/tests/test_data/1_mul/src/main.nr b/crates/nargo_cli/tests/test_data/1_mul/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/1_mul/src/main.nr rename to crates/nargo_cli/tests/test_data/1_mul/src/main.nr diff --git a/crates/nargo/tests/test_data/2_div/Nargo.toml b/crates/nargo_cli/tests/test_data/2_div/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/2_div/Nargo.toml rename to crates/nargo_cli/tests/test_data/2_div/Nargo.toml diff --git a/crates/nargo/tests/test_data/2_div/Prover.toml b/crates/nargo_cli/tests/test_data/2_div/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/2_div/Prover.toml rename to crates/nargo_cli/tests/test_data/2_div/Prover.toml diff --git a/crates/nargo/tests/test_data/2_div/src/main.nr b/crates/nargo_cli/tests/test_data/2_div/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/2_div/src/main.nr rename to crates/nargo_cli/tests/test_data/2_div/src/main.nr diff --git a/crates/nargo/tests/test_data/3_add/Nargo.toml b/crates/nargo_cli/tests/test_data/3_add/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/3_add/Nargo.toml rename to crates/nargo_cli/tests/test_data/3_add/Nargo.toml diff --git a/crates/nargo/tests/test_data/3_add/Prover.toml b/crates/nargo_cli/tests/test_data/3_add/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/3_add/Prover.toml rename to crates/nargo_cli/tests/test_data/3_add/Prover.toml diff --git a/crates/nargo/tests/test_data/3_add/src/main.nr b/crates/nargo_cli/tests/test_data/3_add/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/3_add/src/main.nr rename to crates/nargo_cli/tests/test_data/3_add/src/main.nr diff --git a/crates/nargo/tests/test_data/4_sub/Nargo.toml b/crates/nargo_cli/tests/test_data/4_sub/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/4_sub/Nargo.toml rename to crates/nargo_cli/tests/test_data/4_sub/Nargo.toml diff --git a/crates/nargo/tests/test_data/4_sub/Prover.toml b/crates/nargo_cli/tests/test_data/4_sub/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/4_sub/Prover.toml rename to crates/nargo_cli/tests/test_data/4_sub/Prover.toml diff --git a/crates/nargo/tests/test_data/4_sub/src/main.nr b/crates/nargo_cli/tests/test_data/4_sub/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/4_sub/src/main.nr rename to crates/nargo_cli/tests/test_data/4_sub/src/main.nr diff --git a/crates/nargo/tests/test_data/5_over/Nargo.toml b/crates/nargo_cli/tests/test_data/5_over/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/5_over/Nargo.toml rename to crates/nargo_cli/tests/test_data/5_over/Nargo.toml diff --git a/crates/nargo/tests/test_data/5_over/Prover.toml b/crates/nargo_cli/tests/test_data/5_over/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/5_over/Prover.toml rename to crates/nargo_cli/tests/test_data/5_over/Prover.toml diff --git a/crates/nargo/tests/test_data/5_over/src/main.nr b/crates/nargo_cli/tests/test_data/5_over/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/5_over/src/main.nr rename to crates/nargo_cli/tests/test_data/5_over/src/main.nr diff --git a/crates/nargo/tests/test_data/6/Nargo.toml b/crates/nargo_cli/tests/test_data/6/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/6/Nargo.toml rename to crates/nargo_cli/tests/test_data/6/Nargo.toml diff --git a/crates/nargo/tests/test_data/6/Prover.toml b/crates/nargo_cli/tests/test_data/6/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/6/Prover.toml rename to crates/nargo_cli/tests/test_data/6/Prover.toml diff --git a/crates/nargo/tests/test_data/6/src/main.nr b/crates/nargo_cli/tests/test_data/6/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/6/src/main.nr rename to crates/nargo_cli/tests/test_data/6/src/main.nr diff --git a/crates/nargo/tests/test_data/6_array/Nargo.toml b/crates/nargo_cli/tests/test_data/6_array/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/6_array/Nargo.toml rename to crates/nargo_cli/tests/test_data/6_array/Nargo.toml diff --git a/crates/nargo/tests/test_data/6_array/Prover.toml b/crates/nargo_cli/tests/test_data/6_array/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/6_array/Prover.toml rename to crates/nargo_cli/tests/test_data/6_array/Prover.toml diff --git a/crates/nargo/tests/test_data/6_array/src/main.nr b/crates/nargo_cli/tests/test_data/6_array/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/6_array/src/main.nr rename to crates/nargo_cli/tests/test_data/6_array/src/main.nr diff --git a/crates/nargo/tests/test_data/7/Nargo.toml b/crates/nargo_cli/tests/test_data/7/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/7/Nargo.toml rename to crates/nargo_cli/tests/test_data/7/Nargo.toml diff --git a/crates/nargo/tests/test_data/7/Prover.toml b/crates/nargo_cli/tests/test_data/7/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/7/Prover.toml rename to crates/nargo_cli/tests/test_data/7/Prover.toml diff --git a/crates/nargo/tests/test_data/7/src/main.nr b/crates/nargo_cli/tests/test_data/7/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/7/src/main.nr rename to crates/nargo_cli/tests/test_data/7/src/main.nr diff --git a/crates/nargo/tests/test_data/7_function/Nargo.toml b/crates/nargo_cli/tests/test_data/7_function/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/7_function/Nargo.toml rename to crates/nargo_cli/tests/test_data/7_function/Nargo.toml diff --git a/crates/nargo/tests/test_data/7_function/Prover.toml b/crates/nargo_cli/tests/test_data/7_function/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/7_function/Prover.toml rename to crates/nargo_cli/tests/test_data/7_function/Prover.toml diff --git a/crates/nargo/tests/test_data/7_function/src/main.nr b/crates/nargo_cli/tests/test_data/7_function/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/7_function/src/main.nr rename to crates/nargo_cli/tests/test_data/7_function/src/main.nr diff --git a/crates/nargo/tests/test_data/8_integration/Nargo.toml b/crates/nargo_cli/tests/test_data/8_integration/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/8_integration/Nargo.toml rename to crates/nargo_cli/tests/test_data/8_integration/Nargo.toml diff --git a/crates/nargo/tests/test_data/8_integration/Prover.toml b/crates/nargo_cli/tests/test_data/8_integration/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/8_integration/Prover.toml rename to crates/nargo_cli/tests/test_data/8_integration/Prover.toml diff --git a/crates/nargo/tests/test_data/8_integration/src/main.nr b/crates/nargo_cli/tests/test_data/8_integration/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/8_integration/src/main.nr rename to crates/nargo_cli/tests/test_data/8_integration/src/main.nr diff --git a/crates/nargo/tests/test_data/9_conditional/Nargo.toml b/crates/nargo_cli/tests/test_data/9_conditional/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/9_conditional/Nargo.toml rename to crates/nargo_cli/tests/test_data/9_conditional/Nargo.toml diff --git a/crates/nargo/tests/test_data/9_conditional/Prover.toml b/crates/nargo_cli/tests/test_data/9_conditional/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/9_conditional/Prover.toml rename to crates/nargo_cli/tests/test_data/9_conditional/Prover.toml diff --git a/crates/nargo/tests/test_data/9_conditional/src/main.nr b/crates/nargo_cli/tests/test_data/9_conditional/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/9_conditional/src/main.nr rename to crates/nargo_cli/tests/test_data/9_conditional/src/main.nr diff --git a/crates/nargo/tests/test_data/array_len/Nargo.toml b/crates/nargo_cli/tests/test_data/array_len/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/array_len/Nargo.toml rename to crates/nargo_cli/tests/test_data/array_len/Nargo.toml diff --git a/crates/nargo/tests/test_data/array_len/Prover.toml b/crates/nargo_cli/tests/test_data/array_len/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/array_len/Prover.toml rename to crates/nargo_cli/tests/test_data/array_len/Prover.toml diff --git a/crates/nargo/tests/test_data/array_len/src/main.nr b/crates/nargo_cli/tests/test_data/array_len/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/array_len/src/main.nr rename to crates/nargo_cli/tests/test_data/array_len/src/main.nr diff --git a/crates/nargo/tests/test_data/array_neq/Nargo.toml b/crates/nargo_cli/tests/test_data/array_neq/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/array_neq/Nargo.toml rename to crates/nargo_cli/tests/test_data/array_neq/Nargo.toml diff --git a/crates/nargo/tests/test_data/array_neq/Prover.toml b/crates/nargo_cli/tests/test_data/array_neq/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/array_neq/Prover.toml rename to crates/nargo_cli/tests/test_data/array_neq/Prover.toml diff --git a/crates/nargo/tests/test_data/array_neq/src/main.nr b/crates/nargo_cli/tests/test_data/array_neq/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/array_neq/src/main.nr rename to crates/nargo_cli/tests/test_data/array_neq/src/main.nr diff --git a/crates/nargo/tests/test_data/assign_ex/Nargo.toml b/crates/nargo_cli/tests/test_data/assign_ex/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/assign_ex/Nargo.toml rename to crates/nargo_cli/tests/test_data/assign_ex/Nargo.toml diff --git a/crates/nargo/tests/test_data/assign_ex/Prover.toml b/crates/nargo_cli/tests/test_data/assign_ex/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/assign_ex/Prover.toml rename to crates/nargo_cli/tests/test_data/assign_ex/Prover.toml diff --git a/crates/nargo/tests/test_data/assign_ex/src/main.nr b/crates/nargo_cli/tests/test_data/assign_ex/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/assign_ex/src/main.nr rename to crates/nargo_cli/tests/test_data/assign_ex/src/main.nr diff --git a/crates/nargo/tests/test_data/bit_and/Nargo.toml b/crates/nargo_cli/tests/test_data/bit_and/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/bit_and/Nargo.toml rename to crates/nargo_cli/tests/test_data/bit_and/Nargo.toml diff --git a/crates/nargo/tests/test_data/bit_and/Prover.toml b/crates/nargo_cli/tests/test_data/bit_and/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/bit_and/Prover.toml rename to crates/nargo_cli/tests/test_data/bit_and/Prover.toml diff --git a/crates/nargo/tests/test_data/bit_and/src/main.nr b/crates/nargo_cli/tests/test_data/bit_and/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/bit_and/src/main.nr rename to crates/nargo_cli/tests/test_data/bit_and/src/main.nr diff --git a/crates/nargo/tests/test_data/bool_not/Nargo.toml b/crates/nargo_cli/tests/test_data/bool_not/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/bool_not/Nargo.toml rename to crates/nargo_cli/tests/test_data/bool_not/Nargo.toml diff --git a/crates/nargo/tests/test_data/bool_not/Prover.toml b/crates/nargo_cli/tests/test_data/bool_not/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/bool_not/Prover.toml rename to crates/nargo_cli/tests/test_data/bool_not/Prover.toml diff --git a/crates/nargo/tests/test_data/bool_not/src/main.nr b/crates/nargo_cli/tests/test_data/bool_not/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/bool_not/src/main.nr rename to crates/nargo_cli/tests/test_data/bool_not/src/main.nr diff --git a/crates/nargo/tests/test_data/bool_or/Nargo.toml b/crates/nargo_cli/tests/test_data/bool_or/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/bool_or/Nargo.toml rename to crates/nargo_cli/tests/test_data/bool_or/Nargo.toml diff --git a/crates/nargo/tests/test_data/bool_or/Prover.toml b/crates/nargo_cli/tests/test_data/bool_or/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/bool_or/Prover.toml rename to crates/nargo_cli/tests/test_data/bool_or/Prover.toml diff --git a/crates/nargo/tests/test_data/bool_or/src/main.nr b/crates/nargo_cli/tests/test_data/bool_or/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/bool_or/src/main.nr rename to crates/nargo_cli/tests/test_data/bool_or/src/main.nr diff --git a/crates/nargo/tests/test_data/cast_bool/Nargo.toml b/crates/nargo_cli/tests/test_data/cast_bool/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/cast_bool/Nargo.toml rename to crates/nargo_cli/tests/test_data/cast_bool/Nargo.toml diff --git a/crates/nargo/tests/test_data/cast_bool/Prover.toml b/crates/nargo_cli/tests/test_data/cast_bool/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/cast_bool/Prover.toml rename to crates/nargo_cli/tests/test_data/cast_bool/Prover.toml diff --git a/crates/nargo/tests/test_data/cast_bool/src/main.nr b/crates/nargo_cli/tests/test_data/cast_bool/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/cast_bool/src/main.nr rename to crates/nargo_cli/tests/test_data/cast_bool/src/main.nr diff --git a/crates/nargo/tests/test_data/comptime_array_access/Nargo.toml b/crates/nargo_cli/tests/test_data/comptime_array_access/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/comptime_array_access/Nargo.toml rename to crates/nargo_cli/tests/test_data/comptime_array_access/Nargo.toml diff --git a/crates/nargo/tests/test_data/comptime_array_access/Prover.toml b/crates/nargo_cli/tests/test_data/comptime_array_access/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/comptime_array_access/Prover.toml rename to crates/nargo_cli/tests/test_data/comptime_array_access/Prover.toml diff --git a/crates/nargo/tests/test_data/comptime_array_access/src/main.nr b/crates/nargo_cli/tests/test_data/comptime_array_access/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/comptime_array_access/src/main.nr rename to crates/nargo_cli/tests/test_data/comptime_array_access/src/main.nr diff --git a/crates/nargo/tests/test_data/comptime_fail/Nargo.toml b/crates/nargo_cli/tests/test_data/comptime_fail/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/comptime_fail/Nargo.toml rename to crates/nargo_cli/tests/test_data/comptime_fail/Nargo.toml diff --git a/crates/nargo/tests/test_data/comptime_fail/Prover.toml b/crates/nargo_cli/tests/test_data/comptime_fail/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/comptime_fail/Prover.toml rename to crates/nargo_cli/tests/test_data/comptime_fail/Prover.toml diff --git a/crates/nargo/tests/test_data/comptime_fail/src/main.nr b/crates/nargo_cli/tests/test_data/comptime_fail/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/comptime_fail/src/main.nr rename to crates/nargo_cli/tests/test_data/comptime_fail/src/main.nr diff --git a/crates/nargo/tests/test_data/comptime_recursion_regression/Nargo.toml b/crates/nargo_cli/tests/test_data/comptime_recursion_regression/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/comptime_recursion_regression/Nargo.toml rename to crates/nargo_cli/tests/test_data/comptime_recursion_regression/Nargo.toml diff --git a/crates/nargo/tests/test_data/comptime_recursion_regression/Prover.toml b/crates/nargo_cli/tests/test_data/comptime_recursion_regression/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/comptime_recursion_regression/Prover.toml rename to crates/nargo_cli/tests/test_data/comptime_recursion_regression/Prover.toml diff --git a/crates/nargo/tests/test_data/comptime_recursion_regression/src/main.nr b/crates/nargo_cli/tests/test_data/comptime_recursion_regression/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/comptime_recursion_regression/src/main.nr rename to crates/nargo_cli/tests/test_data/comptime_recursion_regression/src/main.nr diff --git a/crates/nargo/tests/test_data/config.toml b/crates/nargo_cli/tests/test_data/config.toml similarity index 100% rename from crates/nargo/tests/test_data/config.toml rename to crates/nargo_cli/tests/test_data/config.toml diff --git a/crates/nargo/tests/test_data/contracts/Nargo.toml b/crates/nargo_cli/tests/test_data/contracts/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/contracts/Nargo.toml rename to crates/nargo_cli/tests/test_data/contracts/Nargo.toml diff --git a/crates/nargo/tests/test_data/contracts/Prover.toml b/crates/nargo_cli/tests/test_data/contracts/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/contracts/Prover.toml rename to crates/nargo_cli/tests/test_data/contracts/Prover.toml diff --git a/crates/nargo/tests/test_data/contracts/src/main.nr b/crates/nargo_cli/tests/test_data/contracts/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/contracts/src/main.nr rename to crates/nargo_cli/tests/test_data/contracts/src/main.nr diff --git a/crates/nargo/tests/test_data/ec_baby_jubjub/Nargo.toml b/crates/nargo_cli/tests/test_data/ec_baby_jubjub/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/ec_baby_jubjub/Nargo.toml rename to crates/nargo_cli/tests/test_data/ec_baby_jubjub/Nargo.toml diff --git a/crates/nargo/tests/test_data/ec_baby_jubjub/src/main.nr b/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/ec_baby_jubjub/src/main.nr rename to crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr diff --git a/crates/nargo/tests/test_data/generics/Nargo.toml b/crates/nargo_cli/tests/test_data/generics/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/generics/Nargo.toml rename to crates/nargo_cli/tests/test_data/generics/Nargo.toml diff --git a/crates/nargo/tests/test_data/generics/Prover.toml b/crates/nargo_cli/tests/test_data/generics/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/generics/Prover.toml rename to crates/nargo_cli/tests/test_data/generics/Prover.toml diff --git a/crates/nargo/tests/test_data/generics/src/main.nr b/crates/nargo_cli/tests/test_data/generics/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/generics/src/main.nr rename to crates/nargo_cli/tests/test_data/generics/src/main.nr diff --git a/crates/nargo/tests/test_data/global_consts/Nargo.toml b/crates/nargo_cli/tests/test_data/global_consts/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/global_consts/Nargo.toml rename to crates/nargo_cli/tests/test_data/global_consts/Nargo.toml diff --git a/crates/nargo/tests/test_data/global_consts/Prover.toml b/crates/nargo_cli/tests/test_data/global_consts/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/global_consts/Prover.toml rename to crates/nargo_cli/tests/test_data/global_consts/Prover.toml diff --git a/crates/nargo/tests/test_data/global_consts/src/baz.nr b/crates/nargo_cli/tests/test_data/global_consts/src/baz.nr similarity index 100% rename from crates/nargo/tests/test_data/global_consts/src/baz.nr rename to crates/nargo_cli/tests/test_data/global_consts/src/baz.nr diff --git a/crates/nargo/tests/test_data/global_consts/src/foo.nr b/crates/nargo_cli/tests/test_data/global_consts/src/foo.nr similarity index 100% rename from crates/nargo/tests/test_data/global_consts/src/foo.nr rename to crates/nargo_cli/tests/test_data/global_consts/src/foo.nr diff --git a/crates/nargo/tests/test_data/global_consts/src/foo/bar.nr b/crates/nargo_cli/tests/test_data/global_consts/src/foo/bar.nr similarity index 100% rename from crates/nargo/tests/test_data/global_consts/src/foo/bar.nr rename to crates/nargo_cli/tests/test_data/global_consts/src/foo/bar.nr diff --git a/crates/nargo/tests/test_data/global_consts/src/main.nr b/crates/nargo_cli/tests/test_data/global_consts/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/global_consts/src/main.nr rename to crates/nargo_cli/tests/test_data/global_consts/src/main.nr diff --git a/crates/nargo/tests/test_data/hash_to_field/Nargo.toml b/crates/nargo_cli/tests/test_data/hash_to_field/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/hash_to_field/Nargo.toml rename to crates/nargo_cli/tests/test_data/hash_to_field/Nargo.toml diff --git a/crates/nargo/tests/test_data/hash_to_field/Prover.toml b/crates/nargo_cli/tests/test_data/hash_to_field/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/hash_to_field/Prover.toml rename to crates/nargo_cli/tests/test_data/hash_to_field/Prover.toml diff --git a/crates/nargo/tests/test_data/hash_to_field/src/main.nr b/crates/nargo_cli/tests/test_data/hash_to_field/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/hash_to_field/src/main.nr rename to crates/nargo_cli/tests/test_data/hash_to_field/src/main.nr diff --git a/crates/nargo/tests/test_data/higher-order-functions/Nargo.toml b/crates/nargo_cli/tests/test_data/higher-order-functions/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/higher-order-functions/Nargo.toml rename to crates/nargo_cli/tests/test_data/higher-order-functions/Nargo.toml diff --git a/crates/nargo/tests/test_data/higher-order-functions/Prover.toml b/crates/nargo_cli/tests/test_data/higher-order-functions/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/higher-order-functions/Prover.toml rename to crates/nargo_cli/tests/test_data/higher-order-functions/Prover.toml diff --git a/crates/nargo/tests/test_data/higher-order-functions/src/main.nr b/crates/nargo_cli/tests/test_data/higher-order-functions/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/higher-order-functions/src/main.nr rename to crates/nargo_cli/tests/test_data/higher-order-functions/src/main.nr diff --git a/crates/nargo/tests/test_data/if_else_chain/Nargo.toml b/crates/nargo_cli/tests/test_data/if_else_chain/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/if_else_chain/Nargo.toml rename to crates/nargo_cli/tests/test_data/if_else_chain/Nargo.toml diff --git a/crates/nargo/tests/test_data/if_else_chain/Prover.toml b/crates/nargo_cli/tests/test_data/if_else_chain/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/if_else_chain/Prover.toml rename to crates/nargo_cli/tests/test_data/if_else_chain/Prover.toml diff --git a/crates/nargo/tests/test_data/if_else_chain/src/main.nr b/crates/nargo_cli/tests/test_data/if_else_chain/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/if_else_chain/src/main.nr rename to crates/nargo_cli/tests/test_data/if_else_chain/src/main.nr diff --git a/crates/nargo/tests/test_data/main_bool_arg/Nargo.toml b/crates/nargo_cli/tests/test_data/main_bool_arg/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/main_bool_arg/Nargo.toml rename to crates/nargo_cli/tests/test_data/main_bool_arg/Nargo.toml diff --git a/crates/nargo/tests/test_data/main_bool_arg/Prover.toml b/crates/nargo_cli/tests/test_data/main_bool_arg/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/main_bool_arg/Prover.toml rename to crates/nargo_cli/tests/test_data/main_bool_arg/Prover.toml diff --git a/crates/nargo/tests/test_data/main_bool_arg/src/main.nr b/crates/nargo_cli/tests/test_data/main_bool_arg/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/main_bool_arg/src/main.nr rename to crates/nargo_cli/tests/test_data/main_bool_arg/src/main.nr diff --git a/crates/nargo/tests/test_data/main_return/Nargo.toml b/crates/nargo_cli/tests/test_data/main_return/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/main_return/Nargo.toml rename to crates/nargo_cli/tests/test_data/main_return/Nargo.toml diff --git a/crates/nargo/tests/test_data/main_return/Prover.toml b/crates/nargo_cli/tests/test_data/main_return/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/main_return/Prover.toml rename to crates/nargo_cli/tests/test_data/main_return/Prover.toml diff --git a/crates/nargo/tests/test_data/main_return/src/main.nr b/crates/nargo_cli/tests/test_data/main_return/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/main_return/src/main.nr rename to crates/nargo_cli/tests/test_data/main_return/src/main.nr diff --git a/crates/nargo/tests/test_data/merkle_insert/Nargo.toml b/crates/nargo_cli/tests/test_data/merkle_insert/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/merkle_insert/Nargo.toml rename to crates/nargo_cli/tests/test_data/merkle_insert/Nargo.toml diff --git a/crates/nargo/tests/test_data/merkle_insert/Prover.toml b/crates/nargo_cli/tests/test_data/merkle_insert/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/merkle_insert/Prover.toml rename to crates/nargo_cli/tests/test_data/merkle_insert/Prover.toml diff --git a/crates/nargo/tests/test_data/merkle_insert/src/main.nr b/crates/nargo_cli/tests/test_data/merkle_insert/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/merkle_insert/src/main.nr rename to crates/nargo_cli/tests/test_data/merkle_insert/src/main.nr diff --git a/crates/nargo/tests/test_data/modules/Nargo.toml b/crates/nargo_cli/tests/test_data/modules/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/modules/Nargo.toml rename to crates/nargo_cli/tests/test_data/modules/Nargo.toml diff --git a/crates/nargo/tests/test_data/modules/Prover.toml b/crates/nargo_cli/tests/test_data/modules/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/modules/Prover.toml rename to crates/nargo_cli/tests/test_data/modules/Prover.toml diff --git a/crates/nargo/tests/test_data/modules/src/foo.nr b/crates/nargo_cli/tests/test_data/modules/src/foo.nr similarity index 100% rename from crates/nargo/tests/test_data/modules/src/foo.nr rename to crates/nargo_cli/tests/test_data/modules/src/foo.nr diff --git a/crates/nargo/tests/test_data/modules/src/main.nr b/crates/nargo_cli/tests/test_data/modules/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/modules/src/main.nr rename to crates/nargo_cli/tests/test_data/modules/src/main.nr diff --git a/crates/nargo/tests/test_data/modules_more/Nargo.toml b/crates/nargo_cli/tests/test_data/modules_more/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/modules_more/Nargo.toml rename to crates/nargo_cli/tests/test_data/modules_more/Nargo.toml diff --git a/crates/nargo/tests/test_data/modules_more/Prover.toml b/crates/nargo_cli/tests/test_data/modules_more/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/modules_more/Prover.toml rename to crates/nargo_cli/tests/test_data/modules_more/Prover.toml diff --git a/crates/nargo/tests/test_data/modules_more/src/foo.nr b/crates/nargo_cli/tests/test_data/modules_more/src/foo.nr similarity index 100% rename from crates/nargo/tests/test_data/modules_more/src/foo.nr rename to crates/nargo_cli/tests/test_data/modules_more/src/foo.nr diff --git a/crates/nargo/tests/test_data/modules_more/src/foo/bar.nr b/crates/nargo_cli/tests/test_data/modules_more/src/foo/bar.nr similarity index 100% rename from crates/nargo/tests/test_data/modules_more/src/foo/bar.nr rename to crates/nargo_cli/tests/test_data/modules_more/src/foo/bar.nr diff --git a/crates/nargo/tests/test_data/modules_more/src/main.nr b/crates/nargo_cli/tests/test_data/modules_more/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/modules_more/src/main.nr rename to crates/nargo_cli/tests/test_data/modules_more/src/main.nr diff --git a/crates/nargo/tests/test_data/modulus/Nargo.toml b/crates/nargo_cli/tests/test_data/modulus/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/modulus/Nargo.toml rename to crates/nargo_cli/tests/test_data/modulus/Nargo.toml diff --git a/crates/nargo/tests/test_data/modulus/Prover.toml b/crates/nargo_cli/tests/test_data/modulus/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/modulus/Prover.toml rename to crates/nargo_cli/tests/test_data/modulus/Prover.toml diff --git a/crates/nargo/tests/test_data/modulus/src/main.nr b/crates/nargo_cli/tests/test_data/modulus/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/modulus/src/main.nr rename to crates/nargo_cli/tests/test_data/modulus/src/main.nr diff --git a/crates/nargo/tests/test_data/numeric_generics/Nargo.toml b/crates/nargo_cli/tests/test_data/numeric_generics/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/numeric_generics/Nargo.toml rename to crates/nargo_cli/tests/test_data/numeric_generics/Nargo.toml diff --git a/crates/nargo/tests/test_data/numeric_generics/Prover.toml b/crates/nargo_cli/tests/test_data/numeric_generics/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/numeric_generics/Prover.toml rename to crates/nargo_cli/tests/test_data/numeric_generics/Prover.toml diff --git a/crates/nargo/tests/test_data/numeric_generics/src/main.nr b/crates/nargo_cli/tests/test_data/numeric_generics/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/numeric_generics/src/main.nr rename to crates/nargo_cli/tests/test_data/numeric_generics/src/main.nr diff --git a/crates/nargo/tests/test_data/pedersen_check/Nargo.toml b/crates/nargo_cli/tests/test_data/pedersen_check/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/pedersen_check/Nargo.toml rename to crates/nargo_cli/tests/test_data/pedersen_check/Nargo.toml diff --git a/crates/nargo/tests/test_data/pedersen_check/Prover.toml b/crates/nargo_cli/tests/test_data/pedersen_check/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/pedersen_check/Prover.toml rename to crates/nargo_cli/tests/test_data/pedersen_check/Prover.toml diff --git a/crates/nargo/tests/test_data/pedersen_check/src/main.nr b/crates/nargo_cli/tests/test_data/pedersen_check/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/pedersen_check/src/main.nr rename to crates/nargo_cli/tests/test_data/pedersen_check/src/main.nr diff --git a/crates/nargo/tests/test_data/pred_eq/Nargo.toml b/crates/nargo_cli/tests/test_data/pred_eq/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/pred_eq/Nargo.toml rename to crates/nargo_cli/tests/test_data/pred_eq/Nargo.toml diff --git a/crates/nargo/tests/test_data/pred_eq/Prover.toml b/crates/nargo_cli/tests/test_data/pred_eq/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/pred_eq/Prover.toml rename to crates/nargo_cli/tests/test_data/pred_eq/Prover.toml diff --git a/crates/nargo/tests/test_data/pred_eq/src/main.nr b/crates/nargo_cli/tests/test_data/pred_eq/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/pred_eq/src/main.nr rename to crates/nargo_cli/tests/test_data/pred_eq/src/main.nr diff --git a/crates/nargo/tests/test_data/range_fail/Nargo.toml b/crates/nargo_cli/tests/test_data/range_fail/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/range_fail/Nargo.toml rename to crates/nargo_cli/tests/test_data/range_fail/Nargo.toml diff --git a/crates/nargo/tests/test_data/range_fail/Prover.toml b/crates/nargo_cli/tests/test_data/range_fail/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/range_fail/Prover.toml rename to crates/nargo_cli/tests/test_data/range_fail/Prover.toml diff --git a/crates/nargo/tests/test_data/range_fail/src/main.nr b/crates/nargo_cli/tests/test_data/range_fail/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/range_fail/src/main.nr rename to crates/nargo_cli/tests/test_data/range_fail/src/main.nr diff --git a/crates/nargo/tests/test_data/scalar_mul/Nargo.toml b/crates/nargo_cli/tests/test_data/scalar_mul/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/scalar_mul/Nargo.toml rename to crates/nargo_cli/tests/test_data/scalar_mul/Nargo.toml diff --git a/crates/nargo/tests/test_data/scalar_mul/Prover.toml b/crates/nargo_cli/tests/test_data/scalar_mul/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/scalar_mul/Prover.toml rename to crates/nargo_cli/tests/test_data/scalar_mul/Prover.toml diff --git a/crates/nargo/tests/test_data/scalar_mul/src/main.nr b/crates/nargo_cli/tests/test_data/scalar_mul/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/scalar_mul/src/main.nr rename to crates/nargo_cli/tests/test_data/scalar_mul/src/main.nr diff --git a/crates/nargo/tests/test_data/schnorr/Nargo.toml b/crates/nargo_cli/tests/test_data/schnorr/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/schnorr/Nargo.toml rename to crates/nargo_cli/tests/test_data/schnorr/Nargo.toml diff --git a/crates/nargo/tests/test_data/schnorr/Prover.toml b/crates/nargo_cli/tests/test_data/schnorr/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/schnorr/Prover.toml rename to crates/nargo_cli/tests/test_data/schnorr/Prover.toml diff --git a/crates/nargo/tests/test_data/schnorr/src/main.nr b/crates/nargo_cli/tests/test_data/schnorr/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/schnorr/src/main.nr rename to crates/nargo_cli/tests/test_data/schnorr/src/main.nr diff --git a/crates/nargo/tests/test_data/sha256/Nargo.toml b/crates/nargo_cli/tests/test_data/sha256/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/sha256/Nargo.toml rename to crates/nargo_cli/tests/test_data/sha256/Nargo.toml diff --git a/crates/nargo/tests/test_data/sha256/Prover.toml b/crates/nargo_cli/tests/test_data/sha256/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/sha256/Prover.toml rename to crates/nargo_cli/tests/test_data/sha256/Prover.toml diff --git a/crates/nargo/tests/test_data/sha256/src/main.nr b/crates/nargo_cli/tests/test_data/sha256/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/sha256/src/main.nr rename to crates/nargo_cli/tests/test_data/sha256/src/main.nr diff --git a/crates/nargo/tests/test_data/sha2_blocks/Nargo.toml b/crates/nargo_cli/tests/test_data/sha2_blocks/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/sha2_blocks/Nargo.toml rename to crates/nargo_cli/tests/test_data/sha2_blocks/Nargo.toml diff --git a/crates/nargo/tests/test_data/sha2_blocks/Prover.toml b/crates/nargo_cli/tests/test_data/sha2_blocks/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/sha2_blocks/Prover.toml rename to crates/nargo_cli/tests/test_data/sha2_blocks/Prover.toml diff --git a/crates/nargo/tests/test_data/sha2_blocks/src/main.nr b/crates/nargo_cli/tests/test_data/sha2_blocks/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/sha2_blocks/src/main.nr rename to crates/nargo_cli/tests/test_data/sha2_blocks/src/main.nr diff --git a/crates/nargo/tests/test_data/sha2_byte/Nargo.toml b/crates/nargo_cli/tests/test_data/sha2_byte/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/sha2_byte/Nargo.toml rename to crates/nargo_cli/tests/test_data/sha2_byte/Nargo.toml diff --git a/crates/nargo/tests/test_data/sha2_byte/Prover.toml b/crates/nargo_cli/tests/test_data/sha2_byte/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/sha2_byte/Prover.toml rename to crates/nargo_cli/tests/test_data/sha2_byte/Prover.toml diff --git a/crates/nargo/tests/test_data/sha2_byte/src/main.nr b/crates/nargo_cli/tests/test_data/sha2_byte/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/sha2_byte/src/main.nr rename to crates/nargo_cli/tests/test_data/sha2_byte/src/main.nr diff --git a/crates/nargo/tests/test_data/simple_shield/Nargo.toml b/crates/nargo_cli/tests/test_data/simple_shield/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/simple_shield/Nargo.toml rename to crates/nargo_cli/tests/test_data/simple_shield/Nargo.toml diff --git a/crates/nargo/tests/test_data/simple_shield/Prover.toml b/crates/nargo_cli/tests/test_data/simple_shield/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/simple_shield/Prover.toml rename to crates/nargo_cli/tests/test_data/simple_shield/Prover.toml diff --git a/crates/nargo/tests/test_data/simple_shield/src/main.nr b/crates/nargo_cli/tests/test_data/simple_shield/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/simple_shield/src/main.nr rename to crates/nargo_cli/tests/test_data/simple_shield/src/main.nr diff --git a/crates/nargo/tests/test_data/strings/Nargo.toml b/crates/nargo_cli/tests/test_data/strings/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/strings/Nargo.toml rename to crates/nargo_cli/tests/test_data/strings/Nargo.toml diff --git a/crates/nargo/tests/test_data/strings/Prover.toml b/crates/nargo_cli/tests/test_data/strings/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/strings/Prover.toml rename to crates/nargo_cli/tests/test_data/strings/Prover.toml diff --git a/crates/nargo/tests/test_data/strings/src/main.nr b/crates/nargo_cli/tests/test_data/strings/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/strings/src/main.nr rename to crates/nargo_cli/tests/test_data/strings/src/main.nr diff --git a/crates/nargo/tests/test_data/struct/Nargo.toml b/crates/nargo_cli/tests/test_data/struct/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/struct/Nargo.toml rename to crates/nargo_cli/tests/test_data/struct/Nargo.toml diff --git a/crates/nargo/tests/test_data/struct/Prover.toml b/crates/nargo_cli/tests/test_data/struct/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/struct/Prover.toml rename to crates/nargo_cli/tests/test_data/struct/Prover.toml diff --git a/crates/nargo/tests/test_data/struct/src/main.nr b/crates/nargo_cli/tests/test_data/struct/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/struct/src/main.nr rename to crates/nargo_cli/tests/test_data/struct/src/main.nr diff --git a/crates/nargo/tests/test_data/struct_inputs/Nargo.toml b/crates/nargo_cli/tests/test_data/struct_inputs/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/struct_inputs/Nargo.toml rename to crates/nargo_cli/tests/test_data/struct_inputs/Nargo.toml diff --git a/crates/nargo/tests/test_data/struct_inputs/Prover.toml b/crates/nargo_cli/tests/test_data/struct_inputs/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/struct_inputs/Prover.toml rename to crates/nargo_cli/tests/test_data/struct_inputs/Prover.toml diff --git a/crates/nargo/tests/test_data/struct_inputs/src/foo.nr b/crates/nargo_cli/tests/test_data/struct_inputs/src/foo.nr similarity index 100% rename from crates/nargo/tests/test_data/struct_inputs/src/foo.nr rename to crates/nargo_cli/tests/test_data/struct_inputs/src/foo.nr diff --git a/crates/nargo/tests/test_data/struct_inputs/src/foo/bar.nr b/crates/nargo_cli/tests/test_data/struct_inputs/src/foo/bar.nr similarity index 100% rename from crates/nargo/tests/test_data/struct_inputs/src/foo/bar.nr rename to crates/nargo_cli/tests/test_data/struct_inputs/src/foo/bar.nr diff --git a/crates/nargo/tests/test_data/struct_inputs/src/main.nr b/crates/nargo_cli/tests/test_data/struct_inputs/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/struct_inputs/src/main.nr rename to crates/nargo_cli/tests/test_data/struct_inputs/src/main.nr diff --git a/crates/nargo/tests/test_data/submodules/Nargo.toml b/crates/nargo_cli/tests/test_data/submodules/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/submodules/Nargo.toml rename to crates/nargo_cli/tests/test_data/submodules/Nargo.toml diff --git a/crates/nargo/tests/test_data/submodules/Prover.toml b/crates/nargo_cli/tests/test_data/submodules/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/submodules/Prover.toml rename to crates/nargo_cli/tests/test_data/submodules/Prover.toml diff --git a/crates/nargo/tests/test_data/submodules/src/main.nr b/crates/nargo_cli/tests/test_data/submodules/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/submodules/src/main.nr rename to crates/nargo_cli/tests/test_data/submodules/src/main.nr diff --git a/crates/nargo/tests/test_data/to_be_bytes/Nargo.toml b/crates/nargo_cli/tests/test_data/to_be_bytes/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/to_be_bytes/Nargo.toml rename to crates/nargo_cli/tests/test_data/to_be_bytes/Nargo.toml diff --git a/crates/nargo/tests/test_data/to_be_bytes/Prover.toml b/crates/nargo_cli/tests/test_data/to_be_bytes/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/to_be_bytes/Prover.toml rename to crates/nargo_cli/tests/test_data/to_be_bytes/Prover.toml diff --git a/crates/nargo/tests/test_data/to_be_bytes/src/main.nr b/crates/nargo_cli/tests/test_data/to_be_bytes/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/to_be_bytes/src/main.nr rename to crates/nargo_cli/tests/test_data/to_be_bytes/src/main.nr diff --git a/crates/nargo/tests/test_data/to_bytes_integration/Nargo.toml b/crates/nargo_cli/tests/test_data/to_bytes_integration/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/to_bytes_integration/Nargo.toml rename to crates/nargo_cli/tests/test_data/to_bytes_integration/Nargo.toml diff --git a/crates/nargo/tests/test_data/to_bytes_integration/Prover.toml b/crates/nargo_cli/tests/test_data/to_bytes_integration/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/to_bytes_integration/Prover.toml rename to crates/nargo_cli/tests/test_data/to_bytes_integration/Prover.toml diff --git a/crates/nargo/tests/test_data/to_bytes_integration/src/main.nr b/crates/nargo_cli/tests/test_data/to_bytes_integration/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/to_bytes_integration/src/main.nr rename to crates/nargo_cli/tests/test_data/to_bytes_integration/src/main.nr diff --git a/crates/nargo/tests/test_data/to_le_bytes/Nargo.toml b/crates/nargo_cli/tests/test_data/to_le_bytes/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/to_le_bytes/Nargo.toml rename to crates/nargo_cli/tests/test_data/to_le_bytes/Nargo.toml diff --git a/crates/nargo/tests/test_data/to_le_bytes/Prover.toml b/crates/nargo_cli/tests/test_data/to_le_bytes/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/to_le_bytes/Prover.toml rename to crates/nargo_cli/tests/test_data/to_le_bytes/Prover.toml diff --git a/crates/nargo/tests/test_data/to_le_bytes/src/main.nr b/crates/nargo_cli/tests/test_data/to_le_bytes/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/to_le_bytes/src/main.nr rename to crates/nargo_cli/tests/test_data/to_le_bytes/src/main.nr diff --git a/crates/nargo/tests/test_data/tuples/Nargo.toml b/crates/nargo_cli/tests/test_data/tuples/Nargo.toml similarity index 100% rename from crates/nargo/tests/test_data/tuples/Nargo.toml rename to crates/nargo_cli/tests/test_data/tuples/Nargo.toml diff --git a/crates/nargo/tests/test_data/tuples/Prover.toml b/crates/nargo_cli/tests/test_data/tuples/Prover.toml similarity index 100% rename from crates/nargo/tests/test_data/tuples/Prover.toml rename to crates/nargo_cli/tests/test_data/tuples/Prover.toml diff --git a/crates/nargo/tests/test_data/tuples/src/main.nr b/crates/nargo_cli/tests/test_data/tuples/src/main.nr similarity index 100% rename from crates/nargo/tests/test_data/tuples/src/main.nr rename to crates/nargo_cli/tests/test_data/tuples/src/main.nr