Skip to content

Commit c4abe8d

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/fairies
2 parents 8576678 + ceb3429 commit c4abe8d

96 files changed

Lines changed: 1701 additions & 364 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ci3.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -euo pipefail
1010
CI_MODE="${1:?CI_MODE must be provided as first argument}"
1111
shift
1212

13-
NO_CD=1 source $(git rev-parse --show-toplevel)/ci3/source
13+
NO_CD=1 source $(git rev-parse --show-toplevel)/ci3/source_base
1414

1515
function setup_environment {
1616
echo_header "Setup"

.github/ci3_labels_to_env.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ function main {
5050
if [ -n "$pr_number" ]; then
5151
local head_branch
5252
head_branch=$(GH_TOKEN="$GITHUB_TOKEN" gh pr view "$pr_number" --json headRefName -q '.headRefName' 2>/dev/null || true)
53-
if [ "$head_branch" == "merge-train/spartan" ]; then
54-
echo "Merge-train/spartan PR detected, using merge-queue-heavy mode" >&2
53+
if [ "$head_branch" == "merge-train/spartan" ] || [ "$head_branch" == "merge-train/ci" ]; then
54+
echo "Merge-train PR ($head_branch) detected, using merge-queue-heavy mode" >&2
5555
ci_mode="merge-queue-heavy"
5656
fi
5757
fi

.github/local_workflow.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# Runs a github workflow locally.
44
#

.github/workflows/merge-train-create-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
4848
# Create PR with ci-no-squash label
4949
labels="ci-no-squash"
50-
if [[ "$branch" == "merge-train/spartan" ]]; then
50+
if [[ "$branch" == "merge-train/spartan" || "$branch" == "merge-train/ci" ]]; then
5151
labels="$labels,ci-full-no-test-cache"
5252
fi
5353
gh pr create --base "$base_branch" --head "$branch" \

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ bb-docs:
188188
$(call build,$@,barretenberg/docs)
189189

190190
# BB Solidity - Solidity verifier contracts
191-
bb-sol: bb-cpp-native
191+
bb-sol: bb-cpp-native bb-crs
192192
$(call build,$@,barretenberg/sol)
193193

194194
#==============================================================================

aztec-up/bootstrap.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ source $(git rev-parse --show-toplevel)/ci3/source_bootstrap
44
hash=$(hash_str $(cache_content_hash ^aztec-up/) $(../yarn-project/bootstrap.sh hash))
55

66
function build {
7+
# Noop if user doesn't have docker.
8+
if ! command -v docker &>/dev/null; then
9+
echo "Docker not installed. Skipping..."
10+
return
11+
fi
12+
713
# Create versions.json so we know what to install.
814
../bootstrap.sh versions > ./bin/0.0.1/versions
915
echo "Versions:"
@@ -147,8 +153,9 @@ function prep_test_mac {
147153
fi
148154

149155
# Cleanup background processes on exit.
150-
local pids=()
151-
trap 'kill "${pids[@]}" &>/dev/null || true' EXIT
156+
# Note: can't use local - the trap fires after function scope is gone.
157+
_bg_pids=()
158+
trap 'kill "${_bg_pids[@]}" &>/dev/null || true' EXIT
152159

153160
# Start Verdaccio in offline mode (no uplinks), bound to all interfaces.
154161
cat > /tmp/verdaccio-mac-test.yaml <<EOF
@@ -170,13 +177,13 @@ logs: { type: stdout, format: pretty, level: warn }
170177
EOF
171178

172179
verdaccio --config /tmp/verdaccio-mac-test.yaml --listen 0.0.0.0:$verdaccio_port &>/dev/null &
173-
pids+=($!)
180+
_bg_pids+=($!)
174181
while ! nc -z localhost $verdaccio_port &>/dev/null; do sleep 1; done
175182
echo "Verdaccio running on 0.0.0.0:$verdaccio_port"
176183

177184
# Serve bin/ directory over HTTP to mimic S3-hosted install scripts.
178185
python3 -m http.server $http_port --directory ./bin --bind 0.0.0.0 &>/dev/null &
179-
pids+=($!)
186+
_bg_pids+=($!)
180187
while ! nc -z localhost $http_port &>/dev/null; do sleep 1; done
181188
echo "HTTP server running on 0.0.0.0:$http_port (serving ./bin/)"
182189
}
@@ -235,13 +242,20 @@ export -f install_on_mac_vm launch_and_install_on_mac_vm
235242

236243
# Assumes a macos vm is already running.
237244
# Starts services, and runs install script on the mac vm via ssh.
238-
function test_mac {
239-
echo_header "aztec-up test_mac"
245+
function test_on_mac_vm {
240246
local mac_name="${1:?Mac vm name (e.g. 14)}"
247+
echo_header "aztec-up test_on_mac_vm"
241248
prep_test_mac
242249
install_on_mac_vm $mac_name
243250
}
244251

252+
function test_mac {
253+
local mac_name="${1:?Mac vm name (e.g. 14)}"
254+
echo_header "aztec-up test_mac"
255+
prep_test_mac
256+
launch_and_install_on_mac_vm $mac_name
257+
}
258+
245259
# Starts services, launches a mac vm for each version and runs install script via ssh.
246260
function test_macs {
247261
echo_header "aztec-up test_macs"

barretenberg/cpp/CMakePresets.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
},
3636
{
3737
"name": "clang20",
38-
"displayName": "Build with Zig (glibc 2.35)",
39-
"description": "Build with Zig-wrapped Clang targeting glibc 2.35 (Ubuntu 22.04+)",
38+
"displayName": "Build with Zig (glibc 2.35 on Linux)",
39+
"description": "Build with Zig-wrapped Clang. On Linux, pins glibc 2.35 (Ubuntu 22.04+). On macOS, uses native target.",
4040
"inherits": "default",
4141
"binaryDir": "build",
4242
"environment": {
43-
"CC": "zig cc -target native-linux-gnu.2.35",
44-
"CXX": "zig c++ -target native-linux-gnu.2.35"
43+
"CC": "${sourceDir}/scripts/zig-cc.sh",
44+
"CXX": "${sourceDir}/scripts/zig-c++.sh"
4545
},
4646
"cacheVariables": {
4747
"CMAKE_AR": "${sourceDir}/scripts/zig-ar.sh",

barretenberg/cpp/bootstrap.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ function inject_version {
3535
# Version starts immediately after the sentinel
3636
local version_offset=$((sentinel_offset + ${#sentinel}))
3737
printf "$version\0" | dd of="$binary" bs=1 seek=$version_offset conv=notrunc 2>/dev/null
38+
39+
# Re-sign after modifying the binary.
40+
if [[ "$(os)" == "macos" ]]; then
41+
codesign -s - -f "$binary" 2>/dev/null || true
42+
elif llvm-objdump --macho --private-header "$binary" &>/dev/null; then
43+
ldid -S "$binary"
44+
fi
3845
}
3946

4047
# Define build commands for each preset
@@ -55,6 +62,7 @@ function build_preset() {
5562
function build_native_objects {
5663
set -eu
5764
if ! cache_exists barretenberg-$native_preset-$hash.zst; then
65+
(flock -x 200 && cd src/barretenberg/nodejs_module && yarn --immutable) 200>/tmp/bb-yarn.lock
5866
cmake --preset "$native_preset"
5967
targets=$(cmake --build --preset "$native_preset" --target help | awk -F: '$1 ~ /(_objects|_tests|_bench|_gen|.a)$/ && $1 !~ /^cmake_/{print $1}' | tr '\n' ' ')
6068
cmake --build --preset "$native_preset" --target $targets nodejs_module
@@ -87,6 +95,7 @@ function build_cross_objects {
8795
set -eu
8896
target=$1
8997
if ! cache_exists barretenberg-$target-$hash.zst; then
98+
(flock -x 200 && cd src/barretenberg/nodejs_module && yarn --immutable) 200>/tmp/bb-yarn.lock
9099
build_preset zig-$target --target barretenberg nodejs_module vm2_stub circuit_checker honk
91100
fi
92101
}
@@ -96,17 +105,13 @@ function build_cross_objects {
96105
function build_cross {
97106
set -eu
98107
target=$1
99-
is_macos=${2:-false}
100108
if ! cache_download barretenberg-$target-$hash.zst; then
109+
(flock -x 200 && cd src/barretenberg/nodejs_module && yarn --immutable) 200>/tmp/bb-yarn.lock
101110
build_preset zig-$target --target bb --target nodejs_module --target bb-external
102111
cache_upload barretenberg-$target-$hash.zst build-zig-$target/{bin,lib}
103112
fi
104113
# Always inject version (even for cached binaries) to ensure correct version on release
105114
inject_version build-zig-$target/bin/bb
106-
# Code sign for macOS after version injection (must be last modification to binary)
107-
if [ "$is_macos" == "true" ]; then
108-
ldid -S build-zig-$target/bin/bb
109-
fi
110115
}
111116

112117
# Build static library (.a) for iOS using Zig cross-compilation from Linux.
@@ -294,8 +299,6 @@ function build {
294299
rm -rf build*
295300
fi
296301

297-
(cd src/barretenberg/nodejs_module && yarn --frozen-lockfile --prefer-offline)
298-
299302
if semver check "$REF_NAME" && [[ "$(arch)" == "amd64" ]]; then
300303
# Download mobile SDKs before parallel builds (shared across presets)
301304
bash scripts/download-ios-sdk.sh
@@ -306,8 +309,8 @@ function build {
306309
"build_wasm" \
307310
"build_wasm_threads" \
308311
"build_cross arm64-linux" \
309-
"build_cross amd64-macos true" \
310-
"build_cross arm64-macos true" \
312+
"build_cross amd64-macos" \
313+
"build_cross arm64-macos" \
311314
"build_ios zig-arm64-ios" \
312315
"build_ios zig-arm64-ios-sim" \
313316
"build_android zig-arm64-android" \
@@ -325,7 +328,7 @@ function build {
325328
if [ "$(arch)" == "amd64" ] && [ "$CI_FULL" -eq 1 ]; then
326329
bash scripts/download-ios-sdk.sh
327330
bash scripts/download-android-sysroot.sh
328-
builds+=("build_cross arm64-macos true" build_smt_verification "build_ios zig-arm64-ios" "build_ios zig-arm64-ios-sim" "build_android zig-arm64-android" "build_android zig-x86_64-android")
331+
builds+=("build_cross arm64-macos" build_smt_verification "build_ios zig-arm64-ios" "build_ios zig-arm64-ios-sim" "build_android zig-arm64-android" "build_android zig-x86_64-android")
329332
fi
330333
parallel --line-buffered --tag --halt now,fail=1 "denoise {}" ::: "${builds[@]}"
331334
fi

barretenberg/cpp/cmake/avm-transpiler.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ add_definitions(-DENABLE_AVM_TRANSPILER)
2020

2121
message(STATUS "avm-transpiler library: ${AVM_TRANSPILER_LIB}")
2222
message(STATUS "avm-transpiler include: ${AVM_TRANSPILER_INCLUDE}")
23+
24+
if(APPLE AND NOT CMAKE_CROSSCOMPILING)
25+
target_link_libraries(avm_transpiler INTERFACE "-framework CoreFoundation")
26+
endif()

barretenberg/cpp/cmake/module.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function(barretenberg_module_with_sources MODULE_NAME)
204204
endif()
205205
if(NOT WASM)
206206
# Currently haven't found a way to easily wrap the calls in wasmtime when run from ctest.
207-
gtest_discover_tests(${MODULE_NAME}_tests WORKING_DIRECTORY ${CMAKE_BINARY_DIR} TEST_FILTER -*_SKIP_CI*)
207+
gtest_discover_tests(${MODULE_NAME}_tests WORKING_DIRECTORY ${CMAKE_BINARY_DIR} TEST_FILTER -*_SKIP_CI* DISCOVERY_TIMEOUT 30)
208208
endif()
209209
endif()
210210

0 commit comments

Comments
 (0)