From d679d905bea02eb7d12755040341c7c985ce1be8 Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 4 Jan 2024 12:15:30 +0000 Subject: [PATCH 1/5] enabling nargo check in CI --- yarn-project/package.json | 2 +- yarn-project/run_nargo_fmt.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/yarn-project/package.json b/yarn-project/package.json index 041dcde0235..9769892147b 100644 --- a/yarn-project/package.json +++ b/yarn-project/package.json @@ -6,7 +6,7 @@ "prepare": "node ./yarn-project-base/scripts/update_package_jsons.mjs && yarn workspaces foreach run prepare && workspaces-to-typescript-project-references --tsconfigPath tsconfig.json && prettier -w */tsconfig.json", "prepare:check": "node ./yarn-project-base/scripts/update_package_jsons.mjs --check && workspaces-to-typescript-project-references --check --tsconfigPath tsconfig.json", "docs": "typedoc --out docs/dist && cd docs && yarn serve", - "formatting": "FORCE_COLOR=true yarn workspaces foreach -p -j unlimited -v run formatting", + "formatting": "./run_nargo_fmt.sh --check && FORCE_COLOR=true yarn workspaces foreach -p -j unlimited -v run formatting", "formatting:fix": "./run_nargo_fmt.sh && FORCE_COLOR=true yarn workspaces foreach -p -v run formatting:fix", "lint": "yarn eslint --cache --ignore-pattern l1-artifacts .", "format": "yarn prettier --cache -w .", diff --git a/yarn-project/run_nargo_fmt.sh b/yarn-project/run_nargo_fmt.sh index 253b53e7ede..2843db8cb8b 100755 --- a/yarn-project/run_nargo_fmt.sh +++ b/yarn-project/run_nargo_fmt.sh @@ -1,6 +1,18 @@ #!/bin/bash -nargo_executable="$(git rev-parse --show-toplevel)/noir/target/release/nargo" +# We set the executable path as if we were in CI +nargo_executable="/usr/src/noir/target/release/nargo" + +# Check if nargo_executable exists and is executable +if [ ! -x "$nargo_executable" ]; then + # If not, we try to set a nargo path as if the script was run locally + nargo_executable="$(git rev-parse --show-toplevel)/noir/target/release/nargo" + + if [ ! -x "$nargo_executable" ]; then + echo "Error: nargo executable not found" + exit 1 + fi +fi # Find all Nargo.toml files and run 'nargo fmt' find . -name "Nargo.toml" | while read -r file; do From c832079141f069512a9c6a0204cb086b3c4d4804 Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 4 Jan 2024 12:30:11 +0000 Subject: [PATCH 2/5] exiting on error --- yarn-project/run_nargo_fmt.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yarn-project/run_nargo_fmt.sh b/yarn-project/run_nargo_fmt.sh index 2843db8cb8b..7d0672c5b7e 100755 --- a/yarn-project/run_nargo_fmt.sh +++ b/yarn-project/run_nargo_fmt.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash +set -eu # We set the executable path as if we were in CI nargo_executable="/usr/src/noir/target/release/nargo" From 9d6ce7644b98a713dd500493d44f1678b1f9328d Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 4 Jan 2024 13:09:21 +0000 Subject: [PATCH 3/5] comment --- yarn-project/run_nargo_fmt.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yarn-project/run_nargo_fmt.sh b/yarn-project/run_nargo_fmt.sh index 7d0672c5b7e..03642a32a23 100755 --- a/yarn-project/run_nargo_fmt.sh +++ b/yarn-project/run_nargo_fmt.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash + +# Note: This script formats the files multiple times when the given project is included in a workspace. +# Tackling this became a time sink, so I decided to leave it as is for now. + set -eu # We set the executable path as if we were in CI From c086b6b4813c4f6fbf47273fe4c2c2cd6c01b162 Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 4 Jan 2024 13:10:28 +0000 Subject: [PATCH 4/5] introducing formatting issue to see if CI fails --- .../noir-contracts/contracts/parent_contract/src/main.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr b/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr index 785aac2e03b..47d4bd477b8 100644 --- a/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr +++ b/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr @@ -10,7 +10,7 @@ contract Parent { // Private function to call another private function in the targetContract using the provided selector #[aztec(private)] - fn entryPoint(targetContract: AztecAddress, targetSelector: FunctionSelector) -> Field { + fn entryPoint(targetContract : AztecAddress, targetSelector: FunctionSelector) -> Field { // Call the target private function let return_values = context.call_private_function(targetContract, targetSelector, [0]); From 56e17437bc1ff711d961e25a8e5bae5d7007470f Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 4 Jan 2024 13:20:47 +0000 Subject: [PATCH 5/5] Revert "introducing formatting issue to see if CI fails" This reverts commit c086b6b4813c4f6fbf47273fe4c2c2cd6c01b162. --- .../noir-contracts/contracts/parent_contract/src/main.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr b/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr index 47d4bd477b8..785aac2e03b 100644 --- a/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr +++ b/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr @@ -10,7 +10,7 @@ contract Parent { // Private function to call another private function in the targetContract using the provided selector #[aztec(private)] - fn entryPoint(targetContract : AztecAddress, targetSelector: FunctionSelector) -> Field { + fn entryPoint(targetContract: AztecAddress, targetSelector: FunctionSelector) -> Field { // Call the target private function let return_values = context.call_private_function(targetContract, targetSelector, [0]);