Connect
Cover: Two hops, five legs: the largest route shape, and why the bound is a product

Two hops, five legs: the largest route shape, and why the bound is a product

How many pools can one swap touch, and why is that the limit?

A route is at most two hops, each split across at most five parallel legs, so at most ten legs. The bound is the product of two constants, produced once and read by the Router, the Quoter and the Solver.

Known formally as MAX_HOPS x MAX_LEGS_PER_HOP: one product, one producer in the BlazePhoenix whitepaper.

BlazePhoenix Engineering · article updated 2026-11-16 · site dataset through 2026-11-19 · 7 min · written from the deployed bytecode

By Mitra (@Sigmacrit) — anonymous developer of the BlazePhoenix protocol. The code is the résumé.

Abstract in 15 languages · resumo · resumen · 摘要 · 要旨 · ملخص

English — A route has at most two hops, each split across at most five parallel legs, so no route carries more than ten legs. The bound is the product of MAX_HOPS and MAX_LEGS_PER_HOP, produced once and read by the Router, the Quoter and the Solver, and the Router refuses anything wider or deeper with RouterE(3).

Português — Uma rota tem no máximo dois saltos, cada um dividido por no máximo cinco pernas paralelas, pelo que nenhuma rota leva mais de dez pernas. O limite é o produto de MAX_HOPS e MAX_LEGS_PER_HOP, produzido uma só vez e lido pelo Router, pelo Quoter e pelo Solver, e o Router recusa tudo o que seja mais largo ou mais profundo com RouterE(3).

Español — Una ruta tiene como máximo dos saltos, cada uno dividido en como máximo cinco tramos paralelos, así que ninguna ruta lleva más de diez tramos. El límite es el producto de MAX_HOPS y MAX_LEGS_PER_HOP, producido una sola vez y leído por el Router, el Quoter y el Solver, y el Router rechaza todo lo más ancho o más profundo con RouterE(3).

Français — Une route compte au plus deux sauts, chacun réparti sur au plus cinq jambes parallèles, donc aucune route ne porte plus de dix jambes. La borne est le produit de MAX_HOPS et MAX_LEGS_PER_HOP, produit une seule fois et lu par le Router, le Quoter et le Solver, et le Router refuse tout ce qui est plus large ou plus profond avec RouterE(3).

Deutsch — Eine Route hat höchstens zwei Hops, jeder auf höchstens fünf parallele Beine aufgeteilt, sodass keine Route mehr als zehn Beine trägt. Die Grenze ist das Produkt aus MAX_HOPS und MAX_LEGS_PER_HOP, einmal erzeugt und vom Router, vom Quoter und vom Solver gelesen, und der Router lehnt alles Breitere oder Tiefere mit RouterE(3) ab.

Русский — Маршрут содержит не более двух хопов, каждый разделён не более чем на пять параллельных ног, так что ни один маршрут не несёт больше десяти ног. Граница — произведение MAX_HOPS и MAX_LEGS_PER_HOP, заданное один раз и читаемое Router, Quoter и Solver, а Router отклоняет всё более широкое или глубокое с RouterE(3).

Türkçe — Bir rota en fazla iki hop içerir, her hop en fazla beş paralel bacağa bölünür; dolayısıyla hiçbir rota ondan fazla bacak taşımaz. Sınır, MAX_HOPS ile MAX_LEGS_PER_HOP'un çarpımıdır, bir kez üretilir ve Router, Quoter ile Solver tarafından okunur; Router daha geniş ya da daha derin her şeyi RouterE(3) ile reddeder.

العربية — للمسار على الأكثر قفزتان، وكل قفزة تُقسَّم على خمسة مسارات متوازية على الأكثر، فلا يحمل أي مسار أكثر من عشرة مسارات. الحد هو حاصل ضرب MAX_HOPS في MAX_LEGS_PER_HOP، يُنتَج مرة واحدة ويقرؤه الـ Router والـ Quoter والـ Solver، ويرفض الـ Router كل ما هو أعرض أو أعمق بـ RouterE(3).

हिन्दी — एक रूट में अधिकतम दो hop होते हैं, हर hop अधिकतम पाँच समानांतर लेग में बँटता है, इसलिए किसी रूट में दस से अधिक लेग नहीं होते। यह सीमा MAX_HOPS और MAX_LEGS_PER_HOP का गुणनफल है, जो एक बार बनता है और Router, Quoter तथा Solver पढ़ते हैं, और Router इससे चौड़े या गहरे हर रूट को RouterE(3) से अस्वीकार करता है।

日本語 — ルートは最大 2 ホップで、各ホップは最大 5 本の並列の脚に分割されるため、どのルートも 10 本を超える脚を持ちません。この上限は MAX_HOPS と MAX_LEGS_PER_HOP の積で、一度だけ生成され、Router、Quoter、Solver が読み取ります。Router はそれより広い、または深いものを RouterE(3) で拒否します。

中文 — 一条路由最多有两跳,每一跳最多拆成五条并行的腿,因此任何路由都不会超过十条腿。这个上限是 MAX_HOPS 与 MAX_LEGS_PER_HOP 的乘积,只产生一次,由 Router、Quoter 和 Solver 读取,Router 会以 RouterE(3) 拒绝任何更宽或更深的路由。

한국어 — 경로는 최대 2홉이고 각 홉은 최대 5개의 병렬 레그로 나뉘므로, 어떤 경로도 10개를 넘는 레그를 갖지 않습니다. 이 한도는 MAX_HOPS와 MAX_LEGS_PER_HOP의 곱으로, 한 번만 생성되어 Router, Quoter, Solver가 읽으며, Router는 더 넓거나 깊은 것을 RouterE(3)로 거부합니다.

Bahasa Indonesia — Sebuah rute memiliki paling banyak dua hop, tiap hop dibagi ke paling banyak lima leg paralel, sehingga tidak ada rute yang membawa lebih dari sepuluh leg. Batasnya adalah perkalian MAX_HOPS dan MAX_LEGS_PER_HOP, dibuat sekali dan dibaca oleh Router, Quoter, dan Solver, dan Router menolak apa pun yang lebih lebar atau lebih dalam dengan RouterE(3).

বাংলা — একটি রুটে সর্বোচ্চ দুটি hop থাকে, প্রতিটি hop সর্বোচ্চ পাঁচটি সমান্তরাল লেগে ভাগ হয়, তাই কোনো রুটে দশটির বেশি লেগ থাকে না। সীমাটি MAX_HOPS ও MAX_LEGS_PER_HOP-এর গুণফল, একবার তৈরি হয় এবং Router, Quoter ও Solver তা পড়ে; এর চেয়ে চওড়া বা গভীর যা-ই হোক, Router তা RouterE(3) দিয়ে প্রত্যাখ্যান করে।

Filipino — May hanggang dalawang hop ang isang ruta, na bawat isa ay hinahati sa hanggang limang parallel na leg, kaya walang rutang may higit sa sampung leg. Ang hangganan ay ang produkto ng MAX_HOPS at MAX_LEGS_PER_HOP, nililikha nang isang beses at binabasa ng Router, ng Quoter at ng Solver, at tinatanggihan ng Router ang anumang mas malapad o mas malalim sa pamamagitan ng RouterE(3).

Short answer: a route has at most two hops, and each hop splits across at most five parallel legs, so no route carries more than ten legs. The Router refuses anything wider or deeper with `RouterE(3)` at every door, and the Solver never builds a shape the Router would refuse.

The interesting part is the bound itself. It is the product of `MAX_HOPS` and `MAX_LEGS_PER_HOP` and nothing else. No code needs a route-wide leg count, so there is no third constant that could drift away from the other two.

Four topologies, judged by output

The Solver builds four topologies and returns the maximiser. One is a direct route in one hop. The other three are bridge routes, each through one intermediate token (`tIn`, then a bridge, then `tOut`), so `TOPOLOGIES = 1 + BRIDGE_SLOTS = 4`. Bridges come from an operator-configured set of at most three tokens in the Hub, and `BRIDGE_SLOTS = 3` is the Hub's own maximum.

The topologies are judged in order and a tie keeps the earlier one. A bridge topology only adds a candidate to the judgement: a direct route still wins whenever it delivers more, because the comparison is by the output built and not by the depth of the topology.

ConstantValueMeaning
MAX_HOPS2Deepest shape the Solver builds and the Router accepts
MAX_LEGS_PER_HOP5Parallel legs in one hop
Legs per route10MAX_HOPS x MAX_LEGS_PER_HOP
BRIDGE_SLOTS3Bridge tokens the Solver expands (the Hub's MAX_BRIDGES)
TOPOLOGIES4The direct route plus one per bridge slot
MAX_ROUTE_IMPACT_BPS9,000A route whose measured impact exceeds this is not returned

Source: FACTOS section 2; whitepaper 2.4, sections 10.1 and 11.1 and invariant INV-18 (commit 969bcc6).

One producer, three readers

`MAX_LEGS_PER_HOP = 5` lives in the Core and is read three ways. It is the Router's ceiling, where `RouterE(3)` refuses a wider hop. It is the Quoter's test for whether a plan is executable. And it is the Solver's leg budget for every topology. Because all three read one constant, the Solver never proposes a hop the Router refuses and never stops a leg short of one the Router takes.

The invariant is written down as INV-18: no hop carries more than five legs and no route more than two hops, so no route carries more than ten legs. A pair with no admissible route refuses with `SolverE(5)` rather than fabricating one.

What a hop and a leg cost

The shape limit is tied to measured gas. The whitepaper's gas table, taken at commit 969bcc6, reports the marginal cost of one more leg and of one more hop from isolated transaction measurements.

  1. A split adds legs only while the improvement clears the split gate (see measuring-beats-recomputing).
  2. A bridge adds a hop only when its measured total output beats the direct route.
  3. At the ceiling, the Router refuses the route outright with `RouterE(3)`.
MeasurementGasDerived from
One more leg (V2)73,955one leg 200,835; two legs 274,790
One more hop (V2)125,666one hop 200,880; two hops 326,546

Source: Whitepaper 2.4, section 17.4 (the 2026-11-16 column, measured at commit 969bcc6).

What this does not claim

It does not say ten legs is the best number, only that it is the number the three contracts share and the one the tests pin. It does not say a bridge route is ever better than a direct one: the measured output decides, trade by trade.

Do not trust this page — reproduce it

Every claim above is checkable against the chain. Start here:

sed -n '136p;139,149p' src/BlazePhoenixCore.sol   # MAX_HOPS and MAX_LEGS_PER_HOP, and sed -n '107,114p' src/BlazePhoenixSolver.sol for TOPOLOGIES, at commit 969bcc6 in a checkout of the V2 repository. Arithmetic: 274,790 - 200,835 = 73,955 and 326,546 - 200,880 = 125,666. Reading: invariant INV-18 and section 10.1 of the 2.4 whitepaper.
Cite this article

Licensed CC BY-NC-ND 4.0: quote and cite it with attribution and a link. Commercial use and derivative versions need written permission from BlazePhoenix; translations are made by BlazePhoenix. Copy a ready-made citation:

BlazePhoenix (2026). Two hops, five legs: the largest route shape, and why the bound is a product. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/two-hops-five-legs/
@misc{blazephoenix_two_hops_five_legs,
  title  = {Two hops, five legs: the largest route shape, and why the bound is a product},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/two-hops-five-legs/},
  note   = {Accessed: reproduce the claim with the command above}
}

Writing an answer, a wiki entry or a paper? The claim above is reproducible against the chain before you quote it — which is the only sound basis for citing a technical source at all.

Contracts are verified on every chain we deploy to — addresses in the protocol manifest. Deeper formal treatment: the whitepaper (PDF).

Related engineering

Next in Execution semantics · 3 / 7
Rounding and the round trip: every rounding step is chosen to understate, never to promise ›Quotes and payouts round down; protective floors and the fee round up. The direction is fixed by one rule, and a metamorphic test checks that going in and straight back never returns more than went in.7 min

Questions, a partnership or a bug to report? Contact us or email contact@blazephoenix.xyz

Go to APP