Skip to content

Compute Unit Discrepancy vs Mollusk/On-chain Execution #277

@a-maggi

Description

@a-maggi

Description

When simulating identical Solana transactions, LiteSVM reports ~20% higher compute unit (CU) consumption compared to Mollusk-svm, despite both executing the same instruction sequence successfully. That percentage varies from every transaction. The CU reported by Mollusk is much more accurate to mainet.

Reproduction

Test case: 2-hop Meteora DLMM swap via custom program

Simulator CU Reported Delta
Mollusk-svm 0.9.0 90,946 baseline
LiteSVM 0.9.0 109,462 +18,516 (+20.4%)

CU Breakdown Analysis

Component Mollusk LiteSVM Delta
Outer program invoke 87,022 ~105,000 +18k
First DLMM swap CPI 41,002 41,002 0
Second DLMM swap CPI 40,879 40,879 0
SPL Token transfers ~12k ~12k 0

The inner CPI calls report identical CU consumption, but the outer program and transaction-level overhead differ significantly.

Root Cause Hypothesis

LiteSVM processes full transactions (send_transaction) while Mollusk processes single instructions (process_instruction). The overhead may come from:

  1. Transaction signature verification
  2. Account locking/unlocking overhead
  3. Transaction metadata tracking
  4. Different syscall implementations
  5. Fee calculation overhead

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions