-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dsl): Update backend gateCount command to query a Program in a …
…single request (#6228) Resolves #6168 This PR does a very minor update to simply now go through the entire list of functions contained inside of a Program and generate a basic circuit report for each functions. Currently `nargo info` now takes in a JSON report that it works with instead of an individual printed gate count. This PR also does some initial work on making a gate report that is ready for noir-lang/noir-gates-diff. This is yet to be updated but has most of the initial skeleton needed to get a gates report for an entire workspace. Also, once noir-lang/noir#4975 is merged and synced into this repo we can remove the `bb info` command and rename `bb gates` -> `bb info` Nargo info still works as expected: <img width="662" alt="Screenshot 2024-05-08 at 2 55 32 PM" src="https://github.com/AztecProtocol/aztec-packages/assets/43554004/dab5e819-18c4-4bbd-a727-d4bf42f7b95c"> --------- Co-authored-by: Tom French <tom@tomfren.ch>
- Loading branch information
1 parent
eae5822
commit 8079f60
Showing
20 changed files
with
139 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
# TODO(https://github.com/noir-lang/noir/issues/4962): This script is still yet to be integrated with noir-lang/noir-gates-diff | ||
# The script needs some slight updating as `nargo info` expects a complete JSON object, while this script expects a single object field | ||
# representing a list of circuit reports for a program. | ||
# The ACIR tests in barretenberg also expect every target bytecode to have the name `acir.gz` while this script expects the same name of the package | ||
echo "Compile noir-protocol-circuits for gates report..." | ||
cd noir-protocol-circuits | ||
PROTOCOL_CIRCUITS_DIR=$PWD | ||
|
||
# Compile programs into artifacts that the backend expects | ||
NARGO=${NARGO:-../../noir/noir-repo/target/release/nargo} | ||
$NARGO compile --only-acir | ||
|
||
BB_BIN=${BB_BIN:-../../barretenberg/cpp/build/bin/bb} | ||
|
||
echo "{\"programs\": [" > gates_report.json | ||
|
||
# Bound for checking where to place last parentheses | ||
NUM_ARTIFACTS=$(ls -1q "$PROTOCOL_CIRCUITS_DIR/target"/*.gz | wc -l) | ||
|
||
ITER="1" | ||
for pathname in "$PROTOCOL_CIRCUITS_DIR/target"/*.gz; do | ||
ARTIFACT_NAME=$(basename -s .gz "$pathname") | ||
|
||
echo "{\"package_name\": \"$ARTIFACT_NAME\"," >> gates_report.json | ||
$BB_BIN gates -b "./target/$ARTIFACT_NAME.gz" >> gates_report.json | ||
|
||
if (($ITER == $NUM_ARTIFACTS)); then | ||
echo "}" >> gates_report.json | ||
else | ||
echo "}, " >> gates_report.json | ||
fi | ||
|
||
ITER=$(( $ITER + 1 )) | ||
done | ||
|
||
echo "]}" >> gates_report.json |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.