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

> Canonical: https://blazephoenix.xyz/learn/monotonicity-against-the-caller/
> License: CC BY-NC-ND 4.0 (attribution + link) · © 2026 BlazePhoenix
> Updated: 2026-11-16

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.

## 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.

## 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.

## 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



**Verify it yourself:** 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).

Related: https://blazephoenix.xyz/learn/minimum-output-explained/ · https://blazephoenix.xyz/learn/two-entry-points-calldata-trust/ · https://blazephoenix.xyz/learn/iron-floor/ · https://blazephoenix.xyz/learn/claimed-versus-measured/
