fix: correct index out of bounds location#11685
Conversation
Yeah, harmonising these would be very nice but would be a fair bit of work. |
There was a problem hiding this comment.
⚠️ 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: 6c8b20e | Previous: 34e3758 | Ratio |
|---|---|---|---|
rollup-tx-merge |
0.002 s |
0.001 s |
2 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
There was a problem hiding this comment.
⚠️ 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: e73f3dd | Previous: 34e3758 | Ratio |
|---|---|---|---|
rollup-checkpoint-merge |
0.003 s |
0.002 s |
1.50 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
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: 6c8b20e | Previous: 34e3758 | Ratio |
|---|---|---|---|
test_report_zkpassport_noir-ecdsa_ |
3 s |
1 s |
3 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
Yes. It's also hard because in comptime we usually have more context to provide a better error message, and it would be bad to degrade these errors to match ACIR/Brillig. For now I think I'll just capture snapshosts of the different backends. |
…noir-lang/noir into ab/improve-index-out-of-bounds-location
Description
Problem
Resolves https://cantina.xyz/code/50033e8c-8b46-41bc-b019-62098708057b/findings?s=-status:spam,withdrawn+order_by:severity_asc&finding=7
Summary
The finding suggests that it might be incorrect to use the last ACIR opcode location for the failure location. However, what was "wrong" was that when we generated a constrain for the index out of bounds, we did it in the incorrect location. Now we do it in the same location that the array_get happens.
Additional Context
I wanted to add a regression test for this but I noticed that we don't capture snapshots of
execution_failuretests. Then I tried to do that but I found that the error messages we produce for ACIR, Brillig and comptime are sometimes different. Then I thought it might be better to do that in a separate PR, either by storing separate snapshots for different runtimes, or by trying to always produce the same error in all runtimes.While doing this I noticed that one
execution_failuretest was failing because it lacked an input argument, and not because it failed to execute, so I fixed that in this PR too.User Documentation
Check one:
PR Checklist
cargo fmton default settings.