Engineer reviewing real-time oracle price feeds on ultrawide monitor, data visualizations on second screen, clean desk setup in bright apartment.
Protocols

Staleness Tolerance Design and Configuration

A prescriptive guide for setting the getPriceNoOlderThan parameter. Analyzes per-asset volatility profiles, block times, and network congestion to help teams choose a staleness threshold that balances freshness with resilience.
introduction
THE STALENESS PARAMETER AS A PROTOCOL-LEVEL RISK CONTROL

Introduction

How the `getPriceNoOlderThan` parameter functions as a critical safety valve for DeFi protocols consuming Pyth Network price feeds, and why a one-size-fits-all configuration is a systemic risk.

The getPriceNoOlderThan parameter in Pyth Network's pull oracle interface is not a trivial configuration detail; it is a first-order risk control that defines the maximum acceptable age of a price before a consuming protocol rejects it. For builders integrating Pyth into lending markets, perpetuals, or stablecoins, this single value creates a hard trade-off between liveness and data freshness. Set it too tightly, and a protocol risks unnecessary downtime during network congestion or a temporary drop in publisher activity. Set it too loosely, and the protocol may execute critical operations—such as liquidations or new loan originations—against a price that no longer reflects current market conditions, opening a window for latency arbitrage.

The operational challenge is that an effective staleness threshold is not a universal constant. It must be calibrated to the volatility profile of the underlying asset, the block times and congestion patterns of the target chain, and the specific risk tolerance of the protocol's function. A threshold of 5 seconds for a major forex pair on Solana may be conservative, while the same threshold for a long-tail altcoin on an L2 with irregular block production could lead to chronic transaction failures. This requires protocol risk teams to move beyond default values and perform a per-asset, per-chain analysis that models the probability of staleness under various publisher uptime and network conditions.

A misconfigured staleness tolerance can manifest as either a liveness failure or a security failure. A liveness failure occurs when a protocol's core functions—borrowing, trading, minting—are frozen because the oracle consistently reports a price older than the threshold, even if the price is accurate. A security failure occurs when a stale price is accepted, allowing an attacker to arbitrage the discrepancy between the on-chain price and the true market price. Both failure modes have led to significant losses and protocol shutdowns across DeFi. For teams integrating Pyth, a staleness parameter audit that simulates these failure modes against historical publisher performance data is a foundational step in operational readiness.

Chainscore Labs performs staleness parameter audits that model per-asset volatility, publisher uptime distributions, and target-chain block time variability to recommend configurations that balance freshness with resilience. This work is not a one-time exercise; it must be revisited when new assets are listed, when Pyth's publisher set changes, or when the consuming protocol deploys to a new chain. For engineering leads and risk managers, the staleness threshold should be treated as a dynamic risk parameter subject to the same governance and monitoring rigor as a loan-to-value ratio or a liquidation incentive.

STALENESS TOLERANCE CONFIGURATION

Quick Facts

Key parameters and considerations for setting the getPriceNoOlderThan staleness threshold to balance data freshness with protocol resilience.

FieldValueWhy it matters

Core Parameter

getPriceNoOlderThan

The single on-chain check that determines if a Pyth price is fresh enough to use for a protocol's critical functions like borrowing and liquidation.

Primary Risk of Misconfiguration

Denial of service or stale price execution

Setting the threshold too low can freeze a protocol during network congestion; setting it too high allows transactions to execute against outdated prices, creating arbitrage opportunities.

Key Asset-Specific Input

Per-asset volatility profile

A threshold safe for a stablecoin (e.g., 60 seconds) may be dangerously long for a volatile altcoin, requiring a shorter window to prevent trading against a stale price.

Network-Dependent Variable

Target chain block times and congestion

A 5-second tolerance is impossible on a chain with 12-second block times. The threshold must account for the target chain's liveness and typical congestion periods to avoid unnecessary reverts.

Protocol-Specific Constraint

Time-sensitive operations (e.g., liquidations)

Liquidation engines require the freshest possible price to be profitable. The staleness tolerance for a liquidation function is often set independently and more aggressively than for standard user withdrawals.

Configuration Strategy

Per-function or per-asset granularity

A single global staleness constant is a fragile pattern. Mature integrations apply different tolerances to different assets and even different protocol functions (mint, borrow, liquidate).

Monitoring Requirement

Off-chain staleness and deviation alerts

On-chain reverts are a trailing indicator. Operators must monitor the age and deviation of Pyth updates off-chain to proactively detect publisher or relayer issues before the threshold is breached.

Fallback Dependency

Interaction with secondary oracle systems

The staleness threshold is the trigger for fallback logic. A misconfigured threshold can cause premature or delayed failover to a secondary oracle, potentially introducing a worse price. Verify against canonical source.

technical-context
STALENESS TOLERANCE DESIGN AND CONFIGURATION

Technical Mechanism and Failure Modes

A technical analysis of the `getPriceNoOlderThan` parameter in Pyth Network's pull oracle model, its failure modes, and how to configure it to balance data freshness with protocol resilience.

The Pyth Network's pull oracle model requires the consuming smart contract to specify a getPriceNoOlderThan parameter with every price update request. This parameter defines the maximum acceptable age of a price, in seconds, for it to be considered valid for a transaction. If the on-chain aggregate price is older than this threshold, the updatePriceFeeds instruction will fail, causing the dependent transaction to revert. This mechanism is the primary defense against a protocol using a stale price for a critical operation like a liquidation or a new loan issuance, where a price that is even a few seconds old could create a latency arbitrage opportunity.

The core failure mode is a misconfiguration of this threshold. Setting the value too high exposes the protocol to latency arbitrage, where a trader can observe a price move on a centralized exchange, see that Pyth's on-chain price is stale, and front-run a price update with a trade at the old, favorable price. Conversely, setting the value too low creates a liveness risk. During periods of network congestion, low publisher uptime, or a spike in block times, a valid price update may not land on-chain within the narrow window, causing all protocol functions that depend on the oracle to halt. This is a critical availability risk for lending markets where a failure to liquidate an underwater position in a timely manner can lead to the accumulation of bad debt.

The optimal configuration is not a single constant but a per-asset, per-chain function. It must account for the asset's volatility profile, the target chain's block time and congestion patterns, and the specific risk tolerance of the protocol's function. For example, a stablecoin minting function may safely tolerate a 60-second staleness, while a high-volatility altcoin perpetual futures market may require a threshold of 5 seconds or less. A robust design also incorporates Pyth's confidence interval as a secondary signal; a protocol can programmatically widen its staleness tolerance when the confidence interval is low (indicating high publisher agreement) and tighten it when uncertainty is high. Chainscore can perform a staleness parameter audit, modeling per-asset volatility against historical network conditions to recommend configurations that minimize both arbitrage and liveness risks.

STALENESS CONFIGURATION IMPACT

Affected Stakeholders

Risk Parameter Ownership

Risk teams are directly responsible for setting and maintaining the getPriceNoOlderThan parameter. An incorrect threshold exposes the protocol to two primary failure modes: using a stale price that no longer reflects current market conditions, or rejecting a valid price during network congestion and causing a denial-of-service for critical functions like liquidations.

Action Items

  • Model per-asset volatility to determine the maximum acceptable data age before a price is considered untrustworthy.
  • Correlate staleness thresholds with the protocol's liquidation engine to ensure keepers can reliably execute during high-congestion events.
  • Establish a governance process to rapidly adjust thresholds in response to changes in Pyth publisher performance or network gas conditions.

Chainscore can perform a quantitative staleness parameter audit, modeling the risk of stale transactions against historical price deviation data.

implementation-impact
STALENESS PARAMETER AUDIT

Configuration Framework and Impact

A structured analysis of how the getPriceNoOlderThan parameter interacts with asset volatility, network congestion, and protocol solvency. Guides risk teams in setting per-asset thresholds that balance data freshness with operational resilience.

01

Per-Asset Volatility Profiling

Staleness tolerance cannot be uniform. A 5-second stale price for a liquid large-cap asset is fundamentally different from a 5-second stale price for a long-tail volatile asset. Teams must map each asset's historical price deviation over target time windows (1s, 5s, 15s, 60s) to quantify the maximum adverse price movement possible within the chosen staleness threshold. This directly informs the liquidation buffer and Loan-to-Value (LTV) ratios required to prevent insolvency during a stale-price liquidation event.

02

Block Time and Network Congestion Interaction

The effective staleness of a price is the configured getPriceNoOlderThan value plus the maximum expected block time and network congestion delay. On Solana, where slot times are ~400ms, a 1-second threshold is aggressive but feasible. On an L2 with 2-second block times and potential sequencer congestion, a 1-second threshold virtually guarantees transaction reverts. The configuration must account for the target chain's probabilistic finality and mempool behavior to ensure the keeper network can reliably land price updates and liquidation transactions.

03

Circuit Breaker Integration

The staleness check should not operate in isolation. It must be integrated into a broader circuit breaker system that also monitors the confidence interval (conf field) and publisher set size. A price can be technically fresh but highly uncertain. If the confidence interval widens beyond a predefined multiple of the expected spread, or if the number of active publishers drops below a safety threshold, the protocol should pause operations even if the getPriceNoOlderThan check passes. This prevents the protocol from acting on low-quality, high-uncertainty data.

04

Keeper Network Economic Viability

The staleness threshold directly determines the frequency at which keepers must submit updatePriceFeeds transactions. An overly aggressive threshold (e.g., 1 second) creates a hyper-competitive keeper environment where only the most latency-optimized actors can profit, potentially centralizing the keeper set. Conversely, a lax threshold reduces keeper competition and may delay liquidations. The configuration must be stress-tested against the gas costs and expected keeper profit margins on the target chain to ensure a robust, decentralized keeper ecosystem exists to maintain the threshold.

05

Fallback Oracle Consistency

If a protocol uses a secondary oracle (e.g., a Chainlink push feed or a TWAP) as a fallback when Pyth data is stale, the staleness thresholds must be aligned. A mismatch occurs if Pyth is considered stale at 5 seconds, but the fallback oracle's heartbeat is 60 seconds. The protocol would fail over to a significantly more stale data source, increasing risk. The configuration framework must define the staleness threshold for the primary oracle, the trigger condition for fallback, and a separate, stricter staleness check for the fallback data before it can be used.

06

Chainscore Staleness Parameter Audit

Chainscore Labs performs a quantitative audit of your staleness configuration. We model per-asset volatility against your chosen thresholds, simulate keeper network viability under various network congestion scenarios, and verify the consistency of your circuit breaker and fallback logic. The deliverable is a risk-ranked report with specific, per-asset getPriceNoOlderThan recommendations and a validation suite for your liquidation engine. This ensures your protocol's solvency is not dependent on an untested oracle staleness assumption.

STALENESS TOLERANCE CONFIGURATION

Risk Matrix

Evaluates the failure modes and operational risks associated with the getPriceNoOlderThan parameter, mapping specific scenarios to affected actors and required actions.

RiskFailure modeSeverityAffected actorsMitigation

Stale price used in transaction

Network congestion or publisher downtime causes price updates to lag beyond the configured tolerance, but the transaction still succeeds because the threshold is set too high.

Critical

Lending protocols, perps exchanges, liquidators

Calibrate tolerance to asset volatility and block times; implement circuit breakers that revert if staleness exceeds a secondary, stricter threshold.

Liquidation failure

Keeper attempts liquidation with a just-in-time price update, but the update transaction is delayed in the mempool, causing the price to exceed the staleness tolerance and the liquidation to revert.

High

Keeper networks, lending protocol users

Set a slightly longer staleness tolerance for liquidation paths than for standard user operations; design keepers to simulate and re-submit with fresh data.

Protocol-wide deadlock

A major cross-chain outage (e.g., Wormhole guardian set halt) stops all price updates for an extended period, causing every user transaction to revert due to a strict staleness check.

High

All protocol users, protocol operators

Implement a fallback oracle (e.g., Chainlink or a TWAP) that activates when Pyth staleness exceeds a governance-set emergency threshold.

Latency arbitrage exploitation

An attacker monitors a price change at the source and front-runs the Pyth update transaction, interacting with the protocol using a known stale price before the new price is delivered.

Medium

Perps exchanges, lending protocols

Combine staleness checks with confidence interval adjustments; enforce a short execution delay after the price update to allow for network propagation.

Incorrect per-asset configuration

A single staleness threshold is applied uniformly across all assets, causing high-volatility assets to be used with dangerously stale prices while low-volatility assets reject valid updates.

Medium

Risk managers, protocol users

Audit and configure staleness tolerance on a per-asset basis, informed by historical volatility and publisher update frequency.

Governance delay in parameter update

A sudden market regime change (e.g., extreme volatility) requires an immediate reduction in staleness tolerance, but the governance process takes 48 hours to execute.

Medium

Governance delegates, risk teams

Grant a multisig or security council the ability to enact emergency parameter changes within a bounded range, subject to a time-lock and subsequent governance ratification.

SDK or contract upgrade incompatibility

A new Pyth contract version changes the signature of getPriceNoOlderThan or the underlying timestamp format, causing integrators who have not updated their SDK to experience unexpected reverts.

Low

Smart contract developers, integration engineers

Pin SDK and contract versions in production; run automated compatibility tests in CI/CD against testnet deployments of new Pyth releases.

STALENESS TOLERANCE VALIDATION

Operational Configuration Checklist

A structured checklist for engineering and risk teams to validate, deploy, and monitor the `getPriceNoOlderThan` parameter. Each item maps to a specific failure mode that has caused liquidations or stale price ingestion in production DeFi protocols.

What to check: The staleness threshold for each asset must be derived from its historical volatility profile and the chain's expected block time, not a single global constant.

Why it matters: A uniform threshold of 60 seconds might be safe for ETH/USD but catastrophic for a high-volatility altcoin where price can move 5% in 30 seconds. Conversely, an overly aggressive threshold on a chain with irregular block times can cause unnecessary transaction reversions.

Readiness signal: Produce a table mapping each feed ID to its maximum observed 30-second adverse price movement over a 90-day lookback. The staleness threshold should be less than the time it takes for that movement to breach the protocol's minimum liquidation incentive. Document this analysis in the protocol's risk framework.

Chains We Build On

Looking to build on a specific blockchain?

We build smart contracts, DeFi applications, wallets, tokenization platforms, and blockchain infrastructure across the major ecosystems teams choose today. That includes Ethereum, Arbitrum, Optimism, Polygon, Avalanche, Solana, Sui, Aptos, Hedera, Stellar, and NEAR, with support for additional EVM and non-EVM networks based on your product requirements.

EVM ecosystems

  • Ethereum logo
    Ethereum
  • Arbitrum logo
    Arbitrum
  • Optimism logo
    Optimism
  • Polygon logo
    Polygon
  • Avalanche logo
    Avalanche
  • Cronos logo
    Cronos

Non-EVM ecosystems

  • Solana logo
    Solana
  • Sui logo
    Sui
  • Aptos logo
    Aptos
  • Hedera logo
    Hedera
  • Stellar logo
    Stellar
  • NEAR logo
    NEAR

Additional ecosystems

  • Polkadot logo
    Polkadot
  • Cosmos logo
    Cosmos
  • TON logo
    TON
  • Cardano logo
    Cardano
  • Algorand logo
    Algorand
  • Tempo logo
    Tempo

Also available for Base, appchains, custom EVM networks, and cross-chain product architecture.

STALENESS TOLERANCE CONFIGURATION

Frequently Asked Questions

Practical answers to the most common design and operational questions teams face when setting and managing the `getPriceNoOlderThan` parameter for Pyth Network price feeds.

A long staleness tolerance exposes the protocol to a latency arbitrage window. If a price is accepted as valid for, say, 60 seconds after its publication, an arbitrageur can observe a price move on a centralized exchange, execute a trade against your protocol using the stale on-chain price, and exit before the oracle updates. This effectively steals from liquidity providers or lenders. The longer the tolerance, the larger the potential price discrepancy and the greater the extractable value. For volatile assets, this risk is acute; a 60-second window can be catastrophic during a high-volatility event. The core function of the staleness check is to bound this window to an acceptable maximum loss threshold defined by your risk parameters.

Trusted by Industry Leaders

Delivering blockchain solutions for 5+ years.

We have partnered with 50+ leading DeFi protocols, NFT ecosystems, and fintech innovators to build secure, scalable, and capital-efficient blockchain products.

Selected Partners & Clients

ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
“I've been working with Chainscore Labs for last 3+ years, they've consistently delivered with strong ownership across multiple projects. The team is reliable and detail-oriented.”
L
Lee Erswell
CEO, Telos Foundation
how to get started

How to get started?

If you're looking for blockchain integration, ChainScore Labs has 5+ years of experience helping teams build and integrate exchanges, wallets, smart contracts, tokenization solutions, and protocol-connected products, we can help you choose the right path, integrate securely, and get to production faster. Our team consists of experienced blockchain developers and architects who can help you with your blockchain integration needs.

01

Exploration & Strategy

Define your product goals and choose the right blockchain architecture for your use case.

02

Architecture & Design

Design the smart contracts, tokenomics, and security parameters of your system.

03

Development & Integration

Build and integrate with wallets, oracles, and front-end dApps for a seamless experience.

04

Security & Launch

Comprehensive audits followed by a risk-managed mainnet deployment to protect your users.

Start a build

Need a blockchain engineering team?

Send the project context and we will respond with next steps, scope questions, and a practical path to delivery.