Pith. sign in

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 →

arxiv 2502.02059 v1 pith:ZMCNTUMH submitted 2025-02-04 cs.GT

classification cs.GT MSC 90C2590C3991B26
keywords CFMMroutingUniswapv4hookslimitordertradingsetsconvexoptimizationdynamicprogrammingTWAMMliquidationmean-variance
verification ladder T0 review T1 audit T2 compute T3 formal

The pith

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The reading

The paper argues that the new trading features made possible by Uniswap v4 hooks can be absorbed into the existing convex framework for routing over constant-function market makers. Limit orders are encoded as convex trading sets and treated as standing liquidity, so the combined routing problem stays convex. Large liquidations are cast as a dynamic program that uses a volatility and mispricing signal and can beat the TWAMM benchmark when volatility is high. Noncomposable hooks with fill risk become a convex mean-variance optimization with an efficient frontier. If these formulations are right, routers can handle hook-aware trades with off-the-shelf solvers and a well-defined dynamic program.

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.

Watch

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

Editorial extensions of the paper, not claims the author makes directly.

  • 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.
Share X Bluesky LinkedIn Reddit HN

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, and a circularity audit.

Referee Report

4 major / 7 minor

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)
  1. [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.
  2. [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.
  3. [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.
  4. [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)
  1. [Section 3.1] The sentence 'We will shortly that the trading set...' is missing the verb 'show'.
  2. [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.
  3. [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.
  4. [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.
  5. [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.
  6. [Appendix A] The displayed formula for the quoted price reads pt = R'_t/R'_t; it should be pt = R'_t/R_t.
  7. [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

0 steps flagged · score 0.0 of 10

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 4 free parameters · 4 assumptions · 0 invented entities

The central claims rest on four assumptions: known CFMM convexity, an untested mispricing model with restrictive arbitrage resets, an ad hoc hook output parametrization, and atomic composability of limit orders. No free parameters are fit to external data, but several are hand-set and drive the numerical results.

free parameters (4)
  • MDP volatility sigma = Hand-set to 8 in Section 4.2.
    Controls how often favorable mispricing appears; the claim that optimal liquidation beats TWAMM is demonstrated only at this hand-set volatility.
  • MDP costs and discount factor = Hand-set to g = 2, xi (printed as eta) = 0.1, discount = 0.01.
    Gas and inventory costs define the tradeoff; the 0.01 discount makes future rewards nearly irrelevant over 1000 steps, an unusual choice that affects the policy.
  • 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.
    The parametric family G2 and variance forms are ad hoc and not fitted to any real hook; all Section 5 curves depend on these choices.
  • Fee bounds gamma+ and gamma- = Hand-set to 30 basis points.
    The no-arbitrage band controls when the mispricing process is clipped and is a standard Uniswap fee tier, but the MDP results depend on it.
assumptions (4)
  • domain assumption CFMM forward exchange functions are concave and their trading sets are convex, as established in the cited prior work.
    Used throughout Sections 3 and 5 to conclude that the modified routing problems remain convex.
  • 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.
    The routing problem in Section 3.2 assumes this without a protocol-level citation or proof.
  • 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.
    This process is introduced in Section 4.1; it is a modeling assumption, not an empirical fact, and it drives the DP results.
  • 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].
    Section 5.1 postulates this family to represent price improvement; no derivation from the Angstrom hook or any other implementation is provided.

how reviews work

0 comments
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 reproduced from arXiv: 2502.02059 by the authors.

Figure 1
Figure 1. Decentralized exchange trades by number of pools touched [Sui24]. fees to users who trade against their passive capital. For instance, if a liquidity provider owns ETH and USDC, they can facilitate trades from users between these two assets (and charge a fee in the tendered asset). Arbitrageurs synchronize prices between centralized and decentralized venues and are crucial for ensuring CFMMs quote accurate prices [A… view at source ↗
Figure 2
Figure 2. Trading set, T˜ = {z ∈ R 2 | z 2 ≤ p0z 1 , z 2 ≤ V0 , z 1 , z 2 ≥ 0}, for p0 = 0.5, V0 = 2. (minimum) prices the user receives on buy (sell) orders. Early versions of Uniswap and other CFMMs only allowed routers to make use of the liquidity provided in the core protocol; hooks enable the implementation of onchain limit orders. Consequently, our formulation allows the routing problem to use limit orders such as ‘stan… view at source ↗
Figure 3
Figure 3. Comparison of the forward exchange function of a CFMM with and without a limit order. The output with the limit order creates a linear segment at the limit price p0 , followed by a continuation of the CFMM’s forward exchange function. of asset B received. In this spirit, we define the trading set of a limit (buy) order as T˜ = {z = (z 1 , z 2 ) ∈ R 2 | p0z 1 − z 2 ≥ 0, z 2 ≤ V0 , z 1 , z 2 ≥ 0}. In words, this defin… view at source ↗
Figures from the paper (11 more)
Figure 2
Figure 2. Figure 2: We will shortly that the trading set of a limit order is a natural object to consider [PITH_FULL_IMAGE:figures/full_fig_p007_2.png]
Figure 4
Figure 4. Figure 4: Visualization of a limit order as a concentrated liquidity position. The sequence of blue rectangular functions with increasing height and decreasing width approaches a delta function representing a limit order at price p0 , with volume V0 . Darker shades of blue indic…
Figure 5
Figure 5. Figure 5: The CFMM Pigou network with limit orders [PITH_FULL_IMAGE:figures/full_fig_p010_5.png]
Figure 6
Figure 6. Figure 6: Interestingly, we see that this curve exactly matches the modified forward exchange [PITH_FULL_IMAGE:figures/full_fig_p011_6.png]
Figure 7
Figure 7. Figure 7: Optimal amount of asset 3 received, u(s), for the multi-asset limit order network as s, the amount of asset 1 tendered, varies in the presence of limit orders [PITH_FULL_IMAGE:figures/full_fig_p013_7.png]
Figure 8
Figure 8. Figure 8: Optimal trades as s, the amount of asset 1 tendered, varies in the presence of limit orders. 13 [PITH_FULL_IMAGE:figures/full_fig_p013_8.png]
Figure 9
Figure 9. Figure 9: Value function [PITH_FULL_IMAGE:figures/full_fig_p017_9.png]
Figure 12
Figure 12. Figure 12: Inventory over time and dollars liquidated over TWAMM for selling 1000 units of a risky asset priced at $5000 over 1000 blocks Value function and optimal policy. We numerically solve the dynamic program via a value iteration method for a CPMM with initial reserves (R,…
Figure 13
Figure 13. Figure 13: Forward exchange functions of the noncomposable hook for varying values of α. Routing through this market carries no risk (except for transaction-ordering risk found in all blockchains, which we do not model here). When a user sends a trade through this market, it is …
Figure 14
Figure 14. Figure 14: The mean-variance tradeoff for various functional forms of fill risk, σ 2 (∆). we introduce a variance term that is a function of the size of the trade through the non￾composable hook, σ 2 (∆). When the trade size is large, external market makers may face larger uncer…
Figure 15
Figure 15. Figure 15: Efficient frontier for the non-composable hook. 6 Conclusion and Future Work In this paper, we generalize the optimal routing problem for CFMMs to allow for hooks and consider various settings. First, hooks allow for the implementation of onchain limit orders. We show…

Discussion (0). Continue with ORCID to comment.

Forward citations

Cited by 1 Pith paper

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score. Full citation record

  1. Quantifying Sub-Optimality in Routing for Automated Market Makers

    q-fin.TR 2026-07 conditional novelty 6.0 of 10

    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

6 extracted references · 4 canonical work pages · cited by 1 Pith paper

  1. [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...

  2. [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 ...

  3. [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...

  4. [2013]

    Sorella Labs

    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

  5. [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...

  6. [2024]

    https : / / github

    [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

Pith tools

Reviewed August 9, 2026 · model on record in the stance chip above.