Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ All projects have at least a "build hash". This is computed using `cache_content

Some projects will also have a "test hash". The test hash is part of the input to deciding if a test should be re-run. So this might also include files that don't make up the build hash, but are used as part of testing.

To give a concrete example, take `barretenberg/acir_tests`. Here we have a build hash that consists of what makes up `nargo` (`../../noir/.rebuild_patterns` and `../noir/.noir-repo.rebuild_patterns`, but do make use of `../../noir/bootstrap.sh hash` to compute it correctly), and the test programs themselves (`../../noir/.noir-repo.rebuild_patterns_tests`) as they are actually compiled using nargo with the results stored in the build cache. The "test hash" then additionally adds barretenbergs cpp and ts code, because both are used in the actual _running_ of the tests.
To give a concrete example, take `barretenberg/acir_tests`. Here we have a build hash that consists of what makes up `nargo` (`./../noir/.rebuild_patterns`), and the test programs themselves (`../../noir/.rebuild_patterns_tests`) as they are actually compiled using nargo with the results stored in the build cache. The "test hash" then additionally adds barretenbergs cpp and ts code, because both are used in the actual _running_ of the tests.

If a test successfully runs in CI, it won't be run again unless its redis key changes. This key consists of the "test hash" and the "test command". Here's an example:

Expand Down
2 changes: 1 addition & 1 deletion avm-transpiler/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source $(git rev-parse --show-toplevel)/ci3/source_bootstrap

cmd=${1:-}

hash=$(hash_str $(../noir/bootstrap.sh hash) $(cache_content_hash .rebuild_patterns))
hash=$(cache_content_hash ../noir/.rebuild_patterns .rebuild_patterns)

export GIT_COMMIT="0000000000000000000000000000000000000000"
export SOURCE_DATE_EPOCH=0
Expand Down
11 changes: 5 additions & 6 deletions boxes/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ export NARGO=$PWD/../noir/noir-repo/target/release/nargo
export AZTEC_NARGO=$PWD/../aztec-nargo/compile_then_postprocess.sh
export AZTEC_BUILDER=$PWD/../yarn-project/builder/aztec-builder-dest

hash=$(hash_str \
$(../noir/bootstrap.sh hash) \
$(cache_content_hash \
.rebuild_patterns \
../{avm-transpiler,noir-projects,l1-contracts,yarn-project}/.rebuild_patterns \
../barretenberg/*/.rebuild_patterns))
hash=$(cache_content_hash \
.rebuild_patterns \
../noir/.rebuild_patterns \
../{avm-transpiler,noir-projects,l1-contracts,yarn-project}/.rebuild_patterns \
../barretenberg/*/.rebuild_patterns)

function build {
echo_header "boxes build"
Expand Down
8 changes: 3 additions & 5 deletions ci3/cache_content_hash
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
# Calculate the content hash for an artifact that controls rebuilds.
# Takes a list of rebuild pattern files (regex files that match patterns from repo root) or directories.
# The REPO_PATH env var can be used to point the script at the root of the git repository where the patterns
# are rooted, and where the git commands will be executed, which can be used to compute the hash in a sub repo.
# Two special test-only environment variables can control the cache.
# These are used when iterating on build infrastructure:
# - AZTEC_CACHE_NO_SCRIPTS: Don't include any shell files (namely bootstrap.sh) in cache patterns.
Expand All @@ -27,17 +25,17 @@ for arg in "$@"; do
fi
done

GREP_PATTERN=$(echo "$rebuild_patterns" | grep -v '^$')

# For sanity when iterating on build scripts as bootstrap.sh scripts are in every .rebuild_patterns.
if [ -n "${AZTEC_CACHE_NO_SCRIPTS:-}" ]; then
rebuild_patterns=$(echo "$rebuild_patterns" | grep -v '.sh')
rebuild_patterns=$(echo "$rebuild_patterns" | grep -v '*\.sh')
fi
GREP_PATTERN=$(echo "$rebuild_patterns" | grep -v '^$')
# Concatenate patterns with '|' and double escape backslashes for AWK filter empty lines
AWK_PATTERN=$(echo "$rebuild_patterns" | grep -v '^$' | sed 's/\\/\\\\/g' | tr '\n' '|' | sed 's/|$//')

# use git repo root because that is where our patterns are focused
cd "${REPO_PATH:-$(git rev-parse --show-toplevel)}"
cd "$(git rev-parse --show-toplevel)"

diff="$({
git diff --name-only
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmd=${1:-}
export RAYON_NUM_THREADS=${RAYON_NUM_THREADS:-16}
export HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-16}
export NARGO=${NARGO:-../../noir/noir-repo/target/release/nargo}
hash=$(hash_str $(../../noir/bootstrap.sh hash) $(cache_content_hash "^noir-projects/aztec-nr"))
hash=$(cache_content_hash ../../noir/.rebuild_patterns "^noir-projects/aztec-nr")

function build {
# Being a library, aztec-nr does not technically need to be built. But we can still run nargo check to find any type
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ case "$cmd" in
$cmd
;;
"hash")
hash_str $(../noir/bootstrap.sh hash) $(cache_content_hash .rebuild_patterns)
cache_content_hash .rebuild_patterns ../noir/.rebuild_patterns
;;
*)
echo_stderr "Unknown command: $cmd"
Expand Down
13 changes: 6 additions & 7 deletions noir-projects/noir-contracts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,12 @@ export -f process_function

# Compute hash for a given contract.
function get_contract_hash {
hash_str \
$(../../noir/bootstrap.sh hash) \
$(cache_content_hash \
../../avm-transpiler/.rebuild_patterns \
"^noir-projects/noir-contracts/contracts/$1/" \
"^noir-projects/aztec-nr/" \
"^noir-projects/noir-protocol-circuits/crates/types/")
cache_content_hash \
../../noir/.rebuild_patterns \
../../avm-transpiler/.rebuild_patterns \
"^noir-projects/noir-contracts/contracts/$1/" \
"^noir-projects/aztec-nr/" \
"^noir-projects/noir-protocol-circuits/crates/types/"
}
export -f get_contract_hash

Expand Down
6 changes: 3 additions & 3 deletions noir-projects/noir-protocol-circuits/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source $(git rev-parse --show-toplevel)/ci3/source_bootstrap

cmd=${1:-}
project_name=$(basename "$PWD")
test_flag=$project_name-tests-$(cache_content_hash ../../noir/.rebuild_patterns "^noir-projects/$project_name")

export RAYON_NUM_THREADS=${RAYON_NUM_THREADS:-16}
export HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-16}
Expand All @@ -12,16 +13,15 @@ export PLATFORM_TAG=any
export BB=${BB:-../../barretenberg/cpp/build/bin/bb}
export NARGO=${NARGO:-../../noir/noir-repo/target/release/nargo}
export BB_HASH=$(cache_content_hash ../../barretenberg/cpp/.rebuild_patterns)
export NARGO_HASH=$(../../noir/bootstrap.sh hash)
export NARGO_HASH=$(cache_content_hash ../../noir/.rebuild_patterns)

test_flag=$project_name-tests-$(hash_str "$NARGO_HASH" $(cache_content_hash "^noir-projects/$project_name"))
key_dir=./target/keys
mkdir -p $key_dir

# Hash of the entire protocol circuits.
# Needed for test hash, as we presently don't have a program hash for each individual test.
# Means if anything within the dir changes, the tests will rerun.
circuits_hash=$(hash_str "$NARGO_HASH" $(cache_content_hash "^noir-projects/$project_name/crates/"))
circuits_hash=$(cache_content_hash "^noir-projects/$project_name/crates/" ../../noir/.rebuild_patterns)

# Circuits matching these patterns we have client-ivc keys computed, rather than ultra-honk.
ivc_patterns=(
Expand Down
21 changes: 0 additions & 21 deletions noir/.noir-repo.rebuild_patterns

This file was deleted.

2 changes: 0 additions & 2 deletions noir/.noir-repo.rebuild_patterns_tests

This file was deleted.

28 changes: 24 additions & 4 deletions noir/.rebuild_patterns
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
^noir/bootstrap.sh
^noir/Dockerfile
^noir/Dockerfile.packages
^noir/noir-repo.patch
^noir/scripts/bootstrap_native.sh
^noir/scripts/test_native.sh
^noir/noir-repo/acvm-repo
^noir/noir-repo/compiler
^noir/noir-repo/noir_stdlib
^noir/noir-repo/tooling/backend_interface
^noir/noir-repo/tooling/bb_abstraction_leaks
^noir/noir-repo/tooling/debugger
^noir/noir-repo/tooling/lsp
^noir/noir-repo/tooling/nargo
^noir/noir-repo/tooling/nargo_cli
^noir/noir-repo/tooling/nargo_toml
^noir/noir-repo/tooling/nargo_fmt
^noir/noir-repo/tooling/noirc_abi
^noir/noir-repo/tooling/acvm_cli
^noir/Dockerfile.packages
^noir/scripts/bootstrap_packages.sh
^noir/scripts/test_js_packages.sh
^noir/scripts/test_native.sh
^noir/noir-repo/.yarn
^noir/noir-repo/.yarnrc.yml
^noir/noir-repo/package.json
^noir/noir-repo/yarn.lock
^noir/noir-repo/tooling/noir_codegen
^noir/noir-repo/tooling/noir_js
^noir/noir-repo/tooling/noir_js_types
^noir/noir-repo/tooling/noirc_abi_wasm
^noir/bootstrap.sh
2 changes: 2 additions & 0 deletions noir/.rebuild_patterns_tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^noir/noir-repo/test_programs/execution_success/
^noir/noir-repo/examples/
30 changes: 4 additions & 26 deletions noir/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,10 @@ function noir_sync {
denoise "scripts/sync.sh init && scripts/sync.sh update"
}

# Calculate the content hash for caching, taking into account that `noir-repo`
# is not part of the `aztec-packages` repo itself, so the `git ls-tree` used
# by `cache_content_hash` would not take those files into account.
function noir_content_hash {
function noir_repo_content_hash {
echo $(REPO_PATH=./noir-repo cache_content_hash $@)
}
with_tests=${1:-0}
noir_hash=$(cache_content_hash .rebuild_patterns)
noir_repo_hash=$(noir_repo_content_hash .noir-repo.rebuild_patterns)
if [ "$with_tests" == "1" ]; then
noir_repo_hash_tests=$(noir_repo_content_hash .noir-repo.rebuild_patterns_tests)
else
noir_repo_hash_tests=""
fi
echo $(hash_str $noir_hash $noir_repo_hash $noir_repo_hash_tests)
}

# Builds nargo, acvm and profiler binaries.
function build_native {
set -euo pipefail
local hash=$(noir_content_hash)
local hash=$(cache_content_hash .rebuild_patterns)
if cache_download noir-$hash.tar.gz; then
return
fi
Expand All @@ -64,7 +46,7 @@ function build_native {
# Builds js packages.
function build_packages {
set -euo pipefail
local hash=$(noir_content_hash)
local hash=$(cache_content_hash .rebuild_patterns)

if cache_download noir-packages-$hash.tar.gz; then
cd noir-repo
Expand All @@ -74,7 +56,6 @@ function build_packages {

cd noir-repo
npm_install_deps

yarn workspaces foreach --parallel --topological-dev --verbose $js_include run build

# We create a folder called packages, that contains each package as it would be published to npm, named correctly.
Expand Down Expand Up @@ -132,7 +113,7 @@ function test {

# Prints the commands to run tests, one line per test, prefixed with the appropriate content hash.
function test_cmds {
local test_hash=$(noir_content_hash 1)
local test_hash=$(cache_content_hash .rebuild_patterns .rebuild_patterns_tests)
cd noir-repo
cargo nextest list --workspace --locked --release -Tjson-pretty 2>/dev/null | \
jq -r '
Expand Down Expand Up @@ -217,10 +198,7 @@ case "$cmd" in
$cmd "$@"
;;
"hash")
echo $(noir_content_hash)
;;
"hash-tests")
echo $(noir_content_hash 1)
echo $(cache_content_hash .rebuild_patterns)
;;
"make-patch")
scripts/sync.sh make-patch
Expand Down
31 changes: 4 additions & 27 deletions noir/noir-repo.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From b81862448ed79637e1e36cf2e78e70a60a55fdc1 Mon Sep 17 00:00:00 2001
From f6c1dfe13a1993ab6b3e0136448bb3796625684a Mon Sep 17 00:00:00 2001
From: TomAFrench <tom@tomfren.ch>
Date: Sat, 15 Mar 2025 15:36:12 +0000
Subject: [PATCH 1/4] chore: turn on `skipLibCheck`
Subject: [PATCH 1/3] chore: turn on `skipLibCheck`

---
tooling/noir_codegen/tsconfig.json | 1 +
Expand All @@ -22,10 +22,10 @@ index 30dd2a7..a2712fd 100644
--
2.43.0

From 892ce5f3ec0ef5f1ec24f5cfc394e5e1d511f8b0 Mon Sep 17 00:00:00 2001
From 65bce6930794adb2834ac5aba3479308159c08ba Mon Sep 17 00:00:00 2001
From: TomAFrench <tom@tomfren.ch>
Date: Sat, 15 Mar 2025 18:32:24 +0000
Subject: [PATCH 2/4] chore: delete honk test programs
Subject: [PATCH 3/3] chore: delete honk test programs

---
.../double_verify_honk_proof/Nargo.toml | 6 ----
Expand Down Expand Up @@ -207,26 +207,3 @@ index e5f08ef..0000000
--
2.43.0

From fd8f444eba5db51bee2173d7c2f66bebaa693d30 Mon Sep 17 00:00:00 2001
From: aakoshh <akosh@aztecprotocol.com>
Date: Mon, 17 Mar 2025 12:10:58 +0000
Subject: [PATCH 4/4] Ignore package.tgz

---
.gitignore | 3 +++
1 file changed, 3 insertions(+)

diff --git a/.gitignore b/.gitignore
index 3349018..c93fe8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,3 +59,6 @@ codegen

mutants.out
mutants.out.old
+
+# Artifacts created by `noir/bootstrap.sh build_packages`
+**/package.tgz
--
2.43.0

9 changes: 4 additions & 5 deletions yarn-project/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ cmd=${1:-}
[ -n "$cmd" ] && shift

function hash {
hash_str \
$(../noir/bootstrap.sh hash) \
$(cache_content_hash \
../{avm-transpiler,noir-projects,l1-contracts,yarn-project}/.rebuild_patterns \
../barretenberg/*/.rebuild_patterns)
cache_content_hash \
../noir/.rebuild_patterns \
../{avm-transpiler,noir-projects,l1-contracts,yarn-project}/.rebuild_patterns \
../barretenberg/*/.rebuild_patterns
}

function compile_project {
Expand Down
Loading