Skip to content

Commit 2fa9503

Browse files
committed
better info in runtime constraint assertion
1 parent d2ccc9d commit 2fa9503

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: src/bigint.js

+5
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ if (typeof(BigInt) != "undefined") {
226226
return this != b;
227227
};
228228

229+
wBigInt.prototype.toJSNumber = function() {
230+
return Number(this);
231+
};
232+
233+
229234
} else {
230235

231236
var oldProto = bigInt.prototype;

Diff for: src/calculateWitness.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ class RTCtx {
223223
return this.witness[sId];
224224
}
225225

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

0 commit comments

Comments
 (0)