Skip to content
Closed
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
4 changes: 4 additions & 0 deletions barretenberg/cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function inject_version {
# Version starts immediately after the sentinel
local version_offset=$((sentinel_offset + ${#sentinel}))
printf "$version\0" | dd of="$binary" bs=1 seek=$version_offset conv=notrunc 2>/dev/null
# Re-sign on macOS after modifying the binary (version injection invalidates code signature)
if [[ "$(uname)" == "Darwin" ]]; then
codesign -s - -f "$binary" 2>/dev/null || true
fi
}

# Define build commands for each preset
Expand Down
22 changes: 22 additions & 0 deletions barretenberg/cpp/src/barretenberg/bb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ if (NOT(FUZZING))
# Link avm_transpiler when library is provided
if(AVM_TRANSPILER_LIB)
target_link_libraries(bb PRIVATE ${AVM_TRANSPILER_LIB})
if(APPLE)
target_link_libraries(bb PRIVATE "-framework CoreFoundation")
endif()
endif()
if(NOT WASM)
target_link_libraries(bb PRIVATE ipc)
Expand All @@ -38,6 +41,14 @@ if (NOT(FUZZING))
)
endif()

# Re-sign on macOS to fix invalid linker-generated adhoc signature
if(APPLE)
add_custom_command(TARGET bb POST_BUILD
COMMAND codesign -s - -f $<TARGET_FILE:bb>
COMMENT "Re-signing bb binary for macOS"
)
endif()

if(AVM)
# Full bb-avm binary with AVM support (opt-in)
add_executable(
Expand All @@ -61,6 +72,9 @@ if (NOT(FUZZING))
# Link avm_transpiler when library is provided
if(AVM_TRANSPILER_LIB)
target_link_libraries(bb-avm PRIVATE ${AVM_TRANSPILER_LIB})
if(APPLE)
target_link_libraries(bb-avm PRIVATE "-framework CoreFoundation")
endif()
endif()
if(NOT WASM)
target_link_libraries(bb-avm PRIVATE ipc)
Expand All @@ -77,5 +91,13 @@ if (NOT(FUZZING))
-ldw -lelf
)
endif()

# Re-sign on macOS to fix invalid linker-generated adhoc signature
if(APPLE)
add_custom_command(TARGET bb-avm POST_BUILD
COMMAND codesign -s - -f $<TARGET_FILE:bb-avm>
COMMENT "Re-signing bb-avm binary for macOS"
)
endif()
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,9 @@ TEST_F(WorldStateTest, NullifierBatchInsert)
auto response = ws.batch_insert_indexed_leaves<NullifierLeafValue>(
MerkleTreeId::NULLIFIER_TREE, { NullifierLeafValue(150), NullifierLeafValue(142), NullifierLeafValue(180) }, 2);

std::vector<std::pair<NullifierLeafValue, size_t>> expected_sorted_leaves = { { NullifierLeafValue(180), 2 },
{ NullifierLeafValue(150), 0 },
{ NullifierLeafValue(142), 1 } };
std::vector<std::pair<NullifierLeafValue, index_t>> expected_sorted_leaves = { { NullifierLeafValue(180), 2 },
{ NullifierLeafValue(150), 0 },
{ NullifierLeafValue(142), 1 } };
EXPECT_EQ(response.sorted_leaves, expected_sorted_leaves);

{
Expand Down
21 changes: 19 additions & 2 deletions barretenberg/crs/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ function build {
crs_size_bytes=$((crs_size*64))
g1=$crs_path/bn254_g1.dat
g2=$crs_path/bn254_g2.dat
if [ ! -f "$g1" ] || [ $(stat -c%s "$g1") -lt $crs_size_bytes ]; then
# stat -c%s is Linux-only, use stat -f%z on macOS
local g1_size=0
if [ -f "$g1" ]; then
if [[ "$(uname)" == "Darwin" ]]; then
g1_size=$(stat -f%z "$g1")
else
g1_size=$(stat -c%s "$g1")
fi
fi
if [ ! -f "$g1" ] || [ $g1_size -lt $crs_size_bytes ]; then
echo "Downloading crs of size: ${crs_size} ($((crs_size_bytes/(1024*1024)))MB)"
mkdir -p $crs_path
curl -s -H "Range: bytes=0-$((crs_size_bytes-1))" -o $g1 \
Expand All @@ -28,7 +37,15 @@ function build {
crs_size=$((2**18))
crs_size_bytes=$((crs_size*64))
gg1=$crs_path/grumpkin_g1.flat.dat
if [ ! -f "$gg1" ] || [ $(stat -c%s "$gg1") -lt $crs_size_bytes ]; then
local gg1_size=0
if [ -f "$gg1" ]; then
if [[ "$(uname)" == "Darwin" ]]; then
gg1_size=$(stat -f%z "$gg1")
else
gg1_size=$(stat -c%s "$gg1")
fi
fi
if [ ! -f "$gg1" ] || [ $gg1_size -lt $crs_size_bytes ]; then
echo "Downloading grumpkin crs of size: ${crs_size} ($((crs_size_bytes/(1024*1024)))MB)"
curl -s -H "Range: bytes=0-$((crs_size_bytes-1))" -o $gg1 \
https://crs.aztec.network/grumpkin_g1.dat
Expand Down
2 changes: 1 addition & 1 deletion ci3/arch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Returns the standard artifact prefixes for each arch.
case $(uname -m) in
aarch64)
aarch64|arm64)
echo arm64
;;
amd64|x86_64)
Expand Down
16 changes: 14 additions & 2 deletions ci3/denoise
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ function publish_log_final {

function live_publish_log {
while [ -f $outfile ]; do
if [ $(( $(date +%s) - $(stat -c %Y "$outfile") )) -le 5 ]; then
local file_mtime
if [[ "$(uname)" == "Darwin" ]]; then
file_mtime=$(stat -f %m "$outfile")
else
file_mtime=$(stat -c %Y "$outfile")
fi
if [ $(( $(date +%s) - $file_mtime )) -le 5 ]; then
publish_log
fi
sleep 5
Expand All @@ -94,7 +100,13 @@ fi
set +e
echo -e "Executing: $cmd ${log_info:-}"
echo -n " 0 "
tail --sleep-interval=0.2 -n +1 -f "$outfile" > >(
# macOS tail doesn't support --sleep-interval
if [[ "$(uname)" == "Darwin" ]]; then
tail_args="-n +1 -f"
else
tail_args="--sleep-interval=0.2 -n +1 -f"
fi
tail $tail_args "$outfile" > >(
while IFS= read -r line; do
dot_count=$((dot_count+1))
[ $realtime -eq 1 ] && printf "."
Expand Down
11 changes: 10 additions & 1 deletion ci3/source
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# This can be sourced multiple by scripts calling scripts, so it makes sense to only do certain sets through first pass.

# Enter our script directory, allowing usage of scripts from any directory.
[ -z "${NO_CD:-}" ] && cd "$(dirname $0)"
# Skip cd if $0 is a shell binary (e.g., /bin/bash or /opt/homebrew/bin/bash)
if [ -z "${NO_CD:-}" ] && [[ "$0" != */bash ]] && [[ "$0" != */zsh ]] && [[ "$0" != */sh ]]; then
cd "$(dirname $0)"
fi

# We export so we can use from exported functions.
export root=${root:-$(git rev-parse --show-toplevel)}
Expand All @@ -21,6 +24,12 @@ fi
# We are fine using foundry nightly.
export FOUNDRY_DISABLE_NIGHTLY_WARNING=1

# Fix for parallel setting XDG_CACHE_HOME to empty string, which breaks corepack.
# If XDG_CACHE_HOME is set but empty, unset it to use the default.
if [ -n "${XDG_CACHE_HOME+x}" ] && [ -z "$XDG_CACHE_HOME" ]; then
unset XDG_CACHE_HOME
fi

source $ci3/source_options
source $ci3/source_stdlib
source $ci3/source_color
2 changes: 2 additions & 0 deletions ci3/source_stdlib
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ function get_num_cpus {
else
echo $((cpu_quota / cpu_period))
fi
elif [[ "$(uname)" == "Darwin" ]]; then
sysctl -n hw.ncpu
else
nproc
fi
Expand Down
Loading