Skip to content

Commit

Permalink
feat: Sync from noir (#12445)
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 deprecated hash functions from stdlib
(noir-lang/noir#7477)
fix(frontend)!: Restrict capturing mutable variable in lambdas
(noir-lang/noir#7488)
feat: perform constant sha256 compressions at compile-time
(noir-lang/noir#7566)
chore: bump external pinned commits
(noir-lang/noir#7565)
chore(ssa): Turn the Brillig constraints check back on by default
(noir-lang/noir#7404)
chore: bump external pinned commits
(noir-lang/noir#7561)
chore: address some frontend tests TODOs
(noir-lang/noir#7554)
fix: shift right overflow in ACIR with unknown var now returns zero
(noir-lang/noir#7509)
chore(cli): Forward `nargo execute` to `noir_artifact_cli`
(noir-lang/noir#7406)
feat: Support `<Type as Trait>::method` in expressions
(noir-lang/noir#7551)
chore: remove FileDiagnostic
(noir-lang/noir#7546)
chore: add some extra tests
(noir-lang/noir#7544)
fix: fix a few cases where safety comment wasn't correctly identified
(noir-lang/noir#7548)
chore!: remove U128 struct from stdlib
(noir-lang/noir#7529)
feat: simplify simple conditionals for brillig
(noir-lang/noir#7205)
chore: put RcTracker as part of the DIE context
(noir-lang/noir#7309)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <tom@tomfren.ch>
  • Loading branch information
AztecBot and TomAFrench authored Mar 6, 2025
1 parent 0c3024e commit f13b729
Show file tree
Hide file tree
Showing 221 changed files with 3,556 additions and 4,197 deletions.
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
826b18a10630471c19c25ab745f9bfe045813e69
5a3d2bc0e13a12b039c793c73d7817924c13e159
7 changes: 7 additions & 0 deletions .test_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ tests:
owners:
- "U03JYU7AQET" # luke

# Sumcheck is failing for some reason
- regex: "barretenberg/acir_tests/run_test.sh ram_blowup_regression"
skip: true
owners:
- "U04LLT331NK" # Tom


# noir
# Something to do with how I run the tests now. Think these are fine in nextest.
- regex: "noir_lsp-.* notifications::notification_tests::test_caches_open_files"
Expand Down
2 changes: 1 addition & 1 deletion noir/bb-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.72.1
0.77.1
18 changes: 18 additions & 0 deletions noir/noir-repo/.github/actions/download-noir-execute/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Download noir-execute
description: Downloads the noir-execute binary from an artifact and adds it to the path

runs:
using: composite
steps:
- name: Download noir-execute binary
uses: actions/download-artifact@v4
with:
name: noir-execute
path: ./noir-execute

- name: Set noir-execute on PATH
shell: bash
run: |
noir_binary="${{ github.workspace }}/noir-execute/noir-execute"
chmod +x $noir_binary
echo "$(dirname $noir_binary)" >> $GITHUB_PATH
22 changes: 11 additions & 11 deletions noir/noir-repo/.github/benchmark_projects.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define: &AZ_COMMIT a90f08e245add379fa0257c81f8e2819beb190cb
define: &AZ_COMMIT 3b981f9217f9b859bdfbcdba2f5c080392c98da6
projects:
private-kernel-inner:
repo: AztecProtocol/aztec-packages
Expand All @@ -16,7 +16,7 @@ projects:
num_runs: 5
timeout: 4
compilation-timeout: 1.2
execution-timeout: 0.02
execution-timeout: 0.04
compilation-memory-limit: 250
execution-memory-limit: 230
private-kernel-reset:
Expand All @@ -35,19 +35,19 @@ projects:
path: noir-projects/noir-protocol-circuits/crates/rollup-base-private
num_runs: 5
timeout: 15
compilation-timeout: 10
execution-timeout: 0.5
compilation-memory-limit: 1100
execution-memory-limit: 500
compilation-timeout: 20
execution-timeout: 1
compilation-memory-limit: 1500
execution-memory-limit: 650
rollup-base-public:
repo: AztecProtocol/aztec-packages
ref: *AZ_COMMIT
path: noir-projects/noir-protocol-circuits/crates/rollup-base-public
num_runs: 5
timeout: 15
compilation-timeout: 8
execution-timeout: 0.4
compilation-memory-limit: 1000
compilation-timeout: 15
execution-timeout: 0.75
compilation-memory-limit: 1500
execution-memory-limit: 500
rollup-block-root-empty:
repo: AztecProtocol/aztec-packages
Expand All @@ -65,15 +65,15 @@ projects:
cannot_execute: true
num_runs: 1
timeout: 60
compilation-timeout: 110
compilation-timeout: 135
compilation-memory-limit: 8000
rollup-block-root:
repo: AztecProtocol/aztec-packages
ref: *AZ_COMMIT
path: noir-projects/noir-protocol-circuits/crates/rollup-block-root
num_runs: 1
timeout: 60
compilation-timeout: 110
compilation-timeout: 135
execution-timeout: 40
compilation-memory-limit: 8000
execution-memory-limit: 1500
Expand Down
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion noir/noir-repo/.github/scripts/integration-test-node.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -eu

apt-get install libc++-dev -y
apt-get install libc6 libstdc++6 -y
yarn workspace integration-tests test:node
4 changes: 2 additions & 2 deletions noir/noir-repo/.github/workflows/deny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
- uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
with:
command: check all
command: check all
2 changes: 2 additions & 0 deletions noir/noir-repo/.github/workflows/publish-nargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
cargo build --package noir_profiler --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
cargo build --package noir_inspector --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
- name: Package artifacts
run: |
mkdir dist
Expand Down Expand Up @@ -237,3 +238,4 @@ jobs:
overwrite: true
tag: ${{ format('{0}-{1}', 'nightly', steps.date.outputs.date) }}


2 changes: 1 addition & 1 deletion noir/noir-repo/.github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
compare_gates_reports:
name: Circuit sizes
needs: [build-nargo]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
permissions:
pull-requests: write

Expand Down
48 changes: 45 additions & 3 deletions noir/noir-repo/.github/workflows/test-js-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,39 @@ jobs:
path: ./dist/*
retention-days: 3

build-noir-execute:
runs-on: ubuntu-22.04
timeout-minutes: 30

steps:
- name: Checkout Noir repo
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.85.0

- uses: Swatinem/rust-cache@v2
with:
key: x86_64-unknown-linux-gnu
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Build noir-execute
run: cargo build --package noir_artifact_cli --release

- name: Package artifacts
run: |
mkdir dist
cp ./target/release/noir-execute ./dist/noir-execute
7z a -ttar -so -an ./dist/* | 7z a -si ./noir-execute-x86_64-unknown-linux-gnu.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: noir-execute
path: ./dist/*
retention-days: 3

build-noirc-abi:
runs-on: ubuntu-22.04
timeout-minutes: 30
Expand Down Expand Up @@ -361,7 +394,7 @@ jobs:

test-integration-node:
name: Integration Tests (Node)
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [build-acvm-js, build-noir-wasm, build-nargo, build-noirc-abi]
timeout-minutes: 30

Expand All @@ -373,6 +406,7 @@ jobs:
run: |
./scripts/install_bb.sh
echo "$HOME/.bb/" >> $GITHUB_PATH
sudo apt-get install libc6 libstdc++6 -y
- name: Download nargo binary
uses: ./.github/actions/download-nargo
Expand Down Expand Up @@ -456,8 +490,8 @@ jobs:
test-examples:
name: Example scripts
runs-on: ubuntu-22.04
needs: [build-nargo]
runs-on: ubuntu-24.04
needs: [build-nargo, build-noir-execute]
timeout-minutes: 30

steps:
Expand All @@ -473,10 +507,14 @@ jobs:
run: |
./scripts/install_bb.sh
echo "$HOME/.bb/" >> $GITHUB_PATH
sudo apt-get install libc6 libstdc++6 -y
- name: Download nargo binary
uses: ./.github/actions/download-nargo

- name: Download noir-execute binary
uses: ./.github/actions/download-noir-execute

- name: Run `prove_and_verify`
working-directory: ./examples/prove_and_verify
run: ./test.sh
Expand All @@ -485,6 +523,10 @@ jobs:
working-directory: ./examples/codegen_verifier
run: ./test.sh

- name: Run `oracle_transcript`
working-directory: ./examples/oracle_transcript
run: ./test.sh

external-repo-checks:
needs: [build-nargo, critical-library-list]
runs-on: ubuntu-22.04
Expand Down
3 changes: 3 additions & 0 deletions noir/noir-repo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ codegen

**/cspell.json
!./cspell.json

mutants.out
mutants.out.old
3 changes: 3 additions & 0 deletions noir/noir-repo/CRITICAL_NOIR_LIBRARIES
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ https://github.com/noir-lang/noir_string_search
https://github.com/noir-lang/sparse_array
https://github.com/noir-lang/noir_rsa
https://github.com/noir-lang/noir_json_parser
https://github.com/noir-lang/sha256
https://github.com/noir-lang/sha512
https://github.com/noir-lang/keccak256
10 changes: 4 additions & 6 deletions noir/noir-repo/Cargo.lock

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

10 changes: 8 additions & 2 deletions noir/noir-repo/EXTERNAL_NOIR_LIBRARIES.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define: &AZ_COMMIT a90f08e245add379fa0257c81f8e2819beb190cb
define: &AZ_COMMIT 3b981f9217f9b859bdfbcdba2f5c080392c98da6
libraries:
noir_check_shuffle:
repo: noir-lang/noir_check_shuffle
Expand Down Expand Up @@ -29,7 +29,7 @@ libraries:
timeout: 250
noir_base64:
repo: noir-lang/noir_base64
timeout: 3
timeout: 5
noir_string_search:
repo: noir-lang/noir_string_search
timeout: 2
Expand All @@ -45,6 +45,12 @@ libraries:
sha256:
repo: noir-lang/sha256
timeout: 3
sha512:
repo: noir-lang/sha512
timeout: 30
keccak256:
repo: noir-lang/keccak256
timeout: 3
aztec_nr:
repo: AztecProtocol/aztec-packages
ref: *AZ_COMMIT
Expand Down
20 changes: 16 additions & 4 deletions noir/noir-repo/acvm-repo/acir/src/native_types/witness_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ use super::WitnessMap;
enum SerializationError {
#[error(transparent)]
Deflate(#[from] std::io::Error),

#[error(transparent)]
BincodeError(#[from] bincode::Error),
}

#[derive(Debug, Error)]
Expand Down Expand Up @@ -57,26 +60,35 @@ impl<F> From<WitnessMap<F>> for WitnessStack<F> {
}
}

impl<F: Serialize> TryFrom<WitnessStack<F>> for Vec<u8> {
impl<F: Serialize> TryFrom<&WitnessStack<F>> for Vec<u8> {
type Error = WitnessStackError;

fn try_from(val: WitnessStack<F>) -> Result<Self, Self::Error> {
let buf = bincode::serialize(&val).unwrap();
fn try_from(val: &WitnessStack<F>) -> Result<Self, Self::Error> {
let buf = bincode::serialize(val).map_err(|e| WitnessStackError(e.into()))?;
let mut deflater = GzEncoder::new(buf.as_slice(), Compression::best());
let mut buf_c = Vec::new();
deflater.read_to_end(&mut buf_c).map_err(|err| WitnessStackError(err.into()))?;
Ok(buf_c)
}
}

impl<F: Serialize> TryFrom<WitnessStack<F>> for Vec<u8> {
type Error = WitnessStackError;

fn try_from(val: WitnessStack<F>) -> Result<Self, Self::Error> {
Self::try_from(&val)
}
}

impl<F: for<'a> Deserialize<'a>> TryFrom<&[u8]> for WitnessStack<F> {
type Error = WitnessStackError;

fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> {
let mut deflater = GzDecoder::new(bytes);
let mut buf_d = Vec::new();
deflater.read_to_end(&mut buf_d).map_err(|err| WitnessStackError(err.into()))?;
let witness_stack = bincode::deserialize(&buf_d).unwrap();
let witness_stack =
bincode::deserialize(&buf_d).map_err(|e| WitnessStackError(e.into()))?;
Ok(witness_stack)
}
}
Loading

0 comments on commit f13b729

Please sign in to comment.