File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
acvm-repo/acvm/src/compiler Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ impl CircuitSimulator {
105105 self . mark_solvable ( w) ;
106106 true
107107 } else {
108- self . try_solve ( & Opcode :: AssertZero ( op. value . clone ( ) ) )
108+ self . can_solve_expression ( & op. value )
109109 }
110110 }
111111 Opcode :: MemoryInit { block_id, init, .. } => {
@@ -364,4 +364,30 @@ mod tests {
364364 let circuit = Circuit :: from_str ( src) . unwrap ( ) ;
365365 assert_eq ! ( CircuitSimulator :: check_circuit( & circuit) , Some ( 0 ) ) ;
366366 }
367+
368+ #[ test]
369+ fn reports_some_when_write_has_a_single_unknown_witness_in_its_value ( ) {
370+ let src = "
371+ private parameters: [w0, w1]
372+ public parameters: []
373+ return values: []
374+ INIT b0 = [w0]
375+ WRITE b0[w0] = w1 + w2
376+ " ;
377+ let circuit = Circuit :: from_str ( src) . unwrap ( ) ;
378+ assert_eq ! ( CircuitSimulator :: check_circuit( & circuit) , Some ( 1 ) ) ;
379+ }
380+
381+ #[ test]
382+ fn reports_none_when_write_has_known_witnesses_in_its_value ( ) {
383+ let src = "
384+ private parameters: [w0, w1, w2]
385+ public parameters: []
386+ return values: []
387+ INIT b0 = [w0]
388+ WRITE b0[w0] = w1 + w2
389+ " ;
390+ let circuit = Circuit :: from_str ( src) . unwrap ( ) ;
391+ assert_eq ! ( CircuitSimulator :: check_circuit( & circuit) , None ) ;
392+ }
367393}
You can’t perform that action at this time.
0 commit comments