The _getData function relies on a single global oracle staleness threshold value retrieved from the getOracleStalenessThreshold() function to validate the freshness of oracle data across multiple oracles. However, the declared mapping ruleOracleStalenessThreshold for per-oracle staleness thresholds is not utilized in the staleness validation logic. This creates inflexibility and undermines the protocol's ability to handle varying staleness thresholds for different oracles.
In the _getData function oracleStalenessThreshold is retrieved using the function getOracleStalenessThreshold() from the QuantAMMWeightedPool contract. This value is then applied uniformly to all oracles in the pool during the staleness validation. The key part of the logic is:
This check ensures that only oracle data with a timestamp within the staleness threshold (i.e., fresh data) is considered valid. However, this mechanism applies the same threshold to all oracles without considering if some oracles require a different staleness threshold.
The mapping mapping(address => uint) public ruleOracleStalenessThreshold in the same contract
was presumably intended to support per-oracle staleness thresholds allowing each oracle to have its own distinct threshold. However, it is never referenced or utilized in the staleness validation logic of _getData.
Without the ability to apply oracle-specific thresholds, data that may be valid and fresh for one oracle could be rejected due to a globally applied threshold. Conversely, data from slower oracles could be considered fresh even though it is outdated leading to inconsistent outputs.
Stale data can be incorrectly considered valid and/or fresh data being prematurely discarded.
Manual Review
Modify the _getData function to utilize the ruleOracleStalenessThreshold mapping for per-oracle staleness checks.
This is by design, staleness is a strategy aspect: it requires all data to have been updated within n minutes. No more precision needed.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.