This function is used to calculate the TWAP ETH/USD price from the Chainlink oracle over the past lookback
seconds.
Case is with the fact that this function loops through the seconds, keep in mind that normal Twap values should be around 30 minutes, which means that this function would attempt querying latestROundData() a whooping 1800 times which would must surely revert.
Protocol's core functionality not working as intended, any reasonable value for lookback
would cause a crazy amount of gas and inevitably leading to a revert of this instance https://github.com/Cyfrin/2024-02-Beanstalk-1/blob/a3658861af8f5126224718af494d02352fbb3ea5/protocol/contracts/libraries/Oracle/LibEthUsdOracle.sol#L61-L63... and eventually all contract logic that route their call via this method.
Consider reimplementing how TWAP is used in protocol, best to use other oracle sources for TWAPs than chainlink
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.