Mathematical framework2
The below is an attempt to get into the mathematics of manipulating the oracle. Imagine you are using the oracle to settle a large notional, like a perp order. You are opening a long and want to manipulate the reported oracle price as low as possible. You can only place the reported price inside the fee barrier of the report instance, relative to the true price, or you will instantly be swapped against. This fee barrier (called F in below math) includes the internal oracle swap/protocol fees, gas fees, and expected jump loss. We will try to fully describe the game here, including both active, neutral and free_move bias, and the dispute chain branch P(C) acting like an initial report. We will define the ongoing dispute game by three linked states. E_0 is the value from a neutral state, where a manipulator must wait for an opportunity. E_1 is the value from an active state, where a manipulative report is already live. E_2 is the free_move state, which is the initial reporter's state as well as one branch of the active state through P(C). We assume the manipulator has 0 expenses and always gets their report on-chain first. Example state paths without conditional survival bias: Trader longs, wants better a opening price, and is using the oracle to settle some external notional. The trader starts the game as an initial reporter (E_2) and chooses a report price R below the true price. This creates a barrier around the true price of (+F-R) / (-F-R). If the true price moves outside of this barrier, the report gets disputed. The true price has three possible paths. One path is it hits neither barrier, in which case the game ends and the manipulator earns some R that is <= F on their external notional. The second path is the price hits the upper barrier +F - R, where there is no move by any active participant other than to have the reported price be the true price. The third path is the price hits the lower barrier -F - R, in which case the manipulator gets a free move. They can place the reported price wherever they would like below the true price, which is equivalent to the initial reporter state. In this third path the game enters back into E_2 and we play again. We say the first, second and third paths happen with some probability P_a, P_b and P_c respectively. Inside the second path of E_2 with an honest reported price, we enter the E_0 game state (neutral). The manipulator's choice of reported price is constrained by the barriers +F / -F around the true price at 0, since by contract rule you cannot place a price inside the previous report's fee barrier (we assume for now F = swap fee with every other component of F set to zero). We assume the manipulator waits for the price to hit some Y below 0, at which point they submit a reported price just outside -F relative to the true price when E_0 was entered. So inside E_0, the true price has three possible paths. One path is it hits neither barrier, in which case the game ends and the manipulator earns 0 on their external notional. The second path is the price hits -Y, at which point the manipulator submits a price just outside the lower fee barrier. The third path is the price hits +F, where there is no move by any active participant other than to have the reported price be the true price. Inside the second path of E_0 we enter the E_1 game state (active). The manipulator's choice of reported price is now constrained by the barrier +Y / (-2F +Y) around the true price at 0. We have three possible paths once inside E_1. One path is the true price hits neither barrier, in which case the game ends and the manipulator earns F-Y on their external notional. The second path is the price hits +Y and we re-enter the E_0 state (neutral). The third path is the price hits -2F + Y and we re-enter the E_2 state (free_move). Below is a more formulaic description of the above example state paths: Paths from E_2: barrier at (+F - R) / (-F - R) P_a: If neither hits -> end game P_b: If +F - R hits -> enter E_0 state P_c: If -F - R hits -> enter E_2 state Paths from E_1: barrier at +Y / (-2F + Y) P(A): If neither hits -> end game P(B): If +Y hits -> enter E_0 state P(C): If -2F + Y hits -> enter E_2 state Paths from E_0: barrier at -Y / + F P(0): If neither hits -> end game P(G): If -Y hits -> enter E_1 state P(H): If +F hits -> enter E_0 state Probability definitions: P(0) = neutral state hitting neither barrier P(G) = neutral state hitting nearer barrier (-Y) P(H) = neutral state hitting farther barrier (+F) P(A) = active state hitting neither barrier P(B) = active state hitting nearer barrier (+Y) P(C) = active state hitting farther barrier (-2F + Y) P_a = free_move state hitting neither barrier P_b = free_move state hitting nearer barrier (F - R_i) P_c = free_move state hitting farther barrier (-F - R_i) Incorporating conditional bias: The surviving price given no dispute is biased depending on its surrounding barriers. One way to think about bias is with the following example: If I told you ETH was $999, and then one week later the only piece of information I gave you was that ETH was below $1000, your best guess for the current price of ETH would be biased much below $999. If I gave you no information one week later, your best guess would be $999. This type of thinking applies to our oracle game. The optimal manipulation strategy does not have symmetrical barriers, meaning the surviving price (no-dispute) is biased away from the true price at time of manipulative report. For example, in the neutral state E_0, if there is no dispute, this means the price did not hit -Y or +F on either side, starting at 0. Since we assume Y is the closer barrier, this biases the price conditional on no dispute closer to the farther barrier. Since the manipulator is opening a long, and wants as low a price as possible, this conditional bias strictly helps them because they got to open a long at a reported price lower than the true price. You can follow the same logic looking at the barriers for E_1 and E_2, and so the no-dispute branches of the active and free_move states have their own specific biases which both hurt the manipulator. We define the three conditional biases as follows: L_0(Y) = Conditional neutral no-dispute price bias (helps manipulator) L_1(Y) = Conditional active no-dispute price bias (hurts manipulator) L_2(R) = Conditional free_move no-dispute price bias (hurts manipulator) Given all of this information, the system is defined by the following three equations: E_0 = P(G) * E_1 +P(0) * L_0(Y) + P(H) * E_0 E_1 = P(A) * (F-Y - L_1(Y) ) + P(B) * E_0 + P(C) * E_2 E_2 = P_a * (R - L_2(R)) + P_b * E_0 + P_c * E_2 The game starts from E_2 where an initial reporter makes their first move placing a price R below the true price at 0. Every surviving round is within ±F and every disputed round nets zero, so the manipulator’s cumulative EV is ≤ F from any game state.
Next, we want to find the choices of R and Y that maximize E_2 for the manipulator. We will have to solve this numerically because no closed form solution exists. The next step is to specify the oracle parameters as well as background market dynamics. So for example, we could choose to use 30 second settlement windows, F = 8bps, st dev = 8bps over the whole window, alpha = 2 (for normal distribution) and fit our three bias functions to that configuration only. Finally, we want to maximize E_2(R,Y). The easiest way to solve is to just plug different choices of (R,Y) and their respective nine game branch probabilities into the E_2(R,Y) function and see where the EV peaks:

So optimal (R,Y) appears to be somewhere in the neighborhood of (7.5,5), with the full arbitrage loss to passive participants at ~0.5 bps in expectation across the whole life cycle of the oracle (not per round). With an F of 8bps, 0.5/8 ~= F/16 arbitrage loss. This is extremely minimal, but we are using a gaussian assumption (normal distribution). Tails are fatter in real life, which may change things. When we look at the data for an alpha-stable distribution with stability parameter of 1.5, a distribution more typical of real life crypto returns on seconds long timeframes, we find the optimal strategy is a low Y during the neutral state and a high R during the free move state. This increases the number of rounds greatly and arbitrage loss moderately but since the time per round is much smaller, the overall settlement time does not drag on very long. And because we can link the internal oracle costs to the external notional by setting the initial report liquidity to be some fraction of said external notional, we can relate the total internal oracle cost to the maximum arbitrage loss of F against the external notional. Said another way, the manipulator can only earn up to F no matter how many rounds the game goes on for, but they must pay the internal oracle costs every round which are growing exponentially more expensive.
Last updated