Skip to content

Commit

Permalink
feat: Sync from noir (AztecProtocol/aztec-packages#5935)
Browse files Browse the repository at this point in the history
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove pub wildcard import of ast into `noirc_frontend` root
(#4862)
chore: remove `SecondaryAttribute::Event`
(#4868)
chore: more explicit `self` parameter in `Into` trait
(#4867)
chore: remove initialisation of logger in `acvm_js` tests
(#4850)
chore: bump MSRV to `1.74.1`
(#4873)
chore: update NoirJS tutorial
(#4861)
chore(docs): remove link to play.noir-lang.org
(#4872)
chore: update noir README (#4856)
feat(experimental): Add `comptime` keyword
(#4840)
feat: add `min` and `max` functions to the stdlib
(#4839)
feat: Allow numeric generics to non inlined ACIR functions
(#4834)
chore!: Add `as_array` and remove `_slice` variants of hash functions
(#4675)
feat!: reserve keyword `super`
(#4836)
feat: simplify `BoundedVec::eq`
(#4838)
feat: Add comptime Interpreter
(#4821)
feat: Sync from aztec-packages
(#4833)
feat: implement `Eq` trait on `BoundedVec`
(#4830)
chore: add benchmarks for serializing a dummy program
(#4813)
END_COMMIT_OVERRIDE

---------

Co-authored-by: TomAFrench <tom@tomfren.ch>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
  • Loading branch information
4 people committed Apr 23, 2024
2 parents afe40aa + c2130e8 commit 703dddf
Show file tree
Hide file tree
Showing 146 changed files with 2,554 additions and 816 deletions.
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b23e42f5f897936bb9607ba94e57f31723d9984b
cea51073be4ecc65a3c8d36cfe107df8390b853f
2 changes: 1 addition & 1 deletion .github/workflows/docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: ${{ matrix.target }}
components: clippy, rustfmt
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gates_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-acvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
ref: ${{ inputs.noir-ref }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

# These steps are in a specific order so crate dependencies are updated first
- name: Publish acir_field
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-es-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
ref: ${{ inputs.noir-ref }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
ref: ${{ inputs.noir-ref }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
ref: ${{ inputs.noir-ref }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-nargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: ${{ matrix.target }}

Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: ${{ matrix.target }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-js-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1

- uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-rust-workspace-msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: x86_64-unknown-linux-gnu

Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: x86_64-unknown-linux-gnu

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-rust-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: x86_64-unknown-linux-gnu

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.73.0
uses: dtolnay/rust-toolchain@1.74.1
with:
targets: x86_64-unknown-linux-gnu

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
* reserve `unchecked` keyword ([#4432](https://github.com/noir-lang/noir/issues/4432))
* Remove empty value from bounded vec ([#4431](https://github.com/noir-lang/noir/issues/4431))
* Ban Fields in for loop indices and bitwise ops ([#4376](https://github.com/noir-lang/noir/issues/4376))
* bump msrv to 1.73.0 ([#4406](https://github.com/noir-lang/noir/issues/4406))
* Bump msrv to 1.73.0 ([#4406](https://github.com/noir-lang/noir/issues/4406))
* **ci:** Bump MSRV to 1.72.1 and enforce that ACVM can be published using updated lockfile ([#4385](https://github.com/noir-lang/noir/issues/4385))
* Restrict bit sizes ([#4235](https://github.com/noir-lang/noir/issues/4235))
* move noir out of yarn-project (https://github.com/AztecProtocol/aztec-packages/pull/4479)
Expand Down
5 changes: 2 additions & 3 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ version = "0.27.0"
# x-release-please-end
authors = ["The Noir Team <team@noir-lang.org>"]
edition = "2021"
rust-version = "1.73.0"
rust-version = "1.74.1"
license = "MIT OR Apache-2.0"
repository = "https://github.com/noir-lang/noir/"

Expand Down Expand Up @@ -124,6 +124,7 @@ tempfile = "3.6.0"
jsonrpc = { version = "0.16.0", features = ["minreq_http"] }
flate2 = "1.0.24"

im = { version = "15.1", features = ["serde"] }
tracing = "0.1.40"
tracing-web = "0.1.3"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
Expand Down
61 changes: 24 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<div align="center">
<picture>
<img src="./noir-logo.png" alt="The Noir Programming Language" width="35%">
</picture>

[Website][Noir] | [Getting started] | [Documentation] | [Contributing]
</div>



# The Noir Programming Language

Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving system.
Expand All @@ -6,58 +16,35 @@ Noir is a Domain Specific Language for SNARK proving systems. It has been design

## Quick Start

Read the installation section [here](https://noir-lang.org/docs/dev/getting_started/installation/).
Read the [installation section][Getting started] from the [Noir docs][Documentation].

Once you have read through the documentation, you can visit [Awesome Noir](https://github.com/noir-lang/awesome-noir) to run some of the examples that others have created.

## Current Features

Backends:
## Getting Help

- Barretenberg via FFI
- Marlin via arkworks (Note -- latest interfaces may not be updated to support Marlin backend. Please open an issue if this is relevant to your project and requires attention.)
Join the Noir [forum][Forum] or [Discord][Discord]

Compiler:
## Contributing

- Module System
- For expressions
- Arrays
- Bit Operations
- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list]
- Unsigned integers
- If statements
- Structures and Tuples
- Generics

ACIR Supported OPCODES:

- Sha256
- Blake2s
- Schnorr signature verification
- Pedersen
- HashToField
See [CONTRIBUTING.md][CONTRIBUTING].

## Future Work

The current focus is to gather as much feedback as possible while in the alpha phase. The main focuses of Noir are _safety_ and _developer experience_. If you find a feature that does not seem to be in line with these goals, please open an issue!

Concretely the following items are on the road map:

- General code sanitization and documentation (ongoing effort)
- Prover and Verifier Key logic. (Prover and Verifier pre-process per compile)
- Fallback mechanism for backend unsupported opcodes
- Visibility modifiers
- Signed integers
- Backend integration: (Bulletproofs)
- Recursion
- Big integers

## Minimum Rust version

This crate's minimum supported rustc version is 1.73.0.
This workspace's minimum supported rustc version is 1.74.1.

## License

Noir is free and open source. It is distributed under a dual license. (MIT/APACHE)

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this repository by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

[Noir]: https://www.noir-lang.org/
[Getting Started]: https://noir-lang.org/docs/getting_started/installation/
[Forum]: https://forum.aztec.network/c/noir
[Discord]: https://discord.gg/JtqzkdeQ6G
[Documentation]: https://noir-lang.org/docs
[Contributing]: CONTRIBUTING.md
2 changes: 0 additions & 2 deletions acvm-repo/acvm_js/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,3 @@ BROWSER_WASM=${BROWSER_DIR}/${pname}_bg.wasm
run_or_fail cargo build --lib --release --target $TARGET --package ${pname}
run_or_fail wasm-bindgen $WASM_BINARY --out-dir $NODE_DIR --typescript --target nodejs
run_or_fail wasm-bindgen $WASM_BINARY --out-dir $BROWSER_DIR --typescript --target web
run_if_available wasm-opt $NODE_WASM -o $NODE_WASM -O
run_if_available wasm-opt $BROWSER_WASM -o $BROWSER_WASM -O
3 changes: 0 additions & 3 deletions acvm-repo/acvm_js/test/browser/black_box_solvers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import initACVM, {
blake2s256,
ecdsa_secp256k1_verify,
ecdsa_secp256r1_verify,
initLogLevel,
keccak256,
sha256,
xor,
} from '@noir-lang/acvm_js';

beforeEach(async () => {
await initACVM();

initLogLevel('INFO');
});

it('successfully calculates the bitwise AND of two fields', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use noirc_errors::{Location, Span};
use noirc_frontend::ast::{FunctionReturnType, NoirFunction, UnresolvedTypeData};
use noirc_frontend::{
graph::CrateId,
macros_api::{FileId, HirContext},
parse_program, FunctionReturnType, NoirFunction, Type, UnresolvedTypeData,
parse_program, Type,
};

use crate::utils::{
Expand Down
5 changes: 3 additions & 2 deletions aztec_macros/src/transforms/contract_interface.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use noirc_frontend::ast::{NoirFunction, UnresolvedTypeData};
use noirc_frontend::{
graph::CrateId,
macros_api::{FileId, HirContext, HirExpression, HirLiteral, HirStatement},
parse_program,
parser::SortedModule,
NoirFunction, Type, UnresolvedTypeData,
Type,
};

use crate::utils::{
Expand Down Expand Up @@ -52,7 +53,7 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction) -> String {
})
.collect::<Vec<_>>()
.join(", ");
let fn_return_type: noirc_frontend::UnresolvedType = func.return_type();
let fn_return_type: noirc_frontend::ast::UnresolvedType = func.return_type();

let fn_selector = format!("dep::aztec::protocol_types::abis::function_selector::FunctionSelector::from_signature(\"{}\")", SELECTOR_PLACEHOLDER);

Expand Down
6 changes: 4 additions & 2 deletions aztec_macros/src/transforms/events.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use iter_extended::vecmap;
use noirc_errors::Span;
use noirc_frontend::ast::{
ExpressionKind, FunctionDefinition, FunctionReturnType, ItemVisibility, Literal, NoirFunction,
Visibility,
};
use noirc_frontend::{
graph::CrateId,
macros_api::{
Expand All @@ -8,8 +12,6 @@ use noirc_frontend::{
UnresolvedTypeData,
},
token::SecondaryAttribute,
ExpressionKind, FunctionDefinition, FunctionReturnType, ItemVisibility, Literal, NoirFunction,
Visibility,
};

use crate::{
Expand Down
Loading

0 comments on commit 703dddf

Please sign in to comment.