Skip to content

Commit

Permalink
Merge branch 'master' into phated/ref-string
Browse files Browse the repository at this point in the history
* master:
  fix: Fix modulo operator for comptime values (#1361)
  chore: clarify that `verify_signature` takes a hashed message (#1365)
  feat: pass in closure to `Driver` to signal backend opcode support (#1349)
  feat(nargo)!: retire print-acir in favour of flag (#1328)
  chore(ssa): enable cse for assert (#1350)
  chore(ssa refactor): Add basic instruction simplification (#1329)
  chore(noir): Release 0.6.0 (#1279)
  • Loading branch information
TomAFrench committed May 18, 2023
2 parents 7439e39 + ba15d6d commit 2ac6352
Show file tree
Hide file tree
Showing 25 changed files with 484 additions and 108 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Changelog

## [0.6.0](https://github.com/noir-lang/noir/compare/v0.5.1...v0.6.0) (2023-05-16)


### ⚠ BREAKING CHANGES

* Update to acvm 0.11.0 ([#1322](https://github.com/noir-lang/noir/issues/1322))
* **parser:** deprecate `constrain` keyword for `assert` ([#1286](https://github.com/noir-lang/noir/issues/1286))

### Features

* Enable `to_radix` for any field element ([#1343](https://github.com/noir-lang/noir/issues/1343)) ([c3bdec2](https://github.com/noir-lang/noir/commit/c3bdec294234e92a73f39720ec7202fbb17ddc79))
* Enable dynamic arrays ([#1271](https://github.com/noir-lang/noir/issues/1271)) ([9f43450](https://github.com/noir-lang/noir/commit/9f434507fa431a9dbf4130374b866a5de6176d76))
* Issue an error when attempting to use a `return` expression ([#1330](https://github.com/noir-lang/noir/issues/1330)) ([a6de557](https://github.com/noir-lang/noir/commit/a6de557e83eb6318d091e40553bb3e2b3823fdc5))
* **nargo:** Remove usage of `CompiledProgram` in CLI code and use separate ABI/bytecode ([#1269](https://github.com/noir-lang/noir/issues/1269)) ([f144391](https://github.com/noir-lang/noir/commit/f144391b4295b127f3f422e862a087a90dac1dbf))
* **ssa refactor:** experimental-ssa compiler flag ([#1289](https://github.com/noir-lang/noir/issues/1289)) ([afa6749](https://github.com/noir-lang/noir/commit/afa67494c564b68b667535f2d8ef234fbc4bec12))
* **ssa refactor:** Implement dominator tree ([#1278](https://github.com/noir-lang/noir/issues/1278)) ([144ebf5](https://github.com/noir-lang/noir/commit/144ebf51522fb19847be28de5595247051fcd92e))
* **ssa:** add block opcode ([#1291](https://github.com/noir-lang/noir/issues/1291)) ([951ad71](https://github.com/noir-lang/noir/commit/951ad71e0f8bc9a6e95ae21197854396ed7f6e78))
* **stdlib:** add keccak256 foreign function ([#1249](https://github.com/noir-lang/noir/issues/1249)) ([260d87d](https://github.com/noir-lang/noir/commit/260d87d1ef86069a1fcf0f9b4969589273e381d1))


### Bug Fixes

* Fix issue with parsing nested generics ([#1319](https://github.com/noir-lang/noir/issues/1319)) ([36f5b8e](https://github.com/noir-lang/noir/commit/36f5b8e88fe8048ece1a54755789d56c8803b3ab))
* Fix parser error preventing assignments to tuple fields ([#1318](https://github.com/noir-lang/noir/issues/1318)) ([460568e](https://github.com/noir-lang/noir/commit/460568e50a810f90db6559195492547095ab8c32))
* Fix struct or tuple field assignment failing with generics ([#1317](https://github.com/noir-lang/noir/issues/1317)) ([d872890](https://github.com/noir-lang/noir/commit/d872890e408ada056e9aab84a7774dcaa2049324)), closes [#1315](https://github.com/noir-lang/noir/issues/1315)
* **stdlib:** support use of `to_bits` and `to_radix` for values >128 bits ([#1312](https://github.com/noir-lang/noir/issues/1312)) ([12f3e7e](https://github.com/noir-lang/noir/commit/12f3e7e5917fdcb6b8648032772a7541eaef4751))


### Miscellaneous Chores

* **parser:** deprecate `constrain` keyword for `assert` ([#1286](https://github.com/noir-lang/noir/issues/1286)) ([9740f54](https://github.com/noir-lang/noir/commit/9740f54c28f30ea9367897fa986d8aea1aba79f2))
* Update to acvm 0.11.0 ([#1322](https://github.com/noir-lang/noir/issues/1322)) ([da47368](https://github.com/noir-lang/noir/commit/da473685524fc6e5e17f9c3eb95116378ac41fb8))

## [0.5.1](https://github.com/noir-lang/noir/compare/v0.5.0...v0.5.1) (2023-05-01)


Expand Down
22 changes: 11 additions & 11 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ default-members = ["crates/nargo_cli"]

[workspace.package]
# x-release-please-start-version
version = "0.5.1"
version = "0.6.0"
# x-release-please-end
authors = ["The Noir Team <team@noir-lang.org>"]
edition = "2021"
Expand Down
7 changes: 6 additions & 1 deletion crates/nargo_cli/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ fn check_from_path<B: Backend, P: AsRef<Path>>(
p: P,
compile_options: &CompileOptions,
) -> Result<(), CliError<B>> {
let mut driver = Resolver::resolve_root_manifest(p.as_ref(), backend.np_language())?;
let mut driver = Resolver::resolve_root_manifest(
p.as_ref(),
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
)?;

driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?;

Expand Down
7 changes: 6 additions & 1 deletion crates/nargo_cli/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ fn setup_driver<B: Backend>(
backend: &B,
program_dir: &Path,
) -> Result<Driver, DependencyResolutionError> {
Resolver::resolve_root_manifest(program_dir, backend.np_language())
Resolver::resolve_root_manifest(
program_dir,
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
)
}

pub(crate) fn compile_circuit<B: Backend>(
Expand Down
14 changes: 8 additions & 6 deletions crates/nargo_cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ mod compile_cmd;
mod execute_cmd;
mod gates_cmd;
mod new_cmd;
mod print_acir_cmd;
mod prove_cmd;
mod test_cmd;
mod verify_cmd;
Expand Down Expand Up @@ -56,7 +55,6 @@ enum NargoCommand {
Verify(verify_cmd::VerifyCommand),
Test(test_cmd::TestCommand),
Gates(gates_cmd::GatesCommand),
PrintAcir(print_acir_cmd::PrintAcirCommand),
}

pub fn start_cli() -> eyre::Result<()> {
Expand All @@ -79,18 +77,18 @@ pub fn start_cli() -> eyre::Result<()> {
NargoCommand::Test(args) => test_cmd::run(&backend, args, config),
NargoCommand::Gates(args) => gates_cmd::run(&backend, args, config),
NargoCommand::CodegenVerifier(args) => codegen_verifier_cmd::run(&backend, args, config),
NargoCommand::PrintAcir(args) => print_acir_cmd::run(&backend, args, config),
}?;

Ok(())
}

// helper function which tests noir programs by trying to generate a proof and verify it
pub fn prove_and_verify(proof_name: &str, program_dir: &Path, show_ssa: bool) -> bool {
pub fn prove_and_verify(proof_name: &str, program_dir: &Path) -> bool {
let backend = crate::backends::ConcreteBackend::default();

let compile_options = CompileOptions {
show_ssa,
show_ssa: false,
print_acir: false,
allow_warnings: false,
show_output: false,
experimental_ssa: false,
Expand Down Expand Up @@ -128,7 +126,11 @@ mod tests {
///
/// This is used for tests.
fn file_compiles<P: AsRef<Path>>(root_file: P) -> bool {
let mut driver = Driver::new(&acvm::Language::R1CS);
let mut driver = Driver::new(
&acvm::Language::R1CS,
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(acvm::Language::R1CS)),
);
driver.create_local_crate(&root_file, CrateType::Binary);
crate::resolver::add_std_lib(&mut driver);
driver.file_compiles()
Expand Down
35 changes: 0 additions & 35 deletions crates/nargo_cli/src/cli/print_acir_cmd.rs

This file was deleted.

7 changes: 6 additions & 1 deletion crates/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ fn run_tests<B: Backend>(
test_name: &str,
compile_options: &CompileOptions,
) -> Result<(), CliError<B>> {
let mut driver = Resolver::resolve_root_manifest(program_dir, backend.np_language())?;
let mut driver = Resolver::resolve_root_manifest(
program_dir,
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
)?;

driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?;

Expand Down
5 changes: 3 additions & 2 deletions crates/nargo_cli/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
path::{Path, PathBuf},
};

use acvm::Language;
use acvm::{acir::circuit::Opcode, Language};
use nargo::manifest::{Dependency, PackageManifest};
use noirc_driver::Driver;
use noirc_frontend::graph::{CrateId, CrateName, CrateType};
Expand Down Expand Up @@ -71,8 +71,9 @@ impl<'a> Resolver<'a> {
pub(crate) fn resolve_root_manifest(
dir_path: &std::path::Path,
np_language: Language,
is_opcode_supported: Box<dyn Fn(&Opcode) -> bool>,
) -> Result<Driver, DependencyResolutionError> {
let mut driver = Driver::new(&np_language);
let mut driver = Driver::new(&np_language, is_opcode_supported);
let (entry_path, crate_type) = super::lib_or_bin(dir_path)?;

let manifest_path = super::find_package_manifest(dir_path)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/nargo_cli/tests/prove_and_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ mod tests {
println!("Running test {test_name}");

let verified = std::panic::catch_unwind(|| {
nargo_cli::cli::prove_and_verify("pp", test_program_dir, false)
nargo_cli::cli::prove_and_verify("pp", test_program_dir)
});

let r = match verified {
Expand Down
1 change: 1 addition & 0 deletions crates/nargo_cli/tests/test_data/2_div/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ fn main(mut x: u32, y: u32, z: u32) {
let a = x % y;
assert(x / y == z);
assert(a == x - z*y);
assert((50 as u64) % (9 as u64) == 5);
}
Loading

0 comments on commit 2ac6352

Please sign in to comment.