Skip to content

Commit cf49105

Browse files
committed
Merge branch 'master' into gd/issue_2016
* master: chore: rename `ssa_refactor` module to `ssa` (#2129) chore: Use `--show-output` flag on execution rather than compilation (#2116) fix(globals): Accurately filter literals for resolving globals (#2126) feat: Optimize away constant calls to black box functions (#1981) fix: Rename `Option::value` to `Option::_value` (#2127) feat: replace boolean `AND`s with multiplication (#1954) chore: create a `const` to hold the panic message (#2122) feat: Add support for bitshifts by distances known at runtime (#2072) feat: Add additional `BinaryOp` simplifications (#2124) fix: flattening pass no longer overwrites previously mapped condition values (#2117) chore(noirc_driver): Unify crate preparation (#2119) feat!: Support workspaces and package selection on every nargo command (#1992) chore: Make a more clear error for slices passed to std::println (#2113) feat: Implement type aliases (#2112) feat: Add `Option<T>` to noir stdlib (#1781) feat: Format strings for prints (#1952) feat(acir_gen): RecursiveAggregation opcode and updates to black box func call generation (#2097) fix: Mutating a variable no longer mutates its copy (#2057) fix: Implement `.len()` in Acir-Gen (#2077)
2 parents 34c765c + a07b8a4 commit cf49105

File tree

148 files changed

+2902
-1445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+2902
-1445
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@ result
2222
**/target
2323
!crates/nargo_cli/tests/test_data/*/target
2424
!crates/nargo_cli/tests/test_data/*/target/witness.tr
25-
!crates/nargo_cli/tests/test_data_ssa_refactor/*/target
26-
!crates/nargo_cli/tests/test_data_ssa_refactor/*/target/witness.tr

Cargo.lock

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/lsp/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use lsp_types::{
2222
InitializeParams, InitializeResult, InitializedParams, Position, PublishDiagnosticsParams,
2323
Range, ServerCapabilities, TextDocumentSyncOptions,
2424
};
25-
use noirc_driver::{check_crate, create_local_crate};
25+
use noirc_driver::{check_crate, prepare_crate};
2626
use noirc_errors::{DiagnosticKind, FileDiagnostic};
2727
use noirc_frontend::{
2828
graph::{CrateGraph, CrateType},
@@ -190,7 +190,7 @@ fn on_code_lens_request(
190190
}
191191
};
192192

193-
let crate_id = create_local_crate(&mut context, file_path, CrateType::Binary);
193+
let crate_id = prepare_crate(&mut context, file_path, CrateType::Binary);
194194

195195
// We ignore the warnings and errors produced by compilation for producing codelenses
196196
// because we can still get the test functions even if compilation fails
@@ -283,7 +283,7 @@ fn on_did_save_text_document(
283283
}
284284
};
285285

286-
let crate_id = create_local_crate(&mut context, file_path, CrateType::Binary);
286+
let crate_id = prepare_crate(&mut context, file_path, CrateType::Binary);
287287

288288
let mut diagnostics = Vec::new();
289289

crates/lsp/src/lib_hacky.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use lsp_types::{
1919
InitializedParams, Position, PublishDiagnosticsParams, Range, ServerCapabilities,
2020
TextDocumentSyncOptions,
2121
};
22-
use noirc_driver::{check_crate, create_local_crate, create_non_local_crate, propagate_dep};
22+
use noirc_driver::{check_crate, prepare_crate, propagate_dep};
2323
use noirc_errors::{DiagnosticKind, FileDiagnostic};
2424
use noirc_frontend::{
2525
graph::{CrateGraph, CrateId, CrateType},
@@ -286,7 +286,7 @@ fn create_context_at_path(
286286
}
287287
let nargo_toml_path = find_nearest_parent_file(&file_path, &["Nargo.toml"]);
288288

289-
let current_crate_id = create_local_crate(&mut context, &file_path, CrateType::Binary);
289+
let current_crate_id = prepare_crate(&mut context, &file_path, CrateType::Binary);
290290

291291
// TODO(AD): undo hacky dependency resolution
292292
if let Some(nargo_toml_path) = nargo_toml_path {
@@ -297,8 +297,7 @@ fn create_context_at_path(
297297
.parent()
298298
.unwrap() // TODO
299299
.join(PathBuf::from(&dependency_path).join("src").join("lib.nr"));
300-
let library_crate =
301-
create_non_local_crate(&mut context, &path_to_lib, CrateType::Library);
300+
let library_crate = prepare_crate(&mut context, &path_to_lib, CrateType::Library);
302301
propagate_dep(&mut context, library_crate, &crate_name.parse().unwrap());
303302
}
304303
}

crates/nargo/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ rustc_version = "0.4.0"
1414
acvm.workspace = true
1515
noirc_abi.workspace = true
1616
noirc_driver.workspace = true
17+
noirc_frontend.workspace = true
1718
iter-extended.workspace = true
18-
toml.workspace = true
1919
serde.workspace = true
2020
serde_json.workspace = true
2121
thiserror.workspace = true
2222
noirc_errors.workspace = true
23-
base64.workspace = true
23+
base64.workspace = true
24+
regex = "1.9.1"
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
// Directories
22
/// The directory for the `nargo contract` command output
3-
pub(crate) const CONTRACT_DIR: &str = "contract";
3+
pub const CONTRACT_DIR: &str = "contract";
44
/// The directory to store serialized circuit proofs.
5-
pub(crate) const PROOFS_DIR: &str = "proofs";
5+
pub const PROOFS_DIR: &str = "proofs";
66
/// The directory to store Noir source files
7-
pub(crate) const SRC_DIR: &str = "src";
7+
pub const SRC_DIR: &str = "src";
88
/// The directory to store circuits' serialized ACIR representations.
9-
pub(crate) const TARGET_DIR: &str = "target";
9+
pub const TARGET_DIR: &str = "target";
1010

1111
// Files
1212
/// The file from which Nargo pulls prover inputs
13-
pub(crate) const PROVER_INPUT_FILE: &str = "Prover";
13+
pub const PROVER_INPUT_FILE: &str = "Prover";
1414
/// The file from which Nargo pulls verifier inputs
15-
pub(crate) const VERIFIER_INPUT_FILE: &str = "Verifier";
15+
pub const VERIFIER_INPUT_FILE: &str = "Verifier";
1616
/// The package definition file for a Noir project.
17-
pub(crate) const PKG_FILE: &str = "Nargo.toml";
17+
pub const PKG_FILE: &str = "Nargo.toml";
1818

1919
// Extensions
2020
/// The extension for files containing circuit proofs.
21-
pub(crate) const PROOF_EXT: &str = "proof";
21+
pub const PROOF_EXT: &str = "proof";
2222
/// The extension for files containing proof witnesses.
23-
pub(crate) const WITNESS_EXT: &str = "tr";
23+
pub const WITNESS_EXT: &str = "tr";

crates/nargo/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
//! Noir Package Manager abbreviated is npm, which is already taken.
99
1010
pub mod artifacts;
11+
pub mod constants;
1112
mod errors;
12-
pub mod manifest;
1313
pub mod ops;
14+
pub mod package;
15+
pub mod workspace;
1416

1517
pub use self::errors::NargoError;

crates/nargo/src/manifest/errors.rs

-26
This file was deleted.

crates/nargo/src/manifest/mod.rs

-147
This file was deleted.

crates/nargo/src/ops/execute.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub fn execute_circuit<B: BlackBoxFunctionSolver + Default>(
1010
_backend: &B,
1111
circuit: Circuit,
1212
initial_witness: WitnessMap,
13+
show_output: bool,
1314
) -> Result<WitnessMap, NargoError> {
1415
let mut acvm = ACVM::new(B::default(), circuit.opcodes, initial_witness);
1516

@@ -23,7 +24,7 @@ pub fn execute_circuit<B: BlackBoxFunctionSolver + Default>(
2324
}
2425
ACVMStatus::Failure(error) => return Err(error.into()),
2526
ACVMStatus::RequiresForeignCall(foreign_call) => {
26-
let foreign_call_result = ForeignCall::execute(&foreign_call)?;
27+
let foreign_call_result = ForeignCall::execute(&foreign_call, show_output)?;
2728
acvm.resolve_pending_foreign_call(foreign_call_result);
2829
}
2930
}

0 commit comments

Comments
 (0)