Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Cleanup gen_inner_proof_files.sh script. #3242

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions barretenberg/acir_tests/clone_test_vectors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -eu

# Pull down the test vectors from the noir repo, if we don't have the folder already.
if [ ! -d acir_tests ]; then
if [ -n "${TEST_SRC:-}" ]; then
cp -R $TEST_SRC acir_tests
else
rm -rf noir
git clone -b $BRANCH --filter=blob:none --no-checkout https://github.com/noir-lang/noir.git
cd noir
git sparse-checkout init --cone
git sparse-checkout set tooling/nargo_cli/tests/acir_artifacts
git checkout
cd ..
mv noir/tooling/nargo_cli/tests/acir_artifacts acir_tests
rm -rf noir
fi
fi
8 changes: 0 additions & 8 deletions barretenberg/acir_tests/flows/proof_as_fields.sh

This file was deleted.

21 changes: 0 additions & 21 deletions barretenberg/acir_tests/flows/prove.sh

This file was deleted.

8 changes: 0 additions & 8 deletions barretenberg/acir_tests/flows/vk_as_fields.sh

This file was deleted.

8 changes: 0 additions & 8 deletions barretenberg/acir_tests/flows/write_vk.sh

This file was deleted.

69 changes: 18 additions & 51 deletions barretenberg/acir_tests/gen_inner_proof_inputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,42 @@
set -eu

BIN=${BIN:-../cpp/build/bin/bb}
WRITE_VK_FLOW=${FLOW:-write_vk}
VK_FIELDS_FLOW=${FLOW:-vk_as_fields}
PROVE_FLOW=${FLOW:-prove}
PROOF_FIELDS_FLOW=${FLOW:-proof_as_fields}
CRS_PATH=~/.bb-crs
BRANCH=master
VERBOSE=${VERBOSE:-}
RECURSIVE=true
PROOF_NAME="proof_a"

WRITE_VK_FLOW_SCRIPT=$(realpath ./flows/${WRITE_VK_FLOW}.sh)
VK_FIELDS_FLOW_SCRIPT=$(realpath ./flows/${VK_FIELDS_FLOW}.sh)
PROVE_FLOW_SCRIPT=$(realpath ./flows/${PROVE_FLOW}.sh)
PROOF_FIELDS_FLOW_SCRIPT=$(realpath ./flows/${PROOF_FIELDS_FLOW}.sh)

if [ -f $BIN ]; then
BIN=$(realpath $BIN)
else
BIN=$(realpath $(which $BIN))
fi

export BIN CRS_PATH VERBOSE RECURSIVE PROOF_NAME

# Pull down the test vectors from the noir repo, if we don't have the folder already.
if [ ! -d acir_tests ]; then
if [ -n "${TEST_SRC:-}" ]; then
cp -R $TEST_SRC acir_tests
else
rm -rf noir
git clone -b $BRANCH --filter=blob:none --no-checkout https://github.com/noir-lang/noir.git
cd noir
git sparse-checkout init --cone
git sparse-checkout set tooling/nargo_cli/tests/acir_artifacts
git checkout
cd ..
mv noir/tooling/nargo_cli/tests/acir_artifacts acir_tests
rm -rf noir
fi
fi
export BRANCH

cd acir_tests
./clone_test_vectors.sh

cd assert_statement
cd acir_tests/assert_statement

PROOF_DIR=$PWD/proofs
PROOF_PATH=$PROOF_DIR/$PROOF_NAME
VFLAG=${VERBOSE:+-v}
RFLAG=${RECURSIVE:+-r}

echo -e "Write VK to file for assert_statement..\n"
set +e
$WRITE_VK_FLOW_SCRIPT
set -eu
echo "Write VK to file for assert_statement..."
$BIN write_vk $VFLAG -c $CRS_PATH -o

echo -e "Write VK as fields for recursion...\n"
set +e
$VK_FIELDS_FLOW_SCRIPT
set -eu
echo "Write VK as fields for recursion..."
$BIN vk_as_fields $VFLAG -c $CRS_PATH

echo -e "Generate proof to file...\n"
set +e
if [ ! -d "$PROOF_DIR" ]; then
mkdir $PWD/proofs
fi
if [ ! -e "$PROOF_PATH" ]; then
touch $PROOF_PATH
fi
$PROVE_FLOW_SCRIPT
set -eu
echo "Generate proof to file..."
[ -d "$PROOF_DIR" ] || mkdir $PWD/proofs
[ -e "$PROOF_PATH" ] || touch $PROOF_PATH
$BIN prove $VFLAG -c $CRS_PATH -b ./target/acir.gz -o "./proofs/$PROOF_NAME" $RFLAG

echo -e "Write proof as fields for recursion...\n"
set +e
$PROOF_FIELDS_FLOW_SCRIPT
set -eu
echo "Write proof as fields for recursion..."
$BIN proof_as_fields $VFLAG -c $CRS_PATH -p "./proofs/$PROOF_NAME"

cat ./proofs/${PROOF_NAME}_fields.json
echo
19 changes: 2 additions & 17 deletions barretenberg/acir_tests/run_acir_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,9 @@ else
BIN=$(realpath $(which $BIN))
fi

export BIN CRS_PATH VERBOSE
export BIN CRS_PATH VERBOSE BRANCH

# Pull down the test vectors from the noir repo, if we don't have the folder already.
if [ ! -d acir_tests ]; then
if [ -n "${TEST_SRC:-}" ]; then
cp -R $TEST_SRC acir_tests
else
rm -rf noir
git clone -b $BRANCH --filter=blob:none --no-checkout https://github.com/noir-lang/noir.git
cd noir
git sparse-checkout init --cone
git sparse-checkout set tooling/nargo_cli/tests/acir_artifacts
git checkout
cd ..
mv noir/tooling/nargo_cli/tests/acir_artifacts acir_tests
rm -rf noir
fi
fi
./clone_test_vectors.sh

cd acir_tests

Expand Down