Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Allow replacing old value in MarketOracle even if last push was less than reportDelaySec ago #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ahnaguib
Copy link
Contributor

No description provided.

@ahnaguib ahnaguib changed the title Allow for replacing old values in MarketOracle even if last push was less than reportDelaySec ago Allow replacing old value in MarketOracle even if last push was less than reportDelaySec ago Sep 10, 2020
@@ -77,7 +77,8 @@ contract('MedianOracle:pushReport', async function (accounts) {
expect(await chain.isEthException(oracle.pushReport(1000000000000000000, { from: A }))).to.be.true;
oracle.addProvider(A, { from: deployer });
r = await oracle.pushReport(1000000000000000000, { from: A });
// should fail if reportDelaySec did not pass since the previous push
r = await oracle.pushReport(1000000000000000000, { from: A });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we create a separate test for this case?

I think the original test is should only push from authorized source

Copy link
Member

@aalavandhan aalavandhan Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be great if we can test all the cases:

Reported rates (ordered by time) are r1, r2. The new rate is r.

  1. r2 < minValidTimestamp
  2. r1 < minValidTimestamp < r2 < maxValidTimestamp
  3. minValidTimestamp < r1 < r2 < maxValidTimestamp
  4. r1 < minValidTimestamp < maxValidTimestamp < r2
  5. minValidTimestamp < r1 < maxValidTimestamp < r2
  6. maxValidTimestamp < r1

Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will make sure at least coverage is back to 100%

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

Successfully merging this pull request may close these issues.

2 participants