Wasm generation finished

This commit is contained in:
Jordi Baylina
2020-03-16 20:37:08 +01:00
parent 8f63d18ff4
commit ef899e618b
27 changed files with 2617 additions and 374 deletions

View File

@@ -49,18 +49,18 @@ async function doTest(tester, circuit, testVectors) {
describe("basic cases", function () {
this.timeout(100000);
/*
for (let i=0; i<basicCases.length; i++) {
it("c/c++ " + basicCases[i].name, async () => {
await doTest(c_tester, basicCases[i].circuit, basicCases[i].tv);
});
}
*/
for (let i=16; i<17; i++) {
/*
for (let i=0; i<basicCases.length; i++) {
it("wasm " + basicCases[i].name, async () => {
await doTest(wasm_tester, basicCases[i].circuit, basicCases[i].tv);
});
}
*/
});

View File

@@ -198,7 +198,7 @@
"and": 1,
"or": 7,
"xor":6,
"not1": "14474011154664524427946373126085988481658748083205070504932198000989141204986",
"not1": "7059779437489773633646340506914701874769131765994106666166191815402473914361",
"shl": 40,
"shr":0
}
@@ -211,7 +211,7 @@
"and": 0,
"or": 0,
"xor":0,
"not1":"14474011154664524427946373126085988481658748083205070504932198000989141204991",
"not1":"7059779437489773633646340506914701874769131765994106666166191815402473914366",
"shl": 0,
"shr":0
}
@@ -222,10 +222,10 @@
},
{
"and": 0,
"or": "7414231717174750794300032619171286606889616317210963838766006185586667290625",
"xor":"7414231717174750794300032619171286606889616317210963838766006185586667290625",
"or": 0,
"xor": 0,
"not1": "7059779437489773633646340506914701874769131765994106666166191815402473914367",
"shl": "354452279684977160653692112256584732120484551216857172599814370184193376256",
"shl": "14828463434349501588600065238342573213779232634421927677532012371173334581248",
"shr": "10944121435919637611123202872628637544274182200208017171849102093287904247808"
}
]

View File

@@ -17,6 +17,7 @@ describe("field asm test", function () {
const tv = buildTestVector2(bn128r, "add");
await tester(bn128r, tv);
});
/*
it("secp256k1q add", async () => {
const tv = buildTestVector2(secp256k1q, "add");
await tester(secp256k1q, tv);
@@ -37,7 +38,6 @@ describe("field asm test", function () {
const tv = buildTestVector2(mnt6753q, "sub");
await tester(mnt6753q, tv);
});
it("bn128r neg", async () => {
const tv = buildTestVector1(bn128r, "neg");
await tester(bn128r, tv);
@@ -266,6 +266,51 @@ describe("field asm test", function () {
const tv = buildTestVector1(mnt6753q, "square");
await tester(mnt6753q, tv);
});
*/
it("bn128r shl", async () => {
const tv = buildTestVector2(bn128r, "shl");
await tester(bn128r, tv);
});
/*
it("secp256k1q shl", async () => {
const tv = buildTestVector2(secp256k1q, "shl");
await tester(secp256k1q, tv);
});
it("mnt6753q shl", async () => {
const tv = buildTestVector2(mnt6753q, "shl");
await tester(mnt6753q, tv);
});
*/
it("bn128r shr", async () => {
const tv = buildTestVector2(bn128r, "shr");
await tester(bn128r, tv);
});
/*
it("secp256k1q shr", async () => {
const tv = buildTestVector2(secp256k1q, "shr");
await tester(secp256k1q, tv);
});
it("mnt6753q shr", async () => {
const tv = buildTestVector2(mnt6753q, "shr");
await tester(mnt6753q, tv);
});
it("mnt6753q band", async () => {
const tv = buildTestVector2(mnt6753q, "band");
await tester(mnt6753q, tv);
});
it("mnt6753q bor", async () => {
const tv = buildTestVector2(mnt6753q, "bor");
await tester(mnt6753q, tv);
});
it("mnt6753q bxor", async () => {
const tv = buildTestVector2(mnt6753q, "bxor");
await tester(mnt6753q, tv);
});
it("mnt6753q bnot", async () => {
const tv = buildTestVector1(mnt6753q, "bnot");
await tester(mnt6753q, tv);
});
*/
});
function buildTestVector2(p, op) {
@@ -310,6 +355,9 @@ function getCriticalNumbers(p, lim) {
const numbers = [];
addFrontier(0);
addFrontier(bigInt(32));
addFrontier(bigInt(64));
addFrontier(bigInt(p.bitLength()));
addFrontier(bigInt.one.shiftLeft(31));
addFrontier(p.minus(bigInt.one.shiftLeft(31)));
addFrontier(bigInt.one.shiftLeft(32));