Skip to content

Conversation

@guipublic
Copy link
Contributor

Description

Problem

Resolves #11173 and #10524
It also address part of #10522, but we should still add error handling in brillig generation.

Summary

A safe limit has been added in acir_gen to error on very large arrays.
The monomorphizer avoids creating repeated elements in an array.

Additional Context

User Documentation

Check one:

  • No user documentation needed.
  • Changes in docs/ included in this PR.
  • [For Experimental Features] Changes in docs/ 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.

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: dc8c1b1 Previous: e1b2904 Ratio
test_report_noir-lang_noir_bigcurve_ 307 s 236 s 1.30
test_report_zkpassport_noir-ecdsa_ 3 s 2 s 1.50

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.

⚠️ Performance Alert ⚠️

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

Benchmark suite Current: 3df8836 Previous: e48a0d8 Ratio
rollup-block-root-single-tx 0.003 s 0.002 s 1.50
sha512-100-bytes 0.085 s 0.053 s 1.60

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

CC: @TomAFrench

@guipublic guipublic requested a review from a team January 21, 2026 11:38
source: tooling/nargo_cli/tests/execute.rs
expression: stderr
---
error: The return value has 4294967294 witnesses which exceeds the limit of 16777216
Copy link
Contributor

Choose a reason for hiding this comment

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

So we can declare the type, but cannot return the type? This feels like it may confuse users as they may have a type declared with no issue and then once they use the type they start getting an error. I think it would be better to error on the type itself. Wdyt @jfecher?

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 'Execution Memory'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: d0018cb Previous: edcff87 Ratio
private-kernel-reset 453.66 MB 306.98 MB 1.48
rollup-checkpoint-root-single-block 11290 MB 1750 MB 6.45
rollup-checkpoint-root 11300 MB 1750 MB 6.46
rollup-tx-base-private 994.05 MB 525.96 MB 1.89
rollup-tx-base-public 3030 MB 467.15 MB 6.49
sha512_100_bytes 186.09 MB 72.48 MB 2.57

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.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Brillig Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 61cb787 Previous: 0d03696 Ratio
rollup-block-root-single-tx 0.003 s 0.002 s 1.50
rollup-checkpoint-merge 0.002 s 0.001 s 2

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

CC: @TomAFrench

insta::assert_snapshot!(program, @r"
unconstrained fn main$f0() -> () {
let a$l0 = [1, 2];
let b$l1 = [a$l0.clone().clone(); 3];
Copy link
Contributor

@aakoshh aakoshh Jan 26, 2026

Choose a reason for hiding this comment

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

I'm surprised you opted for this, rather than handling it in the SSA. It seems strange to introduce a new AST to capture repeated expressions, and delay their turning into multiple elements until the SSA so that the AST doesn't have N occurrences of Ident nodes, and then to insert N Clone nodes anyway.

I was wondering how this will potentially affect #11124 where I unwrap 1 layer of Clone, but didn't expect it to be nested. It looks like it wouldn't interact with that as this isn't a call argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's easy to handle it in SSA, but I wanted to keep this inside the ownership pass. However I see your point, and may be it is cleaner to do it in SSA, where the repeated is handled. I'll do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unbounded array allocation with repeated array syntax kills process

5 participants