-
Notifications
You must be signed in to change notification settings - Fork 46
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
Make _openTrove and _adjustTrove revert when new oracle failure detected #357
Conversation
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.
Nice!
It seems the new Chanlink mock oracle contract throws some errors. It would nice to get rid of them.
contracts/src/BorrowerOperations.sol
Outdated
@@ -1499,6 +1506,12 @@ contract BorrowerOperations is LiquityBase, AddRemoveManagers, IBorrowerOperatio | |||
} | |||
} | |||
|
|||
function _requireOraclesLive(bool _newOracleFailureDetected) internal view { |
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.
Isn’t this pure?
if (priceFeedDisabled) return lastGoodPrice; | ||
// fetchPrice returns: | ||
// - The price | ||
// - A bool indicating whether a new oracle failure was detected in the call |
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.
So, if the failure is not new (i.e., the oracle and the branch were already down), this would return false, right?
(or at least that seems to happen in the first line of this function)
Why?
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.
Right. The intent is to only detect new failures in this call, so that openTrove
and adjustTrove
revert if they are called in the transaction where the oracle first fails.
If the oracle failed in a previous fetchPrice
call, the branch will already be shut down and using the lastGoodPrice
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.
Ah, yes, of course. Thanks for clarifying!
Closes #336.
_openTrove
and_adjustTrove
check whether an oracle failed, and revert if so.