Skip to content

Commit

Permalink
feat: Sync from noir (AztecProtocol/aztec-packages#5955)
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: Delete unused brillig methods
(#4887)
feat(acir_gen): Brillig stdlib
(#4848)
END_COMMIT_OVERRIDE

---------

Co-authored-by: vezenovm <mvezenov@gmail.com>
  • Loading branch information
AztecBot and vezenovm committed Apr 23, 2024
1 parent 0f9ae0a commit f08f819
Show file tree
Hide file tree
Showing 153 changed files with 3,187 additions and 1,064 deletions.
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
beab8c93857536e07fa37994213fc664a5864013
8f73f18f3c07de0fd5e247ade5a48109c37c1bc5
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 @@ -132,6 +132,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: 1 addition & 1 deletion acvm-repo/acir/src/circuit/brillig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct Brillig {
/// This is purely a wrapper struct around a list of Brillig opcode's which represents
/// a full Brillig function to be executed by the Brillig VM.
/// This is stored separately on a program and accessed through a [BrilligPointer].
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Default, Debug)]
pub struct BrilligBytecode {
pub bytecode: Vec<BrilligOpcode>,
}
3 changes: 0 additions & 3 deletions acvm-repo/acvm_js/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function run_if_available {
require_command jq
require_command cargo
require_command wasm-bindgen
require_command wasm-opt

self_path=$(dirname "$(readlink -f "$0")")
pname=$(cargo read-manifest | jq -r '.name')
Expand All @@ -49,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_or_fail wasm-opt $NODE_WASM -o $NODE_WASM -O
run_or_fail 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
13 changes: 7 additions & 6 deletions aztec_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,18 @@ fn transform_module(
// Check for a user defined storage struct

let maybe_storage_struct_name = check_for_storage_definition(module)?;

let storage_defined = maybe_storage_struct_name.is_some();

if let Some(storage_struct_name) = maybe_storage_struct_name {
if !check_for_storage_implementation(module, &storage_struct_name) {
generate_storage_implementation(module, &storage_struct_name)?;
if let Some(ref storage_struct_name) = maybe_storage_struct_name {
if !check_for_storage_implementation(module, storage_struct_name) {
generate_storage_implementation(module, storage_struct_name)?;
}
// Make sure we're only generating the storage layout for the root crate
// In case we got a contract importing other contracts for their interface, we
// don't want to generate the storage layout for them
if crate_id == context.root_crate_id() {
generate_storage_layout(module, storage_struct_name)?;
generate_storage_layout(module, storage_struct_name.clone())?;
}
}

Expand Down Expand Up @@ -164,14 +165,14 @@ fn transform_module(
transform_function(
fn_type,
func,
storage_defined,
maybe_storage_struct_name.clone(),
is_initializer,
insert_init_check,
is_internal,
)?;
has_transformed_module = true;
} else if storage_defined && func.def.is_unconstrained {
transform_unconstrained(func);
transform_unconstrained(func, maybe_storage_struct_name.clone().unwrap());
has_transformed_module = true;
}
}
Expand Down
Loading

0 comments on commit f08f819

Please sign in to comment.