-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Description
process_binop_opcode in the R1CS compiler contains match arms for handling ConstantOrACIRWitness::Constant inputs to AND/XOR black-box opcodes. These branches are never reachable in practice because nargo never emits AND/XOR black-box opcodes with constant operands — it either folds them at compile time (both constant) or promotes the constant to a witness (one constant, one witness).
Root Cause
process_binop_opcode has three match arms:
| Lines | Case |
|---|---|
| L341–L395 | lhs is Constant (nested match on rhs) |
| L400–L424 | lhs is Witness, rhs is Constant |
| L426–L438 | Both are Witnesses (the only reachable arm) |
Nargo's behaviour (confirmed via ACIR bytecode inspection):
- Both constants → computed at compile time → emits
AssertZeroonly, no black-box opcode - One constant + one witness → constant is embedded as a constant-valued witness in the witness table; the ACIR
FunctionInputis aWitnessreference, not aConstant
So ConstantOrACIRWitness::Constant is never produced by nargo for AND/XOR inputs, and lines L341–L395 and L400–L424 are unreachable.
Affected Files
| File | Notes |
|---|---|
provekit/r1cs-compiler/src/noir_to_r1cs.rs#L341-L395 |
Constant(lhs_c) arm — dead |
provekit/r1cs-compiler/src/noir_to_r1cs.rs#L400-L424 |
Constant(rhs_c) arm — dead |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels