Connect
Cover: The two entry points, contrasted by what each trusts from calldata

The two entry points, contrasted by what each trusts from calldata

How do the two entry points differ in what they trust from calldata?

One entry point accepts a complete route as an argument; the other accepts six scalars and solves. They share every line of the execution core and differ in one thing — the size of the trusted surface — and the same shared line can behave differently depending on which path reached it.

Known formally as The two entry points in the BlazePhoenix whitepaper.

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

At a glance
LevelAdvanced
Formal nameThe two entry points
Reading time11 min
Sections7
Updated2026-08-13

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

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

English — The protocol's two swap entry points share every line of the execution core and differ in one thing that matters — the trusted surface: the calldata path accepts a complete route (pools, kinds, params, splits used as given, though balances, re-quotes and the floor are still derived in-frame), while the solving path takes six scalars and computes the route in the same transaction, collapsing the trusted surface to quantities derived from public state — the contract calling itself externally to convert memory to calldata.

Português — Os dois pontos de entrada de swap do protocolo partilham cada linha do núcleo de execução e diferem numa só coisa que importa — a superfície confiada: o caminho de calldata aceita uma rota completa (pools, tipos, parâmetros, divisões usados tal como vêm, embora saldos, recotações e o piso ainda sejam derivados no frame), enquanto o caminho que resolve recebe seis escalares e computa a rota na mesma transação, colapsando a superfície confiada em quantidades derivadas de estado público — com o contrato a chamar-se externamente para converter memória em calldata.

Español — Los dos puntos de entrada de swap del protocolo comparten cada línea del núcleo de ejecución y difieren en una sola cosa que importa — la superficie confiada: el camino de calldata acepta una ruta completa (pools, tipos, parámetros, divisiones usados tal como vienen, aunque saldos, recotizaciones y el suelo se derivan igualmente en el frame), mientras que el camino que resuelve toma seis escalares y computa la ruta en la misma transacción, colapsando la superficie confiada a cantidades derivadas de estado público — con el contrato llamándose externamente para convertir memoria en calldata.

Français — Les deux points d'entrée de swap du protocole partagent chaque ligne du cœur d'exécution et diffèrent en une seule chose qui compte — la surface de confiance : le chemin calldata accepte une route complète (pools, sortes, paramètres, répartitions pris tels quels, même si soldes, re-devis et plancher restent dérivés dans le frame), tandis que le chemin résolvant prend six scalaires et calcule la route dans la même transaction, réduisant la surface de confiance à des quantités dérivées de l'état public — le contrat s'appelant lui-même en externe pour convertir la mémoire en calldata.

Deutsch — Die zwei Swap-Einstiegspunkte des Protokolls teilen jede Zeile des Ausführungskerns und unterscheiden sich in dem einen, was zählt — der vertrauten Oberfläche: Der Calldata-Pfad akzeptiert eine komplette Route (Pools, Arten, Parameter, Splits wie geliefert, wobei Salden, Re-Quotes und der Boden weiterhin im Frame hergeleitet werden), während der lösende Pfad sechs Skalare nimmt und die Route in derselben Transaktion berechnet — die vertraute Oberfläche kollabiert auf aus öffentlichem Zustand hergeleitete Größen, wobei der Contract sich selbst extern aufruft, um Memory in Calldata zu wandeln.

Русский — Два входа для свопа в протоколе разделяют каждую строку исполняющего ядра и различаются в одном, что важно — в доверенной поверхности: путь calldata принимает готовый маршрут (пулы, виды, параметры, разбиения берутся как есть, хотя балансы, повторные котировки и порог всё равно выводятся во фрейме), тогда как решающий путь берёт шесть скаляров и вычисляет маршрут в той же транзакции, схлопывая доверенную поверхность до величин, выведенных из публичного состояния, — контракт внешне вызывает сам себя, превращая память в calldata.

Türkçe — Protokolün iki takas giriş noktası, yürütme çekirdeğinin her satırını paylaşır ve önemli olan tek şeyde ayrılır — güvenilen yüzey: calldata yolu tam bir rota kabul eder (havuzlar, türler, parametreler, bölüşümler verildiği gibi kullanılır; bakiyeler, yeniden kotasyonlar ve taban yine çerçeve içinde türetilir), çözen yol ise altı skaler alır ve rotayı aynı işlemde hesaplar; güvenilen yüzeyi kamu durumundan türetilen niceliklere indirger — sözleşme, belleği calldata'ya çevirmek için kendini dışarıdan çağırır.

العربية — مدخلا المبادلة في البروتوكول يتقاسمان كل سطر من نواة التنفيذ ويختلفان في الشيء الوحيد المهم — السطح الموثوق: مسار الـcalldata يقبل مساراً كاملاً (المجمّعات والأنواع والمعاملات والتقسيمات تُستخدم كما وردت، وإن ظلت الأرصدة وإعادة التسعير والأرضية تُشتق داخل الإطار)، بينما يأخذ مسار الحلّ ستة أعداد قياسية ويحسب المسار في المعاملة نفسها، فينهار السطح الموثوق إلى كميات مشتقة من الحالة العامة — والعقد يستدعي نفسه خارجياً لتحويل الذاكرة إلى calldata.

हिन्दी — प्रोटोकॉल के दोनों स्वैप प्रवेश-बिंदु निष्पादन-कोर की हर पंक्ति साझा करते हैं और उसी एक बात में भिन्न हैं जो मायने रखती है — विश्वस्त सतह: calldata पथ पूरी रूट स्वीकारता है (पूल, प्रकार, पैरामीटर, बँटवारे जस के तस लिए जाते हैं, यद्यपि बैलेंस, पुनः-कोट और फ़्लोर तब भी फ़्रेम में व्युत्पन्न होते हैं), जबकि हल करने वाला पथ छह अदिश लेकर उसी ट्रांज़ैक्शन में रूट की गणना करता है, विश्वस्त सतह को सार्वजनिक स्थिति से व्युत्पन्न राशियों में समेटते हुए — कॉन्ट्रैक्ट मेमोरी को calldata में बदलने के लिए स्वयं को बाहरी रूप से कॉल करता है।

日本語 — プロトコルの二つのスワップ入口は実行コアの全行を共有し、重要な一点——信頼される面——だけが異なります。calldata経路は完全なルート(プール、種類、パラメータ、分割は与えられたまま使われる。ただし残高、再見積もり、フロアは依然フレーム内で導出)を受け取ります。一方、解く経路は六つのスカラーを取り、同じトランザクション内でルートを計算し、信頼面を公開状態から導出された量へと畳み込みます。メモリをcalldataへ変換するため、コントラクトは自分自身を外部呼び出しします。

中文 — 协议的两个交换入口共享执行核心的每一行代码,只在一件要紧事上不同——受信面:calldata 路径接受一条完整路由(池、类型、参数、拆分照单全收,尽管余额、重新报价与下限仍在帧内推导),而求解路径只取六个标量并在同一笔交易中算出路由,把受信面收缩为由公开状态推导的量——合约通过外部调用自身把内存转换为 calldata。

한국어 — 프로토콜의 두 스왑 진입점은 실행 코어의 모든 줄을 공유하고, 중요한 단 한 가지 — 신뢰 표면 — 에서 다릅니다. calldata 경로는 완전한 경로를 받아들이며(풀, 종류, 파라미터, 분할은 주어진 대로 쓰이지만 잔액, 재견적, 하한은 여전히 프레임 안에서 도출됩니다), 해결 경로는 여섯 스칼라를 받아 같은 트랜잭션에서 경로를 계산해 신뢰 표면을 공개 상태에서 도출된 양들로 접어 넣습니다 — 컨트랙트는 메모리를 calldata로 바꾸기 위해 자신을 외부 호출합니다.

Bahasa Indonesia — Dua titik masuk swap milik protokol berbagi setiap baris inti eksekusi dan berbeda dalam satu hal yang penting — permukaan yang dipercaya: jalur calldata menerima rute lengkap (pool, jenis, parameter, pembagian dipakai apa adanya, meski saldo, kuotasi-ulang, dan lantai tetap diturunkan dalam bingkai), sementara jalur penyelesai mengambil enam skalar dan menghitung rute dalam transaksi yang sama, meruntuhkan permukaan yang dipercaya menjadi kuantitas yang diturunkan dari keadaan publik — kontrak memanggil dirinya sendiri secara eksternal untuk mengubah memori menjadi calldata.

বাংলা — প্রোটোকলের দুই সোয়াপ প্রবেশবিন্দু নির্বাহ-কোরের প্রতিটি লাইন ভাগ করে এবং গুরুত্বপূর্ণ একটিমাত্র বিষয়ে আলাদা — বিশ্বস্ত পৃষ্ঠ: calldata পথ একটি সম্পূর্ণ রুট গ্রহণ করে (পুল, জাত, প্যারামিটার, ভাগ যেমন এসেছে তেমনই ব্যবহৃত, যদিও ব্যালেন্স, পুনঃ-কোট ও ফ্লোর তবু ফ্রেমেই নিষ্পন্ন), আর সমাধানকারী পথ ছয়টি স্কেলার নিয়ে একই ট্রানজ্যাকশনে রুট গণনা করে, বিশ্বস্ত পৃষ্ঠকে সর্বজনীন অবস্থা থেকে নিষ্পন্ন রাশিতে গুটিয়ে আনে — মেমোরিকে calldata-য় বদলাতে কন্ট্রাক্ট নিজেকেই বাহ্যিকভাবে কল করে।

Filipino — Ang dalawang entry point ng swap ng protocol ay nagbabahagi ng bawat linya ng execution core at nagkakaiba sa iisang bagay na mahalaga — ang pinagkakatiwalaang surface: tumatanggap ang calldata path ng kumpletong ruta (mga pool, uri, parameter, hati na ginagamit nang kung ano ang ibinigay, bagaman ang mga balanse, muling pagkukuwenta at ang floor ay hinahango pa rin sa frame), habang ang solving path ay kumukuha ng anim na scalar at kinukuwenta ang ruta sa parehong transaksyon, iniuurong ang pinagkakatiwalaang surface sa mga daming hinango mula sa pampublikong estado — tinatawagan ng kontrata ang sarili nito nang panlabas upang gawing calldata ang memorya.

The protocol offers two ways to swap, and the difference between them is not convenience. It is how much of the answer the contract works out for itself, which is the same as asking how much of calldata it has to believe. Everything else about the routing architecture follows from that split, so it is worth stating precisely and in both directions.

A protocol that offered only the solving path would be charging every user for a guarantee many of them do not want. One that offered only the calldata path would have nothing to distinguish it from the off-chain-solved architecture it was built to answer. Offering both is the honest arrangement provided the difference is documented — which is what this article is for.

The calldata path: a complete route, trusted field by field

This path takes a complete route as an argument: the pools to use, the venue kinds, their parameters, and how the input is divided among them. The caller has solved the problem elsewhere and is asking the contract to carry it out. Three variants exist, differing only in how the input tokens arrive — a plain transfer, a signed permit, or native currency — and all three converge on the same execution core.

What the contract still does for itself on this path is what stops the arrangement from being blind obedience. It measures actual balance deltas rather than trusting declared amounts. It re-quotes each hop on-chain. It recomputes impact and derives its own output floor in-frame, anchored to a quote no caller supplies. And it rescales per hop when the amount that really arrived differs from the amount that was promised. The plan is trusted; the arithmetic is not.

The trusted surface is nonetheless large, and a reader deciding how much to trust an interface should start with the enumeration rather than with the reassurance. Used as given: the pool address that will be called, the expected output each leg is measured against, the venue kind and its parameters, the recipient, and the minimum. Everything in that list is an assumption about the caller.

The on-chain-solving path: six scalars

This path takes the two tokens, the amount, a minimum, a recipient and a deadline, and works out the route itself, calling the solver in the same frame before any tokens move. It then hands the resulting plan to the same execution core the other path uses. Everything in the trusted-surface list above collapses into quantities the contract derived from public state during the transaction.

That hand-off has an unusual shape and a later section depends on it. A route computed in memory cannot be passed directly to a function expecting calldata, so the contract calls itself externally, converting memory to calldata across the call boundary. The inner function is guarded to accept only calls originating from the contract itself. Both paths rejoin at that point and share every line of code from there on — though not every behaviour.

                        calldata path              solving path
route comes from        the caller                 the contract, in-frame
trusted from calldata   pools, kinds, params,      six scalars only
                        splits, expectations
freshness of the plan   as stale as the caller's   same block, same transaction
                        search
gas                     lower                      higher
verifiable by the user  only its outcome           its derivation as well

The same line, two behaviours: who the caller is

Sharing an execution core is usually described as a safety property, and mostly it is: one code path means one thing to audit. The exception is any line whose meaning depends on the calling frame, and there is at least one such line, which produced a real defect.

Inside the inner frame created by the self-call, the caller is the contract itself. The refund of unspent input — written, in the obvious way, as a transfer back to the caller — therefore becomes a transfer to the contract, and the user's change is stranded rather than returned, recoverable only through the administrative rescue path. The calldata path is unaffected, because there the caller is the user. Two paths that share every line do not share every behaviour when a shared line reads a value that differs between frames.

This was found while writing the architecture chapter. A fix exists — the payer is now passed explicitly rather than inferred from the calling frame — and at the time of writing it had not reached the published release. It is printed rather than held back because the alternative, publishing a paper that celebrates this entry point while knowing this, was not available to us.

The protections that are not protocol-wide

The believability band and the capacity clamp live inside the solver. A route assembled by hand and submitted through the calldata path receives neither. That is not a bug — the caller of that path has explicitly taken the routing decision on themselves — but it means those protections are properties of one entry point, and describing them as properties of the protocol would be a category error that shows up in exactly the place a user would be harmed by it.

The boundaries that can enforce nothing are exactly the boundaries that leak, and this is the second instance of that corollary in the codebase. The first is the read-only preview surface. Both are the same structural fact seen twice: a guarantee restated somewhere it is not computed drifts, because nothing fails when it does.

What both paths do share is the enforcement layer, and it is worth being exact about which properties survive on either. Both refuse a swap submitted with no minimum output, at every entry point, where the reference implementation the industry copies accepts zero and lets the trade proceed unprotected. Both derive the protocol floor in-frame and combine it with the caller's limit by a maximum, so a caller can tighten and never loosen. Both measure the recipient's balance change rather than trusting a venue's report. Both emit the quote, the realised amount and the applied floor.

Reentrancy, and two deliberate exceptions

Entry points that move value are guarded against reentrancy, and the guard is transient rather than stored, so it costs a fraction of the usual amount and cannot be left set by a failed transaction. Two places deliberately sit outside it, and both are the kind of exception that should be written down rather than discovered.

The internal hand-off between the solving entry point and the execution core is not guarded, because the outer call already holds the lock and a second guard would reject every legitimate route; it is instead restricted to calls originating from the contract itself. And the venue callbacks — which certain venue families require, since the pool calls back to collect its input — authenticate their caller and cap what may be pulled to the leg being executed.

The failure-signalling discipline is the same across both paths and is worth naming because it removes a whole class of second code path. Where an internal routine cannot produce an answer, it returns a value engineered to trip a guard the caller already has, rather than a plausible number that would pass unnoticed. The failure path reuses an existing check, so there is nothing new to get wrong.

How to choose, and what neither path fixes

Take the calldata path if you have your own solver, want the cheaper execution, and are prepared to own the routing decision including the believability filtering the solver would otherwise have done for you. Take the solving path if what you want is a route no operator produced and you are willing to pay for it in gas and in route quality.

Neither path fixes the thing that actually bounds a user's downside, and the article would be dishonest without the sentence. The minimum is supplied by the caller on both paths, and it is the quantity every other bound falls back to. A compromised front end does not need to break any bound: it proposes a minimum that is non-zero but terrible, which passes every check the contract can perform, because the contract cannot know what the user would have chosen. Choosing the solving path removes the operator from the routing decision and leaves them in the minimum-setting decision, which is where the larger exposure lives.

Do not trust this page — reproduce it

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

compare the two entry points' signatures on-chain: one takes a route structure, the other takes six scalars — the size of that difference is the size of the trusted surface, and it is readable from the ABI without trusting any description of it
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). The two entry points, contrasted by what each trusts from calldata. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/two-entry-points-calldata-trust/
@misc{blazephoenix_two_entry_points_calldata_trust,
  title  = {The two entry points, contrasted by what each trusts from calldata},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/two-entry-points-calldata-trust/},
  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 Architecture · 20 / 20
This was the last one in Architecture — back to the library ›

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

Go to APP