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
AssertZero only, no black-box opcode
- One constant + one witness → constant is embedded as a constant-valued witness in the witness table; the ACIR
FunctionInput is a Witness reference, not a Constant
So ConstantOrACIRWitness::Constant is never produced by nargo for AND/XOR inputs, and lines L341–L395 and L400–L424 are unreachable.
Affected Files
Description
process_binop_opcodein the R1CS compiler contains match arms for handlingConstantOrACIRWitness::Constantinputs 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_opcodehas three match arms:Constant(nested match on rhs)ConstantNargo's behaviour (confirmed via ACIR bytecode inspection):
AssertZeroonly, no black-box opcodeFunctionInputis aWitnessreference, not aConstantSo
ConstantOrACIRWitness::Constantis never produced by nargo for AND/XOR inputs, and lines L341–L395 and L400–L424 are unreachable.Affected Files
provekit/r1cs-compiler/src/noir_to_r1cs.rs#L341-L395Constant(lhs_c)arm — deadprovekit/r1cs-compiler/src/noir_to_r1cs.rs#L400-L424Constant(rhs_c)arm — dead