Browse Source

bls12-381 fix and fast r1cs generation

master
Jordi Baylina 4 years ago
parent
commit
a002bcbc25
No known key found for this signature in database GPG Key ID: 7480C80C1BE43112
4 changed files with 43 additions and 40 deletions
  1. +36
    -35
      package-lock.json
  2. +3
    -3
      package.json
  3. +3
    -0
      src/construction_phase.js
  4. +1
    -2
      src/r1csfile.js

+ 36
- 35
package-lock.json

@ -30,6 +30,11 @@
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0"
} }
}, },
"@iden3/bigarray": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/@iden3/bigarray/-/bigarray-0.0.2.tgz",
"integrity": "sha512-Xzdyxqm1bOFF6pdIsiHLLl3HkSLjbhqJHVyqaTxXt3RqXBEnmsUmEW47H7VOi/ak7TdkRpNkxjyK5Zbkm+y52g=="
},
"@types/color-name": { "@types/color-name": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
@ -209,6 +214,18 @@
"requires": { "requires": {
"ffjavascript": "0.2.10", "ffjavascript": "0.2.10",
"fnv-plus": "^1.3.1" "fnv-plus": "^1.3.1"
},
"dependencies": {
"ffjavascript": {
"version": "0.2.10",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.10.tgz",
"integrity": "sha512-GQI6gHYYG5/iD4Kt3VzezzK7fARJzP0zkc82V/+JAdjfeKBXhDSo5rpKFuK3cDcrdW0Fu2emuYNMEAuFqhEQvQ==",
"requires": {
"big-integer": "^1.6.48",
"wasmcurves": "0.0.5",
"worker-threads": "^1.0.0"
}
}
} }
}, },
"cjson": { "cjson": {
@ -566,9 +583,9 @@
"dev": true "dev": true
}, },
"fastfile": { "fastfile": {
"version": "0.0.16",
"resolved": "https://registry.npmjs.org/fastfile/-/fastfile-0.0.16.tgz",
"integrity": "sha512-2sX5M4JQWAVmS2GojuRPA759aTOs5PyUEpZHjaecNtWBU9CfRFlTf2aBqFG2PJJnrcrawBBAQ1s0QSO+qQ4Zmg=="
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/fastfile/-/fastfile-0.0.18.tgz",
"integrity": "sha512-q03PTKc+wptis4WmuFOwPNQx2p5myFUrl/dMgRlW9mymc1Egyc14JPHgiGnWK+sJ0+dBl2Vwtfh5GfSQltYOpw=="
}, },
"ffiasm": { "ffiasm": {
"version": "0.1.1", "version": "0.1.1",
@ -581,19 +598,19 @@
} }
}, },
"ffjavascript": { "ffjavascript": {
"version": "0.2.10",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.10.tgz",
"integrity": "sha512-GQI6gHYYG5/iD4Kt3VzezzK7fARJzP0zkc82V/+JAdjfeKBXhDSo5rpKFuK3cDcrdW0Fu2emuYNMEAuFqhEQvQ==",
"version": "0.2.22",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.22.tgz",
"integrity": "sha512-EsVqap2Txm17bKW0z/jXCX3M7rQ++nQUAJY8alWDpyhjRj90xjl6GLeVSKZQ8rOFDQ/SFFXcEB8w9X8Boxid+w==",
"requires": { "requires": {
"big-integer": "^1.6.48", "big-integer": "^1.6.48",
"wasmcurves": "0.0.5",
"wasmcurves": "0.0.12",
"worker-threads": "^1.0.0" "worker-threads": "^1.0.0"
}, },
"dependencies": { "dependencies": {
"wasmcurves": { "wasmcurves": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/wasmcurves/-/wasmcurves-0.0.5.tgz",
"integrity": "sha512-BmI4GXLjLawGg2YkvHa8zRsnWec+d1uwoxE+Iov8cqOpDL7GA5XO2pk2yuDbXHMzwIug2exnKot3baRZ86R0pA==",
"version": "0.0.12",
"resolved": "https://registry.npmjs.org/wasmcurves/-/wasmcurves-0.0.12.tgz",
"integrity": "sha512-1Jl9mkatyHSNj80ILjf85SZUNuZQBCkTjJlhzqHnZQXUmIimCIWkugaVaYNjozLs1Gun4h/keZe1MBeBN0sRpg==",
"requires": { "requires": {
"big-integer": "^1.6.42", "big-integer": "^1.6.42",
"blakejs": "^1.1.0" "blakejs": "^1.1.0"
@ -1162,29 +1179,13 @@
"dev": true "dev": true
}, },
"r1csfile": { "r1csfile": {
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.14.tgz",
"integrity": "sha512-7m4eWpnbjkwGGUaRmIAJc4w+HvaeBPJXUKHIqLkHeD9Yyjem6/EHmlgDVl+4hWNWGZqdhXuMqWSH9+O6QOXBdw==",
"version": "0.0.16",
"resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.16.tgz",
"integrity": "sha512-A2jRVWzGgmXeG2lVAc0H4suJmzt50it5UvBnycJgBCpMXM3tH/M6RguP7nvs6suY/yYnkN6jX6iTScSiDUF3FA==",
"requires": { "requires": {
"fastfile": "0.0.7",
"ffjavascript": "0.2.4"
},
"dependencies": {
"fastfile": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/fastfile/-/fastfile-0.0.7.tgz",
"integrity": "sha512-Zk7sdqsV6DsN/rhjULDfCCowPiMDsziTMFicdkrKN80yybr/6YFf9H91ELXN85dVEf6EYkVR5EHkZNc0dMqZKA=="
},
"ffjavascript": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.4.tgz",
"integrity": "sha512-XFeWcjUDFPavN+DDOxhE8p5MOhZQJc9oO1Sj4ml1pyjqNhS1ujEamcjFyK0cctdnat61i7lvpTYzdtS3RYDC8w==",
"requires": {
"big-integer": "^1.6.48",
"wasmcurves": "0.0.4",
"worker-threads": "^1.0.0"
}
}
"@iden3/bigarray": "0.0.2",
"fastfile": "0.0.18",
"ffjavascript": "0.2.22"
} }
}, },
"regexpp": { "regexpp": {
@ -1483,9 +1484,9 @@
} }
}, },
"wasmcurves": { "wasmcurves": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/wasmcurves/-/wasmcurves-0.0.4.tgz",
"integrity": "sha512-c/Tob+F/7jJhep1b2qtj54r4nkGaRifNbQ1OJx8cBBFH1RlHbWIbISHWONClOxiVwy/JZOpbN4SgvSX/4lF80A==",
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/wasmcurves/-/wasmcurves-0.0.5.tgz",
"integrity": "sha512-BmI4GXLjLawGg2YkvHa8zRsnWec+d1uwoxE+Iov8cqOpDL7GA5XO2pk2yuDbXHMzwIug2exnKot3baRZ86R0pA==",
"requires": { "requires": {
"big-integer": "^1.6.42", "big-integer": "^1.6.42",
"blakejs": "^1.1.0" "blakejs": "^1.1.0"

+ 3
- 3
package.json

@ -31,12 +31,12 @@
"dependencies": { "dependencies": {
"chai": "^4.2.0", "chai": "^4.2.0",
"circom_runtime": "0.1.5", "circom_runtime": "0.1.5",
"fastfile": "0.0.16",
"fastfile": "0.0.18",
"ffiasm": "0.1.1", "ffiasm": "0.1.1",
"ffjavascript": "0.2.10",
"ffjavascript": "0.2.22",
"ffwasm": "0.0.7", "ffwasm": "0.0.7",
"fnv-plus": "^1.3.1", "fnv-plus": "^1.3.1",
"r1csfile": "0.0.14",
"r1csfile": "0.0.16",
"tmp-promise": "^2.0.2", "tmp-promise": "^2.0.2",
"wasmbuilder": "0.0.10" "wasmbuilder": "0.0.10"
}, },

+ 3
- 0
src/construction_phase.js

@ -701,6 +701,9 @@ function execPin(ctx, ast) {
if (sel.v[0].t != "N") return NQVAL; if (sel.v[0].t != "N") return NQVAL;
selsP.push(Scalar.toNumber(sel.v[0].v)); selsP.push(Scalar.toNumber(sel.v[0].v));
} }
if (!ctx.components[cIdx]) {
return ctx.throwError(ast, "Component not defined yet");
}
const sIdx = ctx.components[cIdx].names.getSignalIdx(ast.pin.name, selsP); const sIdx = ctx.components[cIdx].names.getSignalIdx(ast.pin.name, selsP);
if (sIdx<0) return ctx.throwError(ast, "Signal not defined:" + buildFullName() ); if (sIdx<0) return ctx.throwError(ast, "Signal not defined:" + buildFullName() );

+ 1
- 2
src/r1csfile.js

@ -8,8 +8,7 @@ module.exports.buildR1cs = buildR1cs;
async function buildR1cs(ctx, fileName) { async function buildR1cs(ctx, fileName) {
const fd = await fastFile.createOverride(fileName);
const fd = await fastFile.createOverride(fileName, 1<<22, 1<<24);
const buffBigInt = new Uint8Array(ctx.F.n8); const buffBigInt = new Uint8Array(ctx.F.n8);

Loading…
Cancel
Save