You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
}
Save the file.
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.
The text was updated successfully, but these errors were encountered:
m1cm1c
changed the title
verifyEq() yields the wrong result for big numbers
Assignments to non-inputs do not yield an error
Oct 7, 2021
Steps to reproduce
Run [...]
.Problem
As you can see,
t0
andt1
are identical except for the last digit wheret0
is 1 larger thant1
. So if you addt2
tot1
, the result should be equal tot0
. However, the assertion fails: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.
The text was updated successfully, but these errors were encountered: