Files
papers/hanzo-hmm/sections/08-mev-resistance.tex

52 lines
2.7 KiB
TeX

\section{MEV Resistance}
\label{sec:mev}
Maximal Extractable Value (MEV)~\cite{daian2020flash} is a critical concern for AMMs. We introduce three mechanisms for MEV resistance.
\subsection{Non-Commutative Phase Space Flows}
In a standard CPMM, the order of two independent swaps does not affect the final state: $\phi_{\Delta_1} \circ \phi_{\Delta_2} = \phi_{\Delta_2} \circ \phi_{\Delta_1}$. This commutativity enables sandwich attacks, where an attacker inserts transactions before and after a target swap.
In HMM with the augmented Hamiltonian (\ref{eq:augmented}), the flows corresponding to swaps in different resource types \emph{do not commute}:
\begin{equation}
[\phi_{\Delta q_i}, \phi_{\Delta q_j}] \neq 0 \quad \text{for } i \neq j, \; \mu_i \neq 0.
\end{equation}
This non-commutativity means that the profitability of a sandwich attack depends on the ordering of \emph{all} concurrent swaps, not just the target swap, making MEV extraction combinatorially harder.
\subsection{Risk-Adjusted Fees}
The total fee for a swap $\Delta\bm{q}$ is:
\begin{equation}
f(\Delta\bm{q}) = f_m + f_r \cdot \frac{\|\Delta\bm{q}\|_2}{\|\bm{q}\|_2} + f_v \cdot \text{Vol}_{7d}(\bm{\pi}),
\end{equation}
where $f_m$ is the base market fee, $f_r$ is the inventory risk fee, and $f_v$ is the volatility surcharge.
\begin{proposition}[Sandwich Attack Unprofitability]
For a sandwich attack with front-run size $\Delta q_f$ and victim swap $\Delta q_v$, the attacker's profit is:
\begin{equation}
\Pi_{\text{sandwich}} = \underbrace{\pi(\Delta q_f + \Delta q_v) - \pi(\Delta q_f)}_{\text{price impact}} - \underbrace{2f(\Delta q_f)}_{\text{round-trip fees}}.
\end{equation}
With HMM's risk fee, $\Pi_{\text{sandwich}} < 0$ whenever $\Delta q_f > \alpha \cdot \|\bm{q}\|$ for a threshold $\alpha$ that depends on $f_r$ and $\lambda$.
\end{proposition}
\subsection{Time-Weighted Batch Auctions}
HMM supports an optional batch auction mode where swaps within a time window $\Delta t$ are aggregated and executed atomically at a single clearing price. This eliminates within-batch ordering advantages and is implemented via a sealed-bid mechanism:
\begin{algorithm}[H]
\caption{HMM Batch Auction}
\label{alg:batch}
\begin{algorithmic}[1]
\Require Batch window $\Delta t$, pending swaps $\mathcal{S}$
\State Collect swap intents during $[t, t + \Delta t]$
\State Sort by resource type, aggregate demand: $\Delta\bm{q}_{\text{agg}} = \sum_{s \in \mathcal{S}} \Delta\bm{q}_s$
\State Compute clearing price via Hamiltonian: $\bm{\pi}^* = \nabla_{\bm{q}} \mathcal{H} / \nabla_{\bm{p}} \mathcal{H}$
\State Execute aggregate swap atomically
\State Distribute resources pro rata to participants
\State \Return Final allocations and prices
\end{algorithmic}
\end{algorithm}