Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGP: Increase SortedOracles report expiry for PHP/USD to 6 minutes #518

Open
5 tasks
chapati23 opened this issue Sep 17, 2024 · 4 comments
Open
5 tasks
Assignees

Comments

@chapati23
Copy link
Contributor

chapati23 commented Sep 17, 2024

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
    1. A new Chainlink rate gets relayed 1 second after the last relay run
    2. We have to wait for another 59 seconds until the next relay attempt
    3. 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
@chapati23 chapati23 changed the title CGP: Increase SortedOracles expiry for PHP/USD and CELO/PHP to 6-7 minutes CGP: Increase SortedOracles expiry for PHP/USD and CELO/PHP to 6 minutes Sep 17, 2024
@chapati23 chapati23 changed the title CGP: Increase SortedOracles expiry for PHP/USD and CELO/PHP to 6 minutes CGP: Increase SortedOracles report expiry for PHP/USD and CELO/PHP to 6 minutes Sep 17, 2024
@bayological
Copy link
Member

bayological commented Sep 19, 2024

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

@philbow61
Copy link
Contributor

philbow61 commented Sep 23, 2024

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.

function oracleHasValidMedian(PoolExchange memory exchange) internal view returns (bool) {

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.

@philbow61
Copy link
Contributor

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.

@philbow61 philbow61 changed the title CGP: Increase SortedOracles report expiry for PHP/USD and CELO/PHP to 6 minutes CGP: Increase SortedOracles report expiry for PHP/USD to 6 minutes Nov 7, 2024
@philbow61
Copy link
Contributor

5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants