---
title: Environment Configuration
description: Builder pattern methods for configuring LiteSVM test environments
---

All configuration methods use the builder pattern with `LiteSVM::default()`.

## with_compute_budget

```rust
pub fn with_compute_budget(self, compute_budget: ComputeBudget) -> Self
```

Set compute unit limits and heap size.

```rust
use solana_compute_budget::compute_budget::ComputeBudget;

let mut svm = LiteSVM::default()
    .with_compute_budget(ComputeBudget {
        compute_unit_limit: 1_400_000,
        heap_size: 256 * 1024,
        ..ComputeBudget::default()
    });
```

## with_sigverify

```rust
pub fn with_sigverify(self, sigverify: bool) -> Self
```

Enable or disable signature verification. Default: `true`.

```rust
// Disable for faster tests
let mut svm = LiteSVM::default()
    .with_sigverify(false);
```

## with_blockhash_check

```rust
pub fn with_blockhash_check(self, check: bool) -> Self
```

Enable or disable blockhash validation. Default: `true`.

```rust
// Disable to use any blockhash
let mut svm = LiteSVM::default()
    .with_blockhash_check(false);
```

## with_transaction_history

```rust
pub fn with_transaction_history(self, capacity: usize) -> Self
```

Set number of transactions to keep in history. Default: `0`.

```rust
// Keep last 100 transactions
let mut svm = LiteSVM::default()
    .with_transaction_history(100);
```

## with_log_bytes_limit

```rust
pub fn with_log_bytes_limit(self, limit: Option<usize>) -> Self
```

Set maximum bytes for transaction logs. Default: `Some(10_000)`.

```rust
// Unlimited logs
let mut svm = LiteSVM::default()
    .with_log_bytes_limit(None);

// Custom limit (50KB)
let mut svm = LiteSVM::default()
    .with_log_bytes_limit(Some(50_000));
```

## with_lamports

```rust
pub fn with_lamports(self, lamports: u64) -> Self
```

Set initial lamports for fee collection. Default: `1_000_000_000`.

```rust
let mut svm = LiteSVM::default()
    .with_lamports(10_000_000_000);
```

## with_default_programs

```rust
pub fn with_default_programs(self) -> Self
```

Include default SPL programs (Token, Associated Token, etc.).

```rust
let mut svm = LiteSVM::default()
    .with_default_programs();
```

## with_sysvars

```rust
pub fn with_sysvars(self) -> Self
```

Includes default sysvars (Clock, Rent, EpochSchedule, SlotHashes, StakeHistory,
etc.).

```rust
let mut svm = LiteSVM::default()
    .with_sysvars();
```

## with_feature_set

```rust
pub fn with_feature_set(self, feature_set: FeatureSet) -> Self
```

Configure Solana feature set for testing specific runtime features.

```rust
use agave_feature_set::FeatureSet;

let mut svm = LiteSVM::default()
    .with_feature_set(FeatureSet::all_enabled());
```

## with_precompiles

```rust
#[cfg(feature = "precompiles")]
pub fn with_precompiles(self) -> Self
```

Includes standard precompile programs (ed25519, secp256k1, secp256r1).

```rust
let mut svm = LiteSVM::default()
    .with_precompiles();
```

<Callout type="info">
  Requires the `precompiles` feature flag:

```toml
[dev-dependencies]
litesvm = { version = "0.11", features = ["precompiles"] }
```

</Callout>

## with_feature_accounts

```rust
pub fn with_feature_accounts(self) -> Self
```

Include feature gate accounts in the test environment. This ensures
feature-gated Solana runtime behavior is accurately reflected in your tests.

```rust
let mut svm = LiteSVM::default()
    .with_feature_accounts();
```

## register-tracing feature

The `register-tracing` feature enables detailed SBF register tracing during
transaction execution. It implies the `invocation-inspect-callback` feature.

```toml
[dev-dependencies]
litesvm = { version = "0.11", features = ["register-tracing"] }
```

Use `LiteSVM::new_debuggable(true)` to create an instance with register tracing
enabled:

```rust
#[cfg(feature = "register-tracing")]
let mut svm = LiteSVM::new_debuggable(true);
```

When enabled, set the `SBF_TRACE_DISASSEMBLE` environment variable to also dump
disassembly output alongside register traces:

```bash
SBF_TRACE_DISASSEMBLE=1 cargo test
```

## set_invocation_inspect_callback

```rust
pub fn set_invocation_inspect_callback<C: InvocationInspectCallback + 'static>(&mut self, callback: C)
```

Register a callback that fires before and after each program invocation.
Requires the `invocation-inspect-callback` feature.

```toml
[dev-dependencies]
litesvm = { version = "0.11", features = ["invocation-inspect-callback"] }
```

```rust
use litesvm::{LiteSVM, types::InvocationInspectCallback};
use solana_svm::invoke_context::InvokeContext;
use solana_svm_transaction::svm_message::SVMMessage;

struct MyInspector;

impl InvocationInspectCallback for MyInspector {
    fn before_invocation(
        &self,
        _svm: &LiteSVM,
        _tx: &impl SVMMessage,
        _program_indices: &[u16],
        _invoke_context: &InvokeContext,
    ) {
        println!("Before program invocation");
    }

    fn after_invocation(
        &self,
        _svm: &LiteSVM,
        _invoke_context: &InvokeContext,
        _enable_register_tracing: bool,
    ) {
        println!("After program invocation");
    }
}

let mut svm = LiteSVM::new();
svm.set_invocation_inspect_callback(MyInspector);
```
