Skip to content

copy sapling params to OUT_DIR instead of source directory#2320

Open
evanbranigan-dotcom wants to merge 2 commits into
zingolabs:devfrom
evanbranigan-dotcom:fix-build-script-params-path
Open

copy sapling params to OUT_DIR instead of source directory#2320
evanbranigan-dotcom wants to merge 2 commits into
zingolabs:devfrom
evanbranigan-dotcom:fix-build-script-params-path

Conversation

@evanbranigan-dotcom
Copy link
Copy Markdown
Contributor

Summary

  • Build script now copies sapling params to $OUT_DIR/zcash-params/ instead of zingolib/zcash-params/ in the source tree
  • Uses rust_embed's interpolate-folder-path feature to resolve $OUT_DIR at compile time
  • Eliminates ~50MB of duplicated param files in the source directory

Problem

The build script wrote sapling params to zingolib/zcash-params/ (in the source tree), violating Cargo's convention of only writing to target/ and ~/.cargo. This broke reproducible builds, caused unnecessary duplication, and panicked if the source directory was read-only.

Changes

File Change
zingolib/build.rs Copy params to $OUT_DIR/zcash-params/ instead of ./zcash-params/
zingolib/src/lib.rs #[folder = "$OUT_DIR/zcash-params/"] (was "zcash-params/")
zingolib/Cargo.toml Add interpolate-folder-path feature to rust-embed

Test plan

  • cargo check -p zingolib passes
  • cargo check -p zingo-cli passes
  • cargo clippy -p zingolib -- -D warnings passes
  • cargo doc --no-deps -p zingolib passes (with -D warnings)
  • cargo fmt clean
  • Params appear in target/debug/build/zingolib-*/out/zcash-params/

Note: The existing zingolib/zcash-params/ directory (gitignored) can now be deleted. New builds will not write to it.

Fixes #2315

AI Disclosure

Claude (Anthropic) assisted with codebase analysis and patch authoring. All code was reviewed and understood by the committer.

evanbranigan-dotcom and others added 2 commits April 1, 2026 18:31
The build script copied sapling params to zingolib/zcash-params/ in
the source tree, violating cargo's convention of only writing to
target/ and ~/.cargo. This broke reproducible builds and caused
unnecessary 50MB duplication.

Copy to $OUT_DIR/zcash-params/ instead and use rust_embed's
interpolate-folder-path feature to resolve the path at compile time.

Fixes zingolabs#2315

AI Disclosure: Claude (Anthropic) assisted with codebase analysis and
patch authoring. All code was reviewed and understood by the committer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Build script writes (copies) Sapling parameters to crate source directory

2 participants