Skip to content

Commit 5f8e5f6

Browse files
authored
Merge branch 'v4-next' into saleel/backport-20547
2 parents 32b2456 + f4ccd73 commit 5f8e5f6

2,984 files changed

Lines changed: 771529 additions & 57588 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.

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ avm-transpiler-cross-arm64-macos:
8888
avm-transpiler-cross-arm64-linux:
8989
$(call build,$@,avm-transpiler,build_cross arm64-linux)
9090

91-
avm-transpiler-cross: avm-transpiler-cross-amd64-macos avm-transpiler-cross-arm64-macos avm-transpiler-cross-arm64-linux
91+
avm-transpiler-cross-amd64-windows:
92+
$(call build,$@,avm-transpiler,build_cross amd64-windows)
93+
94+
avm-transpiler-cross: avm-transpiler-cross-amd64-macos avm-transpiler-cross-arm64-macos avm-transpiler-cross-arm64-linux avm-transpiler-cross-amd64-windows
9295

9396
#==============================================================================
9497
# Barretenberg
@@ -150,7 +153,14 @@ bb-cpp-cross-amd64-macos: bb-cpp-cross-amd64-macos-objects avm-transpiler-cross-
150153
bb-cpp-cross-arm64-macos: bb-cpp-cross-arm64-macos-objects avm-transpiler-cross-arm64-macos
151154
$(call build,$@,barretenberg/cpp,build_cross arm64-macos)
152155

153-
bb-cpp-cross: bb-cpp-cross-arm64-linux bb-cpp-cross-amd64-macos bb-cpp-cross-arm64-macos
156+
bb-cpp-cross-amd64-windows-objects:
157+
$(call build,$@,barretenberg/cpp,build_cross_objects amd64-windows)
158+
159+
# Cross-compile for AMD64 Windows (release only)
160+
bb-cpp-cross-amd64-windows: bb-cpp-cross-amd64-windows-objects avm-transpiler-cross-amd64-windows
161+
$(call build,$@,barretenberg/cpp,build_cross_windows amd64-windows)
162+
163+
bb-cpp-cross: bb-cpp-cross-arm64-linux bb-cpp-cross-amd64-macos bb-cpp-cross-arm64-macos bb-cpp-cross-amd64-windows
154164

155165
# GCC syntax check (CI only, non-release)
156166
bb-cpp-gcc:

avm-transpiler/bootstrap.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ function build_cross {
4848
arm64-macos)
4949
rust_target=aarch64-apple-darwin
5050
;;
51+
amd64-windows)
52+
rust_target=x86_64-pc-windows-gnu
53+
;;
5154
*)
5255
echo_stderr "Unknown target: $target"
5356
exit 1

aztec-up/bin/0.0.1/aztec-install

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# This script installs aztec-up and then delegates to it for version installation.
44
# Usage: bash -i <(curl -s https://install.aztec.network)
55
# or: VERSION=0.85.0 bash -i <(curl -s https://install.aztec.network)
6+
7+
# Guard against truncated curl downloads: bash must parse the entire {} block before executing any of it.
8+
{
69
set -euo pipefail
710

811
# Colors
@@ -28,6 +31,32 @@ VERSION="${VERSION:-nightly}"
2831
# Install URI (root, not version-specific)
2932
INSTALL_URI="${INSTALL_URI:-https://install.aztec-labs.com}"
3033

34+
# Check if version string is valid semver
35+
function is_semver {
36+
local version="$1"
37+
local semver_regex='^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.]+)?$'
38+
[[ "$version" =~ $semver_regex ]]
39+
}
40+
41+
# Resolve alias (like "nightly") to actual version number.
42+
function resolve_version {
43+
local version="$1"
44+
# Strip leading v from semver-like inputs (v0.85.0 -> 0.85.0), but not aliases (v4-nightly)
45+
local stripped="${version#v}"
46+
if is_semver "$stripped"; then
47+
echo "$stripped"
48+
else
49+
local resolved
50+
if ! resolved=$(curl -fsSL "$INSTALL_URI/aliases/$version" 2>/dev/null); then
51+
echo "Error: Could not resolve alias '$version'" >&2
52+
exit 1
53+
fi
54+
echo "$resolved"
55+
fi
56+
}
57+
58+
VERSION=$(resolve_version "$VERSION")
59+
3160
# Add color to the AZTEC ascii art.
3261
function print_colored() {
3362
local b=$'\033[34m' # Blue
@@ -166,7 +195,7 @@ function update_path_env_var {
166195
if grep -q '\.aztec' "$shell_profile" 2>/dev/null; then
167196
# Remove old aztec PATH entries.
168197
local tmp_file=$(mktemp)
169-
grep -Ev 'export PATH=.*/\.aztec/' "$shell_profile" > "$tmp_file" || true
198+
grep -Ev 'export PATH="\$(HOME/\.aztec/|PATH:.*\.aztec/)' "$shell_profile" > "$tmp_file" || true
170199
mv "$tmp_file" "$shell_profile"
171200
fi
172201

@@ -212,3 +241,7 @@ function main {
212241
}
213242

214243
main "$@"
244+
245+
# Explicit exit prevents bash from reading past the closing brace.
246+
exit
247+
}

aztec-up/bin/0.0.1/aztec-up

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ function is_semver {
102102
# Resolve alias (like "nightly") to actual version number
103103
function resolve_version {
104104
local version="$1"
105-
if is_semver "$version"; then
106-
echo "$version"
105+
# Strip leading v from semver-like inputs (v0.85.0 -> 0.85.0), but not aliases (v4-nightly)
106+
local stripped="${version#v}"
107+
if is_semver "$stripped"; then
108+
echo "$stripped"
107109
else
108110
# Fetch alias file to get actual version
109111
local resolved
@@ -313,6 +315,11 @@ function cmd_uninstall {
313315
exit 1
314316
fi
315317

318+
if ! is_semver "$version"; then
319+
echo "Error: Invalid version '$version'. Expected a semver string (e.g. 0.85.0)."
320+
exit 1
321+
fi
322+
316323
local current_version
317324
current_version=$(get_current_version)
318325

aztec-up/bin/0.0.1/install

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Per-version installer script
33
# This script is called by aztec-up to install a specific version of the Aztec toolchain.
44
# It expects VERSION and INSTALL_URI to be set.
5+
6+
# Guard against truncated curl downloads: bash must parse the entire {} block before executing any of it.
7+
{
58
set -euo pipefail
69

710
# Colors
@@ -261,3 +264,7 @@ function main {
261264
}
262265

263266
main "$@"
267+
268+
# Explicit exit prevents bash from reading past the closing brace.
269+
exit
270+
}

barretenberg/cpp/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "wasm32")
108108
endif()
109109
endif()
110110

111+
if(WIN32)
112+
message(STATUS "Cross-compiling for Windows (MinGW)")
113+
link_libraries(ws2_32 bcrypt psapi)
114+
endif()
115+
111116
set(CMAKE_C_STANDARD 11)
112117
set(CMAKE_C_EXTENSIONS ON)
113118
set(CMAKE_CXX_STANDARD 20)

barretenberg/cpp/CMakePresets.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,24 @@
534534
"HAVE_STD_REGEX": "ON"
535535
}
536536
},
537+
{
538+
"name": "zig-amd64-windows",
539+
"displayName": "Build for Windows amd64 with Zig",
540+
"description": "Cross-compile for Windows x86_64 using Zig (MinGW). Excludes ipc/lmdb/world_state/nodejs_module (no Windows support).",
541+
"inherits": "zig-base",
542+
"environment": {
543+
"CC": "zig cc -target x86_64-windows-gnu",
544+
"CXX": "zig c++ -target x86_64-windows-gnu",
545+
"LDFLAGS": "-s"
546+
},
547+
"cacheVariables": {
548+
"CMAKE_SYSTEM_NAME": "Windows",
549+
"CMAKE_SYSTEM_PROCESSOR": "x86_64",
550+
"TARGET_ARCH": "skylake",
551+
"MOBILE": "ON",
552+
"AVM_TRANSPILER_LIB": "${sourceDir}/../../avm-transpiler/target/x86_64-pc-windows-gnu/release/libavm_transpiler.a"
553+
}
554+
},
537555
{
538556
"name": "zig-arm64-ios",
539557
"displayName": "iOS arm64 static library (Zig)",
@@ -785,6 +803,11 @@
785803
"configurePreset": "zig-arm64-macos",
786804
"inheritConfigureEnvironment": true
787805
},
806+
{
807+
"name": "zig-amd64-windows",
808+
"configurePreset": "zig-amd64-windows",
809+
"inheritConfigureEnvironment": true
810+
},
788811
{
789812
"name": "zig-arm64-ios",
790813
"configurePreset": "zig-arm64-ios",

barretenberg/cpp/bootstrap.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ function build_cross_objects {
8585
set -eu
8686
target=$1
8787
if ! cache_exists barretenberg-$target-$hash.zst; then
88-
build_preset zig-$target --target barretenberg nodejs_module vm2_stub circuit_checker honk
88+
if [[ "$target" == *-windows ]]; then
89+
# Windows builds exclude nodejs_module (N-API requires MSVC, not MinGW)
90+
AVM_TRANSPILER=0 build_preset zig-$target --target barretenberg vm2_stub circuit_checker honk
91+
else
92+
(flock -x 200 && cd src/barretenberg/nodejs_module && yarn --immutable) 200>/tmp/bb-yarn.lock
93+
build_preset zig-$target --target barretenberg nodejs_module vm2_stub circuit_checker honk
94+
fi
8995
fi
9096
}
9197

@@ -107,6 +113,19 @@ function build_cross {
107113
fi
108114
}
109115

116+
# Cross compile Windows binary (bb.exe only, no nodejs_module).
117+
# Arg is target arch-os e.g. amd64-windows.
118+
function build_cross_windows {
119+
set -eu
120+
target=$1
121+
if ! cache_download barretenberg-$target-$hash.zst; then
122+
AVM_TRANSPILER=0 build_preset zig-$target --target bb --target bb-external
123+
cache_upload barretenberg-$target-$hash.zst build-zig-$target/{bin,lib}
124+
fi
125+
# Always inject version (even for cached binaries) to ensure correct version on release
126+
inject_version build-zig-$target/bin/bb.exe
127+
}
128+
110129
# Build static library (.a) for iOS using Zig cross-compilation from Linux.
111130
# Only produces static libraries (bb-external) — Zig cannot link iOS executables
112131
# due to lack of TBD/dylib support. Requires iOS SDK headers (downloaded automatically).
@@ -251,6 +270,11 @@ function build_release_dir {
251270
# Package amd64-macos
252271
tar -czf build-release/barretenberg-amd64-darwin.tar.gz -C build-zig-amd64-macos/bin bb
253272

273+
# Package amd64-windows
274+
if [ -f build-zig-amd64-windows/bin/bb.exe ]; then
275+
tar -czf build-release/barretenberg-amd64-windows.tar.gz -C build-zig-amd64-windows/bin bb.exe
276+
fi
277+
254278
# Package static libraries for FFI bindings
255279
if [ -f build/lib/libbb-external.a ]; then
256280
tar -czf build-release/barretenberg-static-amd64-linux.tar.gz -C build/lib libbb-external.a
@@ -264,6 +288,9 @@ function build_release_dir {
264288
if [ -f build-zig-arm64-macos/lib/libbb-external.a ]; then
265289
tar -czf build-release/barretenberg-static-arm64-darwin.tar.gz -C build-zig-arm64-macos/lib libbb-external.a
266290
fi
291+
if [ -f build-zig-amd64-windows/lib/libbb-external.a ]; then
292+
tar -czf build-release/barretenberg-static-amd64-windows.tar.gz -C build-zig-amd64-windows/lib libbb-external.a
293+
fi
267294

268295
# Package iOS static libraries (cross-compiled with Zig from Linux)
269296
if [ -f build-zig-arm64-ios/lib/libbb-external.a ]; then
@@ -282,7 +309,7 @@ function build_release_dir {
282309
fi
283310
}
284311

285-
export -f build_preset build_native_objects build_cross_objects build_native build_cross build_ios build_android build_asan_fast build_wasm build_wasm_threads build_gcc_syntax_check_only build_fuzzing_syntax_check_only build_smt_verification inject_version
312+
export -f build_preset build_native_objects build_cross_objects build_native build_cross build_cross_windows build_ios build_android build_asan_fast build_wasm build_wasm_threads build_gcc_syntax_check_only build_fuzzing_syntax_check_only build_smt_verification inject_version
286313

287314
function build {
288315
echo_header "bb cpp build"
@@ -306,6 +333,7 @@ function build {
306333
"build_cross arm64-linux" \
307334
"build_cross amd64-macos true" \
308335
"build_cross arm64-macos true" \
336+
"build_cross_windows amd64-windows" \
309337
"build_ios zig-arm64-ios" \
310338
"build_ios zig-arm64-ios-sim" \
311339
"build_android zig-arm64-android" \

barretenberg/cpp/src/barretenberg/api/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ if(AVM_TRANSPILER_LIB)
55
target_link_libraries(api_objects PRIVATE avm_transpiler)
66
endif()
77

8-
if(NOT WASM)
8+
if(NOT WASM AND NOT MOBILE)
99
target_link_libraries(api_objects PRIVATE ipc)
1010
endif()

barretenberg/cpp/src/barretenberg/api/api_chonk.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ bool ChonkAPI::prove_and_verify(const std::filesystem::path& input_path)
134134
void ChonkAPI::gates(const Flags& flags, const std::filesystem::path& bytecode_path)
135135
{
136136
BB_BENCH_NAME("ChonkAPI::gates");
137-
chonk_gate_count(bytecode_path, flags.include_gates_per_opcode);
137+
chonk_gate_count(bytecode_path.string(), flags.include_gates_per_opcode);
138138
}
139139

140140
void ChonkAPI::write_solidity_verifier([[maybe_unused]] const Flags& flags,

0 commit comments

Comments
 (0)