Routing & execution

Why A-to-B-to-A is not an ordinary swap path

Distinguish an ordinary token conversion from a route that returns to its starting asset, and understand why loops need a separate objective.

A cycle returns to an asset already visited in the route. A-to-B-to-A is therefore different from an ordinary A-to-C conversion: its final asset matches its starting asset. A useful cycle needs an objective beyond simply exchanging one token for another.

A loop is not automatically beneficial

Trading through several markets can encounter inconsistent prices, but each operation also has pricing effects and possible charges. The presence of a graph cycle says nothing by itself about whether the final amount exceeds the starting amount.

In a hypothetical perfectly aligned fee-free system, completing a reversible loop need not produce any gain. Add trading fees without a compensating price difference and the loop can return less than it started with.

Why arbitrage is a different request

Arbitrage searches for a profitable inconsistency across markets. Ordinary swap routing searches for a desired net asset exchange. The two problems can share mathematical machinery while having different user outcomes.

The CFMM routing research includes arbitrage detection as a special case of network optimization. That is a theoretical relationship, not evidence that any displayed loop is profitable.

Repeated labels need interpretation

A route display can revisit an asset because branches merge, wrappers change representation or the interface simplifies operations. The token sequence alone may not reveal the exact execution graph.

For a hypothetical A-to-B request with a repeated A in the middle, inspect the complete net flow. Determine whether the route intentionally includes a cycle, whether two branches share a label, or whether the representation is incomplete.

The relevant checks are final asset balances, input bounds and compatibility of all pool states. A loop cannot be evaluated by multiplying stale spot prices, and the same pool cannot be treated as untouched on each visit.

This distinction helps read complex routes without turning them into implied trading opportunities. A graph feature is a structural observation; economic benefit requires a complete executable calculation.

Sources & verification (3)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. Optimal Routing for Constant Function Market Makers

    Routing across CFMM networks; fixed execution costs alter optimization complexity.

    https://web.stanford.edu/~boyd/papers/cfmm_routing.html
  2. An Efficient Algorithm for Optimal Routing Through Constant Function Market Makers

    Network routing, utility objectives and optimization under CFMM constraints.

    https://arxiv.org/html/2302.04938v1
  3. Uniswap v2 Pricing

    Reserve pricing, invariant enforcement and exact swap modes.

    https://developers.uniswap.org/docs/protocols/v2/concepts/pricing

Continue reading

How smart order routing finds a token swap path Single-hop vs multi-hop swaps Why an aggregator splits a swap across pools