Skip to main content
phoenix-rise-litesvm-test provides deterministic LiteSVM fixtures for Phoenix program integration tests. It loads Phoenix Eternal and Ember, optionally Hawkeye and Flight, creates fake USDC collateral, initializes markets, seeds actors, and exposes helpers for replaying setup and action transactions. References:

Setup

The fixture helpers look for local protocol SBF artifacts. In CI you can use the fixture package directly; locally, set the artifact paths or point the helpers at a Phoenix repo checkout.
For the example program tests, also build or point to the example program SBF:

Context

Build a SdkLocalnetContext, load any extra program under test, execute fixture setup, then send instructions through the context.
Rust
Source: litesvm-test/src/context.rs.

Prime Markets

Most order tests need current oracle and spline prices plus maker liquidity. The example program primes those from fixture transactions before sending taker instructions.
Rust
Source: example-program/tests/common/mod.rs.

Test A Flow

Write tests against the behavior you expect from your program, not against Phoenix internals. This example places a market order, places a limit order, extracts the order id from return data/log helpers, and cancels it.
Rust
Source: example-program/tests/market_orders.rs.

TypeScript LiteSVM

The TypeScript SDK tests use the litesvm npm package with the same generated localnet fixture. The published package exposes the fixture at @ellipsis-labs/rise/test-fixtures/default-localnet.json; the public repo’s test harness shows how to load local SBF artifacts, replay setup transactions, attach fixture signers, and send SDK-built instructions into LiteSVM.
TypeScript
Source: ts/tests/test-harness/localnet.ts. The public harness wraps those steps in createSdkLocalnetContext and exposes helpers for fixture-backed market params, account contexts, signing, and transaction submission.
TypeScript
Source: ts/tests/sdk-localnet-vm.test.ts. The broader TypeScript flow tests cover the same localnet surface as the Rust fixture tests: deposits, withdrawals, market orders, limit orders, stop losses, conditionals, Hawkeye return data, and isolated subaccounts.

Fixture Metadata

When your off-chain test client needs the same market params as LiteSVM, build PhoenixMetadata from the fixture instead of calling mainnet APIs.
Rust
Use this pattern to test PhoenixTxBuilder flows against the local fixture and keep transaction construction deterministic.