Connect
Cover: Monotonicity against the caller: when a contract may accept your number

Monotonicity against the caller: when a contract may accept your number

When can a contract accept a number computed off-chain without trusting whoever sent it?

The third exit for a number a contract cannot measure: accept it where a false value can only hurt the sender. The rule, the settlement floor it governs, and how to check it.

Known formally as Monotonicity against the caller 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 contract may accept a number from its caller when a false value can only hurt the sender: whatever is passed, what the protocol gives everyone else stays at or above the level it would have with no caller input. The settlement floor is the concrete case, because the Router delivers at least max(F, m), so no choice of m lowers the protocol floor F.

Português — Um contrato pode aceitar um número do seu chamador quando um valor falso só pode prejudicar quem o enviou: qualquer que seja o valor passado, aquilo que o protocolo dá a todos os outros fica igual ou acima do nível que teria sem qualquer entrada do chamador. O piso de liquidação é o caso concreto, porque o Router entrega pelo menos max(F, m), pelo que nenhuma escolha de m baixa o piso do protocolo F.

Español — Un contrato puede aceptar un número de su llamante cuando un valor falso solo puede perjudicar a quien lo envía: sea cual sea el valor pasado, lo que el protocolo da a todos los demás se mantiene igual o por encima del nivel que tendría sin ninguna entrada del llamante. El suelo de liquidación es el caso concreto, porque el Router entrega al menos max(F, m), así que ninguna elección de m baja el suelo del protocolo F.

Français — Un contrat peut accepter un nombre venant de son appelant lorsqu'une fausse valeur ne peut nuire qu'à celui qui l'envoie : quelle que soit la valeur passée, ce que le protocole offre à tous les autres reste au moins au niveau qu'il aurait sans aucune entrée de l'appelant. Le plancher de règlement en est le cas concret, car le Router livre au moins max(F, m) ; aucun choix de m n'abaisse donc le plancher du protocole F.

Deutsch — Ein Vertrag darf eine Zahl von seinem Aufrufer annehmen, wenn ein falscher Wert nur dem Absender schaden kann: Welcher Wert auch übergeben wird, das, was das Protokoll allen anderen bietet, bleibt auf oder über dem Niveau, das ohne jede Eingabe des Aufrufers gelten würde. Der Settlement-Floor ist der konkrete Fall, denn der Router liefert mindestens max(F, m); keine Wahl von m senkt also den Protokoll-Floor F.

Русский — Контракт может принять число от вызывающего, если ложное значение может навредить только отправителю: какое бы значение ни передали, то, что протокол даёт всем остальным, остаётся не ниже уровня, который был бы вообще без ввода от вызывающего. Конкретный случай — нижняя граница расчёта: Router поставляет не меньше max(F, m), поэтому никакой выбор m не снижает нижнюю границу протокола F.

Türkçe — Bir kontrat, yanlış bir değer yalnızca göndereni zarara uğratabiliyorsa, çağıranından gelen bir sayıyı kabul edebilir: hangi değer geçirilirse geçirilsin, protokolün diğer herkese verdiği, çağıranın hiçbir girdisi olmasaydı sahip olacağı seviyenin altına inmez. Somut örnek uzlaşma tabanıdır, çünkü Router en az max(F, m) teslim eder; bu yüzden hiçbir m seçimi protokol tabanı F'yi düşüremez.

العربية — يجوز للعقد أن يقبل رقمًا من المستدعي حين لا تضر القيمة الكاذبة إلا مُرسِلها: أيًّا كانت القيمة الممررة، يبقى ما يقدمه البروتوكول لكل الآخرين عند المستوى الذي كان سيكون عليه دون أي مدخل من المستدعي أو فوقه. وأرضية التسوية هي الحالة الملموسة، لأن الـ Router يسلّم على الأقل max(F, m)، فلا يخفض أي اختيار لـ m أرضية البروتوكول F.

हिन्दी — कॉन्ट्रैक्ट अपने कॉलर से कोई संख्या तब स्वीकार कर सकता है जब ग़लत मान केवल भेजने वाले को नुक़सान पहुँचा सके: कोई भी मान दिया जाए, प्रोटोकॉल बाक़ी सबको जो देता है वह उस स्तर पर या उससे ऊपर रहता है जो कॉलर के किसी इनपुट के बिना होता। सेटलमेंट फ़्लोर इसका ठोस उदाहरण है, क्योंकि Router कम से कम max(F, m) देता है, इसलिए m का कोई भी चुनाव प्रोटोकॉल फ़्लोर F को नहीं घटाता।

日本語 — コントラクトは、偽の値が送信者自身にしか害を及ぼせないとき、呼び出し元からの数値を受け入れてよい。どの値が渡されても、プロトコルが他のすべての人に提供するものは、呼び出し元の入力がまったくない場合の水準以上に保たれる。具体例が決済フロアで、Router は少なくとも max(F, m) を届けるため、どの m を選んでもプロトコルフロア F は下がらない。

中文 — 当虚假的值只会伤害发送者自己时,合约就可以接受调用者传入的数字:无论传入什么值,协议为其他所有人提供的结果,始终不低于调用者完全没有输入时的水平。结算下限就是具体的例子,因为 Router 至少交付 max(F, m),所以无论怎么选 m,都不会拉低协议下限 F。

한국어 — 거짓 값이 전달한 쪽에만 해를 끼칠 수 있다면, 컨트랙트는 호출자가 보낸 숫자를 받아들여도 됩니다. 어떤 값이 전달되든 프로토콜이 다른 모든 사람에게 제공하는 수준은 호출자 입력이 전혀 없을 때의 수준 이상으로 유지됩니다. 구체적인 사례가 정산 하한입니다. Router는 최소한 max(F, m)을 전달하므로 어떤 m을 고르더라도 프로토콜 하한 F는 낮아지지 않습니다.

Bahasa Indonesia — Sebuah kontrak boleh menerima angka dari pemanggilnya ketika nilai palsu hanya bisa merugikan pengirimnya: apa pun nilai yang diberikan, apa yang diberikan protokol kepada semua orang lain tetap berada pada atau di atas tingkat yang berlaku tanpa masukan apa pun dari pemanggil. Batas bawah penyelesaian adalah kasus konkretnya, karena Router mengirimkan setidaknya max(F, m), sehingga pilihan m apa pun tidak menurunkan batas bawah protokol F.

বাংলা — কন্ট্র্যাক্ট তার কলারের কাছ থেকে একটি সংখ্যা গ্রহণ করতে পারে, যখন ভুল মান কেবল প্রেরকেরই ক্ষতি করতে পারে: যে মানই দেওয়া হোক, প্রোটোকল অন্য সবাইকে যা দেয় তা কলারের কোনো ইনপুট না থাকলে যে স্তরে থাকত, তার সমান বা উপরে থাকে। সেটেলমেন্ট ফ্লোর এর বাস্তব উদাহরণ, কারণ Router অন্তত max(F, m) পৌঁছে দেয়, তাই m-এর কোনো পছন্দই প্রোটোকল ফ্লোর F কমাতে পারে না।

Filipino — Maaaring tumanggap ang isang contract ng numero mula sa caller nito kapag ang maling halaga ay makakasakit lamang sa nagpadala: anuman ang ipasa, ang ibinibigay ng protocol sa lahat ng iba ay nananatili sa o higit sa antas na mayroon ito kung walang anumang input mula sa caller. Ang settlement floor ang kongkretong halimbawa, dahil nagde-deliver ang Router ng hindi bababa sa max(F, m), kaya walang pagpili ng m na magpapababa sa protocol floor F.

The short answer

A contract may accept a number from its caller when the function that consumes it is monotone against the caller. Whatever value is passed, the guarantee the protocol gives everyone else stays at or above the level it would have with no caller input at all, and a false value can only move the outcome against the party who supplied it.

When that holds, the number can be computed anywhere (in an interface, in a script, by an agent) and no trust moves with it, because the contract never relies on the computation being honest.

Where the rule sits: three exits for a number you cannot measure

Some numbers enter a router from a caller and cannot be measured by the contract: the minimum the caller will accept, the scale the caller declares, the route the caller proposes. The BlazePhoenix whitepaper (section 2.4) allows exactly three exits for such a number, tried in this order.

ExitWhat the contract doesExample in the DEXWhitepaper
Measure itReads the quantity from the pool, a balance delta or a derivation, and discards the claimThe post-pull balance is measured instead of trusting the nominal amountsection 2.3
Re-home itMoves the quantity to a source the caller cannot write: an immutable constant, a value sealed at construction, or a record only protocol code can updateThe floors, the arming delay of the Gate and the registry capssection 2.4
Make lying costlyAccepts the number, and shapes the consuming function so a false value can only hurt the senderThe caller's own minimum, against the protocol floorsection 2.4

Source: BlazePhoenix whitepaper 2.4, sections 2.3 and 2.4

The condition, stated once

Let c be a value the caller passes and C the set of values the caller is able to pass. Let G(c) be the guarantee the protocol makes to everyone else when c is passed, and G0 the guarantee that holds with no caller input at all. The function is monotone against the caller when:

G(c) >= G0   for every c in C
(and the caller's choice can only move the outcome toward the caller's own loss)

The settlement floor is the concrete case

The Router delivers at least max(F, m). F is the protocol floor, computed from quantities the Router measured during the swap. m is the caller's userMinOut. Since max(F, m) is at least F for every m, no choice of m lowers the protocol floor. Since max(F, m) never decreases as m grows, a larger m only adds a revert condition the caller imposed on its own trade, and a smaller m falls back to F.

A caller who lies about m therefore moves only its own result. The repository states the two halves as two invariants: invariant_DeliveredNeverBelowTheProtocolFloor and invariant_DeliveredNeverBelowUserMinOut.

What the caller passes as the minimumWhat happensWhy it is safe for everyone else
Below the protocol floor FF binds; the delivered amount is still at least Fmax(F, m) is at least F
Above FThe swap reverts if the delivered amount is under mThe extra condition falls on the caller's own trade
ZeroRefused with RouterE(10) before a token moves, on every doorNo path settles without a minimum

Source: Whitepaper 2.4, sections 2 and 2.4; DEX at 969bcc6

The same shape inside a leg

The per-leg floor applies the rule to a second number, the quote a caller attests for each leg. Each leg must deliver at least 80 % (LEG_FLOOR_BPS) of a bound, and the bound is max(attested, floor(q * 5000 / 10000)), where q is the quote the Router measured in the same frame and 5000 is MIN_QUOTE_COVERAGE_BPS. Attesting zero does not switch the floor off: the bound falls back to half the in-frame quote. Attesting more never lowers it.

The operator is a maximum on purpose. On a floor, min(claimed, measured) with a deflated claim would return the deflated figure and relax the floor, which is the move the maximum closes.

Where the rule stops

Monotonicity does not remove the residual every router carries: state can move between signature and inclusion. That is why the minimum is mandatory and final, and why it is the one bound no interface can take from you; the contract honours whatever non-zero minimum it is handed (whitepaper section 3.2).

It is also the last exit, not the first. Measure where a measurement exists, re-home where a source the caller cannot write exists, and reach for monotonicity only when the number is the caller's by nature.

Check it yourself

  1. Check out the DEX repository at commit 969bcc6.
  2. Read the public guarantee lines in README.md, lines 246 to 254: the delivered amount is at least the larger of the protocol floor and userMinOut.
  3. Open test/BlazePhoenixRouter.invariant.t.sol and find the two invariants named above (lines 441 and 462).
  4. Run that file and read which invariants ran: forge test --match-path test/BlazePhoenixRouter.invariant.t.sol.
  5. Read the floor constants in src/BlazePhoenixCore.sol, lines 400 to 408, including MIN_QUOTE_COVERAGE_BPS.

Do not trust this page — reproduce it

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

In a clean checkout of Blaze-Phoenix-Dex at 969bcc6: awk 'NR>=246 && NR<=254' README.md; git grep -n "invariant_DeliveredNeverBelow" -- test/BlazePhoenixRouter.invariant.t.sol (lines 441 and 462); sed -n 400,408p src/BlazePhoenixCore.sol; forge test --match-path test/BlazePhoenixRouter.invariant.t.sol. Whitepaper 2.4: section 2.4 (the derivation) and section 11.3 (the per-leg bound).
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). Monotonicity against the caller: when a contract may accept your number. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/monotonicity-against-the-caller/
@misc{blazephoenix_monotonicity_against_the_caller,
  title  = {Monotonicity against the caller: when a contract may accept your number},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/monotonicity-against-the-caller/},
  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 · 1 / 7
Measuring beats recomputing: the inequality that opens a leg, and the one gate it needs ›A leg opens only while its marginal output exceeds its marginal cost, using quantities measured at the point of the split. The single numeric gate is priced from a measured break-even, not tuned.8 min

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

Go to APP