LibChainlinkOracle.getTwap()
iterates through all the round that took place in period [block.timestamp; block.timestamp - lookback], every iteration it decrements roundId
to get previous roundId:
Problem is that roundId
doesn't increase monotonically as described in Chainlink docs
According to docs roundId
consists of 2 values:
phaseId
which means aggregator version and increments on upgrade. This value is shifted left by 64 bits.
originalId
which monotonically increments in new round.
Problem is that if TWAP wants to read price in period where aggregator upgrade was performed, then it will try to access non-existent roundId because it always decrements roundId
. And as a result price fetch will fail.
In case TWAP lookback tries to fetch price from period with Chainlink aggregator upgrade, price fetch will fail.
Manual Review
Use specific function to get previous roundId
for pair https://docs.chain.link/data-feeds/feed-registry/feed-registry-functions#getpreviousroundid
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.