add witness computation graph extraction to the workflow

This commit is contained in:
Balazs Komuves 2025-03-14 17:52:38 +01:00
parent 7f2d23a318
commit 180e00434c
No known key found for this signature in database
GPG Key ID: F63B7AEF18435562
2 changed files with 18 additions and 1 deletions

View File

@ -61,6 +61,7 @@ TODO:
### Preliminaries
- install `circom`, `snarkjs`, `rapidsnark`: <https://docs.circom.io/getting-started/installation>
- optionally install `circom-witnesscalc`: <https://github.com/iden3/circom-witnesscalc/>
- install Nim: <https://nim-lang.org/>
Build the Nim cli proof input generator:
@ -105,7 +106,12 @@ After that, the first real step is to create the main component:
Then compile the circuit:
$ circom --r1cs --wasm --O2 -l../../circuit proof_main.circom
$ export CIRCUIT_LIBDIRS="-l../../circuit/lib -l../../circuit/poseidon2 -l../../circuit/codex"
$ circom --r1cs --wasm --O2 ${CIRCUIT_LIBDIRS} proof_main.circom
### Optionally extract the witness computation graph
$ build-circuit proof_main.circom proof_main_graph.bin ${CIRCUIT_LIBDIRS}
### Do the circuit-specific setup

View File

@ -8,6 +8,17 @@ source ./cli_args.sh
mkdir -p build
cd build
# --- export the witness computation graph ---
if command -v build-circuit
then
CIRCUIT_INCLUDES="-l${CIRCUIT_LIB_DIR} -l${CIRCUIT_POS_DIR} -l${CIRCUIT_PRF_DIR}"
build-circuit ${CIRCUIT_MAIN}.circom ${CIRCUIT_MAIN}_graph.bin ${CIRCUIT_INCLUDES}
else
echo " "
echo "\`circom-witnesscalc\` not found; skipping graph extraction"
fi
# --- generate input for the circuit ---
echo ""