Skip to content

Commit a7f8d96

Browse files
AztecBotTomAFrenchaakoshhvezenovm
authored
feat: Sync from noir (#11294)
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: let `add_definition_location` take a Location (noir-lang/noir#7185) fix(LSP): correct signature for assert and assert_eq (noir-lang/noir#7184) chore(experimental): Prevent enum panics by returning Options where possible instead of panicking (noir-lang/noir#7180) feat(experimental): Construct enum variants in expressions (noir-lang/noir#7174) feat: add `noir-inspector` (noir-lang/noir#7136) fix: ensure canonical bits decomposition (noir-lang/noir#7168) fix: Keep `inc_rc` for array inputs during preprocessing (noir-lang/noir#7163) fix(docs): Update broken links to EC lib (noir-lang/noir#7141) feat: inline simple functions (noir-lang/noir#7160) feat(ssa): Expand feature set of the Brillig constraint check (noir-lang/noir#7060) fix(ssa): Resolve value before fetching from DFG in a couple cases (noir-lang/noir#7169) fix: `Function::is_no_predicates` always returned false for brillig f… (noir-lang/noir#7167) chore(refactor): Remove globals field on Ssa object and use only the shared globals graph (noir-lang/noir#7156) chore: let `Function::inlined` take a `should_inline_call` function (noir-lang/noir#7149) chore: add compile-time assertions on generic arguments of stdlib functions (noir-lang/noir#6981) fix: LSP hover over function with `&mut self` (noir-lang/noir#7155) feat(brillig): Set global memory size at program compile time (noir-lang/noir#7151) feat: LSP autocomplete module declaration (noir-lang/noir#7154) feat(ssa): Reuse constants from the globals graph when making constants in a function DFG (noir-lang/noir#7153) feat: LSP chain inlay hints (noir-lang/noir#7152) chore: turn on overflow checks in CI rust tests (noir-lang/noir#7145) fix(ssa): Use post order when mapping instructions in loop invariant pass (noir-lang/noir#7140) fix: preserve types when reading from calldata arrays (noir-lang/noir#7144) feat: Resolve enums & prepare type system (noir-lang/noir#7115) feat: `loop` must have at least one `break` (noir-lang/noir#7126) feat: parse globals in SSA parser (noir-lang/noir#7112) fix: allow calling trait impl method from struct if multiple impls exist (noir-lang/noir#7124) fix: avoid creating unnecessary memory blocks (noir-lang/noir#7114) chore: relax threshold for reporting regressions (noir-lang/noir#7130) fix: proper cleanup when breaking from comptime loop on error (noir-lang/noir#7125) fix: Prevent overlapping associated types impls (noir-lang/noir#7047) feat: unconstrained optimizations for BoundedVec (noir-lang/noir#7119) chore: mark libs good (noir-lang/noir#7123) chore: remove comments for time/memory benchmarks (noir-lang/noir#7121) fix: don't always use an exclusive lock in `nargo check` (noir-lang/noir#7120) feat(ssa): Pass to preprocess functions (noir-lang/noir#7072) chore: Formatting issues / minor errors in the docs (noir-lang/noir#7105) fix: defunctionalize pass on the caller runtime to apply (noir-lang/noir#7100) feat: Parser and formatter support for `enum`s (noir-lang/noir#7110) feat(brillig): SSA globals code gen (noir-lang/noir#7021) feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096) chore: Add benchmarking dashboard (noir-lang/noir#7068) feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088) feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106) chore: Cookbook Onboard integration (noir-lang/noir#7044) chore: lock to ubuntu 22.04 (noir-lang/noir#7098) fix: Remove unused brillig functions (noir-lang/noir#7102) chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095) END_COMMIT_OVERRIDE --------- Co-authored-by: Tom French <tom@tomfren.ch> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: aakoshh <akosh@aztecprotocol.com> Co-authored-by: Akosh Farkash <aakoshh@gmail.com> Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
1 parent 76f25b6 commit a7f8d96

File tree

174 files changed

+6996
-1888
lines changed

Some content is hidden

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

174 files changed

+6996
-1888
lines changed

.noir-sync-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c172880ae47ec4906cda662801bd4b7866c9586b
1+
c44b62615f1c8ee657eedd82f2b80e2ec76c9078

barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ void AvmTraceBuilder::pay_fee()
344344
FF current_balance = read_hint.leaf_preimage.value;
345345

346346
const auto updated_balance = current_balance - tx_fee;
347-
if (current_balance < tx_fee) {
347+
// Comparison on Field gives inverted results, so we cast to uint128, which should be enough for fees.
348+
if (static_cast<uint128_t>(current_balance) < static_cast<uint128_t>(tx_fee)) {
348349
info("Not enough balance for fee payer to pay for transaction (got ", current_balance, " needs ", tx_fee);
349350
throw std::runtime_error("Not enough balance for fee payer to pay for transaction");
350351
}

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

+117-97
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ jobs:
315315

316316
external_repo_compilation_and_execution_report:
317317
needs: [build-nargo]
318-
runs-on: ubuntu-latest
318+
runs-on: ubuntu-22.04
319319
timeout-minutes: 15
320320
strategy:
321321
fail-fast: false
@@ -421,53 +421,9 @@ jobs:
421421
retention-days: 3
422422
overwrite: true
423423

424-
upload_compilation_report:
425-
name: Upload compilation report
426-
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
427-
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
428-
if: always()
429-
runs-on: ubuntu-latest
430-
permissions:
431-
pull-requests: write
432-
433-
steps:
434-
- uses: actions/checkout@v4
435-
436-
- name: Download initial compilation report
437-
uses: actions/download-artifact@v4
438-
with:
439-
name: in_progress_compilation_report
440-
441-
- name: Download matrix compilation reports
442-
uses: actions/download-artifact@v4
443-
with:
444-
pattern: compilation_report_*
445-
path: ./reports
446-
447-
- name: Merge compilation reports using jq
448-
run: |
449-
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
450-
./merge-bench-reports.sh compilation_report
451-
452-
- name: Parse compilation report
453-
id: compilation_report
454-
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
455-
with:
456-
report: compilation_report.json
457-
header: |
458-
Compilation Report
459-
memory_report: false
460-
461-
- name: Add memory report to sticky comment
462-
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
463-
uses: marocchino/sticky-pull-request-comment@v2
464-
with:
465-
header: compilation
466-
message: ${{ steps.compilation_report.outputs.markdown }}
467-
468424
external_repo_memory_report:
469425
needs: [build-nargo]
470-
runs-on: ubuntu-latest
426+
runs-on: ubuntu-22.04
471427
timeout-minutes: 30
472428
strategy:
473429
fail-fast: false
@@ -508,6 +464,7 @@ jobs:
508464
path: scripts
509465
sparse-checkout: |
510466
test_programs/memory_report.sh
467+
test_programs/parse_memory.sh
511468
sparse-checkout-cone-mode: false
512469

513470
- name: Checkout
@@ -521,6 +478,7 @@ jobs:
521478
working-directory: ./test-repo/${{ matrix.project.path }}
522479
run: |
523480
mv /home/runner/work/noir/noir/scripts/test_programs/memory_report.sh ./memory_report.sh
481+
mv /home/runner/work/noir/noir/scripts/test_programs/parse_memory.sh ./parse_memory.sh
524482
./memory_report.sh 1
525483
# Rename the memory report as the execution report is about to write to the same file
526484
cp memory_report.json compilation_memory_report.json
@@ -568,14 +526,67 @@ jobs:
568526
retention-days: 3
569527
overwrite: true
570528

529+
upload_compilation_report:
530+
name: Upload compilation report
531+
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
532+
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
533+
if: always()
534+
runs-on: ubuntu-22.04
535+
permissions:
536+
pull-requests: write
537+
# deployments permission to deploy GitHub pages website
538+
deployments: write
539+
# contents permission to update benchmark contents in gh-pages branch
540+
contents: write
541+
542+
steps:
543+
- uses: actions/checkout@v4
544+
545+
- name: Download initial compilation report
546+
uses: actions/download-artifact@v4
547+
with:
548+
name: in_progress_compilation_report
549+
550+
- name: Download matrix compilation reports
551+
uses: actions/download-artifact@v4
552+
with:
553+
pattern: compilation_report_*
554+
path: ./reports
555+
556+
- name: Merge compilation reports using jq
557+
run: |
558+
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
559+
./merge-bench-reports.sh compilation_report
560+
jq ".compilation_reports | map({name: .artifact_name, value: (.time[:-1] | tonumber), unit: \"s\"}) " ./compilation_report.json > time_bench.json
561+
562+
- name: Store benchmark result
563+
continue-on-error: true
564+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
565+
with:
566+
name: "Compilation Time"
567+
tool: "customSmallerIsBetter"
568+
output-file-path: ./time_bench.json
569+
github-token: ${{ secrets.GITHUB_TOKEN }}
570+
# We want this to only run on master to avoid garbage data from PRs being added.
571+
auto-push: ${{ github.ref == 'refs/heads/master' }}
572+
alert-threshold: "120%"
573+
comment-on-alert: true
574+
fail-on-alert: false
575+
alert-comment-cc-users: "@TomAFrench"
576+
max-items-in-chart: 50
577+
571578
upload_compilation_memory_report:
572579
name: Upload compilation memory report
573580
needs: [generate_memory_report, external_repo_memory_report]
574581
# We want this job to run even if one variation of the matrix in `external_repo_memory_report` fails
575582
if: always()
576-
runs-on: ubuntu-latest
583+
runs-on: ubuntu-22.04
577584
permissions:
578585
pull-requests: write
586+
# deployments permission to deploy GitHub pages website
587+
deployments: write
588+
# contents permission to update benchmark contents in gh-pages branch
589+
contents: write
579590

580591
steps:
581592
- uses: actions/checkout@v4
@@ -595,33 +606,36 @@ jobs:
595606
run: |
596607
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
597608
./merge-bench-reports.sh memory_report
598-
# Rename the memory report as to not clash with the compilation memory report file name
599-
cp memory_report.json execution_memory_report.json
600-
601-
- name: Parse compilation memory report
602-
id: compilation_mem_report
603-
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
604-
with:
605-
report: execution_memory_report.json
606-
header: |
607-
Compilation Memory Report
608-
memory_report: true
609-
610-
- name: Add execution memory report to sticky comment
611-
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
612-
uses: marocchino/sticky-pull-request-comment@v2
613-
with:
614-
header: compilation_memory
615-
message: ${{ steps.compilation_mem_report.outputs.markdown }}
609+
jq ".memory_reports | map({name: .artifact_name, value: (.peak_memory | tonumber), unit: \"MB\"}) " ./memory_report.json > memory_bench.json
610+
611+
- name: Store benchmark result
612+
continue-on-error: true
613+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
614+
with:
615+
name: "Compilation Memory"
616+
tool: "customSmallerIsBetter"
617+
output-file-path: ./memory_bench.json
618+
github-token: ${{ secrets.GITHUB_TOKEN }}
619+
# We want this to only run on master to avoid garbage data from PRs being added.
620+
auto-push: ${{ github.ref == 'refs/heads/master' }}
621+
alert-threshold: "120%"
622+
comment-on-alert: true
623+
fail-on-alert: false
624+
alert-comment-cc-users: "@TomAFrench"
625+
max-items-in-chart: 50
616626

617627
upload_execution_memory_report:
618628
name: Upload execution memory report
619629
needs: [generate_memory_report, external_repo_memory_report]
620630
# We want this job to run even if one variation of the matrix in `external_repo_memory_report` fails
621631
if: always()
622-
runs-on: ubuntu-latest
632+
runs-on: ubuntu-22.04
623633
permissions:
624634
pull-requests: write
635+
# deployments permission to deploy GitHub pages website
636+
deployments: write
637+
# contents permission to update benchmark contents in gh-pages branch
638+
contents: write
625639

626640
steps:
627641
- uses: actions/checkout@v4
@@ -643,31 +657,37 @@ jobs:
643657
./merge-bench-reports.sh memory_report
644658
# Rename the memory report as to not clash with the compilation memory report file name
645659
cp memory_report.json execution_memory_report.json
660+
jq ".memory_reports | map({name: .artifact_name, value: (.peak_memory | tonumber), unit: \"MB\"}) " ./execution_memory_report.json > memory_bench.json
646661
647-
- name: Parse execution memory report
648-
id: execution_mem_report
649-
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
662+
- name: Store benchmark result
663+
continue-on-error: true
664+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
650665
with:
651-
report: execution_memory_report.json
652-
header: |
653-
Execution Memory Report
654-
memory_report: true
666+
name: "Execution Memory"
667+
tool: "customSmallerIsBetter"
668+
output-file-path: ./memory_bench.json
669+
github-token: ${{ secrets.GITHUB_TOKEN }}
670+
# We want this to only run on master to avoid garbage data from PRs being added.
671+
auto-push: ${{ github.ref == 'refs/heads/master' }}
672+
alert-threshold: "120%"
673+
comment-on-alert: true
674+
fail-on-alert: false
675+
alert-comment-cc-users: "@TomAFrench"
676+
max-items-in-chart: 50
655677

656-
- name: Add execution memory report to sticky comment
657-
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
658-
uses: marocchino/sticky-pull-request-comment@v2
659-
with:
660-
header: execution_memory
661-
message: ${{ steps.execution_mem_report.outputs.markdown }}
662678

663679
upload_execution_report:
664680
name: Upload execution report
665681
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
666682
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
667683
if: always()
668-
runs-on: ubuntu-latest
684+
runs-on: ubuntu-22.04
669685
permissions:
670686
pull-requests: write
687+
# deployments permission to deploy GitHub pages website
688+
deployments: write
689+
# contents permission to update benchmark contents in gh-pages branch
690+
contents: write
671691

672692
steps:
673693
- uses: actions/checkout@v4
@@ -687,20 +707,20 @@ jobs:
687707
run: |
688708
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
689709
./merge-bench-reports.sh execution_report
690-
691-
- name: Parse execution report
692-
id: execution_report
693-
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
694-
with:
695-
report: execution_report.json
696-
header: |
697-
Execution Report
698-
execution_report: true
699-
700-
- name: Add memory report to sticky comment
701-
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
702-
uses: marocchino/sticky-pull-request-comment@v2
703-
with:
704-
header: execution_time
705-
message: ${{ steps.execution_report.outputs.markdown }}
706-
710+
jq ".execution_reports | map({name: .artifact_name, value: (.time[:-1] | tonumber), unit: \"s\"}) " ./execution_report.json > time_bench.json
711+
712+
- name: Store benchmark result
713+
continue-on-error: true
714+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
715+
with:
716+
name: "Execution Time"
717+
tool: "customSmallerIsBetter"
718+
output-file-path: ./time_bench.json
719+
github-token: ${{ secrets.GITHUB_TOKEN }}
720+
# We want this to only run on master to avoid garbage data from PRs being added.
721+
auto-push: ${{ github.ref == 'refs/heads/master' }}
722+
alert-threshold: "120%"
723+
comment-on-alert: true
724+
fail-on-alert: false
725+
alert-comment-cc-users: "@TomAFrench"
726+
max-items-in-chart: 50

noir/noir-repo/.github/workflows/test-rust-workspace-msrv.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
tool: nextest@0.9.67
5353

5454
- name: Build and archive tests
55-
run: cargo nextest archive --workspace --release --archive-file nextest-archive.tar.zst
55+
run: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst
5656

5757
- name: Upload archive to workflow
5858
uses: actions/upload-artifact@v4

noir/noir-repo/.github/workflows/test-rust-workspace.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- uses: Swatinem/rust-cache@v2
3131
with:
32-
key: x86_64-unknown-linux-gnu
32+
key: x86_64-unknown-linux-gnu-debug
3333
cache-on-failure: true
3434
save-if: ${{ github.event_name != 'merge_group' }}
3535

@@ -39,7 +39,7 @@ jobs:
3939
tool: nextest@0.9.67
4040

4141
- name: Build and archive tests
42-
run: cargo nextest archive --workspace --release --archive-file nextest-archive.tar.zst
42+
run: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst
4343

4444
- name: Upload archive to workflow
4545
uses: actions/upload-artifact@v4

noir/noir-repo/Cargo.lock

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

noir/noir-repo/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ members = [
2424
"tooling/noirc_abi_wasm",
2525
"tooling/acvm_cli",
2626
"tooling/profiler",
27+
"tooling/inspector",
2728
# ACVM
2829
"acvm-repo/acir_field",
2930
"acvm-repo/acir",
@@ -40,6 +41,7 @@ default-members = [
4041
"tooling/nargo_cli",
4142
"tooling/acvm_cli",
4243
"tooling/profiler",
44+
"tooling/inspector",
4345
]
4446
resolver = "2"
4547

noir/noir-repo/compiler/noirc_driver/src/abi_gen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ pub(super) fn abi_type_from_hir_type(context: &Context, typ: &Type) -> AbiType {
110110
AbiType::String { length: size }
111111
}
112112

113-
Type::Struct(def, args) => {
113+
Type::DataType(def, args) => {
114114
let struct_type = def.borrow();
115-
let fields = struct_type.get_fields(args);
115+
let fields = struct_type.get_fields(args).unwrap_or_default();
116116
let fields =
117117
vecmap(fields, |(name, typ)| (name, abi_type_from_hir_type(context, &typ)));
118118
// For the ABI, we always want to resolve the struct paths from the root crate

0 commit comments

Comments
 (0)