Comparing version 0.0.15 to 0.0.16
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "r1cs file format parser", | ||
@@ -39,4 +39,5 @@ "main": "./build/main.cjs", | ||
"dependencies": { | ||
"fastfile": "0.0.16", | ||
"ffjavascript": "0.2.4" | ||
"@iden3/bigarray": "0.0.2", | ||
"fastfile": "0.0.18", | ||
"ffjavascript": "0.2.22" | ||
}, | ||
@@ -43,0 +44,0 @@ "devDependencies": { |
import {Scalar, ZqField} from "ffjavascript"; | ||
import * as fastFile from "fastfile"; | ||
import BigArray from "@iden3/bigarray"; | ||
async function readBinFile(fileName, type, maxVersion) { | ||
const fd = await fastFile.readExisting(fileName, 1<<20, 1<<22); | ||
const fd = await fastFile.readExisting(fileName, 1<<27, 1<<29); | ||
@@ -84,3 +85,3 @@ const b = await fd.read(4); | ||
export async function load(fileName, loadConstraints, loadMap) { | ||
export async function load(fileName, loadConstraints, loadMap, logger) { | ||
@@ -93,4 +94,9 @@ const {fd, sections} = await readBinFile(fileName, "r1cs", 1); | ||
await startReadUniqueSection(fd, sections, 2); | ||
res.constraints = []; | ||
if (res.nConstraints>1<<20) { | ||
res.constraints = new BigArray(); | ||
} else { | ||
res.constraints = []; | ||
} | ||
for (let i=0; i<res.nConstraints; i++) { | ||
if ((logger)&&(i%10000 == 0)) logger.info(`Loading constraints: ${i}/${res.nConstraints}`); | ||
const c = await readConstraint(); | ||
@@ -106,4 +112,7 @@ res.constraints.push(c); | ||
await startReadUniqueSection(fd, sections, 3); | ||
res.map = []; | ||
if (res.nVars>1<<20) { | ||
res.map = new BigArray(); | ||
} else { | ||
res.map = []; | ||
} | ||
for (let i=0; i<res.nVars; i++) { | ||
@@ -131,5 +140,7 @@ const idx = await fd.readULE64(); | ||
const nIdx = await fd.readULE32(); | ||
const buff = await fd.read( (4+res.n8)*nIdx ); | ||
const buffV = new DataView(buff.buffer); | ||
for (let i=0; i<nIdx; i++) { | ||
const idx = await fd.readULE32(); | ||
const val = res.Fr.e(await readBigInt(fd, res.n8)); | ||
const idx = buffV.getUint32(i*(4+res.n8), true); | ||
const val = res.Fr.fromRprLE(buff, i*(4+res.n8)+4); | ||
lc[idx] = val; | ||
@@ -136,0 +147,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126802
428
3
+ Added@iden3/bigarray@0.0.2
+ Added@iden3/bigarray@0.0.2(transitive)
+ Addedfastfile@0.0.18(transitive)
+ Addedffjavascript@0.2.22(transitive)
+ Addedwasmcurves@0.0.12(transitive)
- Removedfastfile@0.0.16(transitive)
- Removedffjavascript@0.2.4(transitive)
- Removedwasmcurves@0.0.4(transitive)
Updatedfastfile@0.0.18
Updatedffjavascript@0.2.22