Light Program Test
A fast local test environment for Solana programs using compressed accounts and tokens.
Features
- Fast in-memory indexer and SVM via LiteSVM
- Supports custom programs
- Built-in prover
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-validator
once to download them
- If programs are missing after CLI installation, run
-
Build programs: Run
cargo test-sbf
to 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
Examples
V1 Trees
use ;
use Signer;
async
V2 Trees
use ;
use Signer;
async