-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add price feed rounds #64
Conversation
@@ -12,7 +12,6 @@ import {RLPReader} from "@solidity-merkle-trees/trie/ethereum/RLPReader.sol"; | |||
* THIS IS AN EXAMPLE LIBRARY THAT USES UN-AUDITED CODE. | |||
* DO NOT USE THIS CODE IN PRODUCTION. | |||
*/ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happened when formatting
if (roundID <= latestRoundID && latestRoundID != 0) { | ||
revert("roundID should be monotonically increasing"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Events should be published monotonically increasingly. This is not true apparently on startup because the blocks catch-up operation is done asynchronously to the tip following one, thanks @cam-schultz !
We may want to modify this logic because of the catch-up so that it can accept any height, but not allow overwrites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An issue arising from that is that there might be some missing rounds although the last one is saved. Some smart contracts relying on this information to calculate i.e. the median price may get surprised by this behavior.
If we assume that any gap can only happen at the startup and that it would be filled quickly, we could save them in a "buffer" and only respond with the getRoundData
method if none of the previous round is missing.
Closes #63
Add rounds to have historical rounds data like
getRoundData
and other missing methods.Only the
getRoundData
has been added so that thePriceFeedImporter
contract implements theAggregatorV3Interface
. It is a good security practice for callers because it gives by default the answer as well as the update time of the answer which can be checked to judge staleness and fallback on other methods if this one is not satisfying enough. Methods such aslatestTimestamp
orlatestAnswer
are deprecated.The method
latestRound
to get the latest roundID though may be useful (methods are at https://github.com/smartcontractkit/libocr/blob/ae747ca5b81236ffdbf1714318c652e923a5ff4d/contract/OffchainAggregator.sol#L721-L785) and in this case we may want to still implement those for legacy purposes ?