F-2024-0005·config-coarseness

MAX_DATA_STALENESS should vary based on data feed

Acknowledgedoracleprice-feeddata-streamsgithub.com/redstone-finance/redstone-oracles-monorepo
TL;DR

A single global MAX_DATA_STALENESS is used for all feeds, but feeds have different update frequencies. A per-feed staleness window better reflects each feed's heartbeat.

Severity
INFO
Impact
LOW
Likelihood
LOW
Method
MManual review
CAT.
Complexity
LOW
Exploitability
LOW
02Section · Description

Description

The MAX_DATA_STALENESS constant defines the maximum duration for which price data is considered valid. Once this period expires, the data is marked as stale, and the oracle will revert rather than return this outdated data. The staleness check is conducted in the following function:

solidity
function _validateLastUpdateDetailsOnRead(bytes32 /* dataFeedId */, uint256 /* lastDataTimestamp */, uint256 lastBlockTimestamp, uint256 lastValue) internal view virtual returns (bool) {
return lastValue > 0 && lastBlockTimestamp + MAX_DATA_STALENESS > block.timestamp;
}

Since different data feeds have varying update frequencies (heartbeats), the staleness period should also be tailored to each data feed type to ensure accurate and reliable data.

03Section · Impact

Impact

A blanket staleness window can either be too tight for slow feeds (causing unnecessary reverts) or too loose for fast feeds (allowing reads of data older than the feed's heartbeat).

04Section · Recommendation

Recommendation

Implement dynamic staleness periods for different data feeds to accommodate their specific update frequencies.

05Section · Resolution

Resolution

RedStone: This function is virtual and allows the add this logic. However, we wanted to have this param quite high, as for the majority of feeds we cannot predict exact update frequency, as usually it depends on the market volatility.

F-2024-0005

oog
zealynx

Smart Contract Security Digest

Monthly exploit breakdowns, audit checklists, and DeFi security research — straight to your inbox

© 2026 Zealynx