From 0ad3242fbddb0778f8dd3a489f5c5c59b5283f2c Mon Sep 17 00:00:00 2001 From: Mario Rugiero Date: Mon, 10 Aug 2026 14:14:20 -0300 Subject: [PATCH 1/2] fix(make): build the guest ELFs the prover targets read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test-prover, test-prover-all, test-prover-debug, test-prover-cuda and test-disk-spill depended on compile-recursion-elfs only, so on a clean checkout every test reading executor/program_artifacts/rust/*.elf or */asm/*.elf panicked with "elf not found". test-fast additionally runs the executor suite, which reads most of the Rust guests. compile-prover-test-elfs builds the asm guests, the recursion guests, and the eight Rust guests the prover suite reads — not all 35, since the .elf rules are FORCE and would re-enter cargo per guest on every run. check-prover-test-elfs greps the prover sources and fails if one is missing from the list, so the next test to read a new guest cannot silently reintroduce the failure; it runs from lint, which CI already invokes. --- Makefile | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index a4b05b507..36d5f649e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ .PHONY: deps deps-linux deps-macos compile-programs-asm compile-programs-rust compile-bench \ -compile-programs compile-recursion-elfs clean-asm clean-rust clean-bench clean-shared \ +compile-programs compile-recursion-elfs compile-prover-test-elfs check-prover-test-elfs \ +clean-asm clean-rust clean-bench clean-shared \ clean-recursion-elfs clean test test-asm \ test-rust test-ethrex test-ethrex-offline test-executor test-syscalls test-flamegraph flamegraph-prover test-profile-recursion test-profile-recursion-single test-profile-recursion-multi \ test-profile-recursion-block recursion-profile-block-input \ @@ -48,6 +49,13 @@ RUST_PROGRAM_DIRS := $(dir $(wildcard $(RUST_PROGRAMS_DIR)/*/Cargo.toml)) RUST_PROGRAMS := $(notdir $(basename $(RUST_PROGRAM_DIRS:%/=%))) RUST_ARTIFACTS := $(addprefix $(RUST_ARTIFACTS_DIR)/, $(addsuffix .elf, $(RUST_PROGRAMS))) +# The Rust guests the prover test suite reads as prebuilt artifacts. The prover +# targets build these instead of all $(RUST_PROGRAMS), because the .elf rules are +# FORCE (see below) and would re-enter cargo once per guest on every test run. +# `check-prover-test-elfs` fails if a prover test reads one that is missing here. +PROVER_TEST_GUESTS := allocator commit_sum ecsm ef_io_demo ethrex hint_min hint_multi pure_commit +PROVER_TEST_ARTIFACTS := $(addprefix $(RUST_ARTIFACTS_DIR)/, $(addsuffix .elf, $(PROVER_TEST_GUESTS))) + BENCH_PROGRAM_DIRS := $(dir $(wildcard $(BENCH_PROGRAMS_DIR)/*/Cargo.toml)) BENCH_PROGRAMS := $(notdir $(basename $(BENCH_PROGRAM_DIRS:%/=%))) BENCH_ARTIFACTS := $(addprefix $(BENCH_ARTIFACTS_DIR)/, $(addsuffix .elf, $(BENCH_PROGRAMS))) @@ -171,6 +179,18 @@ compile-programs: compile-programs-asm compile-programs-rust compile-bench compi compile-recursion-elfs: prepare-sysroot $(RECURSION_ARTIFACTS) $(RECURSION_VERIFIER_ARTIFACTS) +# Everything the prover suite reads off disk: the asm guests (via run_asm_elf), +# the Rust guests listed above, and the recursion guests. +compile-prover-test-elfs: compile-programs-asm compile-recursion-elfs $(PROVER_TEST_ARTIFACTS) + +# Guards the list against drift: a new prover test that reads a Rust guest not in +# $(PROVER_TEST_GUESTS) would pass in CI (which builds every guest) and panic with +# "elf not found" on a clean checkout running `make test-prover`. Run from `lint`. +check-prover-test-elfs: + @grep -rhoE 'program_artifacts/rust/[A-Za-z0-9_]+\.elf' prover/src prover/tests \ + | sed -E 's#.*/##; s#\.elf$$##' | sort -u \ + | awk -v known="$(PROVER_TEST_GUESTS)" 'BEGIN { n = split(known, a, " "); for (i = 1; i <= n; i++) k[a[i]] = 1 } !($$0 in k) { if (!missing++) print "check-prover-test-elfs: prover tests read Rust guests missing from PROVER_TEST_GUESTS:"; print " " $$0 } END { if (missing) { print "Add them to PROVER_TEST_GUESTS in the Makefile."; exit 1 } }' + $(RECURSION_ARTIFACTS_DIR): mkdir -p $@ @@ -535,29 +555,30 @@ test: compile-programs test-syscalls test-ethrex-crypto # === Quick test shortcuts === -# Fast prover tests (skips ignored slow tests). Recursion smoke/PoC tests read -# prebuilt guest ELFs, so build them first. -test-fast: compile-recursion-elfs +# Fast prover tests (skips ignored slow tests). The executor leg reads most of +# the Rust guests, so this one needs the full set rather than the prover subset. +test-fast: compile-programs-asm compile-programs-rust compile-recursion-elfs cargo test -p lambda-vm-prover -p stark -p executor -F stark/parallel # Prover tests only -test-prover: compile-recursion-elfs +test-prover: compile-prover-test-elfs cargo test -p lambda-vm-prover # Prover tests including slow ones. The recursion smoke tests read prebuilt # guest ELFs from executor/program_artifacts/recursion/ — the fast ones on every # run, the slow ones (still #[ignore]d) only under --include-ignored — so build # them first. -test-prover-all: compile-recursion-elfs +test-prover-all: compile-prover-test-elfs cargo test -p lambda-vm-prover -- --include-ignored # Prover tests with debug-checks (shows bus balance report). Also unfiltered, so # it runs the non-ignored recursion tests that read prebuilt guest ELFs. -test-prover-debug: compile-recursion-elfs +test-prover-debug: compile-prover-test-elfs cargo test -p lambda-vm-prover --features debug-checks -- --nocapture # Disk-spill tests (stark + prover). FORCE_DISK_SPILL is required by the prover tests. -test-disk-spill: +# The count_table_lengths filter picks up the drift tests, which read hint_min.elf. +test-disk-spill: compile-prover-test-elfs cargo test --release -p stark --features disk-spill disk_spill FORCE_DISK_SPILL=1 cargo test --release -p lambda-vm-prover --features disk-spill -- disk_spill count_table_lengths @@ -583,9 +604,9 @@ test-cuda-fallback: # GPU + nvcc). The GPU CI counterpart of CPU CI's sharded prover tests. Single-threaded: the # GPU serializes proves and the dispatch counters are process-global. cuda on prover cascades # to stark; crypto/ecsm build without it (they have no GPU path). -# compile-recursion-elfs: this unfiltered run executes the non-ignored recursion -# smoke tests, which read prebuilt guest ELFs; scripts/gpu_test.sh otherwise never builds them. -test-prover-cuda: compile-recursion-elfs +# compile-prover-test-elfs: this unfiltered run executes the non-ignored tests that +# read prebuilt guest ELFs; scripts/gpu_test.sh otherwise never builds them. +test-prover-cuda: compile-prover-test-elfs cargo test --release -p lambda-vm-prover -p stark -p crypto -p ecsm \ --features lambda-vm-prover/cuda -- --test-threads=1 @@ -630,7 +651,7 @@ fmt: cargo fmt --all # Run clippy + fmt check (used by CI) -lint: +lint: check-prover-test-elfs cargo fmt --check --all cargo clippy --workspace --all-targets -- -D warnings -A clippy::op_ref cargo clippy --workspace --all-targets --no-default-features --features lambda-vm-prover/debug-checks -- -D warnings -A clippy::op_ref From 5aa1d67edb16be0762ea6d394dfbbff704eb5042 Mon Sep 17 00:00:00 2001 From: Mario Rugiero Date: Mon, 10 Aug 2026 17:06:08 -0300 Subject: [PATCH 2/2] fix(make): let the ELF guard match hyphenated guest names The pattern matched [A-Za-z0-9_] only, so a guest directory with a hyphen would have been skipped silently. Also states what the guard does not cover. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 36d5f649e..76444d1f7 100644 --- a/Makefile +++ b/Makefile @@ -186,8 +186,11 @@ compile-prover-test-elfs: compile-programs-asm compile-recursion-elfs $(PROVER_T # Guards the list against drift: a new prover test that reads a Rust guest not in # $(PROVER_TEST_GUESTS) would pass in CI (which builds every guest) and panic with # "elf not found" on a clean checkout running `make test-prover`. Run from `lint`. +# Rust guests only — the asm and recursion artifacts are built wholesale, so no +# list can go stale for them. A prover test reading a bench guest (none do today) +# would need its own entry here. check-prover-test-elfs: - @grep -rhoE 'program_artifacts/rust/[A-Za-z0-9_]+\.elf' prover/src prover/tests \ + @grep -rhoE 'program_artifacts/rust/[A-Za-z0-9_-]+\.elf' prover/src prover/tests \ | sed -E 's#.*/##; s#\.elf$$##' | sort -u \ | awk -v known="$(PROVER_TEST_GUESTS)" 'BEGIN { n = split(known, a, " "); for (i = 1; i <= n; i++) k[a[i]] = 1 } !($$0 in k) { if (!missing++) print "check-prover-test-elfs: prover tests read Rust guests missing from PROVER_TEST_GUESTS:"; print " " $$0 } END { if (missing) { print "Add them to PROVER_TEST_GUESTS in the Makefile."; exit 1 } }'