better info in runtime constraint assertion

This commit is contained in:
Jordi Baylina 2019-09-15 10:49:19 +02:00
parent d2ccc9dce5
commit 2fa9503ad6
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
2 changed files with 7 additions and 2 deletions

@ -226,6 +226,11 @@ if (typeof(BigInt) != "undefined") {
return this != b; return this != b;
}; };
wBigInt.prototype.toJSNumber = function() {
return Number(this);
};
} else { } else {
var oldProto = bigInt.prototype; var oldProto = bigInt.prototype;

@ -223,11 +223,11 @@ class RTCtx {
return this.witness[sId]; return this.witness[sId];
} }
assert(a,b) { assert(a,b,errStr) {
const ba = bigInt(a); const ba = bigInt(a);
const bb = bigInt(b); const bb = bigInt(b);
if (!ba.equals(bb)) { 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());
} }
} }
} }