Skip to content

Commit 8eb727c

Browse files
authored
feat: Sync from noir (#12524)
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix(LSP): references/rename only when underlying span has the correct… (noir-lang/noir#7598) feat: Sync from aztec-packages (noir-lang/noir#7606) feat: Compare bincode to CBOR, FlexBuffers and Protobuf - implement best (noir-lang/noir#7513) END_COMMIT_OVERRIDE
1 parent 5a12184 commit 8eb727c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3763
-246
lines changed

.noir-sync-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5a3d2bc0e13a12b039c793c73d7817924c13e159
1+
a6e5526851f717c88799926796e36d6b6225be90

noir/noir-repo/.github/workflows/publish-nargo.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ jobs:
5454
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
5555
cargo build --package noir_profiler --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
5656
cargo build --package noir_inspector --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5759

5860
- name: Package artifacts
5961
run: |
@@ -237,5 +239,3 @@ jobs:
237239
make_latest: false
238240
overwrite: true
239241
tag: ${{ format('{0}-{1}', 'nightly', steps.date.outputs.date) }}
240-
241-

noir/noir-repo/.github/workflows/reports.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242

4343
- name: Build Nargo
4444
run: cargo build --package nargo_cli --release
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4547

4648
- name: Package artifacts
4749
run: |
@@ -305,7 +307,7 @@ jobs:
305307
repository: ${{ matrix.repo }}
306308
path: test-repo
307309
ref: ${{ matrix.ref }}
308-
310+
309311
- name: Fetch noir dependencies
310312
working-directory: ./test-repo/${{ matrix.path }}
311313
run: |
@@ -341,7 +343,7 @@ jobs:
341343
path: ${{ steps.compilation_report.outputs.report_path }}
342344
retention-days: 3
343345
overwrite: true
344-
346+
345347
- name: Generate execution report
346348
id: execution_report
347349
working-directory: ./test-repo/${{ matrix.path }}
@@ -359,7 +361,7 @@ jobs:
359361
360362
echo "report_name=$REPORT_NAME" >> $GITHUB_OUTPUT
361363
echo "report_path=$REPORT_PATH" >> $GITHUB_OUTPUT
362-
364+
363365
- name: Upload execution report
364366
if: ${{ !matrix.cannot_execute }}
365367
uses: actions/upload-artifact@v4
@@ -716,7 +718,7 @@ jobs:
716718
- upload_compilation_memory_report
717719
- upload_execution_report
718720
- upload_execution_memory_report
719-
721+
720722
steps:
721723
- name: Report overall success
722724
run: |

noir/noir-repo/.github/workflows/test-js-packages.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
6464

6565
- name: Build Nargo
6666
run: cargo build --package nargo_cli --release
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6769

6870
- name: Package artifacts
6971
run: |
@@ -535,7 +537,7 @@ jobs:
535537
fail-fast: false
536538
matrix:
537539
include: ${{ fromJson( needs.critical-library-list.outputs.libraries )}}
538-
540+
539541
name: Check external repo - ${{ matrix.repo }}/${{ matrix.path }}
540542
steps:
541543
- name: Checkout

noir/noir-repo/Cargo.lock

+124
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

noir/noir-repo/Cargo.toml

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ members = [
3737
"acvm-repo/bn254_blackbox_solver",
3838
# Utility crates
3939
"utils/iter-extended",
40+
"utils/protobuf",
4041
]
4142
default-members = [
4243
"tooling/nargo_cli",
@@ -94,6 +95,7 @@ noirc_abi = { path = "tooling/noirc_abi" }
9495
noirc_artifacts = { path = "tooling/noirc_artifacts" }
9596
noirc_artifacts_info = { path = "tooling/noirc_artifacts_info" }
9697
noir_artifact_cli = { path = "tooling/artifact_cli" }
98+
noir_protobuf = { path = "utils/protobuf" }
9799

98100
# Arkworks
99101
ark-bn254 = { version = "^0.5.0", default-features = false, features = [
@@ -137,6 +139,11 @@ criterion = "0.5.0"
137139
# https://github.com/tikv/pprof-rs/pull/172
138140
pprof = { version = "0.14", features = ["flamegraph", "criterion"] }
139141

142+
# Protobuf
143+
prost = "0.13"
144+
prost-build = "0.13"
145+
protoc-prebuilt = "0.3"
146+
140147
cfg-if = "1.0.0"
141148
dirs = "4"
142149
serde = { version = "1.0.136", features = ["derive"] }

noir/noir-repo/acvm-repo/acir/Cargo.toml

+16
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,42 @@ workspace = true
1818
[dependencies]
1919
acir_field.workspace = true
2020
brillig.workspace = true
21+
noir_protobuf.workspace = true
22+
23+
color-eyre.workspace = true
2124
serde.workspace = true
2225
thiserror.workspace = true
2326
flate2.workspace = true
2427
bincode.workspace = true
2528
base64.workspace = true
29+
prost.workspace = true
2630
serde-big-array = "0.5.1"
2731
strum = { workspace = true }
2832
strum_macros = { workspace = true }
2933

34+
proptest = { workspace = true, optional = true }
35+
proptest-derive = { workspace = true, optional = true }
36+
37+
[build-dependencies]
38+
prost-build.workspace = true
39+
protoc-prebuilt.workspace = true
40+
3041
[dev-dependencies]
3142
serde_json = "1.0"
3243
serde-reflection = "0.3.6"
3344
serde-generate = "0.25.1"
3445
fxhash.workspace = true
3546
criterion.workspace = true
3647
pprof.workspace = true
48+
num-bigint.workspace = true
49+
50+
acir = { path = ".", features = ["arb"] } # Self to turn on `arb`.
3751

3852
[features]
53+
default = []
3954
bn254 = ["acir_field/bn254"]
4055
bls12_381 = ["acir_field/bls12_381"]
56+
arb = ["proptest", "proptest-derive", "brillig/arb"]
4157

4258
[[bench]]
4359
name = "serialization"
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use std::path::Path;
2+
3+
fn main() {
4+
let (protoc_bin, include_dir) =
5+
protoc_prebuilt::init("29.3").expect("failed to initialize protoc");
6+
7+
unsafe {
8+
std::env::set_var("PROTOC", protoc_bin);
9+
}
10+
11+
prost_build::compile_protos(
12+
&[
13+
// DTOs for a `Program`, which work with the types in `acir.cpp`
14+
"./src/proto/program.proto",
15+
// DTOs for the `WitnessStack`, which work with the types in `witness.cpp`
16+
"./src/proto/acir/witness.proto",
17+
// A pared down DTO for `Program`, so Barretenberg can ignore the Brillig part.
18+
// This is only included to make sure it compiles.
19+
"./src/proto/acir/program.proto",
20+
],
21+
&[Path::new("./src/proto"), include_dir.as_path()],
22+
)
23+
.expect("failed to compile .proto schemas");
24+
}

noir/noir-repo/acvm-repo/acir/src/circuit/brillig.rs

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
66
/// Inputs for the Brillig VM. These are the initial inputs
77
/// that the Brillig VM will use to start.
88
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
9+
#[cfg_attr(feature = "arb", derive(proptest_derive::Arbitrary))]
910
pub enum BrilligInputs<F> {
1011
Single(Expression<F>),
1112
Array(Vec<Expression<F>>),
@@ -15,6 +16,7 @@ pub enum BrilligInputs<F> {
1516
/// Outputs for the Brillig VM. Once the VM has completed
1617
/// execution, this will be the object that is returned.
1718
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
19+
#[cfg_attr(feature = "arb", derive(proptest_derive::Arbitrary))]
1820
pub enum BrilligOutputs {
1921
Simple(Witness),
2022
Array(Vec<Witness>),
@@ -24,6 +26,7 @@ pub enum BrilligOutputs {
2426
/// a full Brillig function to be executed by the Brillig VM.
2527
/// This is stored separately on a program and accessed through a [BrilligPointer].
2628
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Default, Debug, Hash)]
29+
#[cfg_attr(feature = "arb", derive(proptest_derive::Arbitrary))]
2730
pub struct BrilligBytecode<F> {
2831
pub bytecode: Vec<BrilligOpcode<F>>,
2932
}
@@ -32,6 +35,7 @@ pub struct BrilligBytecode<F> {
3235
#[derive(
3336
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Hash, Copy, Default, PartialOrd, Ord,
3437
)]
38+
#[cfg_attr(feature = "arb", derive(proptest_derive::Arbitrary))]
3539
#[serde(transparent)]
3640
pub struct BrilligFunctionId(pub u32);
3741

0 commit comments

Comments
 (0)