Compare commits

..

5 Commits

Author SHA1 Message Date
Jordi Baylina
42162b10c1 0.5.31 2020-11-21 20:40:27 +01:00
Jordi Baylina
a84873161f FIX discard unused signals 2020-11-21 20:40:11 +01:00
Jordi Baylina
9bf1354bf1 0.5.30 2020-10-14 09:50:22 +02:00
Jordi Baylina
ed4c4b4de0 Merge branch 'master' of github.com:iden3/circom 2020-10-14 09:49:51 +02:00
Marta Bellés
6e4a192c6a Update README.md 2020-10-05 10:12:00 +02:00
4 changed files with 22 additions and 11 deletions

View File

@@ -1,12 +1,15 @@
# Circom
Circom is a language designed to write arithmetic circuits that can be used in zero knowledge proofs.
Circom is a language designed to write arithmetic circuits that can be used in zero-knowledge proofs.
In particular, it is designed to work in [zksnarks JavaScript library](https://github.com/iden3/zksnark).
## Usage
### Circom Docs
You can read the details of circom in [the documentation webpage](https://docs.circom.io/).
### Tutorial
A good starting point [is this tutorial](https://github.com/iden3/circom/blob/master/TUTORIAL.md)

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "circom",
"version": "0.5.29",
"version": "0.5.31",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "circom",
"version": "0.5.29",
"version": "0.5.31",
"description": "Language to generate logic circuits",
"main": "index.js",
"directories": {

View File

@@ -183,28 +183,36 @@ function classifySignals(ctx) {
function priorize(t1, t2) {
if ((t1 == ERROR) || (t2==ERROR)) return ERROR;
if (t1 == ctx.stINTERNAL) {
return t2;
} else if (t2==ctx.stINTERNAL) {
return t1;
}
if ((t1 == ctx.stONE) || (t2 == ctx.stONE)) return ctx.stONE;
if ((t1 == ctx.stOUTPUT) || (t2 == ctx.stOUTPUT)) return ctx.stOUTPUT;
if ((t1 == ctx.stPUBINPUT) || (t2 == ctx.stPUBINPUT)) return ctx.stPUBINPUT;
if ((t1 == ctx.stPRVINPUT) || (t2 == ctx.stPRVINPUT)) return ctx.stPRVINPUT;
if ((t1 == ctx.stINTERNAL) || (t2 == ctx.stINTERNAL)) return ctx.stINTERNAL;
if ((t1 == ctx.stCONSTANT) || (t2 == ctx.stCONSTANT)) return ctx.stCONSTANT;
if ((t1 == ctx.stDISCARDED) || (t2 == ctx.stDISCARDED)) return ctx.stDISCARDED;
if (t1!=t2) return ERROR;
return t1;
}
for (let i=0; i<ctx.constraints.length; i++) {
if ((ctx.verbose)&&(i%100000 == 0)) console.log(`marking as internal: ${i}/${ctx.constraints.length}`);
const c = ctx.constraints[i];
for (let s in c.a.coefs) ctx.signals[s].c = ctx.stINTERNAL;
for (let s in c.b.coefs) ctx.signals[s].c = ctx.stINTERNAL;
for (let s in c.c.coefs) ctx.signals[s].c = ctx.stINTERNAL;
}
// First classify the signals
for (let s=0; s<ctx.signals.length; s++) {
if ((ctx.verbose)&&(s%100000 == 0)) console.log(`classify signals: ${s}/${ctx.signals.length}`);
const signal = ctx.signals[s];
let tAll = ctx.stINTERNAL;
let tAll = ctx.stDISCARDED;
let lSignal = signal;
let end = false;
while (!end) {
let t = lSignal.c || ctx.stINTERNAL;
let t = lSignal.c || ctx.stDISCARDED;
if (s == 0) {
t = ctx.stONE;
} else if (lSignal.o & ctx.MAIN) {