From 7264325fc54030b7de9527ba21b9845503032def Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Mon, 20 Mar 2023 19:03:03 -0600 Subject: [PATCH] build circuits --- .github/workflows/ci.yml | 2 ++ scripts/circuit-prep.sh | 29 +++-------------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43623f4..56a247a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,5 +27,7 @@ jobs: key: ${{ runner.os }}-circom-${{ hashFiles('./scripts/install-circom.sh') }} - name: Install circom if not cached run: sh ./scripts/install-circom.sh + - name: Build circuits + run: sh ./scripts/circuit-prep.sh - name: Run the tests run: RUST_BACKTRACE=full cargo test -r diff --git a/scripts/circuit-prep.sh b/scripts/circuit-prep.sh index a008fba..4d6b65a 100755 --- a/scripts/circuit-prep.sh +++ b/scripts/circuit-prep.sh @@ -1,28 +1,5 @@ #!/bin/bash -set -e -set -x - -CIRCUIT=`basename $1` -POWER="${2:-12}" -CURVE="${3:-bn128}" - -POTPREFIX=pot${POWER}_${CURVE} - -if [ ! -f ${POTPREFIX}_final.ptau ] -then - snarkjs powersoftau new $CURVE $POWER ${POTPREFIX}_0000.ptau -v - snarkjs powersoftau contribute ${POTPREFIX}_0000.ptau ${POTPREFIX}_0001.ptau --name="First contribution" -v -e="random text" - snarkjs powersoftau verify ${POTPREFIX}_0001.ptau - snarkjs powersoftau beacon ${POTPREFIX}_0001.ptau ${POTPREFIX}_beacon.ptau 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 10 -n="Final Beacon" - snarkjs powersoftau prepare phase2 ${POTPREFIX}_beacon.ptau ${POTPREFIX}_final.ptau -v - snarkjs powersoftau verify ${POTPREFIX}_final.ptau -fi - -# phase 2 -circom $1.circom --r1cs --wasm - -snarkjs groth16 setup ${CIRCUIT}.r1cs ${POTPREFIX}_final.ptau ${CIRCUIT}_0000.zkey -snarkjs zkey contribute ${CIRCUIT}_0000.zkey ${CIRCUIT}_0001.zkey --name="1st Contributor Name" -v -e="another random text" -snarkjs zkey verify ${CIRCUIT}.r1cs ${POTPREFIX}_final.ptau ${CIRCUIT}_0001.zkey -snarkjs zkey beacon ${CIRCUIT}_0001.zkey ${CIRCUIT}_final.zkey 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 10 -n="Final Beacon phase2" +circom src/circuit_tests/poseidon-digest-test.circom --r1cs --wasm +circom src/circuit_tests/poseidon-hash-test.circom --r1cs --wasm +circom src/circuit_tests/storer-test.circom --r1cs --wasm