Mathematical framework
The below is 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 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 and 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, assuming the manipulator outbids anyone else for the spot. 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. E2 is the free_move state, which is the initial reporter's state as well as one branch of the active state through P(C). Example state paths: Trader longs, wants better a opening price, and is using the oracle to settle some external notional. paths from E_2 barrier at (F - R_i) / (-F - R_i) If +R_i hits -> enter E_0 state If -2F + R hits -> enter E_2 state If neither hits -> end game paths from E_1 barrier at +Y / (-2F + Y) If +Y hits -> enter E_0 state If -2F + Y hits -> enter E_2 state If neither hits -> end game paths from E_0 barrier at -Y / + F If -Y hits -> enter E_1 state If +F hits -> enter E_0 state If neither hits -> end game 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) 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_i) = Conditional free_move no-dispute price bias (hurts manipulator) 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_i - L_2(R_i)) + P_b*E_0 + P_c*E_2 The game starts from E_2 where an initial reporter makes their first move, R_i. 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 choice of R_i that maximizes E_2. Let's reframe E_0 first. Given: 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 Rearranging E_0: E_0 = E_1 * P(G) / (1 - P(H)) + L_0(Y) * P(0) / (1 - P(H)) Plugging this E_0 into E_1: E_1 = P(A) * (F-Y - L_1(Y) ) + P(B) *(E_1 * P(G) / (1 - P(H)) + L_0(Y) * P(0) / (1 - P(H)))+ P(C) * E_2 If we collect the terms proportional to E_0 and rearrange: E_0 = a + b * E_2 Where a and b are treated as constants which do depend on the choice of R_i. Next, recall E_2 and let R_i = R for simplicity, E_2(R) is: E_2 = P_a(R) * (R - L_2(R)) + P_b(R)*E_0(R) + P_c(R)*E_2(R) subsituting our E_0 form above: ⇒ E_2(R) = P_a(R) * (R - L_2(R)) + P_b(R)*(a + b * E_2(R)) + P_c(R)*E_2(R) The reduced form of this equation is: E_2(R) = N / D N = P_a(R) * [R - L_2(R)] + P_b(R) * a D = 1 - P_c(R) - b * P_b(R) One thing we are missing is that R depends on choice of Y. So the pair (R,Y) that maximizes E_2 contains the information we are looking for. We will have to solve this numerically because no closed form solution exists. We have to calculate a bias function first for L_2(R). We will do this by numerically finding the mean conditional drift of P_a(R), that is, given neither the F-R nor -F-R barriers are hit, and given the true price started at 0, by how much farther from the nearest wall (should always be F-R) is the price biased? This strictly hurts the manipulator since they, being long and wanting a lower price, do not actually capture the full R spread because the conditional bias goes against them. We fit a rational interpolation to the mapping of choices of R to conditional drift captured by our simulation. This fits the data well and make its derivative L_2'(R) easy to calculate. In order to do this, we must first 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 find the L_2(R) rational interpolation applying to that configuration only. Next, now that we have our bias function L_2(R), we can solve E_2'(R,Y) = 0 numerically. We have a joint optimization problem. The easiest way to solve is just plug different choices of R and Y 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