Skip to content

Assignments to non-inputs do not yield an error #33

@m1cm1c

Description

@m1cm1c

Steps to reproduce

  1. Create an XJSnark program with the following code:
private uint_150 t0; 
private uint_150 t1; 
private uint_150 t2; 
private uint_150 t4; 
 
inputs { 
  t1, t2 
} 
outputs { 
  t4  
} 
witnesses_AssertRange { 
  << ... >>  
} 
witnesses { 
  << ... >>  
} 
 
 
public void outsource() { 
  uint_150 t3 = t1 + t2; 
  verifyEq ( t0 , t3 ); 
  t4 = t3; 
} 
 
SampleRun("Sample_Run1", true){ 
  pre { 
      t0.val = new BigInteger("7252435245245243524352435243535635463546356356354635424352345234"); 
      t1.val = new BigInteger("7252435245245243524352435243535635463546356356354635424352345233"); 
      t2.val = new BigInteger("1"); 
  } 
  post { 
      System.out.println(t4.val); 
  } 
}
  1. Save the file.
  2. Right-click the file and choose Run [...].

Problem

As you can see, t0 and t1 are identical except for the last digit where t0 is 1 larger than t1. So if you add t2 to t1, the result should be equal to t0. However, the assertion fails:

Error - Assertion Failed assert in 2 <1 0> out 1 <189> 		# Equality assertion of long elements | case 2 | index 0
Exception in thread "main" 0*1!=886742162
java.lang.RuntimeException: Error During Circuit Evaluation
	at backend.operations.primitive.AssertBasicOp.compute(AssertBasicOp.java:29)
	at backend.operations.primitive.BasicOp.evaluate(BasicOp.java:71)
	at backend.eval.CircuitEvaluator.evaluate(CircuitEvaluator.java:160)
	at backend.structure.CircuitGenerator.__evaluateSampleRun(CircuitGenerator.java:463)
	at xjsnark.rsa.RSAModExpFixedModulusVariableExponent.<init>(RSAModExpFixedModulusVariableExponent.java:25)
	at xjsnark.rsa.RSAModExpFixedModulusVariableExponent.main(RSAModExpFixedModulusVariableExponent.java:19)

The reason for this is that t0 was not declared as an input.

(The problem does not occur in the original RSAModExpFixedModulusVariableExponent file. I simply modified this file.)

Expected behavior

The compiler should tell the user that he trying to assign a value to something that is not an input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions