mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-06 18:56:40 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d5077106a | ||
|
|
b68c9fa5d2 |
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.5.33",
|
"version": "0.5.34",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -208,9 +208,9 @@
|
|||||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
|
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
|
||||||
},
|
},
|
||||||
"circom_runtime": {
|
"circom_runtime": {
|
||||||
"version": "0.1.8",
|
"version": "0.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/circom_runtime/-/circom_runtime-0.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/circom_runtime/-/circom_runtime-0.1.9.tgz",
|
||||||
"integrity": "sha512-5ZmzCyidkNPb1zZsJGRXTuWcJ6kW6+gRBtHgf2tFqTh5dUyWVVPH0Zg7AsU2ijPr1AmYZUlme0yORUZK5HrjOA==",
|
"integrity": "sha512-eh34quaGpeEWXthnhmC9zpoBL/5zJ0mGDbPT/plb/xVmFaKxJDcLuCr2sma5s3il8AYlEIb/nbqytojyI3TWDQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ffjavascript": "0.2.10",
|
"ffjavascript": "0.2.10",
|
||||||
"fnv-plus": "^1.3.1"
|
"fnv-plus": "^1.3.1"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.5.33",
|
"version": "0.5.34",
|
||||||
"description": "Language to generate logic circuits",
|
"description": "Language to generate logic circuits",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"circom_runtime": "0.1.8",
|
"circom_runtime": "0.1.9",
|
||||||
"fastfile": "0.0.18",
|
"fastfile": "0.0.18",
|
||||||
"ffiasm": "0.1.1",
|
"ffiasm": "0.1.1",
|
||||||
"ffjavascript": "0.2.22",
|
"ffjavascript": "0.2.22",
|
||||||
|
|||||||
@@ -433,6 +433,7 @@ class BuilderC {
|
|||||||
`#define NOutputs ${this.header.NOutputs}`,
|
`#define NOutputs ${this.header.NOutputs}`,
|
||||||
`#define NInputs ${this.header.NInputs}`,
|
`#define NInputs ${this.header.NInputs}`,
|
||||||
`#define NVars ${this.header.NVars}`,
|
`#define NVars ${this.header.NVars}`,
|
||||||
|
`#define NPublic ${this.header.NPublic}`,
|
||||||
`#define __P__ "${this.header.P.toString()}"`,
|
`#define __P__ "${this.header.P.toString()}"`,
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -662,7 +663,7 @@ class BuilderC {
|
|||||||
|
|
||||||
async _buildCircuitVar(fdData) {
|
async _buildCircuitVar(fdData) {
|
||||||
|
|
||||||
const buff = new Uint8Array(72);
|
const buff = new Uint8Array(76);
|
||||||
const buffV = new DataView(buff.buffer);
|
const buffV = new DataView(buff.buffer);
|
||||||
|
|
||||||
utils.setUint64(buffV, 0, this.pWit2Sig, true);
|
utils.setUint64(buffV, 0, this.pWit2Sig, true);
|
||||||
@@ -678,6 +679,7 @@ class BuilderC {
|
|||||||
buffV.setUint32(60, this.header.NInputs, true);
|
buffV.setUint32(60, this.header.NInputs, true);
|
||||||
buffV.setUint32(64, this.header.NVars, true);
|
buffV.setUint32(64, this.header.NVars, true);
|
||||||
buffV.setUint32(68, this.nCets, true);
|
buffV.setUint32(68, this.nCets, true);
|
||||||
|
buffV.setUint32(72, this.header.NPublic, true);
|
||||||
|
|
||||||
fdData.pos = 0;
|
fdData.pos = 0;
|
||||||
|
|
||||||
@@ -697,7 +699,7 @@ class BuilderC {
|
|||||||
|
|
||||||
async build(fdCode, fdData) {
|
async build(fdCode, fdData) {
|
||||||
const encoder = new TextEncoder("utf-8");
|
const encoder = new TextEncoder("utf-8");
|
||||||
fdData.pos = 72;
|
fdData.pos = 76;
|
||||||
while (fdData.pos % 8) fdData.pos++;
|
while (fdData.pos % 8) fdData.pos++;
|
||||||
|
|
||||||
const code=new BigArray();
|
const code=new BigArray();
|
||||||
|
|||||||
@@ -693,6 +693,15 @@ module.exports = function buildRuntime(module, builder) {
|
|||||||
f.addCode(c.i32_const(builder.header.NVars));
|
f.addCode(c.i32_const(builder.header.NVars));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildGetNPublic() {
|
||||||
|
const f = module.addFunction("getNPublic");
|
||||||
|
f.setReturnType("i32");
|
||||||
|
|
||||||
|
const c = f.getCodeBuilder();
|
||||||
|
|
||||||
|
f.addCode(c.i32_const(builder.header.NPublic));
|
||||||
|
}
|
||||||
|
|
||||||
function buildGetFrLen() {
|
function buildGetFrLen() {
|
||||||
const f = module.addFunction("getFrLen");
|
const f = module.addFunction("getFrLen");
|
||||||
f.setReturnType("i32");
|
f.setReturnType("i32");
|
||||||
@@ -892,6 +901,7 @@ module.exports = function buildRuntime(module, builder) {
|
|||||||
buildCheckAssert();
|
buildCheckAssert();
|
||||||
|
|
||||||
buildGetNVars();
|
buildGetNVars();
|
||||||
|
buildGetNPublic();
|
||||||
buildGetFrLen();
|
buildGetFrLen();
|
||||||
buildGetPWitness();
|
buildGetPWitness();
|
||||||
buildGetPRawPrime();
|
buildGetPRawPrime();
|
||||||
@@ -901,6 +911,7 @@ module.exports = function buildRuntime(module, builder) {
|
|||||||
|
|
||||||
module.exportFunction("init");
|
module.exportFunction("init");
|
||||||
module.exportFunction("getNVars");
|
module.exportFunction("getNVars");
|
||||||
|
module.exportFunction("getNPublic");
|
||||||
module.exportFunction("getFrLen");
|
module.exportFunction("getFrLen");
|
||||||
module.exportFunction("getSignalOffset32");
|
module.exportFunction("getSignalOffset32");
|
||||||
module.exportFunction("setSignal");
|
module.exportFunction("setSignal");
|
||||||
|
|||||||
@@ -781,20 +781,21 @@ class BuilderWasm {
|
|||||||
|
|
||||||
_buildHeader(module) {
|
_buildHeader(module) {
|
||||||
|
|
||||||
this.pCircuit = module.alloc(48);
|
this.pCircuit = module.alloc(52);
|
||||||
|
|
||||||
this.pNSignals = this.pCircuit;
|
this.pNSignals = this.pCircuit;
|
||||||
this.pNComponents = this.pCircuit + 4;
|
this.pNComponents = this.pCircuit + 4;
|
||||||
this.pNInputs = this.pCircuit + 8;
|
this.pNInputs = this.pCircuit + 8;
|
||||||
this.pNOutputs = this.pCircuit + 12;
|
this.pNOutputs = this.pCircuit + 12;
|
||||||
this.pNVars = this.pCircuit + 16;
|
this.pNVars = this.pCircuit + 16;
|
||||||
this.ppWit2sig = this.pCircuit + 20;
|
this.pNPublic = this.pCircuit + 20;
|
||||||
this.ppComponents = this.pCircuit + 24;
|
this.ppWit2sig = this.pCircuit + 24;
|
||||||
this.ppMapIsInput = this.pCircuit + 28;
|
this.ppComponents = this.pCircuit + 28;
|
||||||
this.ppConstants = this.pCircuit + 32;
|
this.ppMapIsInput = this.pCircuit + 32;
|
||||||
this.ppSignals = this.pCircuit + 36;
|
this.ppConstants = this.pCircuit + 36;
|
||||||
this.ppInputSignalsToTrigger = this.pCircuit + 40;
|
this.ppSignals = this.pCircuit + 40;
|
||||||
this.ppSignalsAssigned = this.pCircuit + 44;
|
this.ppInputSignalsToTrigger = this.pCircuit + 44;
|
||||||
|
this.ppSignalsAssigned = this.pCircuit + 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildSizes(module) {
|
_buildSizes(module) {
|
||||||
@@ -985,6 +986,7 @@ class BuilderWasm {
|
|||||||
module.addData(this.pNInputs, intToBytes32(this.header.NInputs));
|
module.addData(this.pNInputs, intToBytes32(this.header.NInputs));
|
||||||
module.addData(this.pNOutputs, intToBytes32(this.header.NOutputs));
|
module.addData(this.pNOutputs, intToBytes32(this.header.NOutputs));
|
||||||
module.addData(this.pNVars, intToBytes32(this.header.NVars));
|
module.addData(this.pNVars, intToBytes32(this.header.NVars));
|
||||||
|
module.addData(this.pNPublic, intToBytes32(this.header.NPublic));
|
||||||
module.addData(this.ppWit2sig, intToBytes32(this.pWit2sig));
|
module.addData(this.ppWit2sig, intToBytes32(this.pWit2sig));
|
||||||
module.addData(this.ppComponents, intToBytes32(this.pComponents));
|
module.addData(this.ppComponents, intToBytes32(this.pComponents));
|
||||||
module.addData(this.ppMapIsInput, intToBytes32(this.pMapIsInput));
|
module.addData(this.ppMapIsInput, intToBytes32(this.pMapIsInput));
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ function buildHeader(ctx) {
|
|||||||
NInputs: ctx.components[ ctx.getComponentIdx("main") ].nInSignals,
|
NInputs: ctx.components[ ctx.getComponentIdx("main") ].nInSignals,
|
||||||
NOutputs: ctx.totals[ ctx.stOUTPUT ],
|
NOutputs: ctx.totals[ ctx.stOUTPUT ],
|
||||||
NVars: ctx.totals[ctx.stONE] + ctx.totals[ctx.stOUTPUT] + ctx.totals[ctx.stPUBINPUT] + ctx.totals[ctx.stPRVINPUT] + ctx.totals[ctx.stINTERNAL],
|
NVars: ctx.totals[ctx.stONE] + ctx.totals[ctx.stOUTPUT] + ctx.totals[ctx.stPUBINPUT] + ctx.totals[ctx.stPRVINPUT] + ctx.totals[ctx.stINTERNAL],
|
||||||
|
NPublic: ctx.totals[ctx.stOUTPUT] + ctx.totals[ctx.stPUBINPUT],
|
||||||
P: ctx.F.p
|
P: ctx.F.p
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user