Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sync aztec-packages #4011

Merged
merged 70 commits into from
Jan 17, 2024
Merged
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
6743afc
feat: Aztec CI files in Noir (#3430)
ludamad Nov 27, 2023
5b5046b
Merge branch 'master' into aztec
kevaundray Nov 28, 2023
7f1b857
Merge remote-tracking branch 'origin/master' into aztec
sirasistant Nov 29, 2023
454b140
feat: Pull latest noir for brillig optimizations (#3464)
sirasistant Nov 29, 2023
fc00722
Merge branch 'master' into aztec
kevaundray Dec 10, 2023
0ad7ba5
Merge branch 'master' into aztec
sirasistant Dec 15, 2023
2d265b4
Merge branch 'master' into aztec-packages
sirasistant Dec 18, 2023
d788414
Merge branch 'master' into aztec-packages
sirasistant Dec 19, 2023
f06ab9c
feat: update to latest noir and update noir compiler (#3696)
Thunkar Dec 19, 2023
29ff6ce
chore: revert unwanted changes
TomAFrench Dec 19, 2023
d144743
chore: Cleanup recursion interface (#3744)
vezenovm Dec 19, 2023
20f1652
feat!: updated note hash and nullifier macro (#3777)
benesjan Jan 2, 2024
ce02b01
fix: event macro (#3784)
benesjan Jan 2, 2024
50925ea
feat!: moving `compute_selector` to `FunctionSelector` (#3806)
benesjan Jan 3, 2024
338cb57
chore: Just nargo compile. (#3775)
charlielye Jan 3, 2024
717f1fa
Merge branch 'master' into aztec-packages
sirasistant Jan 4, 2024
1005f32
chore: delete extraneous gzips
sirasistant Jan 4, 2024
50cb28c
chore: fix clippy and fmt
sirasistant Jan 4, 2024
a6289a5
chore: noir sync (#3884)
ludamad Jan 8, 2024
c0826b5
chore!: Remove aggregation objects from RecursionConstraint (#3885)
vezenovm Jan 8, 2024
3521d28
feat: update BB version
sirasistant Jan 9, 2024
a3366d6
test: fix serialization and bb tests
sirasistant Jan 9, 2024
16a4f50
Merge branch 'master' into aztec-packages
sirasistant Jan 9, 2024
c6bc062
fix: remove extraneous usage of hash to field
sirasistant Jan 9, 2024
e9405f0
style: fmt
sirasistant Jan 9, 2024
4178e74
chore: update serialized bytecodes
sirasistant Jan 9, 2024
ad7e3b1
chore: update bbjs
sirasistant Jan 9, 2024
404ffbf
fix: intermediate proof artifacts returns proof without public inputs
sirasistant Jan 9, 2024
0886b1b
Try to fix recursion test and remove unused codegen
sirasistant Jan 9, 2024
812576b
Remove test-cargo workflow
sirasistant Jan 9, 2024
3c8f83e
chore: remove now unused bb abstraction leaks
sirasistant Jan 9, 2024
89bf498
chore: fix builds of `noir_js_backend_barretenberg`
TomAFrench Jan 9, 2024
9affee6
Revert "chore: remove now unused bb abstraction leaks"
TomAFrench Jan 9, 2024
1725e70
chore: clippy fix
TomAFrench Jan 9, 2024
394154e
Revert "chore: fix builds of `noir_js_backend_barretenberg`"
TomAFrench Jan 9, 2024
39d4bfa
fix: avoid decoding public inputs
sirasistant Jan 9, 2024
04f2bf4
Merge branch 'aztec-packages' of github.com:noir-lang/noir into aztec…
sirasistant Jan 9, 2024
5b64df3
Revert "fix: avoid decoding public inputs"
sirasistant Jan 9, 2024
9ec2e07
fix: possible workaround for the hidden public inputs issue
sirasistant Jan 9, 2024
ee2e6c0
test: fix test
sirasistant Jan 9, 2024
742e940
test: fix noir_js_backend_bb test
sirasistant Jan 9, 2024
61c2b9b
fix: output public inputs vector + function to recover a witness map
sirasistant Jan 9, 2024
114aa6f
chore: fix formatting
sirasistant Jan 9, 2024
ee802c9
Merge branch 'master' into aztec-packages
TomAFrench Jan 9, 2024
3f6a24d
Merge branch 'master' into aztec-packages
TomAFrench Jan 11, 2024
f4bbe21
Merge branch 'master' into aztec-packages
TomAFrench Jan 11, 2024
75c8334
Merge branch 'master' into aztec-packages
TomAFrench Jan 11, 2024
3416229
Merge branch 'master' into aztec-packages
TomAFrench Jan 11, 2024
5646354
chore: git subrepo commit (merge) noir (#3955)
ludamad Jan 11, 2024
7c357e4
feat!: implement keccakf1600 in brillig (#3914)
TomAFrench Jan 11, 2024
b5a1eb5
chore!: define key type in maps (#3841)
Thunkar Jan 12, 2024
5162b33
chore: fix rust tests (#3963)
TomAFrench Jan 12, 2024
55aa96f
chore: fix formatter tests
TomAFrench Jan 12, 2024
d7c4c66
Merge branch 'master' into aztec-packages
sirasistant Jan 12, 2024
563c704
feat: Update noir (#3979)
sirasistant Jan 12, 2024
787ccdc
Merge branch 'master' into aztec-packages
TomAFrench Jan 13, 2024
e7da1ab
Merge branch 'master' into aztec-packages
TomAFrench Jan 15, 2024
7f22446
Merge branch 'master' into aztec-packages
TomAFrench Jan 15, 2024
0f38b22
Merge branch 'master' into aztec-packages
TomAFrench Jan 15, 2024
2d92108
chore: sync noir (#4025)
TomAFrench Jan 15, 2024
001b8e0
chore: replace `AztecU128` with `U128` (#3951)
TomAFrench Jan 15, 2024
5e51255
fix: dont spam logs with yarn install (#4027)
ludamad Jan 15, 2024
45165d1
fix: Start witness of ACIR generated by Noir start at zero not one (#…
vezenovm Jan 16, 2024
4980553
chore: bump `bb` version to 0.18.0
TomAFrench Jan 16, 2024
4300ce2
chore: cargo fmt
TomAFrench Jan 16, 2024
9995d2b
Merge branch 'master' into aztec-packages
TomAFrench Jan 16, 2024
a4b6635
chore: sync from noir repo (#4047)
TomAFrench Jan 16, 2024
0c185c2
Merge branch 'master' into aztec-packages
sirasistant Jan 17, 2024
e6d3e73
chore: bump version
TomAFrench Jan 17, 2024
3541dd0
chore: bump bb.js
TomAFrench Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: update to latest noir and update noir compiler (#3696)
This PR updates aztec-packages to use latest noir.

- Regarding noir_wasm, providing the solved sources directly to
`node_wasm` eliminates the need for `source-resolver`, which has been
completely removed from the repository.
 - Added required pub in return values
 - Updated return_type
 - Pulled latest noir
Thunkar authored and AztecBot committed Dec 19, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit f06ab9cf5e3580385bf5945276b57460a56aafbd
2 changes: 1 addition & 1 deletion .github/actions/docs/build-status/script.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s#refs/[^/]*/##")
DEPLOY_STATUS=$(curl -X GET "https://api.netlify.com/api/v1/sites/$SITE_ID/deploys?branch=$BRANCH_NAME" | jq -r '.[] | select(.created_at != null) | .state' | head -1)
51 changes: 51 additions & 0 deletions .github/workflows/test-cargo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test cargo

on:
pull_request:
merge_group:
push:
branches:
- master

# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: Test cargo
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "date=$(date +'%Y.%m.%d.%H.%M')" >> $GITHUB_STATE
- name: prepare docker images tags
id: prep
run: |
REGISTRY="ghcr.io"
IMG="${REGISTRY}/${{ github.repository }}"
IMAGE=$(echo "$IMG" | tr '[:upper:]' '[:lower:]')
TAGS="${IMAGE}:${{ github.sha }}"
TAGS="${TAGS},${IMAGE}:latest,${IMAGE}:v${{ steps.date.outputs.date }}"
echo ::set-output name=tags::${TAGS}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test cargo
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ci
tags: ${{ steps.prep.outputs.tags }}
target: test-cargo
cache-from: type=gha
cache-to: type=gha,mode=max
35 changes: 22 additions & 13 deletions Cargo.lock

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

17 changes: 7 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
FROM rust:alpine3.17
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
build-base \
bash
FROM rust:bookworm
WORKDIR /usr/src/noir
COPY . .
RUN ./scripts/bootstrap_native.sh

# When running the container, mount the current working directory to /project.
FROM alpine:3.17
# When running the container, mount the users home directory to same location.
FROM ubuntu:lunar
# Install Tini as nargo doesn't handle signals properly.
# Install git as nargo needs it to clone.
RUN apt-get update && apt-get install -y git tini && rm -rf /var/lib/apt/lists/* && apt-get clean
COPY --from=0 /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo
WORKDIR /project
ENTRYPOINT ["/usr/src/noir/target/release/nargo"]
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/src/noir/target/release/nargo"]
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

cd $(dirname "$0")
2 changes: 1 addition & 1 deletion compiler/integration-tests/scripts/codegen-verifiers.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

self_path=$(dirname "$(readlink -f "$0")")

8 changes: 6 additions & 2 deletions scripts/bootstrap_native.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

cd $(dirname "$0")/..
@@ -13,4 +13,8 @@ else
fi

# Build native.
cargo build --release
if [ -n "${DEBUG:-}" ]; then
cargo build
else
cargo build --release
fi
2 changes: 1 addition & 1 deletion scripts/bootstrap_packages.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

cd $(dirname "$0")/..
2 changes: 1 addition & 1 deletion scripts/install_wasm-bindgen.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

cd $(dirname "$0")/..
2 changes: 1 addition & 1 deletion test_programs/gates_report.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

# These tests are incompatible with gas reporting
4 changes: 2 additions & 2 deletions test_programs/rebuild.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

process_dir() {
@@ -14,7 +14,7 @@ process_dir() {
if [ -d ./target/ ]; then
rm -r ./target/
fi
cargo run compile --only-acir && cargo run execute witness
nargo compile --only-acir && nargo execute witness

if [ -d "$current_dir/acir_artifacts/$dir_name/target" ]; then
rm -r "$current_dir/acir_artifacts/$dir_name/target"
5 changes: 3 additions & 2 deletions tooling/nargo_cli/src/cli/lsp_cmd.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_lsp::{
client_monitor::ClientProcessMonitorLayer, concurrency::ConcurrencyLayer,
concurrency::ConcurrencyLayer,
panic::CatchUnwindLayer, server::LifecycleLayer, tracing::TracingLayer,
};
use clap::Args;
@@ -39,10 +39,11 @@ pub(crate) fn run(
.layer(LifecycleLayer::default())
.layer(CatchUnwindLayer::default())
.layer(ConcurrencyLayer::default())
.layer(ClientProcessMonitorLayer::new(client))
.service(router)
});

eprintln!("LSP starting...");

// Prefer truly asynchronous piped stdin/stdout without blocking tasks.
#[cfg(unix)]
let (stdin, stdout) = (

Unchanged files with check annotations Beta

// Check if the negative version is smaller to represent
//
let minus_number = BigUint::from_bytes_be(&(self.neg()).to_be_bytes());
let (smaller_repr, is_negative) =

Check warning on line 22 in acvm-repo/acir_field/src/generic_ark.rs

GitHub Actions / Spellcheck / Spellcheck

Unknown word (repr)
if minus_number.to_string().len() < number.to_string().len() {
(minus_number, true)
} else {
}
// Number of bits needed to represent the smaller representation
let num_bits = smaller_repr.bits();

Check warning on line 33 in acvm-repo/acir_field/src/generic_ark.rs

GitHub Actions / Spellcheck / Spellcheck

Unknown word (repr)
// Check if the number represents a power of 2
if smaller_repr.count_ones() == 1 {

Check warning on line 36 in acvm-repo/acir_field/src/generic_ark.rs

GitHub Actions / Spellcheck / Spellcheck

Unknown word (repr)
let mut bit_index = 0;
for i in 0..num_bits {
if smaller_repr.bit(i) {

Check warning on line 39 in acvm-repo/acir_field/src/generic_ark.rs

GitHub Actions / Spellcheck / Spellcheck

Unknown word (repr)
bit_index = i;
break;
}
let mul_sign = "×";
for power in [64, 32, 16, 8, 4] {
let power_of_two = BigUint::from(2_u128).pow(power);
if &smaller_repr % &power_of_two == BigUint::zero() {

Check warning on line 62 in acvm-repo/acir_field/src/generic_ark.rs

GitHub Actions / Spellcheck / Spellcheck

Unknown word (repr)
return write!(
f,
"2{}{}{}",
## Introduction
The purpose of ACIR is to make the link between a generic proving system, such as Aztec's Barretenberg, and a frontend, such as Noir, which describes user-specific computations.
More precisely, Noir is a programming language for zero-knowledge proofs (ZKP) which allows users to write programs in an intuitive way using a high-level language close to Rust syntax. Noir is able to generate a proof of execution of a Noir program, using an external proving system. However, proving systems uses specific low-level constrain-based languages. Similarly, frontends have their own internal representation in order to represent user programs.

Check warning on line 9 in acvm-repo/acir/acir_docs.md

GitHub Actions / Spellcheck / Spellcheck

Unknown word (frontends)
The goal of ACIR is to provide a generic open-source intermediate representation close to proving system 'languages', but agnostic to a specific proving system, that can be used both by proving system as well as a target for frontends. So, at the end of the day, an ACIR program is just another representation of a program, dedicated to proving systems.

Check warning on line 11 in acvm-repo/acir/acir_docs.md

GitHub Actions / Spellcheck / Spellcheck

Unknown word (frontends)
## Abstract Circuit Intermediate Representation
ACIR stands for abstract circuit intermediate representation:
In summary, the workflow is the following:
1. user program -> (compilation) ACIR, a list of opcodes which constrain (partial) witnesses
2. user inputs + ACIR -> (execution/solving) assign values to all the (partial) witnesses
3. witness assignement + ACIR -> (proving system) proof

Check warning on line 35 in acvm-repo/acir/acir_docs.md

GitHub Actions / Spellcheck / Spellcheck

Unknown word (assignement)
Although the ordering of opcode does not matter in theory, since a system of equations is not dependent on its ordering, in practice it matters a lot for the solving (i.e the performance of the execution). ACIR opcodes **must be ordered** so that each opcode can be resolved one after the other.
*Remark*: The value of a partial witness is unique and fixed throughout a program execution, although in some rare cases, multiple values are possible for a same execution and witness (when there are several valid solutions to the constraints). Having multiple possible values for a witness may indicate that the circuit is not safe.
*Remark*: Why do we use the term partial witnesses? It is because the proving system may create other constraints and witnesses (especially with BlackBoxFuncCall, see below). A proof refers to a full witness assignements and their constraints. ACIR opcodes and their partial witnesses are still an intermediate representation before getting the full list of constraints and witnesses. For the sake of simplicity, we will refer to witness instead of partial witness from now on.

Check warning on line 46 in acvm-repo/acir/acir_docs.md

GitHub Actions / Spellcheck / Spellcheck

Unknown word (assignements)
## ACIR Reference
Finally, some opcodes will have a predicate, whose value is 0 or 1. Its purpose is to nullify the opcode when the value is 0, so that it has no effect. Note that removing the opcode is not a solution because this modifies the circuit (the circuit being mainly the list of the opcodes).
*Remark*: Opcodes operate on witnesses, but we will see that some opcode work on Arithmetic expressions of witnesses. We call an arithmetic expression a linear combination of witnesses and/or products of two witnesses (and also a constant term). A single witness is a (simple) arithmetic expression, and conversly, an arithmetic expression can be turned into a single witness using an arithmetic opcode (see below). So basically, using witnesses or arithmetic expressions is equivalent, but the latter can avoid the creation of witness in some cases.

Check warning on line 58 in acvm-repo/acir/acir_docs.md

GitHub Actions / Spellcheck / Spellcheck

Unknown word (conversly)
### Arithmetic opcode
An arithmetic opcode adds the constraint that P(w) = 0, where w=(w_1,..w_n) is a tuple of n witnesses, and P is a multi-variate polynomial of total degree at most 2.