diff --git a/acir_tests/flows/all_cmds.sh b/acir_tests/flows/all_cmds.sh index 1055f712a..dda4353fb 100755 --- a/acir_tests/flows/all_cmds.sh +++ b/acir_tests/flows/all_cmds.sh @@ -1,15 +1,13 @@ #!/bin/sh set -eu -NAME=$(basename $PWD) - if [ -n "${VERBOSE:-}" ]; then VFLAG="-v" else VFLAG="" fi -BFLAG="-b ./target/${NAME}.bytecode" +BFLAG="-b ./target/acir.gz" FLAGS="-c $CRS_PATH $VFLAG" # Test we can perform the proof/verify flow. diff --git a/acir_tests/flows/prove_and_verify.sh b/acir_tests/flows/prove_and_verify.sh index 945b6194d..216c3742a 100755 --- a/acir_tests/flows/prove_and_verify.sh +++ b/acir_tests/flows/prove_and_verify.sh @@ -1,10 +1,8 @@ #!/bin/sh set -eu -NAME=$(basename $PWD) - if [ -n "$VERBOSE" ]; then - $BIN prove_and_verify -v -c $CRS_PATH -b ./target/$NAME.bytecode + $BIN prove_and_verify -v -c $CRS_PATH -b ./target/acir.gz else - $BIN prove_and_verify -c $CRS_PATH -b ./target/$NAME.bytecode > /dev/null 2>&1 + $BIN prove_and_verify -c $CRS_PATH -b ./target/acir.gz > /dev/null 2>&1 fi \ No newline at end of file diff --git a/acir_tests/headless-test/src/index.ts b/acir_tests/headless-test/src/index.ts index 25ebf0332..5c91dc8fa 100644 --- a/acir_tests/headless-test/src/index.ts +++ b/acir_tests/headless-test/src/index.ts @@ -38,8 +38,8 @@ function formatAndPrintLog(message: string): void { } const readBytecodeFile = (path: string): Uint8Array => { - const data = fs.readFileSync(path, "ascii"); - const buffer = gunzipSync(Buffer.from(data, "base64")); + const data = fs.readFileSync(path); + const buffer = gunzipSync(data); return buffer; }; @@ -60,13 +60,13 @@ program ) .option( "-b, --bytecode-path ", - "Specify the bytecode path", - "./target/main.bytecode" + "Specify the path to the gzip encoded ACIR bytecode", + "./target/acir.gz" ) .option( "-w, --witness-path ", - "Specify the witness path", - "./target/witness.tr" + "Specify the path to the gzip encoded ACIR witness", + "./target/witness.gz" ) .action(async ({ bytecodePath, witnessPath, recursive }) => { const acir = readBytecodeFile(bytecodePath); diff --git a/acir_tests/run_acir_tests.sh b/acir_tests/run_acir_tests.sh index ef0c71a03..7b97f2873 100755 --- a/acir_tests/run_acir_tests.sh +++ b/acir_tests/run_acir_tests.sh @@ -30,10 +30,10 @@ if [ ! -d acir_tests ]; then 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 crates/nargo_cli/tests/execution_success + git sparse-checkout set crates/nargo_cli/tests/acir_artifacts git checkout cd .. - mv noir/crates/nargo_cli/tests/execution_success acir_tests + mv noir/crates/nargo_cli/tests/acir_artifacts acir_tests rm -rf noir fi fi @@ -73,7 +73,7 @@ else continue fi - if [[ ! -f ./$TEST_NAME/target/$TEST_NAME.bytecode || ! -f ./$TEST_NAME/target/witness.tr ]]; then + if [[ ! -f ./$TEST_NAME/target/acir.gz || ! -f ./$TEST_NAME/target/witness.gz ]]; then echo -e "\033[33mSKIPPED\033[0m (uncompiled)" continue fi diff --git a/cpp/bin-test/target/acir.gz b/cpp/bin-test/target/acir.gz new file mode 100644 index 000000000..d1fe5b039 Binary files /dev/null and b/cpp/bin-test/target/acir.gz differ diff --git a/cpp/bin-test/target/witness.gz b/cpp/bin-test/target/witness.gz new file mode 100644 index 000000000..b250bdfe7 Binary files /dev/null and b/cpp/bin-test/target/witness.gz differ diff --git a/cpp/src/barretenberg/bb/get_bytecode.hpp b/cpp/src/barretenberg/bb/get_bytecode.hpp index 2b59e9b4f..2c7af46cf 100644 --- a/cpp/src/barretenberg/bb/get_bytecode.hpp +++ b/cpp/src/barretenberg/bb/get_bytecode.hpp @@ -6,6 +6,6 @@ */ inline std::vector get_bytecode(const std::string& bytecodePath) { - std::string command = "cat " + bytecodePath + " | base64 -d | gunzip"; + std::string command = "gunzip -c \"" + bytecodePath + "\""; return exec_pipe(command); } \ No newline at end of file diff --git a/cpp/src/barretenberg/bb/main.cpp b/cpp/src/barretenberg/bb/main.cpp index 3ca8df8ba..3b527b5db 100644 --- a/cpp/src/barretenberg/bb/main.cpp +++ b/cpp/src/barretenberg/bb/main.cpp @@ -293,8 +293,8 @@ int main(int argc, char* argv[]) std::string command = args[0]; - std::string bytecode_path = getOption(args, "-b", "./target/main.bytecode"); - std::string witness_path = getOption(args, "-w", "./target/witness.tr"); + std::string bytecode_path = getOption(args, "-b", "./target/acir.gz"); + std::string witness_path = getOption(args, "-w", "./target/witness.gz"); std::string proof_path = getOption(args, "-p", "./proofs/proof"); std::string vk_path = getOption(args, "-k", "./target/vk"); CRS_PATH = getOption(args, "-c", "./crs"); diff --git a/ts/bin-test/target/acir.gz b/ts/bin-test/target/acir.gz new file mode 100644 index 000000000..d1fe5b039 Binary files /dev/null and b/ts/bin-test/target/acir.gz differ diff --git a/ts/bin-test/target/witness.gz b/ts/bin-test/target/witness.gz new file mode 100644 index 000000000..b250bdfe7 Binary files /dev/null and b/ts/bin-test/target/witness.gz differ diff --git a/ts/src/main.ts b/ts/src/main.ts index 664ae5ca0..187813af5 100755 --- a/ts/src/main.ts +++ b/ts/src/main.ts @@ -17,9 +17,8 @@ const debug = createDebug('bb.js'); const MAX_CIRCUIT_SIZE = 2 ** 19; function getBytecode(bytecodePath: string) { - const encodedCircuit = readFileSync(bytecodePath, 'utf-8'); - const buffer = Buffer.from(encodedCircuit, 'base64'); - const decompressed = gunzipSync(buffer); + const encodedCircuit = readFileSync(bytecodePath); + const decompressed = gunzipSync(encodedCircuit); return decompressed; } @@ -250,8 +249,8 @@ function handleGlobalOptions() { program .command('prove_and_verify') .description('Generate a proof and verify it. Process exits with success or failure code.') - .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/main.bytecode') - .option('-w, --witness-path ', 'Specify the witness path', './target/witness.tr') + .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/acir.gz') + .option('-w, --witness-path ', 'Specify the witness path', './target/witness.gz') .option('-r, --recursive', 'prove and verify using recursive prover and verifier', false) .action(async ({ bytecodePath, witnessPath, recursive, crsPath }) => { handleGlobalOptions(); @@ -262,8 +261,8 @@ program program .command('prove') .description('Generate a proof and write it to a file.') - .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/main.bytecode') - .option('-w, --witness-path ', 'Specify the witness path', './target/witness.tr') + .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/acir.gz') + .option('-w, --witness-path ', 'Specify the witness path', './target/witness.gz') .option('-r, --recursive', 'prove using recursive prover', false) .option('-o, --output-path ', 'Specify the proof output path', './proofs/proof') .action(async ({ bytecodePath, witnessPath, recursive, outputPath, crsPath }) => { @@ -274,7 +273,7 @@ program program .command('gates') .description('Print gate count to standard output.') - .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/main.bytecode') + .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/acir.gz') .action(async ({ bytecodePath: bytecodePath }) => { handleGlobalOptions(); await gateCount(bytecodePath); @@ -295,7 +294,7 @@ program program .command('contract') .description('Output solidity verification key contract.') - .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/main.bytecode') + .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/acir.gz') .option('-o, --output-path ', 'Specify the path to write the contract', './target/contract.sol') .requiredOption('-k, --vk-path ', 'Path to a verification key. avoids recomputation.') .action(async ({ outputPath, vkPath }) => { @@ -306,7 +305,7 @@ program program .command('write_vk') .description('Output verification key.') - .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/main.bytecode') + .option('-b, --bytecode-path ', 'Specify the bytecode path', './target/acir.gz') .requiredOption('-o, --output-path ', 'Specify the path to write the key') .action(async ({ bytecodePath, outputPath, crsPath }) => { handleGlobalOptions();