mirror of
https://github.com/logos-storage/zk-benchmarks.git
synced 2026-01-07 00:03:06 +00:00
clean up Poseidon2 snark proof scripts
This commit is contained in:
parent
1c00f1a483
commit
b3e839ae21
@ -1,15 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z ${ZKBENCH_INPUT_SIZE} ]; then
|
||||
ZKBENCH_INPUT_SIZE=256
|
||||
fi
|
||||
|
||||
if [ -z ${ZKBENCH_WHICH} ]; then
|
||||
ZKBENCH_WHICH="hash_sponge"
|
||||
fi
|
||||
|
||||
ORIG=`pwd`
|
||||
|
||||
mkdir -p build
|
||||
|
||||
gcc -O3 generate_input.c -o build/generate_input || { echo "gcc failed"; exit 101; }
|
||||
|
||||
sed "s/ZKBENCH_INPUT_SIZE/${ZKBENCH_INPUT_SIZE}/g" hash_sponge.circom.template >build/hash_sponge.circom
|
||||
NAME=${ZKBENCH_WHICH}
|
||||
sed "s/ZKBENCH_INPUT_SIZE/${ZKBENCH_INPUT_SIZE}/g" ${NAME}.circom.template >build/${NAME}.circom
|
||||
|
||||
cd build
|
||||
|
||||
circom hash_sponge.circom --r1cs --wasm || { echo "circom failed"; exit 102; }
|
||||
circom ${NAME}.circom --r1cs --wasm || { echo "circom failed"; exit 102; }
|
||||
|
||||
cd $ORIG
|
||||
@ -1,11 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z ${ZKBENCH_PROVER} ]; then
|
||||
ZKBENCH_PROVER="snarkjs"
|
||||
fi
|
||||
|
||||
if [ -z ${ZKBENCH_WHICH} ]; then
|
||||
ZKBENCH_WHICH="hash_sponge"
|
||||
fi
|
||||
|
||||
ORIG=`pwd`
|
||||
|
||||
cd build
|
||||
|
||||
NAME="hash_sponge"
|
||||
echo "generating proof with snarkjs"
|
||||
snarkjs groth16 prove ${NAME}_prover.zkey ${NAME}_witness.wtns ${NAME}_proof.json ${NAME}_public.json
|
||||
echo "generating proof with ${ZKBENCH_PROVER}"
|
||||
case $ZKBENCH_PROVER in
|
||||
snarkjs)
|
||||
NAME="${ZKBENCH_WHICH}"
|
||||
snarkjs groth16 prove ${NAME}_prover.zkey ${NAME}_witness.wtns ${NAME}_proof.json ${NAME}_public.json
|
||||
;;
|
||||
rapidsnark)
|
||||
NAME="${ZKBENCH_WHICH}"
|
||||
rapidsnark ${NAME}_prover.zkey ${NAME}_witness.wtns ${NAME}_proof.json ${NAME}_public.json
|
||||
;;
|
||||
*)
|
||||
echo "unknown prover \`$ZKBENCH_PROVER\`"
|
||||
exit 99
|
||||
;;
|
||||
esac
|
||||
|
||||
cd $ORIG
|
||||
|
||||
@ -1,20 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z ${ZKBENCH_WHICH} ]; then
|
||||
ZKBENCH_WHICH="hash_sponge"
|
||||
fi
|
||||
|
||||
ORIG=`pwd`
|
||||
ROOT="${ORIG}/../../../../"
|
||||
|
||||
cd build
|
||||
|
||||
echo "generating input..."
|
||||
./generate_input $ZKBENCH_INPUT_SIZE >input.json
|
||||
|
||||
echo "generating witness..."
|
||||
NAME="hash_sponge"
|
||||
cd ${NAME}_js
|
||||
node generate_witness.js ${NAME}.wasm ../input.json ../${NAME}_witness.wtns || { echo "witness gen failed"; exit 101; }
|
||||
cd ..
|
||||
|
||||
echo "circuit-specific ceremony..."
|
||||
NAME="${ZKBENCH_WHICH}"
|
||||
snarkjs groth16 setup ${NAME}.r1cs ${ROOT}/ceremony/ceremony.ptau ${NAME}_0000.zkey
|
||||
echo "some_entropy" | snarkjs zkey contribute ${NAME}_0000.zkey ${NAME}_0001.zkey --name="1st Contributor Name"
|
||||
rm ${NAME}_0000.zkey
|
||||
|
||||
24
hash/snark/bench/Poseidon2/witness.sh
Executable file
24
hash/snark/bench/Poseidon2/witness.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z ${ZKBENCH_INPUT_SIZE} ]; then
|
||||
ZKBENCH_INPUT_SIZE=256
|
||||
fi
|
||||
|
||||
if [ -z ${ZKBENCH_WHICH} ]; then
|
||||
ZKBENCH_WHICH="hash_sponge"
|
||||
fi
|
||||
|
||||
ORIG=`pwd`
|
||||
|
||||
cd build
|
||||
|
||||
echo "generating input..."
|
||||
./generate_input $ZKBENCH_INPUT_SIZE >input.json
|
||||
|
||||
echo "generating witness... (WASM)"
|
||||
NAME="${ZKBENCH_WHICH}"
|
||||
cd ${NAME}_js
|
||||
node generate_witness.js ${NAME}.wasm ../input.json ../${NAME}_witness.wtns || { echo "witness gen failed"; exit 101; }
|
||||
cd ..
|
||||
|
||||
cd $ORIG
|
||||
Loading…
x
Reference in New Issue
Block a user