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 Eliminate the Oracle Problem for Composability

Solana's Cross-Program Invocations (CPIs) allow smart contracts to read each other's state directly and atomically. This architectural primitive removes the need for trusted price oracles for simple composability, fundamentally reshaping DeFi design patterns on high-performance chains.

introduction
THE COMPOSABILITY COST

The Oracle Tax: A Hidden Tax on Every DeFi Interaction

Cross-program invocations eliminate the need for external oracles, removing a systemic cost and security risk from DeFi composability.

Oracles are a systemic tax on composability. Every time a protocol like Aave or Compound needs external data, it pays a fee to Chainlink or Pyth and introduces a new attack vector. This cost and risk compound with each composable interaction.

Cross-program invocations are native oracles. When one on-chain program directly calls another within the same state machine, the data is authoritative and free. This eliminates the oracle tax and the associated latency and trust assumptions.

Solana's synchronous composability demonstrates this. A Jupiter swap that routes through multiple DEXs and lending protocols executes in a single transaction with shared, atomic state. There is no need for price feeds between the internal steps.

The cost is quantifiable. On EVM chains, oracle updates consume 5-20% of a block's gas. This is a direct tax on every DeFi action that relies on external data, from liquidations to options settlements.

deep-dive
THE COMPOSABILITY ENGINE

Anatomy of a CPI: Trustless State Reads as a Primitive

Cross-Program Invocations (CPIs) enable smart contracts to read and verify on-chain state from other programs without relying on external oracles.

Trustless State Verification is the core primitive. A CPI allows Program A to directly call and verify the state of Program B within the same atomic transaction. This eliminates the need for an external oracle to attest to on-chain data, removing a critical trust assumption and attack vector.

The Oracle Problem for Composability is solved. Traditional multi-chain applications rely on services like Chainlink or Wormhole to relay state, introducing latency and trust. A CPI is a native, synchronous state read that is as secure as the underlying blockchain's consensus.

Contrast with EVM's staticcall. Solana's CPI model is more powerful than Ethereum's view functions. While staticcall prevents state changes, a CPI can optionally write back to the calling program, enabling complex, multi-step atomic compositions that are impossible with simple reads.

Evidence: Solana's DeFi Dominance. Protocols like Jupiter and Raydium leverage CPIs for their aggregators and AMMs. This native composability is a key reason Solana processes orders of magnitude more DEX volume than other chains, as seen in its ~70% market share of non-EVM DEX volume.

COMPOSABILITY ARCHITECTURE

Composability Models: Oracle-Dependent vs. Native CPI

Comparison of composability models based on their reliance on external data (oracles) versus native, atomic program calls.

Feature / MetricOracle-Dependent ModelNative CPI Model (e.g., Solana)Hybrid / Intent-Based (e.g., UniswapX)

Core Composability Mechanism

External data feed triggers on-chain action

Direct, atomic cross-program invocation (CPI)

Off-chain solver network fulfills user intent

Latency for Dependent Action

Oracle update interval (2-60 sec)

Same transaction (< 400ms block time)

Solver competition + on-chain settlement (~1-2 min)

Atomicity Guarantee

Conditional (via settlement layer)

Trust & Security Model

Trust in oracle committee (e.g., Chainlink)

Trust in runtime & validator consensus

Trust in solver economic incentives

Maximal Extractable Value (MEV) Surface

Oracle front-running, latency arbitrage

Localized to transaction order within block

Revealed to solver network for optimization

Protocol Examples

MakerDAO, Aave (price feeds)

Solana DeFi (Jupiter, Raydium)

UniswapX, CowSwap, Across

Failure Mode

Oracle manipulation or delay

Runtime failure or network congestion

Solver censorship or failed settlement

Development Overhead

Oracle integration & heartbeat management

Direct program calls, no external dependencies

Intent specification & integration with solver API

case-study
COMPOSABLE STATE

Real-World CPI Applications: Beyond Simple Swaps

Cross-Program Invocation (CPI) enables on-chain programs to call each other directly, creating a single atomic transaction that eliminates the oracle problem for composability.

01

The Problem: Fragmented Liquidity & Oracle Dependence

DeFi protocols like Aave or Compound rely on external oracles for price feeds, creating a single point of failure and latency. A cross-margin position requiring liquidation across multiple venues is impossible atomically.

  • Oracle latency creates arbitrage windows and MEV.
  • Manual bridging between Solidity and Rust programs is slow and risky.
  • TVL is siloed; a position on Solana cannot natively interact with Ethereum liquidity.
~2s
Oracle Latency
$100B+
Siloed TVL
02

The Solution: Atomic Cross-Protocol Margin

CPI allows a single transaction to: deposit collateral into Mango Markets, borrow against it, swap the borrowed asset via Jupiter, and supply it to Solend—all without intermediate confirmations or trust in external data.

  • Eliminates oracle risk; prices are the program's internal state.
  • Enables novel primitives like cross-margin perpetuals and recursive lending.
  • Unlocks capital efficiency by treating the entire chain as a single balance sheet.
1 TX
Full Cycle
>90%
Capital Efficiency
03

The Architecture: Solana's Synchronous Composability

Unlike Ethereum's asynchronous calls, Solana's runtime allows programs to modify each other's states within a single slot (~400ms). This is the foundation for protocols like Drift (perps) and Marginfi (lending) to build complex, interdependent logic.

  • State is shared memory, not messages between chains.
  • Fee-less internal calls between programs reduce user cost.
  • Security model is unified; a failed sub-call reverts the entire transaction.
~400ms
Slot Time
0 Fee
Internal Call
04

The Killer App: On-Chain Order Flow Auctions

CPI enables the native implementation of intent-based systems like UniswapX or CowSwap. A solver program can atomically route a user's trade across Raydium, Orca, and private pools, guaranteeing the best price or reverting.

  • Eliminates MEV leakage to searchers by keeping logic on-chain.
  • Aggregates fragmented liquidity across all AMMs in one atomic execution.
  • Turns liquidity into a commodity, with solvers competing on execution quality.
100%
Execution Guarantee
-99%
MEV Reduction
05

The Limitation: State Contention & Parallelization

Synchronous composability creates a trade-off: programs accessing the same accounts cannot run in parallel. This is the state contention problem that limits throughput for highly composable applications like central limit order books.

  • Forces serial execution on hot accounts (e.g., USDC vault).
  • Architects must design for account isolation to leverage SeaLevel parallelization.
  • Contrast with async models (e.g., Cosmos IBC, LayerZero) which avoid this but reintroduce latency.
1x
Serial Speed
Critical
Design Constraint
06

The Future: CPI as Universal Adapter

The end-state is CPI as a universal adapter layer, where programs like Pyth (oracle) or Wormhole (bridge) are invoked directly, making their services a native, trust-minimized subroutine of any application logic.

  • Turns external services into on-chain library calls.
  • Enables "DeFi Lego" 2.0, where complexity is abstracted, not avoided.
  • Foundation for L2s & SVM app-chains to maintain composability across a rollup ecosystem.
Universal
Adapter
Lego 2.0
Composability
counter-argument
THE REALITY CHECK

The Limits of CPIs: When Oracles Are Still Necessary

Cross-Program Invocations solve composability within a single state machine, but external data and cross-chain logic remain oracle-dependent.

CPIs are intra-state composability. They enable synchronous, atomic calls between programs on a shared ledger like Solana or the EVM. This eliminates the oracle problem for internal data, as programs read directly from the canonical state. Protocols like Jupiter and Raydium use CPIs to build complex, trustless DeFi transactions.

External data requires oracles. CPIs cannot access off-chain information like asset prices, sports scores, or real-world events. This is the classic oracle problem, solved by networks like Pyth Network and Chainlink, which provide verifiable data feeds on-chain. A CPI-based lending protocol still needs an oracle for liquidations.

Cross-chain logic is impossible. A CPI on Solana cannot directly read Ethereum's state or trigger an action on Avalanche. This necessitates bridges and messaging layers like Wormhole or LayerZero. Projects like Across Protocol use optimistic verification, which is a specialized oracle design for cross-chain intent settlement.

Evidence: The Total Value Secured (TVS) by oracle networks exceeds $100B. This metric quantifies the external data dependency that CPIs cannot address, proving that oracles remain a critical, non-redundant layer in the blockchain stack.

takeaways
COMPOSABILITY'S ENDGAME

TL;DR: The CPI Advantage

Cross-Program Invocations (CPIs) enable on-chain, atomic composability, making external oracles for internal state a redundant and risky anachronism.

01

The Oracle Problem: A Composability Tax

Traditional DeFi protocols like MakerDAO or Aave rely on external oracles (e.g., Chainlink) to read each other's state, creating a trusted third-party in every transaction. This introduces:\n- Latency & Staleness: ~2-10 second update delays create arbitrage windows.\n- Centralized Failure Points: Oracle downtime or manipulation breaks the entire stack.\n- Cost Inefficiency: Paying for external data feeds on every interaction.

2-10s
Oracle Latency
+30%
Attack Surface
02

The CPI Solution: Atomic State Sharing

CPIs allow one on-chain program to call another directly and atomically, treating other protocols as internal libraries. This is the core innovation behind Solana's DeFi ecosystem and Sei's Parallel Stack.\n- Atomic Execution: All steps succeed or fail together, eliminating settlement risk.\n- Native Trustlessness: State is verified by the underlying consensus, not a secondary network.\n- Sub-Second Composability: Enables novel designs like Jupiter's limit orders and Drift's perpetuals.

400ms
Full Tx Time
0
Oracle Cost
03

The New Primitive: Composable Liquidity

With CPIs, liquidity is no longer siloed. Protocols like Raydium and Orca become composable liquidity layers for more complex applications. This mirrors the UniswapX and CowSwap intent-based vision, but executed on-chain.\n- Deep Integration: Lending protocols can liquidate positions directly against a DEX in one block.\n- Emergent Products: Flash loan-style logic becomes standard, enabling on-chain MEV capture for users.\n- Capital Efficiency: $10B+ TVL can be leveraged across multiple applications simultaneously without bridging.

10x
Capital Efficiency
1 Tx
Full Stack
04

The Architectural Mandate

For CTOs, this creates a non-negotiable design rule: if your protocol's core logic requires an oracle to read another on-chain state, your architecture is obsolete. The benchmark is set by Solana, Sui, Aptos, and Sei v2.\n- First-Principles Win: Rethink dependencies from the VM level up.\n- Kill the Middleman: Eliminate LayerZero-style bridging for intra-chain logic.\n- Performance as a Feature: ~$0.001 fees and ~500ms finality are now table stakes for composable chains.

~$0.001
Tx Cost
0 Oracles
Required
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
How Solana CPIs Solve the Oracle Problem for DeFi Composability | ChainScore Blog