Skip to main content

Local Development Cheat Sheet

Quick reference of every command a contributor needs. Anchored to the pin f8915bc (0.13.1). For the full discussion, see Chapter 2 (Build, Test, and Contribute).

Clone and Toolchain

git clone https://github.com/zcash/orchard
cd orchard
git checkout 0.13.1
# rustup will install rust 1.85.1 automatically from rust-toolchain.toml
cargo --version

Build

GoalCommand
Default featurescargo build
All featurescargo build --all-features
No defaults (no circuit, no std)cargo build --no-default-features
no_std for wasmcargo build --no-default-features --target wasm32-wasip1
no_std for embedded ARMcargo build --no-default-features --target thumbv7em-none-eabihf
Releasecargo build --release

Test

GoalCommand
Full test matrix as CIcargo test --verbose
Library tests onlycargo test --lib
Integration tests onlycargo test --test builder
Doctestscargo test --doc
One modulecargo test --lib keys::tests
One test with outputcargo test --lib keys::tests::foo -- --nocapture
Skip slow circuit testscargo test --no-default-features --features std
Release-speed full suitecargo test --release

Format and Lint

cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings

A pre-push hook running these two is the cheapest way to avoid CI round trips.

Benchmarks

cargo bench --bench circuit -- --quick # Action circuit prover / verifier
cargo bench --bench note_decryption # ZIP 212 decryption
cargo bench --bench small # micro-benchmarks

Source: benches/circuit.rs, benches/note_decryption.rs, benches/small.rs.

Docs

cargo doc --no-deps --open
# All features (matches docs.rs):
cargo doc --no-deps --all-features --open

The rustdoc-args injected by package.metadata.docs.rs in Cargo.toml embeds the KaTeX header katex-header.html so math in rustdoc renders correctly.

Dependency Audit

cargo install cargo-audit # one-time
cargo audit
cargo tree -d # find duplicate transitive deps
cargo tree -e features # see feature propagation

Common Bash Loops

# Run the integration test, retrying on the slow first build.
cargo test --release --test builder

# Verify no diff after format, as the lints workflow does.
cargo fmt --all && git diff --exit-code

# Rebuild after a Cargo.lock bump, mirroring the "latest deps" CI job.
rm Cargo.lock && cargo build --all-features

CI Workflow Reference

CI definitions live in .github/workflows/. Local equivalents:

CI jobLocal command
testcargo test --verbose
build-latestrm Cargo.lock && cargo build --all-features --verbose
build-nostdcargo build --release --no-default-features --target wasm32-wasip1
lints-stable.fmtcargo fmt --all -- --check
lints-stable.clippycargo clippy --all-targets --all-features -- -D warnings
book(separate mdBook setup; not required for contributing to the crate)

Useful gh Commands

# Browse open issues.
gh issue list --state open --limit 30 --repo zcash/orchard

# Read an issue with comments.
gh issue view 463 --repo zcash/orchard --comments

# Read a PR with all review comments.
gh pr view 496 --repo zcash/orchard --comments