All testst finished with c_build

This commit is contained in:
Jordi Baylina 2019-12-16 21:35:52 +01:00
parent e32460efe1
commit 7a6b0eda6e
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
15 changed files with 48 additions and 79 deletions

@ -77,8 +77,8 @@ describe("Baby Jub test", function () {
it("Should check (0,1) is a valid poiny", async() => {
const w = await circuitTest.calculateWitness({x: 0, y:1});
// TODO Check constraints
// assert(circuitTest.checkWitness(w));
await circuitTest.checkConstraints(w);
});
it("Should check (1,0) is an invalid point", async() => {
@ -106,8 +106,7 @@ describe("Baby Jub test", function () {
await circuitPbk.assertOut(w, {Ax : A[0], Ay: A[1]});
// TODO Check constraints
// assert(circuitPbk.checkWitness(w));
await circuitPbk.checkConstraints(w);
});
});

@ -9,13 +9,13 @@ const assert = chai.assert;
describe("Sum test", function () {
this.timeout(100000);
this.timeout(100000000);
it("Should create a constant circuit", async () => {
const circuit = await tester(path.join(__dirname, "circuits", "constants_test.circom"));
await circuit.loadConstraints();
// TODO
// assert.equal(cirDef.nVars, 2);
assert.equal(circuit.nWires, 2);
const witness = await circuit.calculateWitness({ "in": bigInt("d807aa98", 16)});
@ -24,9 +24,9 @@ describe("Sum test", function () {
});
it("Should create a sum circuit", async () => {
const circuit = await tester(path.join(__dirname, "circuits", "sum_test.circom"));
await circuit.loadConstraints();
// TODO
// assert.equal(cirDef.nVars, 97); // 32 (in1) + 32(in2) + 32(out) + 1 (carry)
assert.equal(circuit.nWires, 97); // 32 (in1) + 32(in2) + 32(out) + 1 (carry)
const witness = await circuit.calculateWitness({ "a": "111", "b": "222" });

@ -62,8 +62,6 @@ describe("EdDSA test", function () {
const w = await circuit.calculateWitness({A: aBits, R8: r8Bits, S: sBits, msg: msgBits});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
});

@ -37,8 +37,9 @@ describe("EdDSA MiMC test", function () {
S: signature.S,
M: msg});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
it("Detect Invalid signature", async () => {
@ -89,7 +90,7 @@ describe("EdDSA MiMC test", function () {
S: signature.S,
M: msg});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
});

@ -38,8 +38,7 @@ describe("EdDSA Poseidon test", function () {
S: signature.S,
M: msg});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
it("Detect Invalid signature", async () => {
@ -90,7 +89,6 @@ describe("EdDSA Poseidon test", function () {
S: signature.S,
M: msg});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
});

@ -20,8 +20,7 @@ describe("Exponentioation test", function () {
const w = await circuit.calculateWitness({in: 1});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
let g = [
bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"),
@ -48,8 +47,7 @@ describe("Exponentioation test", function () {
const w = await circuit.calculateWitness({in: 1});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
let g = [
bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"),
@ -80,8 +78,7 @@ describe("Exponentioation test", function () {
const w = await circuit.calculateWitness({"in": 31});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
let g = [
bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"),

@ -25,8 +25,7 @@ describe("Escalarmul test", function () {
const w = await circuitEMulAny.calculateWitness({"e": 1, "p": g});
// TODO
// assert(circuitEMulAny.checkWitness(w));
await circuitEMulAny.checkConstraints(w);
await circuitEMulAny.assertOut(w, {out: g});
@ -37,8 +36,7 @@ describe("Escalarmul test", function () {
const r = bigInt("2736030358979909402780800718157159386076813972158567259200215660948447373041");
const w = await circuitEMulAny.calculateWitness({"e": r, "p": g});
// TODO
// assert(circuitEMulAny.checkWitness(w));
await circuitEMulAny.checkConstraints(w);
await circuitEMulAny.assertOut(w, {out: [0,1]});

@ -23,8 +23,7 @@ describe("Escalarmul test", function () {
const w = await circuit.calculateWitness({"e": 0});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {out: [0,1]});
@ -34,8 +33,7 @@ describe("Escalarmul test", function () {
const w = await circuit.calculateWitness({"e": 1});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {out: babyjub.Base8});
@ -51,8 +49,7 @@ describe("Escalarmul test", function () {
const w = await circuit.calculateWitness({"e": s});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
const expectedRes = babyjub.mulPointEscalar(base8, s);
@ -72,8 +69,7 @@ describe("Escalarmul test", function () {
const w = await circuit.calculateWitness({"e": s});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
const expectedRes = babyjub.mulPointEscalar(base8, s);
@ -85,8 +81,7 @@ describe("Escalarmul test", function () {
const w = await circuit.calculateWitness({"e": babyjub.subOrder });
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {out: [0,1]});
});

@ -20,7 +20,6 @@ describe("MiMC Circuit test", function () {
await circuit.assertOut(w, {out: res2});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
});

@ -19,8 +19,7 @@ describe("MiMC Sponge Circuit test", function () {
await circuit.assertOut(w, {xL_out: out2.xL, xR_out: out2.xR});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
@ -33,7 +32,6 @@ describe("MiMC Sponge Circuit test", function () {
await circuit.assertOut(w, {outs: out2});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
});

@ -4,7 +4,6 @@ const tester = require("circom").tester;
describe("Mux4 test", function() {
this.timeout(100000);
it("Should create a constant multiplexer 4", async () => {
const circuit = await tester(path.join(__dirname, "circuits", "mux4_1.circom"));
@ -31,11 +30,9 @@ describe("Mux4 test", function() {
for (let i=0; i<16; i++) {
const w = await circuit.calculateWitness({ "selector": i });
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {out: ct16[i]});
}
});
@ -57,8 +54,7 @@ describe("Mux4 test", function() {
for (let i=0; i<8; i++) {
const w = await circuit.calculateWitness({ "selector": i });
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {out: ct8[i]});
}
@ -77,8 +73,7 @@ describe("Mux4 test", function() {
for (let i=0; i<4; i++) {
const w = await circuit.calculateWitness({ "selector": i });
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {out: ct4[i]});
}
@ -95,8 +90,7 @@ describe("Mux4 test", function() {
for (let i=0; i<2; i++) {
const w = await circuit.calculateWitness({ "selector": i });
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {out: ct2[i]});
}

@ -13,13 +13,11 @@ describe("Point 2 bits test", function() {
it("Should do the both convertions for 8Base", async () => {
const w = await circuit.calculateWitness({ in: babyJub.Base8});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
it("Should do the both convertions for Zero point", async () => {
const w = await circuit.calculateWitness({ in: [0, 1]});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
});

@ -37,8 +37,7 @@ describe("Poseidon Circuit test", function () {
await circuit.assertOut(w, {out : res2});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
it("Should check constrain of hash([3, 4])", async () => {
@ -51,7 +50,6 @@ describe("Poseidon Circuit test", function () {
await circuit.assertOut(w, {out : res2});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
});

@ -28,8 +28,7 @@ async function testInsert(tree, key, value, circuit, log ) {
newValue: value
}, log);
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {newRoot: res.newRoot});
@ -51,8 +50,7 @@ async function testDelete(tree, key, circuit) {
newValue: res.delValue
});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {newRoot: res.newRoot});
}
@ -73,8 +71,7 @@ async function testUpdate(tree, key, newValue, circuit) {
newValue: res.newValue
});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
await circuit.assertOut(w, {newRoot: res.newRoot});
}
@ -190,8 +187,7 @@ describe("SMT test", function () {
const root1 = w[circuit.symbols["main.oldRoot"].idxWit];
const root2 = w[circuit.symbols["main.newRoot"].idxWit];
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
assert(root1.equals(root2));
});

@ -31,8 +31,8 @@ async function testInclusion(tree, key, circuit) {
value: res.foundValue
});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
}
async function testExclusion(tree, key, circuit) {
@ -54,11 +54,11 @@ async function testExclusion(tree, key, circuit) {
value: 0
});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
}
describe("SMT test", function () {
describe("SMT Verifier test", function () {
let circuit;
let tree;
@ -105,8 +105,8 @@ describe("SMT test", function () {
value: 0
});
// TODO
// assert(circuit.checkWitness(w));
await circuit.checkConstraints(w);
});
it("Check inclussion Adria case", async () => {