semaphore-protocol / semaphore

A zero-knowledge protocol for anonymous interactions.
https://semaphore.pse.dev
MIT License
899 stars 194 forks source link

SnarkJS setup phase never finishes #35

Closed oskarth closed 4 years ago

oskarth commented 4 years ago

./do_setup.sh and it gets stuck on:

..
+ NODE_OPTIONS=--max-old-space-size=4096
+ npx snarkjs setup --protocol groth
(...)

For hours. This is on Linux with a recent X1 (Intel i7 gen 8, 16GB RAM).

For comparison, a basic multiplier circuit works:

> snarkjs info -c circuit.json 
# Wires: 4
# Constraints: 1
# Private Inputs: 2
# Public Inputs: 0
# Outputs: 1
> time snarkjs setup --protocol groth

real    0m1.014s
user    0m1.096s
sys 0m0.047s
> ls
circuit.json  proving_key.json  verification_key.json

My hunch would be that the circuit is "too big":

> snarkjs info -c circuit.json 
# Wires: 69197
# Constraints: 59213
# Private Inputs: 48
# Public Inputs: 2
# Outputs: 2

It's not clear to me what the bottlenecks are and what instrumentation might be useful, e.g. I notice there's some NODE_OPTIONS=--max-old-space-size=4096 flag that I suppose is meant to help.

Same thing happens if I execute the command in the snarks folder without using the shell/npx wrapper.

For what its worth, using the original Semaphore library I was able to complete the setup phase (based on libsnarks, not circom).

Any ideas @kobigurk?

weijiekoh commented 4 years ago

Hi,

What's your Node version? It should work with 11.14.0.

Is this URL accessible for you if you're logged in to CircleCI via Github? https://app.circleci.com/jobs/github/weijiekoh/semaphore/140

It's running a new build and unless something's broken, the setup should be done in about an hour.

Hope this helps!

oskarth commented 4 years ago

Hi @weijiekoh, my node version for this run is v9.12.2 - I explicitly downgraded from v13 in order to get around this issue with an outdated package: https://github.com/kobigurk/semaphore/issues/33

(I tried switching to v11.14.0 for the setup step specifically, will update with result)

https://app.circleci.com/jobs/github/weijiekoh/semaphore/140

I get a 404 from that one while being logged into Github

UPDATE: After ~70m running setup step with Node v11 it finished! Thanks :)

weijiekoh commented 4 years ago

Awesome! Glad to hear it worked!