fix(acir-gen): Use the side effect variable in slice_pop_back#10455
Merged
fix(acir-gen): Use the side effect variable in slice_pop_back#10455
slice_pop_back#10455Conversation
Contributor
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Contributor
There was a problem hiding this comment.
⚠️ 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: 5bb3ce6 | Previous: e422898 | Ratio |
|---|---|---|---|
test_report_zkpassport_noir-ecdsa_ |
2 s |
1 s |
2 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Nov 11, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix(brillig_gen): Switch to iterative variable liveness (noir-lang/noir#10460) feat: remove unnecessary mutation of blackbox functions during flattening (noir-lang/noir#10182) chore: revert "fix: revert "feat(ACIR): reuse element_type_sizes blocks with… (noir-lang/noir#10461) chore: green light for acir (native_types) audit (noir-lang/noir#10381) chore: lock Cargo.lock in cargo-binstall (noir-lang/noir#10459) fix(acir-gen): Use the side effect variable in `slice_pop_back` (noir-lang/noir#10455) fix: correct location for out of bounds match case integer (noir-lang/noir#10454) fix: Defunctionalize foreign functions in pre-SSA pass over mAST (noir-lang/noir#10160) fix: use unit for fmtstr without variables (noir-lang/noir#10456) chore(docs): Update tinyjs app tutorial for versioned docs (noir-lang/noir#10453) fix(frontend): Resolve to correct type on fmtstr interpolation error (noir-lang/noir#10450) fix: avoid producing duplicate private error messages (noir-lang/noir#10449) chore(docs): update dependencies and installation instructions in NoirJS tutorial and examples (noir-lang/noir#10400) fix(compiler): Improve error message for impl on primitive types (noir-lang/noir#10430) (noir-lang/noir#10442) chore: get trait as non-mut (noir-lang/noir#10447) chore(frontend): Tuple dereference chain unit test and minor method reorg (noir-lang/noir#10410) fix(doc): analyze sub-modules imports before self (noir-lang/noir#10390) chore: green light for blackbox_solver audit (noir-lang/noir#10372) chore: use `get_last_condition` in `link_condition` (noir-lang/noir#10424) chore: bump external pinned commits (noir-lang/noir#10443) feat: primitive types doc comments (noir-lang/noir#10432) chore(frontend): Trait impl Self path unit tests (noir-lang/noir#10437) END_COMMIT_OVERRIDE
AztecBot
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Nov 11, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix(brillig_gen): Switch to iterative variable liveness (noir-lang/noir#10460) feat: remove unnecessary mutation of blackbox functions during flattening (noir-lang/noir#10182) chore: revert "fix: revert "feat(ACIR): reuse element_type_sizes blocks with… (noir-lang/noir#10461) chore: green light for acir (native_types) audit (noir-lang/noir#10381) chore: lock Cargo.lock in cargo-binstall (noir-lang/noir#10459) fix(acir-gen): Use the side effect variable in `slice_pop_back` (noir-lang/noir#10455) fix: correct location for out of bounds match case integer (noir-lang/noir#10454) fix: Defunctionalize foreign functions in pre-SSA pass over mAST (noir-lang/noir#10160) fix: use unit for fmtstr without variables (noir-lang/noir#10456) chore(docs): Update tinyjs app tutorial for versioned docs (noir-lang/noir#10453) fix(frontend): Resolve to correct type on fmtstr interpolation error (noir-lang/noir#10450) fix: avoid producing duplicate private error messages (noir-lang/noir#10449) chore(docs): update dependencies and installation instructions in NoirJS tutorial and examples (noir-lang/noir#10400) fix(compiler): Improve error message for impl on primitive types (noir-lang/noir#10430) (noir-lang/noir#10442) chore: get trait as non-mut (noir-lang/noir#10447) chore(frontend): Tuple dereference chain unit test and minor method reorg (noir-lang/noir#10410) fix(doc): analyze sub-modules imports before self (noir-lang/noir#10390) chore: green light for blackbox_solver audit (noir-lang/noir#10372) chore: use `get_last_condition` in `link_condition` (noir-lang/noir#10424) chore: bump external pinned commits (noir-lang/noir#10443) feat: primitive types doc comments (noir-lang/noir#10432) chore(frontend): Trait impl Self path unit tests (noir-lang/noir#10437) END_COMMIT_OVERRIDE
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Nov 11, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix(brillig_gen): Switch to iterative variable liveness (noir-lang/noir#10460) feat: remove unnecessary mutation of blackbox functions during flattening (noir-lang/noir#10182) chore: revert "fix: revert "feat(ACIR): reuse element_type_sizes blocks with… (noir-lang/noir#10461) chore: green light for acir (native_types) audit (noir-lang/noir#10381) chore: lock Cargo.lock in cargo-binstall (noir-lang/noir#10459) fix(acir-gen): Use the side effect variable in `slice_pop_back` (noir-lang/noir#10455) fix: correct location for out of bounds match case integer (noir-lang/noir#10454) fix: Defunctionalize foreign functions in pre-SSA pass over mAST (noir-lang/noir#10160) fix: use unit for fmtstr without variables (noir-lang/noir#10456) chore(docs): Update tinyjs app tutorial for versioned docs (noir-lang/noir#10453) fix(frontend): Resolve to correct type on fmtstr interpolation error (noir-lang/noir#10450) fix: avoid producing duplicate private error messages (noir-lang/noir#10449) chore(docs): update dependencies and installation instructions in NoirJS tutorial and examples (noir-lang/noir#10400) fix(compiler): Improve error message for impl on primitive types (noir-lang/noir#10430) (noir-lang/noir#10442) chore: get trait as non-mut (noir-lang/noir#10447) chore(frontend): Tuple dereference chain unit test and minor method reorg (noir-lang/noir#10410) fix(doc): analyze sub-modules imports before self (noir-lang/noir#10390) chore: green light for blackbox_solver audit (noir-lang/noir#10372) chore: use `get_last_condition` in `link_condition` (noir-lang/noir#10424) chore: bump external pinned commits (noir-lang/noir#10443) feat: primitive types doc comments (noir-lang/noir#10432) chore(frontend): Trait impl Self path unit tests (noir-lang/noir#10437) END_COMMIT_OVERRIDE
5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
Resolves #10446
Summary
Fixes the ACIR generation of the
slice_pop_backoperation to use thecurrent_side_effect_varif the length of the slice is not a constant, to calculatenew_lengthas(slice_length - 1) * side_effects_enabledinstead of justslice_length - 1.Additional Context
The flattening pass makes the slice length a variable which is calculated based on which branch of the program was taken. In the example in the ticket, we had code like this:
When we flatten this for ACIR, we end up with a slice backed by an array of length 4, to accommodate the longest alternative, and a length that is a multiplication of the different length options:
length = (1-a)*a*2 + (1-a)*(1-a)*4 + a*0 = (1-a)*4array = [(1-a)*a*20 + (1-a)*(1-a)*40, (1-a)*a*30 + (1-a)*(1-a)*50, 60, 70] = [(1-a)*40, (1-a)*50, 60, 70]When
ais 1, thelengthbecomes 0, and thearraybecomes[0, 0, 60, 70], which is what we see in #10446 (comment)The problem is that
slice_pop_backwants to read the item atlength-1, ie. the last item, which for a slice of length 0 is item -1.With the current change, it should read item 0.
I think reading item 0 should not fail: if a slice is known to be empty, the instruction would have already been eliminated as unreachable.
User Documentation
Check one:
PR Checklist
cargo fmton default settings.