CGP: Increase SortedOracles report expiry for PHP/USD to 6 minutes
Opened this issue · 4 comments
Description
- Chainlink currently has a heartbeat of ~5mins for the PHP/USD rate
- We relay this rate every minute to SortedOracles
- SortedOracles has a default report expiry of ~5mins for all rates
- There can be a race condition where
- A new Chainlink rate gets relayed 1 second after the last relay run
- We have to wait for another 59 seconds until the next relay attempt
- In that time, the rate could temporarily expire in SortedOracles for a few seconds
The simplest fix here would be to increase token report expiry for PHP/USD in SortedOracles to 6 minutes and update the referenceRateResetFrequency for the cUSD/PUSO pool as well
Acceptance Criteria
- CeloGovernace Proposal for increasing report expiry to 6mins
- MentoGovernenace Proposal to destroy existing cUSD/PUSO exchange and recreate it with referenceRateResetFrequency of 6 mins
- Proposals should be first tested on alfajores
- Two Forum posts are written
- Both proposals are submitted
What are the implications of increasing the report expiry without increasing the bucket update reset time? We should confirm this before making this change. We also need to know if we will make a change to the bipool manager as this will push out the intended governance freeze for MU0 Next
Setting the report expiry to 6 minutes won't solve this problem unless we also increase the referenceRateResetFrequency
in the BiPoolManager. This is because the oracleHasValidMedian
function that is used to determine whether a median is valid and can be used.
mento-core/contracts/swap/BiPoolManager.sol
Line 519 in 6f8b5b7
With the suggested changes the isOldestReportExpired would return false in the described scenario but the medianReportRecent would still be false since the calculation doesn't just use the report expiryseconds from SortedOracles but the referenceRateResetFrequency from the exchange for comparison.
So I guess we would need to change both values. This means not just calling setTokenReportExpiry
in SortedOracles but also destroying and reconfiguring the cUSD/PUSO exchange in the BiPoolManager.
Also, I don't think we need to increase this value for CELO/PHP since this rate feed is only used for gas payment and the gas payment logic doesn't take the report expiry into account.
5