Skip to content

Commit fd5757a

Browse files
fix(bb): link env_objects into wasm exec; prefetch CRS for wasm-perf-gate
1 parent ee04aeb commit fd5757a

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/wasm-emscripten.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,29 @@ jobs:
235235
run: |
236236
cmake --preset wasm-threads
237237
cmake --build --preset wasm-threads --target ultra_honk_bench
238+
- name: Stage CRS for the wasm benchmark
239+
run: |
240+
# The bench calls init_file_crs_factory, which throws if the CRS
241+
# files are absent. http_download is unsupported under WASM
242+
# (throws "HTTP download not supported in WASM"), so the runtime
243+
# cannot self-fetch -- prefetch on the host before running.
244+
# 4 MiB of compressed g1 covers up to 2^17 points, well above the
245+
# 2^16 filter below.
246+
set -eu
247+
mkdir -p "$HOME/.bb-crs"
248+
curl -fsSL --range 0-4194303 \
249+
https://crs.aztec-cdn.foundation/g1_compressed.dat \
250+
-o "$HOME/.bb-crs/bn254_g1_compressed.dat"
251+
curl -fsSL https://crs.aztec-cdn.foundation/g2.dat \
252+
-o "$HOME/.bb-crs/bn254_g2.dat"
238253
- name: Run benchmark
239254
id: bench
240255
working-directory: barretenberg/cpp
241256
run: |
242257
# --benchmark_out writes a clean JSON to a file; google-benchmark
243258
# otherwise prints to stdout intermixed with BB_BENCH profiling
244259
# tree, which breaks `json.load`.
245-
./scripts/wasm-run --dir=. \
260+
./scripts/wasm-run --dir="$HOME/.bb-crs" --dir=. \
246261
./build-wasm-threads/bin/ultra_honk_bench \
247262
--benchmark_format=json \
248263
--benchmark_out=/tmp/bench.json \

barretenberg/cpp/src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ if(WASM)
244244
add_executable(
245245
barretenberg
246246
${BARRETENBERG_TARGET_OBJECTS}
247+
# env provides logstr / throw_or_abort_impl. Outside WASM these are
248+
# supplied by the consumer linking libbarretenberg + env; the WASM
249+
# exec is the artifact we ship, so it must bundle them. Without
250+
# this, -sEXPORT_ALL=1 hard-errors at link time on the unresolved
251+
# WASM_IMPORT-decorated declarations.
252+
$<TARGET_OBJECTS:env_objects>
247253
# This is an object library, so doesn't need _objects.
248254
$<TARGET_OBJECTS:vm2_stub>
249255
)

0 commit comments

Comments
 (0)