Browse Source

FIX: Error in wasm generation of big circuits

master
Jordi Baylina 4 years ago
parent
commit
c7c6b799ad
No known key found for this signature in database GPG Key ID: 7480C80C1BE43112
3 changed files with 20 additions and 20 deletions
  1. +3
    -3
      package-lock.json
  2. +1
    -1
      package.json
  3. +16
    -16
      ports/wasm/builder.js

+ 3
- 3
package-lock.json

@ -592,9 +592,9 @@
}
},
"ffjavascript": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.0.4.tgz",
"integrity": "sha512-6eiRvy+YuGCRjH4U8KdJbRel5VBW0zeuUL1FXQ+fFxTp5xv2ClqTfCYf5ClUtq0voGpd9XJAdUCvgIxHDbAQ0Q==",
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.0.5.tgz",
"integrity": "sha512-7je6PydOWLDUj3vU8JeCUgeezg4yrG/6qjlukQNuPHeeavnM4REcrN9LA2+xtqIMIPdx/wdUkPMQpixsz+CdIw==",
"requires": {
"big-integer": "^1.6.48"
}

+ 1
- 1
package.json

@ -33,7 +33,7 @@
"chai": "^4.2.0",
"circom_runtime": "0.0.3",
"ffiasm": "0.0.2",
"ffjavascript": "0.0.4",
"ffjavascript": "0.0.5",
"ffwasm": "0.0.6",
"fnv-plus": "^1.3.1",
"r1csfile": "0.0.3",

+ 16
- 16
ports/wasm/builder.js

@ -923,41 +923,41 @@ class BuilderWasm {
}
_buildComponents(module) {
const bytes = [];
const bytes = new Array(this.components.length*5*4);
bytes.length=0;
for (let i=0; i<this.components.length; i++) {
const c = this.components[i];
bytes.push(intToBytes32(this.hashMaps[c.hashMapName].pointer));
bytes.push(intToBytes32(this.componentEntriesTables[c.entryTableName].pointer));
bytes.push(intToBytes32(i));
bytes.push(intToBytes32(c.nInSignals));
bytes.push(intToBytes32(c.newThread ? 1 : 0));
bytes.push(...intToBytes32(this.hashMaps[c.hashMapName].pointer));
bytes.push(...intToBytes32(this.componentEntriesTables[c.entryTableName].pointer));
bytes.push(...intToBytes32(i));
bytes.push(...intToBytes32(c.nInSignals));
bytes.push(...intToBytes32(c.newThread ? 1 : 0));
module.addFunctionToTable(c.functionName);
}
const fBytes = [].concat(...bytes);
this.pComponents = module.alloc(fBytes);
this.pComponents = module.alloc(bytes);
}
_buildMapIsInput(module) {
const bytes = [];
const bytes = new Array(this.mapIsInput.length*4);
bytes.length=0;
for (let i=0; i<this.mapIsInput.length; i++) {
bytes.push(intToBytes32(this.mapIsInput[i]));
bytes.push(...intToBytes32(this.mapIsInput[i]));
}
const fBytes = [].concat(...bytes);
this.pMapIsInput = module.alloc(fBytes);
this.pMapIsInput = module.alloc(bytes);
}
_buildWit2Sig(module) {
const bytes = [];
const bytes = new Array(this.wit2sig.length*4);
bytes.length =0;
for (let i=0; i<this.wit2sig.length; i++) {
bytes.push(intToBytes32(this.wit2sig[i]));
bytes.push(...intToBytes32(this.wit2sig[i]));
}
const fBytes = [].concat(...bytes);
this.pWit2sig = module.alloc(fBytes);
this.pWit2sig = module.alloc(bytes);
}
_buildCircuitVar(module) {

Loading…
Cancel
Save