Light Program Test
A fast local test environment for Solana programs using compressed accounts and tokens.
For Rust and Anchor program development, see light-sdk.
For Rust client, see light-client.
For full program examples, see the Program Examples.
For detailed documentation, visit zkcompression.com.
Features
v2- Enables v2 batched Merkle trees.
Testing Features
Use light-program-test when:
- You need fast test execution
- You write unit/integration tests for your program or client code
Use solana-test-validator when:
- You need RPC methods or external tools that are incompatible with LiteSVM
- Testing against real validator behavior
Configuration Options
with_prover: bool
true: Starts a prover server in the background for generating validity proofsfalse: Runs without prover (faster for tests that don't need proofs, or repeated test runs to reduce startup time)
additional_programs: Option<Vec<(&str, Pubkey)>>
- Specify custom programs to deploy alongside the default Light Protocol programs
- Format:
vec![("program_name", program_id)] - Programs are loaded from built artifacts
Prerequisites
-
ZK Compression CLI: Required to start the prover server and download Light Protocol programs
- If programs are missing after CLI installation, run
light test-validatoronce to download them
- If programs are missing after CLI installation, run
-
Build programs: Run
cargo test-sbfto build program binaries and set the required environment variables for locating program artifacts
Prover Server
The prover server runs on port 3001 when enabled. To manually stop it:
# Find the process ID
# Kill the process
Debugging
Set RUST_BACKTRACE=1 to show detailed transaction information including accounts and parsed instructions:
RUST_BACKTRACE=1
Examples
V1 Trees
use ;
use Signer;
async
V2 Trees
use ;
use Signer;
async