Skip to main content

Developer cheat sheet

Single-page reference. Open it in a tab while you work.

Toolchain

ToolPinned byCommand to install / check
Rust 1.85.1rust-toolchain.tomlrustup show
cargo-vetsupply-chain/cargo install cargo-vet
cargo-mutants (optional)mutants.ymlcargo install cargo-mutants

Build

# Full workspace.
cargo build --workspace --all-features

# Release mode.
cargo build --workspace --all-features --release

# One crate.
cargo build -p zcash_client_sqlite --all-features

# Documentation locally.
cargo doc --workspace --no-deps --all-features --open

Test

# All tests.
cargo test --workspace --all-features

# One crate.
cargo test -p zcash_primitives --all-features

# One test (substring match).
cargo test -p zcash_primitives roundtrip

# Show stdout from passing tests.
cargo test -p zcash_primitives -- --nocapture

# Single thread (helpful when tests share filesystem state).
cargo test -p zcash_client_sqlite -- --test-threads=1

Lint and format

cargo fmt --all # write
cargo fmt --all -- --check # CI mode
cargo clippy --workspace --all-features --all-targets -- -D warnings

Supply chain

cargo vet # audit
cargo vet diff <crate> # diff vs prior approved version
cargo vet certify <crate> # add a certification (requires policy match)

Mutation testing

cargo mutants --in-place --no-shuffle --package zcash_primitives

A surviving mutant means a test is not exercising that branch.

Docs site (this course)

cd onboarding
make install # npm install
make dev # local server with hot reload
make build # production build
make preview # serve the production build locally

Common debugging recipes

# Print the resolved dependency graph for one crate.
cargo tree -p zcash_client_sqlite --all-features

# Find which crate pulls in a specific transitive dependency.
cargo tree -i <crate-name>

# Re-run tests with backtraces.
RUST_BACKTRACE=1 cargo test -p zcash_primitives -- --nocapture

# Re-run a single test with logging visible.
RUST_LOG=debug cargo test -p zcash_client_sqlite some_test -- --nocapture

Git workflow

# Create a feature branch from main.
git switch -c <issue-N>-<short-slug>

# Squash changelog entry into its own commit (keep code separate).
git commit --interactive

# Rebase on main before opening the PR (no merge commits).
git fetch upstream main
git rebase upstream/main

# DCO sign-off (if required).
git commit -s

Workflow files in .github/workflows/

FileWhat it runsTriggered on
ci.ymlbuild + tests + fmt + clippypush, PR
audits.ymlcargo vetpush, PR
aggregate-audits.ymlaggregate vet metadatascheduled
book.ymlmdBook build (not this course)push to main
mutants.ymlcargo mutantsscheduled
zizmor.ymllint workflows themselvespush, PR
onboarding-docs.ymlthis course's deploypush to onboarding