REVIEW 4 major objections 7 minor 1 cited by
Optimal Routing in the Presence of Hooks: Three Case Studies
T0 review · 4 major / 7 minor · reviewed 2026-08-09 · deepseek-v4-flash
Pith's one-line read This paper claims that hooks can be encoded into the existing convex CFMM routing problem, with limit orders as convex trading sets, time-varying liquidation as a dynamic program, and noncomposable hooks as mean-variance optimization.
desk verdict Section 4's headline TWAMM comparison is likely invalidated by a sign error in the benchmark; Section 3's limit-order routing is clean and worth engaging. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The load-bearing object is the trading set of a limit order: the convex set of all trades satisfying price and volume constraints, for a buy order $\tilde{T} = \{z \in \mathbb{R}^2 : p_0 z_1 - z_2 \ge 0,\ z_2 \le V_0,\ z_1,z_2 \ge 0\}$. Because Minkowski sums of convex sets stay convex, any number of limit orders between a pair of assets collapse into one convex set, and appending these sets to the CFMM routing problem preserves convexity. The modified forward exchange function, linear with slope $p_0$ while the order is being filled, stays differentiable and concave, so forward exchange rates remain non-increasing. For time-varying liquidation, the central construction is a Markov decision process whose state is remaining inventory plus log mispricing, with a jump term $\tilde{J}_t(\Delta_t) = -2\log\left(1 + \Delta_t \sqrt{p_t}/L\right)$ capturing price impact and fee bounds $\gamma^-, \gamma^+$ bounding arbitrage. For noncomposable hooks, a parametric family $G_2(\Delta) = 2\Delta - (R'_n/R_n)\Delta^{1+\alpha}$ plus a variance function $\sigma^2(\Delta)$ defines the convex mean-variance tradeoff.
What would settle it
Run the Section 3.2 Pigou-network route on a Uniswap v4 testnet with a hook limit order, attempting to fill the CFMM leg and the limit-order leg in one atomic transaction; the central claim is falsified if the limit-order leg cannot be filled within that same transaction, since the convex program would then be optimizing over trades that no blockchain transaction can execute. Alternatively, on historical price data, compare the dynamic-programming liquidation policy to a TWAMM across volatility buckets: the claim that optimal liquidation outperforms TWAMM under high volatility would be falsified if the TWAMM dominates in all tested volatility regimes.
Extended reading notes
Core claim
The paper's central claim is that hook functionality does not force a new routing paradigm: each hook studied here can be encoded as extra convex constraints and variables in the existing optimal routing problem. A limit buy order with price $p_0$ and volume $V_0$ has trading set $\tilde{T} = \{z \in \mathbb{R}^2 : p_0 z_1 - z_2 \ge 0,\ z_2 \le V_0,\ z_1,z_2 \ge 0\}$, so routing through arbitrarily many limit orders remains a convex program whose solution reproduces the modified forward exchange function of a CFMM with that limit order attached. Limit orders are presented as the limiting case of concentrated liquidity on a price tick of zero width. The liquidation problem becomes a dynamic program over a mispricing process with no-arbitrage fee bounds, and numerical value iteration shows the optimal policy can beat the TWAMM benchmark in high-volatility regimes. Noncomposable hooks are modeled by a parametric forward exchange function and a variance term, giving a convex mean-variance problem and an efficient frontier for fill risk versus return.
Load-bearing premise
The load-bearing assumption is that a Uniswap v4 hook limit order can be treated as standing liquidity that a router composes atomically with ordinary CFMM trades inside a single route; if such orders are cancellable, asynchronous, or otherwise not available within one atomic swap, the convex routing problem of Section 3.2 does not describe a realizable trade.
Editorial extensions
If this is right
- Limit-order legs can be added to existing convex routing solvers without changing the algorithm class; the problem size just grows by two variables per order.
- The optimal output of a CFMM with a limit order attached is the modified forward exchange function, with kinks at the order's price and volume boundaries.
- For liquidation, the dynamic programming policy trades only in favorable mispricing states, and the advantage over TWAMM grows with asset volatility.
- Noncomposable hook users can compute either the risk-minimizing allocation for a target return or the return-maximizing allocation for a risk tolerance.
- Any future hook whose trading set is convex can be slotted into the same routing framework, so convexity is the design condition for router-friendly hooks.
Reading between the lines
- If Uniswap v4 limit orders turn out not to be atomically composable inside a single route, the Section 3.2 convex program would be a planning model for a settlement layer that batches fills, not a description of one transaction; the same convex sets would still organize that batching problem.
- The delta-function view of limit orders suggests extending the framework to finite-width concentrated liquidity positions by integrating over ticks, which would connect this routing problem to Uniswap v3 tick indexing.
- The dynamic-programming liquidation requires knowing the mean and volatility of the mispricing process; a natural extension is to estimate these online from hook-provided oracle data, turning the policy into an adaptive controller.
- The noncomposable-hook efficient frontier is only as credible as the parametric forms for $G_2$ and $\sigma^2$; the sharp dropoff under quadratic variance suggests that calibrating the true fill-risk function is the decisive empirical step.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper studies optimal trade routing over networks of constant-function market makers (CFMMs) in the presence of Uniswap v4 hooks, through three case studies: (i) routing with on-chain limit orders modeled as convex trading sets, (ii) time-varying optimal liquidation via a Markov decision process benchmarked against a TWAMM strategy, and (iii) routing through non-composable hooks using mean-variance optimization and an efficient frontier. For each case, the authors propose convex or dynamic-programming formulations and support them with numerical experiments, with code provided at a public repository. The central methodological claim is that hook functionality can be encoded into existing convex routing frameworks and solved with off-the-shelf solvers.
Significance. If the results hold, the paper provides a useful and practical extension of CFMM routing to hooks: the limit-order trading-set formulation is elegant, the convexity observations are clean, and the mean-variance framework for non-composable hooks is a reasonable first model of fill risk versus price improvement. The explicit link between limit orders and concentrated liquidity is also pedagogically valuable. The paper ships reproducible code and the convex formulations are directly implementable. However, the TWAMM comparison in Section 4 is likely compromised by a sign error in the benchmark, and the modified forward exchange function in Section 3 has a branch error; these issues affect the load-bearing numerical and analytical claims, so the current version needs revision before the results can be relied upon.
major comments (4)
- [Section 3.1, modified forward exchange function] The piecewise definition of G̃(∆) is incorrect in the third branch. For ∆ ≥ ∆2, the CFMM has already received ∆1 units of input while the limit order absorbed the next ∆2−∆1 units, so the correct expression is G(∆1 + ∆ − ∆2) + p0(∆2 − ∆1), not G(∆ − (∆2 − ∆1)) + p0(∆2 − ∆1). As written, the third branch drops the G(∆1) term, making G̃ discontinuous at ∆2 (the left limit exceeds the right limit by G(∆1) − p0∆1). Consequently the claims that G̃ is continuous, differentiable, and concave at ∆2 do not follow from the displayed formula. This is load-bearing for the modified-forward-exchange-function construction and for Figure 6, which claims exact agreement with this function.
- [Section 4.1, TWAMM benchmark] The TWAMM expected output formula uses exp(z*_t) where it should use exp(−z*_t). Since z_t = log(p'_t/p_t), the post-arbitrage pool price is p'_t exp(−z*_t), not p'_t exp(z*_t). The displayed expression E[∑ p'_t exp(z*_t) D/T] − g therefore overstates the pool price when z*_t > 0 and understates it when z*_t < 0. Because the optimal policy in Figure 10 sells when the mispricing is negative (z*_t < 0), the benchmark is understated precisely in the states where the DP acts, so the reported improvement in Figure 12b may be an artifact of the sign error rather than a genuine policy advantage. This is the only quantitative evidence for the TWAMM-outperformance claim, so the benchmark must be rerun with the corrected arbitrage-adjusted price and, ideally, with error bars across price paths.
- [Section 5.2, efficient frontier] The efficient-frontier constraint is written as G1(∆) + G2(D − ∆) ≥ τ (and later as G1(∆) + G2(100 − ∆) ≥ τ), but the model in Section 5.1 defines ∆ as the amount sent to the non-composable hook and D − ∆ as the amount sent to the composable CFMM. The correct total output constraint is therefore G1(D − ∆) + G2(∆) ≥ τ. As written, the objective and the constraint are inconsistent with the variable definitions, and the reported efficient frontier may not correspond to the stated routing problem. Please correct the constraint and rerun the numerical results if the code used the wrong expression.
- [Section 3.2 and Section 3.3] The routing model treats limit orders as 'standing liquidity' that a router can combine atomically with ordinary CFMM trades inside a single route, and the paper asserts that hooks enable this. No protocol-level citation or proof is given for this atomic composability and non-cancellability assumption. If Uniswap v4 hook limit orders are not atomically composable, are cancellable, or must be filled asynchronously, then the convex problem in Section 3.2 does not describe a realizable trade. The authors should either cite protocol documentation or clearly state this as a modeling assumption and discuss the realizability conditions.
minor comments (7)
- [Section 3.1] The sentence 'We will shortly that the trading set...' is missing the verb 'show'.
- [Section 4.1, reward function] The text says 'The second term encodes the fact that the user pays gas cost' and 'The third term encodes the running inventory cost,' but the displayed reward has two output terms followed by gas and inventory terms; the numbering should be adjusted to avoid confusion.
- [Section 4.2] The parameter list sets η = 0.1, but the reward and Figure 12a use ξ as the inventory-cost parameter; either η is a typo or the two parameters should be connected explicitly.
- [Section 4.2] The discount factor is set to 0.01 for a 1000-block horizon, which heavily discounts future rewards; the per-block interpretation should be clarified so the reader can assess the effective horizon.
- [Figure 12b] The figure reports average improvement over TWAMM without confidence intervals, standard errors, or number of simulation paths; without this information the magnitude of the improvement is hard to evaluate.
- [Appendix A] The displayed formula for the quoted price reads pt = R'_t/R'_t; it should be pt = R'_t/R_t.
- [Table 1] The limit-order rows are formatted as 'Limit order at price 0.5 1 40' and 'Limit order at price 0.2 1 20'; this is ambiguous and should use clear column separators.
Circularity Check
No significant circularity: the convex routing, MDP liquidation, and mean-variance hook analyses follow from stated model assumptions, with only background self-citations.
full rationale
The paper's derivations are self-contained relative to their stated assumptions. Section 3 appends linear trading sets for limit orders to the convex routing program of [Ang+22b]; convexity is preserved because Minkowski sums and intersections of convex sets are convex, and the paper states the sets explicitly, e.g. \tilde{T} = {z | p0 z1 - z2 >= 0, z2 <= V0, z1,z2 >= 0}. The claim that the Pigou solution reproduces the modified forward exchange function is a consistency check, not a prediction derived from that function. Section 4's MDP is a model construction: state transitions, reward, and the TWAMM benchmark are all defined directly from the mispricing process and gas costs; no parameter is fitted to the DP output, and the improvement claim is a numerical experiment with illustrative parameters. Section 5's mean-variance and efficient-frontier problems are convex by inspection given concave G1, G2 and convex variance choices; the parametric family G2 is an ansatz, not a result derived from itself. Self-citations to [AC20], [Ang+22b], and [KDC23] are background theorems and examples with assumptions that do not include the paper's target claims, and the paper gives enough of the convexity argument inline that the load is not on the citations alone. One caveat: the TWAMM expected-output formula in Section 4.1, E[sum p'_t exp(z*_t) D/T] - g, appears to use the wrong sign for the arbitrage-adjusted pool price (the reward uses exp(-z_t)), which is a correctness or consistency concern outside circularity; it is not a fitted input renamed as a prediction. Verdict: no significant circularity.
Assumptions & free parameters
free parameters (4)
- MDP volatility sigma =
Hand-set to 8 in Section 4.2.
- MDP costs and discount factor =
Hand-set to g = 2, xi (printed as eta) = 0.1, discount = 0.01.
- Noncomposable hook curvature alpha and variance scale beta =
Hand-set: alpha = 0.1 for the frontier, beta = 1 for the frontier; varied in Figure 14.
- Fee bounds gamma+ and gamma- =
Hand-set to 30 basis points.
assumptions (4)
- domain assumption CFMM forward exchange functions are concave and their trading sets are convex, as established in the cited prior work.
- domain assumption Limit orders are atomically composable with CFMM trades and can be modeled as standing liquidity with the convex trading set defined in Section 3.1.
- domain assumption The log mispricing z_t follows a clipped geometric Brownian motion with a jump caused by the user's own trade, and arbitrageurs reset z to the fee bounds every block.
- ad hoc to paper Noncomposable hook output has the exact parametric form G2(Delta) = 2*Delta - (R'_n/R_n)*Delta^(1+alpha), with alpha in [0,1].
Cite this review
Pith. "Pith review of Optimal Routing in the Presence of Hooks: Three Case Studies." pith.science (2026). https://pith.science/paper/ZMCNTUMH
@misc{pith2026250202059,
author = {Pith},
title = {Pith review of: Optimal Routing in the Presence of Hooks: Three Case Studies},
year = {2026},
howpublished = {\url{https://pith.science/paper/ZMCNTUMH}},
note = {Machine review of arXiv:2502.02059}
}
read the original abstract
We consider the problem of optimally executing a user trade over networks of constant function market makers (CFMMs) in the presence of hooks. Hooks, introduced in an upcoming version of Uniswap, are auxiliary smart contracts that allow for extra information to be added to liquidity pools. This allows liquidity providers to enable constraints on trades, allowing CFMMs to read external data, such as volatility information, and implement additional features, such as onchain limit orders. We consider three important case studies for how to optimally route trades in the presence of hooks: 1) routing through limit orders, 2) optimal liquidations and time-weighted average market makers (TWAMMs), and 3) noncomposable hooks, which provide additional output in exchange for fill risk. Leveraging tools from convex optimization and dynamic programming, we propose simple methods for formulating and solving these problems that can be useful for practitioners.
Figures
Figures from the paper (11 more)
Forward citations
Cited by 1 Pith paper
-
Quantifying Sub-Optimality in Routing for Automated Market Makers
Realized DEX router allocations on WETH–USDC are on average ~2 bps worse than a gas-aware optimal benchmark, with losses concentrated in under-activated pools, stale-state planning, and sandwiched trades.
Reference graph
Works this paper leans on
-
[1]
Improved price oracles: Constant func- tion market makers
[AC20] Guillermo Angeris and Tarun Chitra. “Improved price oracles: Constant func- tion market makers”. In: Proceedings of the 2nd ACM Conference on Advances in Financial Technologies. 2020, pp. 80–91. [ACE22] Guillermo Angeris, Tarun Chitra, and Alex Evans. “When does the tail wag the dog? Curvature and market making”. In: (2022). [Ada+21] Hayden Adams e...
work page 2022
-
[6]
[WRA21] David White, Dan Robinson, and Hayden Adams
url: https://www.theblock.co/post/286679/uniswap- hits- a- historic- 2- trillion-in-trading-volume . [WRA21] David White, Dan Robinson, and Hayden Adams. “TW AMM”. In: (2021). url: https://www.paradigm.xyz/2021/07/twamm. A The CPMM Jump Process A CFMM with trading function ( R + x)(R′ − y) = RR′ = K has a liquidity constant L = √ K [Ada+21]. Suppose that ...
work page 2021
-
[444]
Optimal routing for constant function market mak- ers
[Ang+22b] Guillermo Angeris et al. “Optimal routing for constant function market mak- ers”. In: Proceedings of the 23rd ACM Conference on Economics and Compu- tation. 2022, pp. 115–128. [Ang+23] Guillermo Angeris et al. “The geometry of constant function market makers”. In: arXiv preprint arXiv:2308.08066 (2023). [CAE21] Tarun Chitra, Guillermo Angeris, a...
arXiv 2023
-
[2013]
24 [Sor] Sorella Labs Team. Sorella Labs. https://sorellalabs.xyz. Accessed: 2024- 08-22. [Sui24] Danning Sui. DEX trades by pool touched (7d) . https://dune.com/queries/ 3607406/6078007. Apr
work page 2024
-
[2021]
An efficient algorithm for optimal routing through constant function market makers
[Dia+23] Theo Diamandis et al. “An efficient algorithm for optimal routing through constant function market makers”. In: International Conference on Financial Cryptography and Data Security . Springer. 2023, pp. 128–145. [Hoo] Uniswap v4 Hooks . https://docs.uniswap.org/contracts/v4/overview . Accessed: 2024-04-06. [KDC23] Kshitij Kulkarni, Theo Diamandis...
arXiv 2023
-
[2024]
[Uni] Uniswap v4 . https : / / github . com / Uniswap / v4 - core / blob / main / docs / whitepaper-v4.pdf. Accessed: 2024-04-06. [Wat24] RT Watson. Uniswap hits a historic 2 trillion in trading volume
work page 2024
Reviewed August 9, 2026 · model on record in the stance chip above.
Discussion (0). Continue with ORCID to comment.