Skip to content

Commit

Permalink
better info in runtime constraint assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaylina committed Sep 15, 2019
1 parent d2ccc9d commit 2fa9503
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/bigint.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ if (typeof(BigInt) != "undefined") {
return this != b;
};

wBigInt.prototype.toJSNumber = function() {
return Number(this);
};


} else {

var oldProto = bigInt.prototype;
Expand Down
4 changes: 2 additions & 2 deletions src/calculateWitness.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ class RTCtx {
return this.witness[sId];
}

assert(a,b) {
assert(a,b,errStr) {
const ba = bigInt(a);
const bb = bigInt(b);
if (!ba.equals(bb)) {
throw new Error("Constraint doesn't match: " + ba.toString() + " != " + bb.toString());
throw new Error("Constraint doesn't match "+ this.currentComponent+": "+ errStr + " -> "+ ba.toString() + " != " + bb.toString());
}
}
}

0 comments on commit 2fa9503

Please sign in to comment.