Why atomic execution doesn’t always payoff for arbitrageurs
This blog post is based on a research paper written as part of my work with Matter Labs. In this link you can find the original paper. Special thanks to Ben Livshits , Matej Pavlovic and Krzysztof Gogol for the early discussions and reviews.
In the Ethereum ecosystem, there has been a growing interest in shared sequencing solutions. These systems allow transactions from multiple rollups to be processed together with the aim to improve composability and user experience. Examples of companies working on this space include Astria , which already has a solution in production, and Radius , NodeKit , and Expresso Systems , which have deployed their testnets.
The proponents of shared sequencers argue that these solutions have the potential to increase sequencer revenue by enhancing Maximum Extractable Value (MEV) extraction. However, there has been little research on these claims, raising questions about the actual impact of shared sequencing on arbitrage profits, which is the most common MEV strategy used in rollups.
In this post, we look at this question. In particular, we are interested in one of the properties enabled by shared sequencing, namely, atomic execution. Atomic execution allows an arbitrageur to bundle two swaps (one for each rollup) and have the guarantee that if one of the swaps reverts, the other will also revert. We hope to shed some light into the conditions when atomic execution is beneficial for arbitrage profits and thus when it is worthwhile for arbitrageurs to switch from independent sequencing to shared sequencing.
Arbitrage Profit Model
To answer this question, we use a simplified arbitrage extraction model. Concretely, we make the following assumptions:
- An arbitrageur identifies an opportunity to profit from the price difference between the tokens $X\text{-}Y$ in two different rollups, $A$ and $B$.
- In rollup $A$ the price of $X\text{-}Y$ is $P_A$
- In rollup $B$ the price of $X\text{-}Y$ is $P_B$
- $P_A > P_B$
- Both prices are denominated in token $Y$
- Both pools are Constant Product Market Markers and charge the same trading fee, $f$.
- Since there is no atomic bridging, the arbitrageur must have liquidity on both rollups, which is maintained in $X$ and $Y$. We use an external price $P_\text{ext}$ to value these tokens, which is again denominated in units of token $Y$.
- The arbitrageur will execute the optimal trade, i.e., they will size their trade to extract the maximal value from the target pools.
- The model ignores transaction costs on the two rollups.
In this situation, the arbitrageur will submit two swaps, namely:
- Swap $S_B$ in rollup $B$: Pays $\Delta y_B$ units of token $Y$ and wants to receive $\Delta x_B$ units of token $X$.
- Swap $S_A$ in rollup $A$: Pays $\Delta x_A$ units of token $X$ and wants to receive $\Delta y_A$ units of token $Y$. Note that $\Delta x_A = \Delta x_B$.
The exact trade sizes for the optimal arbitrage can be derived from the CPMM formulas. Then, we can use the trade sizes to derive the arbitrage profit. In this case, the arbitrage profit is simply the difference in the combined liquidity of the arbitrageur across the two rollups, valued using the external price $P_\text{ext}$. For the full derivation and formulas, please refer to the original paper .
After both swaps are submitted, there is a possibility that the swaps may not execute as expected. This may happen due to other traders moving the pool states or, most likely, due to other arbitrageurs exploiting the same pools with their own strategies. We represent these events of “failure” with the random variables $\mathcal{F}_{S_A}$ and $\mathcal{F}_{S_B}$, which we assume are independent. These random variables take the value 1 if the swap fails and 0 if the swap is successful. In addition, we define $f_A$ and $f_B$ as the probabilities of swaps $S_A$ and $S_B$ failing, respectively.
There are four possible combined outcomes for these two variables. For each, we can describe the difference in arbitrage profits between the atomic and non-atomic execution regimes (assuming $\text{Profit}_\text{diff}:=\text{Profit}_\text{atomic}-\text{Profit}_\text{non-atomic}$):
- $\mathcal{F}_{S_A} = 0 \cap \mathcal{F}_{S_B} = 0$. In this outcome, both swaps execute, and thus, the difference in arbitrage profits between the two regimes is zero.
- $\mathcal{F}_{S_A} = 1 \cap \mathcal{F}_{S_B} = 1$. In this outcome, both swaps fail. Thus, the difference in arbitrage profits between the two regimes is again zero.
- $\mathcal{F}_{S_A} = 1 \cap \mathcal{F}_{S_B} = 0$. In this outcome, swap $S_A$ fails, but swap $S_B$ executes. Here, there is a difference since, in the atomic regime, both swaps would be reverted. Therefore, $\text{Profit}_\text{diff} = 0 - (\Delta x_B P_\text{ext} - \Delta y_B) = \Delta y_B - \Delta x_B P_\text{ext}$.
- $\mathcal{F}_{S_A} = 0 \cap \mathcal{F}_{S_B} = 1$. In this outcome, swap $S_A$ executes, while swap $S_B$ fails. Again, there is a difference in this combined outcome since, in the atomic regime, both swaps would be reverted. Therefore, $\text{Profit}_\text{diff} = 0 - (\Delta y_A - \Delta x_A P_\text{ext}) = \Delta x_A P_\text{ext} - \Delta y_A$.
Putting all of this together, we can derive the expected value of the profit difference as:
$$ \begin{align} &\nonumber \mathbb{E}[\text{Profit}_\text{diff}] = \\ % &\nonumber = (\Delta y_B - \Delta x_B P_\text{ext}) \cdot f_A \cdot (1-f_B) + (\Delta x_B P_\text{ext} - \Delta y_A) \cdot (1-f_A) \cdot f_B\\ % &= f_A(\Delta y_B - \Delta x_B P_\text{ext}) + f_B(\Delta x_A P_\text{ext} - \Delta y_A) + f_Af_B(\Delta y_A - \Delta y_B) \end{align} $$Interestingly, we can rewrite the previous equation in terms of the price paid by the arbitrageur in each swap, namely, $P^*_A = \frac{\Delta y_A}{\Delta x_A}$ and $P^*_B = \frac{\Delta y_B}{\Delta x_B}$:
$$ \begin{equation} \mathbb{E}[\text{Profit}_\text{diff}] = \Delta x_B\big[ f_A(P^*_B - P_\text{ext}) + f_B(P_\text{ext} - P^*_A) + f_Af_B(P^*_A - P^*_B)\big] \end{equation} $$Atomicity Profit Conditions
The formula we derived above offers a straightforward way to assess when it is advantageous for an arbitrageur to adopt atomic execution. It highlights that expected profit relies on a few critical parameters. By examining each of these parameters, we can see how their fluctuations affect the expected profit. The first parameter we can look at is the trade size ($\Delta x_B$). The optimal trade size is fully determined by the state of the pools in each rollup: this includes the token reserves, the price differences between both pools and the trading fees. Generally, as the pools’ reserves and the price difference increase, so does the optimal trade size. Since $\Delta x_B > 0$, the state of the pools does not influence whether the profit is negative or positive. Instead, it has a multiplicative effect on the expected profit difference, affecting the magnitude of this difference.
This means that whether atomicity is profitable for the arbitrageur only depends on the remaining two factors:
- The external price $P_\text{ext}$ and its relative position to the prices experienced by the arbitrageur in their optimal trade, $P^*_A$ and $P^*_B$.
- The failure probabilities $f_A$ and $f_B$.
To further understand how these factors impact the expected gain an arbitrageur will experience when switching from a non-atomic regime to an atomic regime, we considered a specific arbitrage scenario and plotted the profit difference for a range of values of these two factors. The figure below illustrates the results.
Let’s look at Figure 1 (a). When the external price is larger than both pool prices, the expected profit difference can be positive or negative, depending on the probabilities of failure. If failures are more likely on rollup $B$, the difference is positive, meaning that the arbitrageur will profit on average by switching to the atomic regime. However, if failures are more likely on rollup $A$, the difference is negative, and switching is no longer profitable.
Intuitively, this relationship makes sense. When the difference between the external price and rollup $B$ exceeds the price differences in the two rollups, it’s advantageous to arbitrage rollup $B$ against the external price instead of rollup $A$. Consequently, when swap $S_A$ fails while swap $S_B$ succeeds, it results in a profit for the arbitrageur when valued against this external price, indicating that atomicity is less beneficial for the arbitrageur.
On the other hand, if we look at Figure 1 (c), we can see that the relationship is inverted when the external price is smaller than both pool prices. In this case, the rationale is similar, and switching to an atomic regime is only advantageous when failures are more likely on rollup $A$ since arbitraging rollup $A$ against the external price generates more profit than arbitraging it against rollup $B$.
Finally, in Figure 1 (b), we can see the case where the external price is between the two pool prices. This can arguably be the most likely case if we assume that the external price comes from a more liquid venue and that the pools on the two rollups move around this more stable price. Interestingly, the expected profit difference is always negative in this case, independently of the failure probabilities. Similar to the previous cases, when we value liquidity using an external price, and one of the swaps fails while the other executes, we are, in a way, arbitraging the pool that did not fail against the external price. When the external price is between the pool prices, having only one swap fail is always better than having both revert, as we would collect some additional profit from arbitraging the pool that did not fail against the external price.
Conclusion
In this analysis, we aimed to understand the cases when atomic execution improves the expected profits that an arbitrageur will experience when executing cross-rollup arbitrages. We considered the case where an arbitrageur exploits an opportunity between two CPMM pools and values the final profit using an external price. We found that whether switching from non-atomic to atomic execution is net positive for the arbitrageur depends on the failure probabilities of the swaps in each rollup and the relative difference between the external price and the pool prices.
These results thus reveal that arbitrage profits do not always improve under atomic execution, and thus, this feature alone is not enough to convince both arbitrageurs and rollup operators to switch to a shared sequencing regime.
Alternatively, atomic bridging has a bigger potential to improve profit extraction for arbitrageurs. Atomic bridging goes further than atomic execution by allowing for bridge operations between rollups, eliminating the need for liquidity across different chains. An arbitrageur can take a flash loan on one rollup, swap tokens, bridge them to another rollup for the second swap, and then bridge the tokens back to repay the loan. Yet, this property is significantly more challenging to achieve and requires additional trust assumptions on the shared sequencing infrastructure.
As next steps, this work can be extended in multiple ways. Firstly, we assume that the arbitrageur maintains their liquidity in the tokens being arbitraged. However, arbitrageurs may keep liquidity in a stable token and convert it on demand to address volatility; our model could be extended to account for this conversion. Secondly, we do not consider transaction costs. Although it is currently low and likely to remain such for rollups, adding this cost would be another possible extension to the model. Thirdly, and more importantly, one could explore how prevalent the scenarios in which atomic execution is not beneficial to an arbitrageur are. This would require a detailed empirical analysis of various pools across different deployed rollups and varying time periods.