johnson86tw / maci

Minimal anti collusion infrastructure
https://appliedzkp.github.io/maci/
Other
0 stars 1 forks source link

Fail to run buildBatchUpdateStateTreeSnark #1

Closed johnson86tw closed 2 years ago

johnson86tw commented 2 years ago
❯ cd ../circuits
❯ npm run buildBatchUpdateStateTreeSnark

> maci-circuits@0.9.1 buildBatchUpdateStateTreeSnark /home/johnson/maci/circuits
> ./scripts/buildBatchUpdateStateTreeSnark.sh

Compiling circom/test/batchUpdateStateTree_test.circom...
Generated params/batchUstCircuit.r1cs
Error: exec: /home/johnson/maci/circuits/params/main.cpp:13:10: fatal error: nlohmann/json.hpp: No such file or directory
   13 | #include <nlohmann/json.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/johnson/maci/circuits/params/calcwit.hpp:4,
                 from /home/johnson/maci/circuits/params/calcwit.cpp:10:
/home/johnson/maci/circuits/params/circom.hpp:4:10: fatal error: gmp.h: No such file or directory
    4 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
In file included from /home/johnson/maci/circuits/params/utils.hpp:4,
                 from /home/johnson/maci/circuits/params/utils.cpp:7:
/home/johnson/maci/circuits/params/circom.hpp:4:10: fatal error: gmp.h: No such file or directory
    4 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
In file included from /home/johnson/maci/circuits/params/fr.cpp:1:
/home/johnson/maci/circuits/params/fr.hpp:6:10: fatal error: gmp.h: No such file or directory
    6 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
In file included from params/batchUst.c:1:
params/circom.hpp:4:10: fatal error: gmp.h: No such file or directory
    4 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.

    at Object.error (/home/johnson/maci/circuits/node_modules/shelljs/src/common.js:110:27)
    at execSync (/home/johnson/maci/circuits/node_modules/shelljs/src/exec.js:102:12)
    at Object._exec (/home/johnson/maci/circuits/node_modules/shelljs/src/exec.js:205:12)
    at Object.exec (/home/johnson/maci/circuits/node_modules/shelljs/src/common.js:335:23)
    at main (/home/johnson/maci/circuits/build/buildSnarks.js:116:15)
    at Object.<anonymous> (/home/johnson/maci/circuits/build/buildSnarks.js:138:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
johnson86tw commented 2 years ago

Solution: sudo apt-get install build-essential libgmp-dev libsodium-dev nasm nlohmann-json3-dev

Successfully run buildBatchUpdateStateTreeSnark

Output:

❯ npm run buildBatchUpdateStateTreeSnark

> maci-circuits@0.9.1 buildBatchUpdateStateTreeSnark /home/johnson/maci/circuits
> ./scripts/buildBatchUpdateStateTreeSnark.sh

params/batchUstCircuit.r1cs exists. Skipping compilation.
Generating params file...
Loading circuit from params/batchUstCircuit.r1cs...
Generating trusted setup parameters...
Has generated 81381 points
Writing to file...
Saved parameters to params/batchUst.params
Exporting verification key...
Exporting params/batchUst.params...
Created params/batchUstPk.json and params/batchUstVk.json.
Generated params/batchUstPk.json and params/batchUstVk.json
Generating Solidity verifier...
Copying BatchUpdateStateTreeVerifier.sol to contracts/sol.