Connect
Cover: The authentic callback: the Router checks a committed pool, not a derived address

The authentic callback: the Router checks a committed pool, not a derived address

When a pool calls back asking for payment, how does the Router know it is the right pool?

A V3-shaped pool asks to be paid from inside its own swap. The Router answers only to the pool it committed to just before the call, only up to the leg's input, and only once. CREATE2 belongs to discovery, not to this check.

Known formally as Callback authentication by a committed pool in transient storage in the BlazePhoenix whitepaper.

BlazePhoenix Engineering · article updated 2026-11-16 · site dataset through 2026-11-19 · 8 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 — The Router authenticates a callback by remembering who it called: before pool.swap it commits the pool, the token and the maximum payment in transient storage, and the callback must come from that pool, within that maximum, once. The check uses a committed address, not a CREATE2-derived one.

Português — O Router autentica um callback lembrando-se de quem chamou: antes de pool.swap regista a pool, o token e o pagamento máximo em transient storage, e o callback tem de vir dessa pool, dentro desse máximo, uma só vez. A verificação usa um endereço comprometido, não um derivado por CREATE2.

Español — El Router autentica un callback recordando a quién llamó: antes de pool.swap registra el pool, el token y el pago máximo en transient storage, y el callback debe venir de ese pool, dentro de ese máximo, una sola vez. La comprobación usa una dirección comprometida, no una derivada con CREATE2.

Français — Le Router authentifie un callback en se souvenant de qui il a appelé : avant pool.swap, il inscrit le pool, le token et le paiement maximal dans le transient storage, et le callback doit venir de ce pool, dans ce maximum, une seule fois. Le contrôle utilise une adresse engagée, pas une adresse dérivée par CREATE2.

Deutsch — Der Router authentifiziert einen Callback, indem er sich merkt, wen er aufgerufen hat: Vor pool.swap schreibt er den Pool, den Token und die maximale Zahlung in den Transient Storage, und der Callback muss von diesem Pool kommen, innerhalb dieses Maximums, genau einmal. Die Prüfung nutzt eine festgelegte Adresse, keine per CREATE2 abgeleitete.

Русский — Router аутентифицирует callback, запоминая, кого он вызвал: перед pool.swap он записывает в transient storage пул, токен и максимальный платёж, а callback должен прийти от этого пула, в пределах этого максимума, один раз. Проверка использует зафиксированный адрес, а не выведенный через CREATE2.

Türkçe — Router, bir callback'i kimi çağırdığını hatırlayarak doğrular: pool.swap öncesinde havuzu, token'ı ve azami ödemeyi transient storage'a yazar; callback o havuzdan, o azami tutarın içinde ve yalnızca bir kez gelmelidir. Kontrol CREATE2 ile türetilmiş bir adres değil, taahhüt edilmiş bir adres kullanır.

العربية — يوثّق الـ Router الـ callback بتذكّر من استدعاه: قبل pool.swap يسجّل المجمّع والتوكن وأقصى دفعة في الـ transient storage، ويجب أن يأتي الـ callback من ذلك المجمّع، ضمن ذلك الحد الأقصى، مرة واحدة. يعتمد الفحص على عنوان مُلتزَم به وليس عنوانًا مشتقًّا بـ CREATE2.

हिन्दी — Router किसी callback को इस याद से प्रमाणित करता है कि उसने किसे कॉल किया था: pool.swap से पहले वह पूल, टोकन और अधिकतम भुगतान को transient storage में दर्ज करता है, और callback उसी पूल से, उसी अधिकतम सीमा के भीतर, एक ही बार आना चाहिए। जाँच प्रतिबद्ध पते का उपयोग करती है, CREATE2 से निकाले गए पते का नहीं।

日本語 — Router は、誰を呼んだかを覚えておくことでコールバックを認証します。pool.swap の前にプール、トークン、最大支払額を transient storage に書き込み、コールバックはそのプールから、その最大額の範囲内で、一度だけ来なければなりません。検証に使うのは CREATE2 で導出したアドレスではなく、コミットしたアドレスです。

中文 — Router 通过记住自己调用了谁来认证回调:在 pool.swap 之前,它把池子、代币和最大支付额写入 transient storage,回调必须来自该池子、不超过该最大值,且只能一次。该检查使用已承诺的地址,而不是通过 CREATE2 推导出的地址。

한국어 — Router는 자신이 누구를 호출했는지 기억하는 방식으로 콜백을 인증합니다. pool.swap 전에 풀, 토큰, 최대 지불액을 transient storage에 기록하고, 콜백은 그 풀에서, 그 최대치 이내로, 단 한 번만 와야 합니다. 검사에는 CREATE2로 유도한 주소가 아니라 확약된 주소를 씁니다.

Bahasa Indonesia — Router mengotentikasi callback dengan mengingat siapa yang dipanggilnya: sebelum pool.swap ia mencatat pool, token, dan pembayaran maksimum di transient storage, dan callback harus datang dari pool itu, dalam batas maksimum itu, satu kali. Pemeriksaannya memakai alamat yang telah dikomit, bukan alamat turunan CREATE2.

বাংলা — Router কাকে কল করেছিল তা মনে রেখে callback যাচাই করে: pool.swap-এর আগে সে পুল, টোকেন ও সর্বোচ্চ পেমেন্ট transient storage-এ লিখে রাখে, এবং callback অবশ্যই সেই পুল থেকে, সেই সর্বোচ্চ সীমার মধ্যে, মাত্র একবার আসতে হবে। যাচাইয়ে প্রতিশ্রুত ঠিকানা ব্যবহৃত হয়, CREATE2 থেকে নির্ণীত ঠিকানা নয়।

Filipino — Pinapatotohanan ng Router ang callback sa pamamagitan ng pag-alala kung sino ang tinawag nito: bago ang pool.swap, itinatala nito ang pool, ang token at ang pinakamataas na bayad sa transient storage, at ang callback ay dapat magmula sa pool na iyon, sa loob ng maximum na iyon, nang isang beses lamang. Gumagamit ang pagsusuri ng committed na address, hindi ng hinango sa CREATE2.

Short answer: the Router remembers who it called. Just before it calls `pool.swap`, it writes the pool, the token it will be paid in and the most it may be paid into transient storage. When a callback arrives, the caller must be that pool, the amount must not exceed that maximum, and the record is erased before any payment moves. The authentication is a committed address, not a derived one.

This is section 26.3 of the 2.4 whitepaper. The Router does not recompute the pool address with CREATE2 at this point, and the difference matters for what the guard can and cannot be fooled by.

What happens inside one leg

A V3-shaped venue (V3, Algebra, and a Gate wrapper, which speaks the same swap and callback ABI) asks to be paid from inside its own `swap`. The Router answers in a `fallback()` that accepts any selector, as long as the calldata holds at least 4 + 64 bytes, and hands the two words to the callback handler.

  1. Before `pool.swap`, the Router writes three transient values: the pool of this leg, the token it will be paid in, and the most it may be paid, which is the leg's input.
  2. In the callback it requires `msg.sender == expected` and `expected != 0`. Otherwise it reverts with `RouterE(6)`.
  3. It takes the amount owed from the callback and refuses zero, and anything above the committed maximum, with `RouterE(8)`.
  4. It clears all three values before it pays. A pool that re-enters the callback reads `expected == 0` the second time and reverts with `RouterE(6)`.
  5. After `pool.swap` returns, the three slots are cleared again. A pool slot still set means no callback ran, and the leg's input is counted as zero, never as paid.

What bounds a fake pool

An impostor that calls the Router while a swap is in flight is not the committed pool, so it reverts at the sender check. A real pool that lies about what it is owed is stopped by the committed maximum: a callback can never take more than this leg's input. A pool that calls back twice meets an erased record.

Behind those sit two measurements. The Router checks that the pool received what the callback paid, and refuses a fee-on-transfer input with `RouterE(13)`. And the per-leg floor requires the leg to deliver at least 80 % of its bound whenever it has one, or the whole swap reverts with `RouterE(5)`.

Attack shapeWhat stops itError
A different contract asks to be paid mid-swapSender is not the committed poolRouterE(6)
Callback re-entered by the poolRecord cleared before paying; second read is zeroRouterE(6)
Callback asks for zero or more than the leg's inputCommitted maximumRouterE(8)
Pool never calls backSlot still set after the swap; input counted as unpaidnone, leg counts as zero
Input token delivers short on transferMeasured receipt by the poolRouterE(13)

Source: Whitepaper 2.4, section 26.3 and section 11.3.

Where CREATE2 does belong

The derivation lives where a pool is discovered and attested, in the Hub and the Core, and the Router never calls it. The mechanism is CREATE2: a contract's address is a pure function of its deployer, a salt and the hash of its init code. The preimage is 1 + 20 + 32 + 32 = 85 bytes, and the pool is the last twenty bytes of the keccak256 of it. The Core spells that out exactly once, in `create2Address`, so the live derivation and the attested one cannot drift apart.

The Hub also holds the invariant that no address without runtime bytecode enters a route. The split of duties is deliberate: discovery asks which address a pool should have, and execution asks which pool it just called.

The guard has tests that can fail

Three tests keep it honest. `CallbackAuthImpostorDrain` has a swap in flight while a different contract asks to be paid, and the assertion is the impostor's balance. `V3ContextDiesWithTheSwap` checks that the context is cleared when a pool returns without calling back. `FallbackCalldataLengthGate` covers the minimum calldata length. For the first two, their headers state the mutant each one kills: deleting the sender check, and deleting the clear after the swap.

Do not trust this page — reproduce it

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

grep -n 'create2Address\|deriveAddress' src/BlazePhoenixRouter.sol   # prints nothing at commit 969bcc6, in a checkout of the V2 repository. The three tests are test/CallbackAuthImpostorDrain.t.sol, test/V3ContextDiesWithTheSwap.t.sol and test/FallbackCalldataLengthGate.t.sol. For the discovery side, recompute a pool address with cast keccak over 0xff, the origin, the salt and the init code hash, and keep the last 20 bytes. Reading: sections 26.3 and 7.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). The authentic callback: the Router checks a committed pool, not a derived address. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/the-authentic-callback/
@misc{blazephoenix_the_authentic_callback,
  title  = {The authentic callback: the Router checks a committed pool, not a derived address},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/the-authentic-callback/},
  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 Adversarial robustness · 3 / 5
Hostile venues and the sandwich curve: ten pathologies, two doors, and the attacker’s side of the floor ›Ten venue pathologies crossed with two doors settle or refuse with a selector of ours — 20 of 20, no third outcome. Then the floor from the attacker’s side: on a 1 %-of-depth trade a sandwich takes about 2.7 % of the trade at most, the floor refuses beyond about 3 % of manipulation.6 min

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

Go to APP