Introduction

This report presents the findings of a security audit conducted on Lighter’s ZK circuits for spot market trading. The audit was performed by zkSecurity starting November 24th, 2025, with two consultants over a period of two weeks. The engagement focuses on the circuit changes required to introduce spot market trading functionality and multi-asset support. This is the 6th audit in a series of audits on the Lighter protocol; we give a brief overview of the newly reviewed functionality below.

Scope

The audit was conducted in two phases on a private lighter-prover repository:

Phase 1 (commit 11c373555dd56478ddf7c9fbae27c2c2c4052665) focused on the foundational multi-asset infrastructure:

Component Files
Delta Circuit delta_constraints.rs, account_delta_full_leaf.rs, utils.rs
Asset Management l1_register_asset.rs, l1_update_asset.rs
Deposit/Withdraw l1_deposit.rs, l1_withdraw.rs, l2_withdraw.rs
Transfer l2_transfer.rs
Supporting Types account_asset.rs, asset.rs, constants.rs

Phase 2 (commit b31b173ced2df143a7289b21df9020bfc664f3f6) extended the review to order-related transactions and included fixes for Phase 1 findings:

Component Files
Matching Engine matching_engine.rs, apply_trade.rs
Order Transactions l1_create_order.rs, l2_create_order.rs, l2_cancel_order.rs, l2_modify_order.rs, internal_create_order.rs, internal_cancel_order.rs, internal_claim_order.rs
Market Management l1_create_market.rs, l1_update_market.rs, market.rs
Liquidation internal_liquidate_position.rs, internal_deleverage.rs, internal_exit_position.rs
Transaction State tx_constraints.rs, tx_state.rs, transfer.rs

Overview of Key Concepts

Multi-asset support. Prior to these changes, Lighter supported only USDC as the collateral asset for perpetual trading. The spot market feature introduces support for multiple assets (up to 62), each identified by an asset_index. Valid indices range from 1 to 62, with index 0 reserved as nil and 63 unused. USDC is assigned index 3. Each asset has configurable parameters including margin_mode (only enabled for USDC) and extension_multiplier for decimal precision handling. Assets are registered and configured via L1 priority transactions.

Spot vs perpetual operations. The protocol distinguishes between perpetual and spot operations across both fund movements and trading. For deposits, withdrawals, and transfers, two route types are supported: the PERPS route operates on the USDC-denominated collateral field used for perpetual margin, while the SPOT route operates on per-asset balances stored in an aggregated_assets array. The circuit enforces that PERPS routes can only be used with USDC. For trading, perpetual markets (indices 0–254) operate on collateral and positions, while spot markets (indices 2048+, with 255 reserved as nil) enable direct trading between asset pairs—the matching engine transfers base and quote assets directly between maker and taker accounts rather than updating margin positions.

Data availability. To support multi-asset accounts, the delta circuit was extended with an asset delta tree. This 64-element structure tracks balance changes per asset index and is included in the public digest. Only indices 1-62 are included in the digest, matching the valid asset index range.

Exit hatch. The change to the account model also incurs a change in the emergency withdrawal mechanism (known as the exit hatch or desert exit). A call to the exit hatch must now specify an asset that the user wishes to withdraw. The circuit then performs a balance check for this asset. If the asset is traded in the spot market, then the balance check is a straightforward comparison. However, if the asset is used in the perps market (currently only USDC), then balance calculation reverts to the TAV calculation detailed in the report titled Audit of Lighter’s Exit Hatch.

Note: The code in commit b31b173 did not yet include witness generation for the desert exit circuits.

Summary and Recommendations

The spot market and multi-asset implementation follows a sound architectural approach and no major architectural flaws were identified beyond the findings documented below. The circuit correctly separates SPOT and PERPS routes, enforces USDC-only constraints for collateral operations, and extends the matching engine to handle direct asset transfers for spot trades.

However, our review identified multiple significant issues requiring attention, including two high-severity findings related to collateral inflation and data availability. In general we observed that the management of reserved asset indices is somewhat fragile. The codebase defines MIN_ASSET_INDEX and MAX_ASSET_INDEX constants suggesting a configurable valid range, yet the validation logic (e.g., ensure_valid_asset_index) checks only for the specific boundary values 0 and 63 rather than validating against the constants. This inconsistency could lead to errors if the range definition changes. We recommend unifying the approach: either validate against MIN_ASSET_INDEX and MAX_ASSET_INDEX throughout, or simplify to explicit checks for 0 and 63 if these are the only reserved indices and will remain so.

The phased nature of the engagement (with fixes for Phase 1 findings incorporated into the Phase 2 commit) reflects that the codebase was under active development during the audit. We recommend establishing a stabilization period before deployment to ensure all findings are addressed and the changes are thoroughly tested.