Skip to content

fix: do not mutate arrays later copied inside other arrays#8701

Merged
TomAFrench merged 4 commits intomasterfrom
gd/issue_8563
May 30, 2025
Merged

fix: do not mutate arrays later copied inside other arrays#8701
TomAFrench merged 4 commits intomasterfrom
gd/issue_8563

Conversation

@guipublic
Copy link
Contributor

Description

Problem*

Resolves #8563

Summary*

One array was mutated in place by the array_set optimisation, while it was copied into another array.
I added a check for arrays used inside make_array, treating it similarly to an array_get.

Additional Context

I still need to add a (small) unit test.

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@guipublic guipublic added the bench-show Display benchmark results on PR label May 28, 2025
Copy link
Member

@TomAFrench TomAFrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a regression test here as Guillaume is on holiday today.

@TomAFrench TomAFrench enabled auto-merge May 29, 2025 15:06
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACVM Benchmarks

Details
Benchmark suite Current: 5cb4c51 Previous: 04e3415 Ratio
purely_sequential_opcodes 259340 ns/iter (± 695) 255462 ns/iter (± 2259) 1.02
perfectly_parallel_opcodes 229682 ns/iter (± 3068) 223069 ns/iter (± 6808) 1.03
perfectly_parallel_batch_inversion_opcodes 3609703 ns/iter (± 29480) 3581902 ns/iter (± 15698) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilation Time

Details
Benchmark suite Current: 5cb4c51 Previous: 04e3415 Ratio
private-kernel-inner 2.248 s 2.454 s 0.92
private-kernel-reset 6.92 s 7.168 s 0.97
private-kernel-tail 1.056 s 1.058 s 1.00
rollup-base-private 16.84 s 16.66 s 1.01
rollup-base-public 13.74 s 15.08 s 0.91
rollup-block-root-empty 1.342 s 1.29 s 1.04
rollup-block-root-single-tx 124 s 130 s 0.95
rollup-block-root 134 s 123 s 1.09
rollup-merge 1.078 s 1.1 s 0.98
rollup-root 1.538 s 1.592 s 0.97
semaphore-depth-10 0.802 s 0.821 s 0.98

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact Size

Details
Benchmark suite Current: 5cb4c51 Previous: 04e3415 Ratio
private-kernel-inner 1133.3 KB 1133.3 KB 1
private-kernel-reset 2156.7 KB 2156.7 KB 1
private-kernel-tail 589 KB 589 KB 1
rollup-base-private 5129.7 KB 5129.7 KB 1
rollup-base-public 4071.2 KB 4071.2 KB 1
rollup-block-root-empty 257 KB 257 KB 1
rollup-block-root-single-tx 25708.1 KB 25708.1 KB 1
rollup-block-root 25715.1 KB 25715.1 KB 1
rollup-merge 183.7 KB 183.7 KB 1
rollup-root 418.6 KB 418.6 KB 1
semaphore-depth-10 636.3 KB 636.3 KB 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execution Time

Details
Benchmark suite Current: 5cb4c51 Previous: 04e3415 Ratio
private-kernel-inner 0.028 s 0.029 s 0.97
private-kernel-reset 0.167 s 0.166 s 1.01
private-kernel-tail 0.011 s 0.012 s 0.92
rollup-base-private 0.314 s 0.313 s 1.00
rollup-base-public 0.196 s 0.205 s 0.96
rollup-block-root 11 s 10.9 s 1.01
rollup-merge 0.004 s 0.004 s 1
rollup-root 0.009 s 0.009 s 1
semaphore-depth-10 0.019 s 0.02 s 0.95

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite Duration

Details
Benchmark suite Current: 5cb4c51 Previous: 04e3415 Ratio
test_report_AztecProtocol_aztec-packages_noir-projects_aztec-nr 66 s 66 s 1
test_report_AztecProtocol_aztec-packages_noir-projects_noir-contracts 95 s 93 s 1.02
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_blob 47 s 43 s 1.09
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_private-kernel-lib 197 s 203 s 0.97
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_rollup-lib 201 s 181 s 1.11
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_types 70 s 70 s 1
test_report_noir-lang_noir-bignum_ 375 s 377 s 0.99
test_report_noir-lang_noir_bigcurve_ 232 s 224 s 1.04
test_report_noir-lang_sha512_ 32 s 30 s 1.07
test_report_zkpassport_noir_rsa_ 2 s 2 s 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: e5dd9c6 Previous: af2e5c9 Ratio
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_blob 52 s 43 s 1.21

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilation Memory

Details
Benchmark suite Current: 5cb4c51 Previous: 04e3415 Ratio
private-kernel-inner 292.42 MB 292.46 MB 1.00
private-kernel-reset 533.03 MB 533.03 MB 1
private-kernel-tail 192.3 MB 192.3 MB 1
rollup-base-private 1390 MB 1390 MB 1
rollup-base-public 1550 MB 1550 MB 1
rollup-block-root-empty 353.4 MB 353.39 MB 1.00
rollup-block-root-single-tx 7160 MB 7160 MB 1
rollup-block-root 7170 MB 7170 MB 1
rollup-merge 337.61 MB 337.61 MB 1
rollup-root 391.93 MB 391.95 MB 1.00
semaphore_depth_10 106.4 MB 106.4 MB 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execution Memory

Details
Benchmark suite Current: 5cb4c51 Previous: 04e3415 Ratio
private-kernel-inner 201.52 MB 201.52 MB 1
private-kernel-reset 225.36 MB 225.36 MB 1
private-kernel-tail 176.66 MB 176.66 MB 1
rollup-base-private 501.76 MB 501.76 MB 1
rollup-base-public 498.08 MB 498.08 MB 1
rollup-block-root 1410 MB 1410 MB 1
rollup-merge 322.46 MB 322.46 MB 1
rollup-root 328.15 MB 328.15 MB 1
semaphore_depth_10 70.97 MB 70.97 MB 1

This comment was automatically generated by workflow using github-action-benchmark.

@TomAFrench TomAFrench added this pull request to the merge queue May 30, 2025
Merged via the queue into master with commit 33e0c08 May 30, 2025
118 checks passed
@TomAFrench TomAFrench deleted the gd/issue_8563 branch May 30, 2025 09:28
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jun 1, 2025
Automated pull of nightly from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix(fmt): correctly format mixed secondary attributes and doc comments
(noir-lang/noir#8735)
fix!: require types for trait impl associated constants
(noir-lang/noir#8734)
fix!: Prevent returning references from if expressions
(noir-lang/noir#8731)
fix: cast signed to u1 follow-up
(noir-lang/noir#8730)
fix: cast signed to u1 (noir-lang/noir#8720)
fix: do not mutate arrays later copied inside other arrays
(noir-lang/noir#8701)
chore: box `AsTraitPath` and `TypePath` in `ExpressionKind`
(noir-lang/noir#8716)
fix: general solution for accessing associated constants
(noir-lang/noir#8417)
fix(ssa): Validate checked signed add/sub is followed by a truncate
(noir-lang/noir#8706)
chore: add pre- and post-check on `array_set` optimization pass
(noir-lang/noir#8714)
fix: merge expr bindings with instantiations bindings during
monomorphization (noir-lang/noir#8713)
fix: better way to do LSP file overrides
(noir-lang/noir#8702)
fix(fmt): correct indentation when formatting long struct patterns
(noir-lang/noir#8711)
fix(fuzz): Prevent breaking/continuing out from let blocks in the AST
fuzzer (noir-lang/noir#8708)
chore: remove override for zero length inputs
(noir-lang/noir#8709)
feat: Replace converging jmpif with empty block destinations with a
single jmp (noir-lang/noir#8613)
feat(cli): Add `nargo interpret` command
(noir-lang/noir#8700)
chore: more 1-tuple printing fixes
(noir-lang/noir#8699)
chore(fuzz): Fuzz the SSA parser
(noir-lang/noir#8647)
fix: (SSA parser) translate blocks in logical order rather than syntax
order (noir-lang/noir#8668)
fix(SSA): show and parse range_check's assert_message
(noir-lang/noir#8652)
chore: Show the step number in the SSA message
(noir-lang/noir#8698)
chore(docs): Add pointers to tests
(noir-lang/noir#8695)
chore(fuzz): Capture comptime print output
(noir-lang/noir#8635)
fix: nargo expand reexports correctly implemented
(noir-lang/noir#8693)
feat(cli): Show multiple SSA passes
(noir-lang/noir#8692)
chore(test): Add regression test for defunctionalize
(noir-lang/noir#8691)
chore: add an assertion when parsing SSA that all functions are
well-formed (noir-lang/noir#8671)
feat!: prevent compiling blake3 hashes which barretenberg cannot prove
(noir-lang/noir#8690)
fix(ssa): Remove the array cache from the function inserter
(noir-lang/noir#8607)
chore: bump external pinned commits
(noir-lang/noir#8684)
chore: reenable fuzzing tests in CI
(noir-lang/noir#8688)
fix: Handle `&mut function` in defunctionalize
(noir-lang/noir#8665)
fix(defunctionalize): Higher order functions (HOF) dynamic dispatch and
HOFs in arrays (noir-lang/noir#8672)
chore(ci): avoid running fuzzer tests in the merge queue
(noir-lang/noir#8664)
fix: Make casts in `comptime` consistent with runtime casts
(noir-lang/noir#8669)
fix: relax connectedness requirement on purity analysis pass
(noir-lang/noir#8667)
fix: always use `u32` for indexing arrays in SSA
(noir-lang/noir#8633)
chore: explicitly pull from `next` branch in aztec-packages
(noir-lang/noir#8660)
chore(fuzz): Build the dictionary from the SSA
(noir-lang/noir#8591)
chore(docs): Remove old versioned docs
(noir-lang/noir#8061)
chore: bump external pinned commits
(noir-lang/noir#8634)
fix(SSA): don't use string literal if byte is "form feed" ('\f')
(noir-lang/noir#8653)
chore(defunctionalize): Add regression test for missing lambda variants
panic (noir-lang/noir#8642)
chore(ci): Do not run ast_fuzzer orig vs. morph in ci
(noir-lang/noir#8646)
fix: disable underflow fix for fields
(noir-lang/noir#8631)
fix: revert "fix: error on unused generic in trait impl
(noir-lang/noir#8395)"
(noir-lang/noir#8636)
fix(ssa interpreter): Default to zero when we have an overflowing shl
(noir-lang/noir#8638)
fix: ensure that purity analysis pass explores all functions
(noir-lang/noir#8452)
feat: acir_formal_proofs (noir-lang/noir#8140)
fix: error on unused generic in trait impl
(noir-lang/noir#8395)
fix(expand): use re-exports for non-visibile items
(noir-lang/noir#8374)
END_COMMIT_OVERRIDE

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bench-show Display benchmark results on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

println statement changes execution result of program

3 participants