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

Add delay before price update triggers Liquidation #5843

Closed
Chris-Hibbert opened this issue Jul 27, 2022 · 5 comments
Closed

Add delay before price update triggers Liquidation #5843

Chris-Hibbert opened this issue Jul 27, 2022 · 5 comments
Assignees
Labels
Core Economy OBSOLETE in favor of INTER-protocol enhancement New feature or request Inter-protocol Overarching Inter Protocol oracle Related to on-chain oracles. vaults_triage DO NOT USE Vaults VaultFactor (née Treasury)

Comments

@Chris-Hibbert
Copy link
Contributor

Chris-Hibbert commented Jul 27, 2022

What is the Problem Being Solved?

Vaults currently get added to the liquidation queue as soon as a triggering price update is received. There are several reasons why it would be better to wait and at least one reason not to.

This price must be usable elsewhere in vaults on checks against MCR and Liquidation.

Benefits

  • the vault owner would have more time to rescue their vault (add collateral or pay back their debt). Avoiding liquidation should always be our preferred choice.
  • It would reduce having the protocol overreacting to temporary price movements. This allows us to respond less often to transitory changes.
  • It gives the protocol time to identify and mitigate oracle manipulation attacks. Oracle manipulation is a major attack vector, which is aggravated by reacting immediately to a price change.
  • It reduces gas and oracle fees since we don't need to update the oracle price as often.

Limitations

In a rapidly declining market, liquidations occur at lower prices than if the response was quicker.

Description of the Design

UPDATES from COMMENT
After discussion with @rowgraus, the current design is that there will be a governed parameter PRICE_LOCK_PERIOD defining a time before the start of each auction at which the oracle price will be locked for purposes of liquidation. This will not be referenced by the auction. If auctions are scheduled to run every hour, and PRICE_LOCK_PERIOD is 20 minutes, then at 20 minutes before the hour, the oracle price will be captured (and published). At the top of the hour (or a few minutes earlier to allow the work to be complete before the auction starts) the vaultManagers will liquidate vaults according to that locked price and send the resulting collateral to the auction.

All of the prices used as the triggers are from oracles reporting averages over observations from multiple sources. The locked price is neither more nor less reliable than the momentary observation of the "current" price. The lock price is neither more nor less manipulable.

Security Considerations

Has economic implications, but not much security relevance.

Test Plan

In addition to unit tests, we should include this functionality in our economic exercises.

@Chris-Hibbert Chris-Hibbert added Core Economy OBSOLETE in favor of INTER-protocol enhancement New feature or request oracle Related to on-chain oracles. Vaults VaultFactor (née Treasury) labels Jul 27, 2022
@Chris-Hibbert Chris-Hibbert added this to the Mainnet 1 milestone Jul 27, 2022
@dckc dckc added MUST-HAVE Inter-protocol Overarching Inter Protocol labels Aug 3, 2022
@Tartuffo
Copy link
Contributor

Tartuffo commented Aug 4, 2022

One possible default value for delay time: 1 hour. Per new MD oracle network liquidation default.

@Tartuffo Tartuffo removed the e2e1 label Aug 4, 2022
@Chris-Hibbert Chris-Hibbert self-assigned this Aug 4, 2022
@dtribble
Copy link
Member

dtribble commented Aug 5, 2022

The security relevance is that it protects against oracle bugs/attacks because it gives time to respond to incorrect oracle signals. However that also requires hooks to allow such response (e.g., preventing inappropriate liquidation)

@Chris-Hibbert
Copy link
Contributor Author

After discussion with @rowgraus, the current design is that there will be a governed parameter PRICE_LOCK_PERIOD defining a time before the start of each auction at which the oracle price will be locked for purposes of liquidation. This will not be referenced by the auction. If auctions are scheduled to run every hour, and PRICE_LOCK_PERIOD is 20 minutes, then at 20 minutes before the hour, the oracle price will be captured (and published). At the top of the hour (or a few minutes earlier to allow the work to be complete before the auction starts) the vaultManagers will liquidate vaults according to that locked price (unless the current price at the liquidation deadline is higher, in which case the higher price will be used) and send the resulting collateral to the auction.

A case can be made that the locked price should be used regardless of rising prices, but this is the default approach.

All of the prices used as the triggers are from oracles reporting averages over observations from multiple sources. The locked price is neither more nor less reliable than the momentary observation of the "current" price. The lock price is neither more nor less manipulable.

@ivanlei ivanlei added this to the Vaults RC0 milestone Feb 1, 2023
@rowgraus
Copy link

Updated description to be clear we are using the locked price for liquidation regardless of whether price has recovered. We need a clear signal to the market.

@Chris-Hibbert
Copy link
Contributor Author

As of #7000 and #7047, the auction has a governed param PriceLockPeriod. It controls how long before each auction starts that VaultManagers should capture a price from the oracle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Economy OBSOLETE in favor of INTER-protocol enhancement New feature or request Inter-protocol Overarching Inter Protocol oracle Related to on-chain oracles. vaults_triage DO NOT USE Vaults VaultFactor (née Treasury)
Projects
None yet
Development

No branches or pull requests

6 participants