Skip to content

fix(acir): Handle inserting into an empty vector at index 0 in ACIR#11703

Merged
aakoshh merged 2 commits intomasterfrom
af/vector-insert-empty-oob
Feb 26, 2026
Merged

fix(acir): Handle inserting into an empty vector at index 0 in ACIR#11703
aakoshh merged 2 commits intomasterfrom
af/vector-insert-empty-oob

Conversation

@aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Feb 26, 2026

Description

Problem

Resolves https://cantina.xyz/code/50033e8c-8b46-41bc-b019-62098708057b/findings?s=-status%253Aspam%252Cwithdrawn%252Cfixed&finding=2

Summary

Changes to convert_vector_insert in ACIR gen to not return early when a vector we are inserting into has a known 0 length, but rather just avoid reading from it during insertion.

Additional Context

The early return was added in #10882 , however it only covered ACIR: Brillig, comptime and the SSA interpreter all allowed insertion at index 0, returning a single element vector.

The reason this discrepancy wasn't caught by the integration test was that it contained another assertion on input values that always failed (assert_eq(x, y);), and, as @asterite noted in #11685 the execution_failure tests do not check why the execution fails at the moment, so it was a false negative.

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.

@aakoshh aakoshh requested a review from a team February 26, 2026 15:17
@github-actions
Copy link
Contributor

Changes to circuit sizes

Generated at commit: 229000ab71500460ac8393e01e0793036a4e9e90, compared to commit: bb4cd6cdfcbccd2eb08c499367a9d443fa15cada

🧾 Summary (10% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
vector_insert_oob_invalid_pred +3 ❌ +25.00% +15 ❌ +0.53%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
vector_insert_oob_invalid_pred 15 (+3) +25.00% 2,829 (+15) +0.53%

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: 5d64d78 Previous: bb4cd6c Ratio
private-kernel-tail 0.011 s 0.009 s 1.22
rollup-checkpoint-merge 0.003 s 0.002 s 1.50

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

CC: @TomAFrench

Copy link
Collaborator

@asterite asterite left a comment

Choose a reason for hiding this comment

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

👍

@aakoshh aakoshh added this pull request to the merge queue Feb 26, 2026
Merged via the queue into master with commit 0e02b0c Feb 26, 2026
145 checks passed
@aakoshh aakoshh deleted the af/vector-insert-empty-oob branch February 26, 2026 17:33
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.

2 participants