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

chore: acir tests are no longer base64 encoded #1854

Merged
merged 24 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a11594e
try remove base64
kevaundray Aug 29, 2023
ddb2555
base64 decode file
kevaundray Aug 29, 2023
5867798
Merge branch 'master' into kw/try-remove-b64
kevaundray Aug 29, 2023
d54f9ca
Empty-Commit
kevaundray Aug 29, 2023
a676504
Merge branch 'kw/try-remove-b64' of github.com:AztecProtocol/aztec-pa…
kevaundray Aug 29, 2023
311ce9c
Merge remote-tracking branch 'origin/master' into kw/try-remove-b64
kevaundray Aug 31, 2023
8478337
remove .json for .bytecode
kevaundray Aug 31, 2023
e9cbb70
remove test when building dockerfile should be a part of yarn test
kevaundray Aug 31, 2023
32c4538
Merge branch 'master' into kw/try-remove-b64
kevaundray Aug 31, 2023
ab12d74
remove extraneous buffer instance
kevaundray Aug 31, 2023
3d6bf04
Merge branch 'master' into kw/try-remove-b64
kevaundray Sep 1, 2023
0b30745
revert branch rename
kevaundray Sep 1, 2023
22857bf
Merge remote-tracking branch 'origin/master' into kw/try-remove-b64
kevaundray Sep 4, 2023
a1b48a5
use witness.gz and acir.gz
kevaundray Sep 4, 2023
16079ee
change files in bin-test
kevaundray Sep 4, 2023
4fc906a
remove utf8 when reading file
kevaundray Sep 4, 2023
603a7a7
formatting
kevaundray Sep 4, 2023
88e89a9
Merge remote-tracking branch 'origin/master' into kw/try-remove-b64
kevaundray Sep 4, 2023
51eb53b
modify bb bash scripts
kevaundray Sep 4, 2023
660becd
rename extension
kevaundray Sep 4, 2023
e1f12d2
expand description
kevaundray Sep 4, 2023
339053e
use acir.gz instead of DIR_NAME.bytecode
kevaundray Sep 4, 2023
98f47a2
remove base64 encoding as this is ran on acir_tests
kevaundray Sep 4, 2023
5b32bef
Update run_acir_tests.sh
kevaundray Sep 5, 2023
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
4 changes: 1 addition & 3 deletions circuits/cpp/barretenberg/acir_tests/flows/all_cmds.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions circuits/cpp/barretenberg/acir_tests/headless-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -60,13 +60,13 @@ program
)
.option(
"-b, --bytecode-path <path>",
"Specify the bytecode path",
"./target/main.bytecode"
"Specify the path to the gzip encoded ACIR bytecode",
"./target/acir.gz"
)
.option(
"-w, --witness-path <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);
Expand Down
6 changes: 3 additions & 3 deletions circuits/cpp/barretenberg/acir_tests/run_acir_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
*/
inline std::vector<uint8_t> get_bytecode(const std::string& bytecodePath)
{
std::string command = "cat " + bytecodePath + " | base64 -d | gunzip";
std::string command = "gunzip -c \"" + bytecodePath + "\"";
return exec_pipe(command);
}
4 changes: 2 additions & 2 deletions circuits/cpp/barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Binary file not shown.
Binary file not shown.
19 changes: 9 additions & 10 deletions circuits/cpp/barretenberg/ts/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 <path>', 'Specify the bytecode path', './target/main.bytecode')
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.tr')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/acir.gz')
.option('-w, --witness-path <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();
Expand All @@ -262,8 +261,8 @@ program
program
.command('prove')
.description('Generate a proof and write it to a file.')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/main.bytecode')
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.tr')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/acir.gz')
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.gz')
.option('-r, --recursive', 'prove using recursive prover', false)
.option('-o, --output-path <path>', 'Specify the proof output path', './proofs/proof')
.action(async ({ bytecodePath, witnessPath, recursive, outputPath, crsPath }) => {
Expand All @@ -274,7 +273,7 @@ program
program
.command('gates')
.description('Print gate count to standard output.')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/main.bytecode')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/acir.gz')
.action(async ({ bytecodePath: bytecodePath }) => {
handleGlobalOptions();
await gateCount(bytecodePath);
Expand All @@ -295,7 +294,7 @@ program
program
.command('contract')
.description('Output solidity verification key contract.')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/main.bytecode')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/acir.gz')
.option('-o, --output-path <path>', 'Specify the path to write the contract', './target/contract.sol')
.requiredOption('-k, --vk-path <path>', 'Path to a verification key. avoids recomputation.')
.action(async ({ outputPath, vkPath }) => {
Expand All @@ -306,7 +305,7 @@ program
program
.command('write_vk')
.description('Output verification key.')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/main.bytecode')
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/acir.gz')
.requiredOption('-o, --output-path <path>', 'Specify the path to write the key')
.action(async ({ bytecodePath, outputPath, crsPath }) => {
handleGlobalOptions();
Expand Down