Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
solana-and-the-rise-of-high-performance-chains
Blog

Why Cross-Program Invocations Redefine Composable Finance

Solana's Cross-Program Invocations (CPIs) enable atomic, trustless composability within a single state machine. This eliminates the bridging delays, security risks, and oracle dependencies that plague multi-chain EVM architectures, redefining the foundation of on-chain finance.

introduction
THE NEW PRIMITIVE

Introduction

Cross-Program Invocations (CPIs) are the atomic transaction that enables seamless, trust-minimized interoperability between on-chain programs.

CPIs eliminate bridging friction by allowing one smart contract to call another directly within a single atomic transaction. This removes the need for users to sign multiple transactions or rely on external bridging protocols like Across or Stargate for simple logic hops.

Composability becomes synchronous and atomic, contrasting with the asynchronous, multi-step risk of traditional DeFi legos. A single transaction can now execute a swap on Raydium, deposit to a Kamino vault, and stake the LP token, with a guarantee of all-or-nothing execution.

The Solana Virtual Machine (SVM) architecture makes this possible by treating programs as native, callable libraries. This is a fundamental architectural advantage over EVM-based chains, where contract calls are more isolated and composability often requires complex, error-prone bundling via protocols like Gelato.

Evidence: The rise of Jupiter's LFG Launchpad and marginfi's integrated lending/borrowing pools demonstrates that CPI-driven applications capture user flow by collapsing 5+ manual steps into one click, directly increasing protocol TVL and user retention.

COMPOSABILITY PRIMITIVES

Architectural Showdown: CPI vs. Multi-Chain Messaging

Comparing the core architectural primitives enabling composable finance: intra-chain synchronous calls versus cross-chain asynchronous messaging.

FeatureCross-Program Invocation (CPI)Multi-Chain Messaging (MCM)Hybrid Approach (e.g., LayerZero)

Execution Atomicity

Latency

< 1 sec

15 sec - 15 min

15 sec - 15 min

Gas Cost Model

Single-chain gas

Relayer fee + destination gas

Relayer fee + destination gas

State Consistency

Strong (single state machine)

Eventual

Eventual

Security Boundary

Single VM (e.g., SVM, EVM)

External Validator Set / Oracle

Decentralized Verifier Network

Failure Mode

All-or-nothing revert

Partial success, stuck messages

Partial success, stuck messages

Example Protocols

Solana DeFi (Jupiter, Raydium)

Axelar, Wormhole, CCIP

LayerZero, Hyperlane

deep-dive
THE PRIMITIVE

How CPIs Enable Atomic Composable Finance

Cross-Program Invocations (CPIs) are the fundamental building block for trustless, atomic execution across Solana's state machine.

CPIs guarantee atomic execution. A single transaction can invoke instructions across multiple on-chain programs, with success or failure applied to the entire operation. This eliminates the deferred execution risk inherent in Ethereum's callback-based model used by protocols like Uniswap V3.

Composability becomes permissionless. Any developer can call any public program's instruction, creating new financial legos without integrations. This is the core mechanism behind liquidity aggregation in Jupiter Swap and cross-margin systems in Drift Protocol.

The state is globally consistent. All program state changes within a CPI transaction commit simultaneously. This prevents the partial failure states and orphaned transactions that plague non-atomic ecosystems, making complex DeFi strategies viable.

Evidence: Over 50% of Solana transactions contain CPIs, with protocols like Kamino Finance routinely executing 5+ program calls in a single user action for leveraged yield farming.

case-study
FROM MONOLITHS TO LEGOS

CPI-Powered Composable Finance in Action

Cross-Program Invocation (CPI) transforms isolated smart contracts into interoperable financial primitives, enabling atomic, trust-minimized composition.

01

The Problem: Fragmented Liquidity Silos

DeFi protocols like Aave and Compound operate as isolated vaults. Moving assets between them requires multiple user-signed transactions, exposing users to MEV and failed execution risk.

  • Solution: CPI allows a single transaction to deposit collateral, borrow, and swap assets across protocols atomically.
  • Result: Enables composite yield strategies and flash loan-like functionality without the complexity, reducing execution risk by ~90%.
~90%
Risk Reduced
1 Tx
Multi-Action
02

The Solution: Native Cross-Chain Compositions

Projects like Wormhole and LayerZero use CPI to build native cross-chain applications (xApps), moving beyond simple asset bridges.

  • Mechanism: A program on Solana can CPI to a Wormhole core messaging contract to trigger an action on Ethereum, all within a single Solana transaction.
  • Impact: Enables cross-chain DEX aggregators and unified margin accounts, reducing latency from minutes to ~500ms for state attestation.
~500ms
Latency
Native
Execution
03

The Result: Programmable Liquidity Hooks

CPI turns liquidity into a programmable layer. Oracles like Pyth and Switchboard use CPI for on-demand price updates, and AMMs like Orca use it for permissionless pool creation.

  • Capability: Any program can pull real-time data or instantiate new financial instruments as a subroutine.
  • Scale: This composability underpins the $10B+ TVL in Solana DeFi, enabling rapid innovation cycles and complex derivatives markets.
$10B+
TVL Enabled
On-Demand
Data
04

The Architectural Shift: From Messages to Direct Calls

Unlike Ethereum's external calls or Cosmos IBC, CPI is a synchronous, in-process invocation with shared memory.

  • Key Difference: The calling program's context (accounts, signers) is passed directly, eliminating the need for bridging middleware and its associated trust assumptions.
  • Performance: Enables sub-second finality for complex compositions, a requirement for high-frequency DeFi and on-chain gaming that EVM L2s struggle with.
Synchronous
Execution
Sub-Second
Finality
counter-argument
THE COMPOSABILITY SPECTRUM

The Counter-Argument: Isn't This Just a Monolithic Chain?

Cross-program invocations create a spectrum of composability that monolithic chains cannot replicate.

Monolithic chains enforce a single environment. Every application on Ethereum or Solana shares the same execution layer, virtual machine, and state. This creates a homogeneous execution sandbox where composability is a byproduct of shared infrastructure, not a designed protocol feature.

Cross-chain CPIs are a protocol-level primitive. Systems like LayerZero and Axelar treat interoperation as a first-class citizen. This creates a heterogeneous execution environment where applications compose across different VMs, security models, and data layers, which is architecturally distinct from a single-state machine.

The distinction is sovereignty versus subjugation. In a monolithic chain, an app's performance is subjugated to the chain's consensus. With CPIs, an app on Arbitrum maintains its sovereign execution while composing with a Celestia-settled rollup, a choice monolithic designs cannot offer.

Evidence: The modular stack proves the demand. The rapid adoption of EigenLayer for shared security and Celestia for data availability demonstrates that developers prioritize selecting optimal components over accepting a one-size-fits-all monolithic runtime, which CPIs enable at the application logic layer.

risk-analysis
WHY COMPOSABILITY HAS A COST

The CPI Bear Case: Risks and Limitations

Cross-Program Invocation (CPI) enables atomic composability but introduces systemic fragility and hidden costs that architects must mitigate.

01

The Atomicity Trap

CPI's all-or-nothing execution creates a single point of failure for complex transactions. A single revert in a nested call chain can cascade, wasting resources and creating a poor UX.

  • Failed transactions still incur compute unit (CU) costs, burning gas for no result.
  • State rollback complexity increases with dependency depth, complicating error handling.
  • Creates a brittle system where one faulty program can doom a $1M+ transaction.
100%
Tx Rollback
Wasted CU
Cost Sink
02

The Compute Unit (CU) Budget Ceiling

Solana's finite per-transaction CU limit (~1.4M CUs) is the ultimate composability cap. Deeply nested CPIs can exhaust the budget mid-execution, a hard constraint that scaling solutions like Jito's Bundle or state compression must work around.

  • Limits the maximum depth and complexity of a single atomic action.
  • Forces protocol designers to make trade-offs between feature richness and atomic guarantees.
  • Parallel execution via Sealevel mitigates but does not eliminate this fundamental bottleneck.
~1.4M
CU Limit
Fixed
Per Tx
03

Program Privilege Escalation

CPI passes the transaction's signing authority, creating a trust vector where a called program can act with the user's permissions. This is the core of composability but also its greatest security risk.

  • Malicious or buggy programs in a call chain can drain wallets or manipulate state.
  • Increases the attack surface exponentially; security is now the weakest link in the dependency graph.
  • Necessitates rigorous auditing of the entire stack, not just the primary protocol.
Weakest Link
Security Model
Full Access
Privilege Risk
04

State Contention & Latency Spikes

Atomic CPI transactions require locking all involved accounts, creating hotspots. When popular accounts (e.g., a USDC mint, Jupiter router) are targeted, parallel execution fails, causing network-wide congestion and failed transactions.

  • Direct cause of the Solana congestion events of Q2 2024.
  • ~50%+ failure rates observed during peak demand for composed DeFi actions.
  • Highlights the conflict between atomic guarantees and high-throughput design goals.
~50%+
Tx Fail Rate
Hotspots
Bottleneck
05

The Oracle Problem in a CPI World

CPIs that depend on real-world data (price oracles like Pyth, Switchboard) must trust the CPI chain to propagate that data atomically. A delay or failure in the oracle CPI breaks the entire transaction's logic.

  • Oracle latency (~300-400ms) becomes a critical path in a sub-second blockchain.
  • Creates a systemic risk where a single oracle's downtime can freeze major money legos.
  • Contrasts with Ethereum's slower, more deliberate block times which mask this issue.
~400ms
Oracle Latency
Single Point
Of Failure
06

Economic Abstraction vs. Fee Reality

While CPI abstracts away token approvals, it cannot abstract transaction fees. Users must still hold SOL for gas, and complex compositions have unpredictable costs. This creates friction for new users and complicates sponsored transaction models.

  • Fee estimation for a 10-CPI deep transaction is non-trivial and volatile.
  • Gasless onboarding solutions require relayer infrastructure, adding centralization vectors.
  • Limits the "invisible blockchain" ideal that CPI's UX otherwise enables.
SOL Only
Fee Token
Unpredictable
Cost
future-outlook
THE COMPOSABILITY ENGINE

Future Outlook: The Synchronous Finance Stack

Cross-Program Invocations (CPIs) are transforming smart contract interoperability from a series of asynchronous, trust-minimized steps into a single, synchronous, and atomic state machine.

CPIs Enable Atomic Compositions. Unlike asynchronous bridging via Across or LayerZero, CPIs allow a single transaction to call multiple on-chain programs while guaranteeing all succeed or fail together. This eliminates the settlement risk and latency inherent in cross-chain messaging, creating a unified execution environment.

The Stack Shifts from Messaging to Execution. The primary challenge moves from secure message passing (solved by Wormhole, Axelar) to optimizing execution flow and shared state. This mirrors the evolution from HTTP APIs to microservices with shared databases, demanding new standards for gas metering and state access.

Solana's Sealevel Proves the Model. Solana's runtime, with its parallel transaction processing, demonstrates that high-throughput CPIs are viable at scale. The model shifts the composability bottleneck from network latency to compute unit optimization, a fundamentally different scaling constraint than Ethereum's L2 rollups face.

Evidence: Jupiter's Aggregator Dominance. Jupiter's routing engine executes complex, multi-hop swaps across dozens of Solana DEXs in one transaction via CPIs. This atomic execution is the core reason it processes more volume than most Ethereum L2s combined, proving the user experience and capital efficiency advantage of synchronous finance.

takeaways
WHY CPIs REDEFINE COMPOSABILITY

Key Takeaways for Builders and Architects

Cross-Program Invocations (CPIs) transform smart contract interaction from a series of fragile, user-mediated steps into a single atomic state machine.

01

The End of Sandwichable User Journeys

Traditional multi-step DeFi interactions are vulnerable to MEV and front-running between transactions. CPIs enable atomic composability, where a single transaction can execute a complex, multi-contract workflow.

  • Guaranteed Execution: The entire sequence succeeds or fails as one unit, eliminating toxic order flow.
  • Native Integration: Protocols like Raydium and Jupiter use CPIs to bundle swaps, lending, and staking without user intervention.
0
MEV Steps
1 TX
Full Workflow
02

From Integration Hell to Native SDK

Building cross-protocol apps on EVM often requires complex, error-prone off-chain orchestrators or bridging layers. Solana's CPI model acts as a native composability SDK.

  • Direct Function Calls: Contracts call each other synchronously within the same runtime, with ~400ms finality.
  • Reduced Overhead: Eliminates the need for external relayers or liquidity bridges like LayerZero for simple logic, slashing integration complexity.
-80%
Integration Code
~400ms
Settlement Time
03

The Liquidity Unification Thesis

Fragmented liquidity across isolated smart contracts creates capital inefficiency and poor UX. CPIs enable programmatic liquidity routing, creating a unified financial primitive.

  • Dynamic Routing: A single swap can source liquidity from Orca, Raydium, and a custom AMM pool in one atomic operation.
  • Capital Efficiency: Lending protocols like Solend can use deposited collateral in yield strategies without moving funds, mimicking MakerDAO's DSProxy but natively.
100%
Utilization
1-Click
Complex Strategies
04

Architectural Debt in EVM vs. Solana

EVM's message-passing model forces a trade-off between security (audited, slow integrations) and innovation (fast, risky composability). Solana's CPI, with its single global state, offers a third path.

  • Deterministic Costing: Transaction costs are predictable and bounded before execution, unlike Ethereum's gas auction dynamics.
  • No Wrapper Hell: Avoids the UniswapX or CowSwap intent-based workarounds needed for safe batching on EVM.
Predictable
Fee Model
No Relayers
Required
05

Security Model: Shared Responsibility

CPIs shift security from pure contract isolation to a call graph security model. A vulnerability in one program can cascade, but this enforces stricter audit standards across the ecosystem.

  • Explicit Privileges: Called programs must be passed the correct PDAs and accounts, creating clear security boundaries.
  • Ecosystem Cohesion: This forces a higher baseline of code quality, similar to the scrutiny seen in Cosmos IBC, but at the smart contract layer.
Explicit
Permissioning
Holistic
Audit Scope
06

The New Abstraction Layer: Program-as-API

CPIs enable smart contracts to be consumed as high-level APIs, not just standalone applications. This creates a Lego-brick economy for financial primitives.

  • Monetizable Logic: Programs can charge fees for their logic, not just liquidity provision.
  • Meta-Protocols Emerge: Platforms like Drift or Mango Markets can be used as liquidity engines for entirely new derivative products built on top.
API-First
Design
New Biz Models
Enabled
ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Cross-Program Invocations: Solana's Atomic Composable Finance | ChainScore Blog