Drift Protocol has a number of resiliency checks around oracles. Currently, Drift utilises Pyth and Switchboard as an oracle sources and has the flexiblility to update as necessary on a per market basis.

Validity Checks

For robustness, Drift's program checks oracle validity. An oracle will return a price validity error if any of following conditions occur:

1. Stale pricing (latest slot update too far behind, currently: 120 slots)

2. Confidence interval is too large (confidence if very large percent of price, currently: >25%)

3. Negative price (any price field < 0)

4. Price too volatile (TWAP/price ratio out of bounds, currently: 50%)

In the case of oracle error, the market will pause most liquidations and funding rate updates. The on-chain oracle twap calculation will also be shrunk proportional to the duration of the invalid period to avoid errenous payment magnitudes.

Liquidation Protection

In the case of a large oracle and mark price divergence (currently: >10%), and the oracle price is valid, then liquidations will be paused.

large oracle mark divergence
large oracle mark divergence

Full logic for blocking/allowing liquidations:

liquidation allow check (<- yes, no ->)
liquidation allow check (<- yes, no ->)

Price Manipulation Prevention

The Clearinghouse will also pause risk-increasing trades that further increase large oracle-mark divergence. Closing/reducing a position that further breaches this divergence is also not allowed (unless the divergence has already been breached).


Future Work

Drift is working on improving resiliency against oracle manipulation.





Updated 30 Apr 2022
Did this page help you?