Different tokens have different Oracle Staleness Threshold/Heartbeat as can be seen from the docs of Oracles . Using the same Oracle staleness check for different tokens in a pool will cause unnecessary reverts and stale datas .
oracleStalenessThreshold state variable in QuantAMMWeightedPool is Maximum amount of seconds that can pass between two oracle updates . The problem is , there is only one oracleStalenessThreshold defined for a single pool .
That means all the assets in a QuantAMMWeightedPool will be checked against same oracleStalenessThreshold . So whenever updates happen , data from the Oracle is checked against the same staleness threshold in UpdateWeightRunner as can be seen here :
https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/UpdateWeightRunner.sol#L347-L374
Let's see an example to demonstrate this problem , In Chainlink we can see different price feeds of tokens have different Heartbeats(or maximum amount of time that is allowed to pass before the data is updated) , for eg :
In Eth Mainnet -
LINK/USD in Mainnet has heartbeat of 3600s
BAL/USD in Mainnet has heartbeat of 86400s
So if one sets oracleStalenessThreshold in QuantAMMWeightedPool as 3600s , then BAL/USD price derivation would report as stale price for a long time and cause reverts , even though it is giving the most updated data and if oracleStalenessThreshold is set to 86400s, then LINK/USD will pass even if it is returning stale data .
Leads to incorrect price derivation for assets in the pool.
Chainlink Docs = https://docs.chain.link/data-feeds/price-feeds/addresses?network=ethereum&page=1&search=BAL
Set different oracle staleness check for different tokens to avoid price derivation problems i.e., use something like ruleOracleStalenessThreshold variable of UpdateWeightRunner which gives different thresholds for each oracle address :
https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/UpdateWeightRunner.sol#L190-L191
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.