Skip to content

fix: address LA Suggestion 3 review on v1#406

Merged
Bisht13 merged 2 commits into
v1from
rs/suggestion3_v1
Apr 17, 2026
Merged

fix: address LA Suggestion 3 review on v1#406
Bisht13 merged 2 commits into
v1from
rs/suggestion3_v1

Conversation

@rose2221
Copy link
Copy Markdown
Collaborator

@rose2221 rose2221 commented Apr 10, 2026

Summary

  • binops.rs: drop the redundant 32-bit check in cow_to_digit. Constants reaching this helper have already been byte-decomposed by process_binop_opcode (each value is one byte of a 32-bit operand), so the assertion was unreachable. Document the byte-decomposition invariant in a comment.

  • drop the helper-level cow_to_digit_rejects_oversized_constant test.

Apply the v1-applicable parts of the c87f1a5 follow-up review:

- binops.rs: drop the redundant 32-bit check in `cow_to_digit`. Constants
  reaching this helper have already been byte-decomposed by
  `process_binop_opcode` (each value is one byte of a 32-bit operand),
  so the assertion was unreachable. Document the byte-decomposition
  invariant in a comment.

- binops.rs: drop the helper-level `cow_to_digit_rejects_oversized_constant`
  test. With the unreachable assertion removed there is nothing to exercise,
  and the test was previously panicking on a code path the real compiler
  flow could never produce.

- noir_to_r1cs.rs: clarify the three inline 32-bit assertion messages in
  `process_binop_opcode` to say "exceeds the 32-bit binop limit", and add
  a comment at the lhs site explaining why: v1's binop pipeline is
  hardcoded to 32-bit operands (`(value as u32).to_le_bytes()`), so a
  wider constant would otherwise be silently truncated. The assertions
  themselves stay — they are correct for v1's 32-bit-only pipeline.

The user-visible u64/u128 bug Bisht13 reported on main does not apply
to v1: the width-parameterized binop refactor (cfcd5da) has not been
ported, so v1 simply does not accept wider operands. Porting that
refactor + the c87f1a5 fix together would be a separate, larger change.
@Bisht13 Bisht13 merged commit 670b8bb into v1 Apr 17, 2026
2 of 3 checks passed
@Bisht13 Bisht13 deleted the rs/suggestion3_v1 branch April 17, 2026 05:45
dcbuild3r pushed a commit that referenced this pull request May 16, 2026
fix: address LA Suggestion 3 review on v1
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