Skip to content

fix(build): ignore target dirs when watching guest dependencies - #3026

Merged
bergkvist merged 5 commits into
mainfrom
tobias/sp1-build-rerun
Oct 26, 2026
Merged

bergkvist merged 5 commits into
mainfrom
tobias/sp1-build-rerun

Conversation

@bergkvist

Copy link
Copy Markdown
Contributor

Summary

sp1-build emits cargo:rerun-if-changed for every path dependency of a guest program. Cargo scans those directories recursively. crates/verifier contains guest-verify-programs/target, and crates/test-artifacts contains the other guest programs' target/ directories. Every guest build writes to these directories, so test-artifacts was always dirty. Every cargo test then recompiled it and 7 crates that depend on it (sp1-core-machine, sp1-prover, sp1-sdk, …).

This change keeps watching each dependency directory, but skips target/ directories and the program's own target directory, even before it exists. A directory is emitted as one path when nothing inside it is skipped.

It also removes the SP1_SKIP_PROGRAM_BUILD workaround from .oss-scanner/Dockerfile. That cuts the image build from 10.6 to 6.8 minutes, so it should fit in the OSS Scanner CI's 40-minute limit (anthropics/oss-scanner#1032).

Test plan

  • cargo test -p sp1-build paths_excluding
  • cargo build --release -p test-artifacts twice: second build is Fresh (was Dirty: the file crates/verifier has changed)
  • Touching crates/verifier/src/lib.rs, crates/test-artifacts/programs/fibonacci/src/main.rs or crates/zkvm/entrypoint/src/lib.rs still rebuilds test-artifacts
  • .oss-scanner/Dockerfile from a fresh clone: offline cargo sp1-test --no-run is a no-op on the first run, and test_fibonacci_prove_simple passes with 2 CPUs and 8 GB
  • cargo fmt --all -- --check, cargo clippy -p sp1-build --all-targets --all-features

🤖 Generated with Claude Code

Comment thread crates/build/src/utils.rs Outdated
Comment thread crates/build/src/utils.rs
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Test Old New Diff
bls12_381_tests_test_v2_field_checks 29324 29324 0.0000 %
bn_test_bn_test_fq_inverse_100 786417 786417 0.0000 %
sha_test_sha2_v0_10_6_expected_digest_lte_100_times 1342451 1340489 -0.1462 %
bn_test_bn_test_g1_add_100 988624 988624 0.0000 %
sha_test_sha2_v0_9_9_expected_digest_lte_100_times 1256580 1251618 -0.3949 %
bn_test_field_checks 31646 31646 0.0000 %
bls12_381_tests_test_inverse_fp2_100 2216948 2216948 0.0000 %
bn_test_bn_test_fr_inverse_100 803517 803517 0.0000 %
bn_test_bn_test_g1_double_100 728704 728704 0.0000 %
curve25519_dalek_ng_test_zero_mul 107750 107750 0.0000 %
bls12_381_tests_test_sqrt_fp_100 828074 781900 -5.5761 %
curve25519_dalek_test_add_then_multiply 2604616 2571223 -1.2821 %
bls12_381_tests_test_field_checks 29324 29324 0.0000 %
bls12_381_tests_test_inverse_fp_100 1197070 1197070 0.0000 %
bn_test_bn_test_g1_mul_zero 47803 47803 0.0000 %
sha_test_sha2_v0_11_0_expected_digest_lte_100_times 1329552 1337279 0.5812 %
k256_test_verify_rand_lte_100 11759421 11757278 -0.0182 %
curve25519_dalek_test_ed25519_verify 12938496 12939687 0.0092 %
curve25519_dalek_test_decompressed_expected_value 4549819 4469630 -1.7625 %
curve25519_dalek_ng_test_zero_msm 125133 125133 0.0000 %
rustcrypto_bigint_test_bigint_mul_add_residue 2053023 2053023 0.0000 %
curve25519_dalek_test_zero_msm 83427 83427 0.0000 %
rustcrypto_bigint_test_bigint_mul_mod_special 1717435 1717435 0.0000 %
k256_test_point_ops_edge_cases 40933 40933 0.0000 %
p256_test_verify_rand_lte_100 12074897 12060613 -0.1183 %
bls12_381_tests_test_sqrt_fp2_100 1819029 1838587 1.0752 %
bls12_381_tests_test_v2_point_checks 1738384 1738384 0.0000 %
k256_test_recover_pubkey_infinity 98610 98610 0.0000 %
k256_test_recover_rand_lte_100 4431227 4420923 -0.2325 %
bn_test_bn_test_g1_add_neg 291962 291962 0.0000 %
p256_test_point_checks 347502 347502 0.0000 %
k256_test_schnorr_verify 5758116 5770497 0.2150 %
curve25519_dalek_ng_test_add_then_multiply 3904477 3403992 -12.8182 %
p256_test_recover_rand_lte_100 15916670 15921836 0.0325 %
secp256k1_program_test_recover_rand_lte_100 5525081 5522546 -0.0459 %
k256_test_recover_high_hash_high_recid 2223636 1922779 -13.5300 %
sha_test_sha2_v0_10_9_expected_digest_lte_100_times 1345091 1340516 -0.3401 %
bn_test_bn_test_fq_partial_ord 184528 184528 0.0000 %
secp256k1_program_test_verify_rand_lte_100 17117882 17120307 0.0142 %
k256_test_field_checks 40519 40519 0.0000 %
secp256k1_program_test_verify_v0_30_0_rand_lte_100 17078502 17114215 0.2091 %
curve25519_dalek_test_decompressed_noncanonical 7725 7725 0.0000 %
keccack_test_expected_digest_lte_100 1710964 1707712 -0.1901 %
sha_test_sha2_v0_10_8_expected_digest_lte_100_times 1344706 1343863 -0.0627 %
sha_test_sha3_expected_digest_lte_100_times 1176398 1176324 -0.0063 %
p256_test_recover_pubkey_infinity 98144 98144 0.0000 %
bn_test_bn_test_fq_sqrt_100 787370 787379 0.0011 %
curve25519_dalek_test_zero_mul 71838 71838 0.0000 %
p256_test_field_checks 47543 47543 0.0000 %
rust_crypto_rsa_test_pkcs_verify_100 29296712 29290292 -0.0219 %
secp256k1_program_test_recover_v0_30_0_rand_lte_100 5513763 5503944 -0.1781 %
curve25519_dalek_ng_test_decompressed_noncanonical 189834 189834 0.0000 %
bn_test_bn_test_g1_msm_edge 375798 375798 0.0000 %
bls12_381_tests_test_bls_double_100 6284517 6284517 0.0000 %
bls12_381_tests_test_bls_add_100 10355715 10355715 0.0000 %
bls12_381_tests_test_point_checks 797024 797024 0.0000 %
p256_test_recover_high_hash_high_recid 6352753 4554537 -28.3061 %

@fakedev9999 fakedev9999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bergkvist
bergkvist enabled auto-merge (squash) October 26, 2026 14:46
@bergkvist
bergkvist merged commit 517b2dc into main Oct 26, 2026
14 checks passed
@bergkvist
bergkvist deleted the tobias/sp1-build-rerun branch October 26, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants