Skip to content
Permalink
Browse files

Update readme + error checks

- Add note about java version (Issue #8)
- Add extra error checks (Issue #4)
  • Loading branch information...
akosba committed Apr 28, 2019
1 parent 99715c6 commit d4a4f88b9a265379c159c258488c6b486228fe79
Showing with 9 additions and 2 deletions.
  1. +8 −1 JsnarkCircuitBuilder/src/circuit/eval/CircuitEvaluator.java
  2. +1 −1 README.md
@@ -15,6 +15,7 @@

import util.Util;
import circuit.auxiliary.LongElement;
import circuit.config.Config;
import circuit.operations.WireLabelInstruction;
import circuit.operations.WireLabelInstruction.LabelType;
import circuit.structure.CircuitGenerator;
@@ -33,6 +34,9 @@ public CircuitEvaluator(CircuitGenerator circuitGenerator) {
}

public void setWireValue(Wire w, BigInteger v) {
if(v.signum() < 0 || v.compareTo(Config.FIELD_PRIME) >=0){
throw new IllegalArgumentException("Only positive values that are less than the modulus are allowed for this method.");
}
valueAssignment[w.getWireId()] = v;
}

@@ -71,7 +75,10 @@ public void setWireValue(LongElement e, BigInteger value,
}

public void setWireValue(Wire wire, long v) {
setWireValue(wire, new BigInteger(v + ""));
if(v < 0){
throw new IllegalArgumentException("Only positive values that are less than the modulus are allowed for this method.");
}
setWireValue(wire, BigInteger.valueOf(v));
}

public void setWireValue(Wire[] wires, BigInteger[] v) {
@@ -11,7 +11,7 @@ __Updates__:
### Prerequisites

- Libsnark prerequisites
- JDK 8
- JDK 8 (Higher versions are also expected to work. We've only tested with JDKs 8 and 12.)
- Junit 4
- BouncyCastle library

0 comments on commit d4a4f88

Please sign in to comment.
You can’t perform that action at this time.