Skip to content

Commit

Permalink
feat: use nargo compile --workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Sep 13, 2023
1 parent ba74d97 commit 9276771
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 68 deletions.
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/abis/ecdsa_account_contract.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/abis/schnorr_account_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion yarn-project/noir-compiler/src/noir-version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"tag": "aztec",
"commit": "39e1433a9c4184b72f3c5ab0368cfaa5d4ce537b"
"commit": "f173c05cbff96dfc48a22cc2f1f76396b968d5a0"
}
1 change: 0 additions & 1 deletion yarn-project/noir-contracts/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ RUN ./scripts/install_noirup.sh $(pwd)
ENV PATH="/usr/src/yarn-project/noir-contracts/.nargo/bin:${PATH}"

RUN ./scripts/install_noir.sh
RUN ./scripts/install_noir_backend.sh
RUN ./scripts/compile_ci.sh
RUN ./scripts/nargo_test_ci.sh
4 changes: 2 additions & 2 deletions yarn-project/noir-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests",
"noir:clean": "rm -rf ./src/artifacts ./src/types && mkdir -p ../aztec.js/src/abis/ && find ../aztec.js/src/abis/ -mindepth 1 -delete",
"noir:clean": "rm -rf ./src/artifacts ./src/types && mkdir -p ../aztec.js/src/abis/ && find ../aztec.js/src/abis/ -mindepth 1 -delete && rm -r target/",
"noir:build": "./src/scripts/compile.sh",
"noir:build:all": "yarn noir:clean && ./src/scripts/compile.sh $(./scripts/get_all_contracts.sh)",
"noir:build:all": "yarn noir:clean && ./src/scripts/compile_all.sh $(./scripts/get_all_contracts.sh)",
"noir:types:all": "./scripts/types.sh $(./scripts/get_all_contracts.sh)"
},
"inherits": [
Expand Down
19 changes: 19 additions & 0 deletions yarn-project/noir-contracts/scripts/catch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Handler for SIGCHLD, cleanup if child exit with error, used by nargo_test.sh and compile.sh
handle_sigchld() {
for pid in "${pids[@]}"; do
# If process is no longer running
if ! kill -0 "$pid" 2>/dev/null; then
# Wait for the process and get exit status
wait "$pid"
status=$?

# If exit status is error
if [ $status -ne 0 ]; then
# Create error file
touch "$error_file"
fi
fi
done
}
20 changes: 2 additions & 18 deletions yarn-project/noir-contracts/scripts/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,15 @@

# Compiles noir contracts in parallel, bubbling any compilation errors

source ./scripts/catch.sh

ROOT=$(pwd)

# Error flag file
error_file="/tmp/error.$$"
# Array of child PIDs
pids=()

# Handler for SIGCHLD, cleanup if child exit with error
handle_sigchld() {
for pid in "${pids[@]}"; do
# If process is no longer running
if ! kill -0 "$pid" 2>/dev/null; then
# Wait for the process and get exit status
wait "$pid"
status=$?

# If exit status is error
if [ $status -ne 0 ]; then
# Create error file
touch "$error_file"
fi
fi
done
}

# Set SIGCHLD handler
trap handle_sigchld SIGCHLD # Trap any ERR signal and call the custom error handler

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/noir-contracts/scripts/compile_ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

# Runs the compile scripts for all contracts.

./scripts/compile.sh $(./scripts/get_all_contracts.sh)
echo "Compiling all contracts"
nargo compile --workspace
13 changes: 0 additions & 13 deletions yarn-project/noir-contracts/scripts/install_noir_backend.sh

This file was deleted.

22 changes: 3 additions & 19 deletions yarn-project/noir-contracts/scripts/nargo_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# If testing multiple libraries:
# ./scripts/test.sh LIB <LIBRARY_NAME> <LIBRARY_NAME> <LIBRARY_NAME> <LIBRARY_NAME> ...

source ./scripts/catch.sh

ROOT=$(pwd)

# Get the project type from the first argument
Expand All @@ -23,24 +25,6 @@ error_file="/tmp/error.$$"
# Array of child PIDs
pids=()

# Handler for SIGCHLD, cleanup if child exit with error
handle_sigchld() {
for pid in "${pids[@]}"; do
# If process is no longer running
if ! kill -0 "$pid" 2>/dev/null; then
# Wait for the process and get exit status
wait "$pid"
status=$?

# If exit status is error
if [ $status -ne 0 ]; then
# Create error file
touch "$error_file"
fi
fi
done
}

# Set SIGCHLD handler
trap handle_sigchld SIGCHLD # Trap any ERR signal and call the custom error handler

Expand All @@ -51,7 +35,7 @@ test() {
CONTRACT_FOLDER="${PROJECT_NAME}_contract"
echo "Testing contract $PROJECT_NAME..."
cd src/contracts/$CONTRACT_FOLDER
nargo test
nargo test --package ${PROJECT_NAME}_contract
else
echo "Testing library $PROJECT_NAME..."
cd ../noir-libs/$PROJECT_NAME
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/noir-contracts/scripts/nargo_test_ci.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

#!/bin/bash

# Runs tests scripts for all contracts, then for all libraries.

./scripts/nargo_test.sh CONTRACT $(./scripts/get_all_contracts.sh)
./scripts/nargo_test.sh LIB $(./scripts/get_all_libraries.sh)
7 changes: 5 additions & 2 deletions yarn-project/noir-contracts/src/scripts/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
set -euo pipefail;

# Run build scripts
./scripts/compile.sh "$@"
./scripts/types.sh "$@"
echo "Compiling all contracts"
nargo compile --workspace

echo "Generating types"
./scripts/types.sh "$@"

0 comments on commit 9276771

Please sign in to comment.