# BlazePhoenix-Dex Whitepaper v2.4.0 — part 3 of 9: Part II — The primitives > One part of the whitepaper in llms.txt form; every part and every section is listed in > https://blazephoenix.xyz/whitepaper/llms.txt. The parts are the full text, unabridged: the bodies of parts > 1-9, joined in order, are https://blazephoenix.xyz/whitepaper.md byte for byte (sha256 a47389f947e4aa6656f693004e43fbe3e0101dccaf133e49c303767811f223cc). > Cite as https://doi.org/10.5281/zenodo.24517342; numbering (§, E, INV-) as in the paper. ----- verbatim text of whitepaper.md follows ----- ## Part II — The primitives ## §4 The Eightfold Dispatcher Ω *Plain:* one function that knows how to price every kind of pool. *Precise:* `_quoteArms` in the Core is the quote dispatcher for the Solver and for the Quoter's preview. It is private; it is reached through two public doors. `universalQuoteRank(QuoteCtx, amountIn, bar, wantFee)` returns the expected output, a token-denominated depth for the split allocator, and the two figures a ranking may read (`rank`, `hi`); the Solver asks it at its own `bar`, the Quoter at the maximum, because the Quoter reads the output alone. `universalProbe` asks the same arms at `bar = 0` and returns what the Solver's price band needs: the vote's mass, the ranking figure, the fee that figure charged, and two error bounds (§9). A pool the dispatcher cannot price returns zero and is dropped before anything is sent. The Router evaluates the same Core primitives per leg in its own frame (`_hopScaleImpactAndQuote`), a sibling kept for gas and stack depth, and the Quoter's Exact Pass asks a different question again (§12); the three are recorded together in the repository's shared-quantity register, and their agreement is pinned by named tests rather than assumed (§15). The house name is kept from the eight-kind enumeration the dispatcher shipped with; the enumeration has since grown a ninth member and surrendered three to deliberate excision, so the numbers now run 0 to 9, with seven live kinds and three retired. The numbering keeps its gaps: a Monoslot recorded yesterday must decode identically for ever. ### §4.1 Seven kinds, five families, one attribute table | Kind | Constant | Family | Pricing branch | Θ attributes | Gas ladder (Solver) | |---|---|---|---|---|---| | 0 | `KIND_V2` | Constant product (Uniswap V2, Sushi, forks) | closed form `outV2` over `getReserves`, after the pair is shown to hold what it declares | reserves · pair-verifiable | 90,000 | | 1 | `KIND_V3` | Concentrated liquidity (Uniswap V3 and V3-shaped forks) | closed form `outV3` over `slot0` for ranking; the pool's own ticks walked for the promise (§4.2) | concentrated-at-pool · pair-verifiable | 110,000 | | 4 | `KIND_V4` | Uniswap V4 singleton | the pool's book walked through `extsload`, tick crossings included | concentrated-in-singleton | 180,000 | | 5 | `KIND_SOLIDLY` | Solidly (Aerodrome, Velodrome, forks), stable and volatile | ask the pool `getAmountOut`, less one wei; replicated curve as fallback | reserves · pair-verifiable | 90,000 | | 6 | `KIND_ALGEBRA` | Algebra (Camelot-class), dynamic fee | same branch as kind 1, fee measured from `globalState` | concentrated-at-pool · pair-verifiable | 110,000 | | 8 | `KIND_V4_NATIVE` | V4 pool holding the chain's native currency | same branch as kind 4 | concentrated-in-singleton | 215,000 | | 9 | `KIND_EXTERNAL` | Delegated: a Gate wrapper (§4.5) | identity first, then the wrapper's own `quote` through `gateQuote` | none, on purpose (Θ = `0x0`) | 90,000 (default) | Seven live kinds, five families: constant product {0}, concentrated {1, 6}, Solidly {5}, the V4 singleton {4, 8}, and the delegated wrapper {9}. The attribute column is not prose: it is the bit table `THETA_ATTR = 0x040A9400A9` in the Core, four bits per kind — *reads reserves*, *concentrated at the pool address*, *concentrated in the singleton*, *exposes `token0()`/`token1()`* — so every membership question in the five contracts that read it ("does this kind read reserves?") is one shift and one AND (`kindHas`, `kindHasAny`). A kind whose nibble is zero answers no to every such question and fails closed with no default branch for anyone to forget. The table is unchanged from the 2.3 paper, and kind 9 reads a zero nibble: [derived] reading the constant's ten nibbles from the low end gives 9, A, 0, 0, 4, 9, A, 0, 4, 0 for kinds 0 to 9, and a kind of 10 or more shifts past the 40 bits of the constant and reads zero. The gas column is a second table, `THETA_GAS = 0x2B0016122400001612`, read only by the Solver's `estGas`, one byte per kind in units of 5,000 gas, and a zero byte means the historical default of 90,000; kind 9 has no byte in the constant, so it takes that default. **Kind 9 is an identity, not an attribute.** A Gate wrapper speaks the V3 `swap` and `uniswapV3SwapCallback` ABI in front of a curated, code-pinned adapter, so the Router settles it through the same callback and the same measured delta as a V3 pool. But the Core has no reader for the venue's own state (no reserves, no `slot0`), so its Θ field is zero on purpose: no attribute question answers yes, and no code path can treat a wrapper as a V3 pool by accident. What replaces the attribute is the identity check `gateWrapperLive` — the wrapper must derive from the Hub's Gate row and the hop's own tokens and fee — and the price comes from one producer, `gateQuote`. The Hub admits kind 9 only as a `MODE_CREATE2_V3` factory row, and it sits outside `KINDS_EXECUTABLE`, the set the Hub's `recordSwap` accepts; the Router executes it by identity. Kind 8 is never registered by a factory at all: it derives from the singleton. **Kinds 2, 3 and 7 are absent by deliberate excision.** They were Curve stable (2), Balancer V2 (3) and Curve crypto (7), retired by the owner's decision of 2026-08-20. Almost no L2 carried them, and they cost bytecode in five contracts; with them went the Router's only token `approve`, the only depth figure attested by a caller instead of measured from a pool, and the only exception in the Hub's pair-authenticity proof. They fail closed in four independent places, all by construction and none by branch: their Θ field is `0x0`; they sit outside `KINDS_ROUTABLE`, so the Hub's `addFactory` refuses them, and outside `KINDS_EXECUTABLE`, so its `recordSwap` skips them; and the Router's execution dispatch falls into its final `else` and reverts `RouterE(8)` before it touches a pool. The retired numbers are never reassigned: `decodeKind` reads the kind from Monoslot bits, so reusing 2 would reinterpret every pool ever recorded under it. The families themselves have not gone: Balancer and Curve return as data behind the Gate (§4.5), all carried by kind 9, and the three old numbers stay burned. **The native-currency kind (8) exists because one invariant breaks there and nowhere else.** The Router's working assumption — every asset is an ERC-20 with `balanceOf` — fails exactly when a V4 pool's currency is the chain's native asset, and encoding that exception as a *type* makes it visible in the pool record, carried in the route plan, and greppable by an auditor. The pricing needs no branch: the pool identifier derives from the two sorted currencies, and `address(0)` sorts first by construction. The kind earns its place empirically: measured on 2026-08-13 across the chains served, 62.9 % of the ETH-denominated liquidity inside V4 sat in native pools (Arbitrum 99.6 %, Optimism 95.0 %, Base 48.9 %). That is a dated measurement, not a standing figure. ### §4.2 The closed forms **Constant product.** Reserves satisfy $x \cdot y = k$ and a fee $f$ in basis points is taken from the input. Before the formula runs, the pair is shown to hold what it declares: `heldBy` compares the two reserves `getReserves` reported against the pair's own token balances, and a pair that declares more than it holds quotes zero, for every consumer (probe, split, leg quote, Quoter). The Solidly arm applies the same check. For a pair that passes, the Core computes $$ y \;=\; \mathrm{outV2}(x,\, r_{\mathrm{in}},\, r_{\mathrm{out}},\, f) \;=\; \left\lfloor \frac{x\,(\mathrm{BPS}-f)\; r_{\mathrm{out}}}{\,r_{\mathrm{in}}\cdot \mathrm{BPS} \;+\; x\,(\mathrm{BPS}-f)\,} \right\rfloor $$ ^e2 with no division until the final step, so the only rounding is the floor of the last quotient, and a fee of `BPS` or more makes the pool unquotable (returns zero). The fee that enters this formula is `effV2Fee(declared)`: a declared fee of zero or above `V2_FEE_CEILING_BPS = 100` is replaced by the canonical 30 bps, so a registration cannot deflate its own quote — and with it the floor that quote anchors — by declaring an implausible fee. The Router's per-leg quote reads the same function (`legQuoteImpact` calls `effV2Fee`), so both sides of the trade price with one number. **Worked example 1 — a constant-product quote.** A pool holds $r_{\mathrm{in}} = 1{,}000{,}000$ USDC and $r_{\mathrm{out}} = 500$ WETH at the canonical 30 bps; a trader sells $x = 10{,}000$ USDC. In the pool's own units (USDC has 6 decimals, WETH 18) $x = 10^{10}$, $r_{\mathrm{in}} = 10^{12}$, $r_{\mathrm{out}} = 5 \times 10^{20}$: 1. Fee-adjusted input: $x(\mathrm{BPS}-f) = 10^{10} \times 9{,}970 = 9.97 \times 10^{13}$. 2. Numerator: $9.97 \times 10^{13} \times 5 \times 10^{20} = 4.985 \times 10^{34}$. 3. Denominator: $10^{12} \times 10^{4} + 9.97 \times 10^{13} = 1.00997 \times 10^{16}$. 4. Output: $\lfloor 4.985 \times 10^{34} / 1.00997 \times 10^{16} \rfloor = 4.935790 \times 10^{18}$ wei, i.e. **4.935790 WETH** (to six decimals; the contract floors the last quotient to the wei). At the spot price of 0.0005 WETH per USDC the same 10,000 USDC would fetch 5 WETH; the fill is 1.28 % below spot, of which 0.30 % is the fee. The Core's reserve-based impact measure for this leg is $\mathrm{impactV2Bps} = \lceil x \cdot \mathrm{BPS} / (r_{\mathrm{in}} + x) \rceil = \lceil 10^{14} / 1.01 \times 10^{12} \rceil = 100$ bps — the number the Iron-Law floor consumes in §11. **Concentrated liquidity.** V3-shaped pools store no reserves; they store a square-root price $\sqrt{P}$ in Q64.96 fixed point and an active liquidity $L$. Within a tick, for token0 → token1 with fee $f$ in parts per million and $x_{f} = \lfloor x\,(10^{6} - f)/10^{6} \rfloor$: $$ \sqrt{P}\,' \;=\; \frac{L\,\sqrt{P}}{\,L \;+\; x_{f}\,\sqrt{P}/Q_{96}\,}, \qquad y \;=\; \frac{L\left(\sqrt{P}-\sqrt{P}\,'\right)}{Q_{96}} $$ ^e3 and for token1 → token0, $\sqrt{P}\,' = \sqrt{P} + x_{f} Q_{96}/L$ and $y = L\,Q_{96}(\sqrt{P}\,' - \sqrt{P})/(\sqrt{P}\,\sqrt{P}\,')$, the division split in two stages. The naïve computation overflows: $L \cdot \sqrt{P}$ can reach $2^{288}$ (a 128-bit $L$ times a 160-bit $\sqrt{P}$). The Core never forms it — every product is factored through a full-precision `mulDiv` (512-bit intermediate, 256-bit result), so each stage fits, and a step that would move the price the wrong way or to zero returns zero rather than a number. Algebra pools (kind 6) share the branch and differ in one respect the branch handles: their state and their dynamic fee live in `globalState`, read once (§5.4). **One interval, and what the promise does about it.** The dispatcher's concentrated arm is a single-interval form: it prices the whole order as if the current $L$ continued for as long as the order needs, and every call site of `outV3` passes a zero price limit, so there is no clamp. [derived] Along a swap the marginal price is $dy/dx = P$ whatever $L$ is, because $dy = L\,d\sqrt{P}$ and $dx = L\,d(1/\sqrt{P})$ give $dy/|dx| = \sqrt{P}\cdot\sqrt{P} = P$; what $L$ sets is how far the price must travel to absorb an input. So when liquidity beyond the interval's edge is thinner than $L$ (or absent), the true price falls faster than the form assumes and the form over-estimates the output; when it is thicker, the price falls more slowly and the form under-estimates it. The form is exact only while the order stays inside the interval. The design does not replicate a venue's tick-crossing arithmetic in the ranking arm, because replicating a venue's internal mathematics is a structural liability: any divergence between copy and original surfaces as a mispriced quote. The ranking uses one convention for every concentrated venue; the *promise* is where the venue's own book is consulted. `v3PaysOnBudget` walks the pool's ticks as the V4 walk does (§5), with a pool identifier of zero and a budget of `V3_PAY_READS = 12` reads of the pool. If the walk finishes inside the reads and inside the walk's step cap, the answer is the smaller of the walked output and the single-interval figure $f$; if it does not finish, it is the smaller of $f$ and the walked output plus a single-interval estimate of the remainder; a book that does not answer returns $f$. It never answers above $f$. Two consumers read it, and it has one producer: the Solver's `_paysWhatItWalks` lowers a leaf's promise when the walk comes in under it, recomputes the hop, leaves the ranking unchanged, and returns the pools whose promise fell to the funnel so the leader is rebuilt without them; the Router reads it through the Core's `legQuoteImpact`, where the impact it reports stays that of one interval, the figure the Solver's floor reads. The Solver's capacity probe takes the same walk for a V3 pool whose holdings cap the order, once per solve topology. The walk uses the pool's own arithmetic with its own rounding, input rounded up and output rounded down, so it can understate a delivery and never overstate one, including the remainder term of `v3PaysOnBudget`, priced by `outV3`, which takes the pool's own step (the next square-root price rounded up), so it is never a wei above what the pool pays, and the answer stays capped by $f$. The promise therefore rests on the pool's own book, not on the one-interval estimate; the Quoter's Exact Pass (§12) gives an integrator the pool's own answer when it wants one. **Depth.** Every branch also returns a depth in token units — the shorter reserve side for reserve families (`shortSide18`), and for concentrated families the virtual reserve $L/\sqrt{P}$ or $L\sqrt{P}$ that $L$ represents at the current price (`depthFromL18`), so a V3 pool and a V2 pool of equal depth compare equal in the allocator instead of differing by a factor of $\sqrt{P}$. A Gate wrapper's depth is the Gate's own `vitalOf` figure (§4.5). ### §4.3 Two fee units, carried natively Constant-product and Solidly venues quote fees in basis points; concentrated venues in parts per million. Each arm computes in its own native unit, which removes a class of rounding failure at the price of two constants instead of one. The only place the two meet is the figure the probe reports back: `universalProbe` returns the fee its ranking figure charged in pips (parts per million), so a V2 or Solidly basis-point fee is multiplied by 100 once, at the edge, and a wrapper, whose fee no read in the Core can see, returns the sentinel `FEE_UNKNOWN`, a value no real fee can take. Two venue families know their fee only at execution time — V4 dynamic-fee pools and Algebra — and both are handled by measuring the fee from the same state read that supplies the price (§5.4). A V4 pool with a dynamic fee and a protocol fee set together is priced at the fail-closed ceiling instead of at a guess. ### §4.4 One dispatcher, three readers The same arms are read in three places, and the table records what each place asks of each kind. | Kind | Quoter preview | Solver's plan | Router, in its own frame | |---|---|---|---| | V2 (0) | `outV2` over `getReserves`, after `heldBy` | same | `outV2` through `legQuoteImpact` | | V3 / Algebra (1, 6) | one-interval `outV3` over `slot0` / `globalState`; Algebra's live fee measured from the same read | ranking: one interval; promise: `v3PaysOnBudget` (§4.2) | `legQuoteImpact`: impact of one interval, promise from `v3PaysOnBudget` | | Solidly (5) | `solidlyAskOut`: the pool's `getAmountOut` less one wei; replicated curve × 9,800 / 10,000 when the pool does not answer but answers `stable()` (any other pair asks zero) | same | same function for quote and execution | | V4 / V4-native (4, 8) | the book walked through `extsload`, fail-closed fee gate | same walk (16 steps for the promise, up to 256 for the ranking) | `_v4LegQuote` → `v4LegOut`: the same walk, fee resolved in the swap's direction | | EXTERNAL (9) | `gateQuote` (identity, then the wrapper's `quote`) | `gateQuote` | identity (`gateWrapperLive`, else `RouterE(19)`) and the measured delta; no re-quote | Two details in the table carry the argument. First, the V4 walk is the one place the ranking and the promise differ in depth on purpose: the promise is bounded at 16 steps, so an order that does not finish inside them under-estimates, the safe side; the ranking reads a deeper walk of up to 256 steps, because anyone can place a one-wei position on the ticks under an honest pool (`modifyLiquidity` has no access control), and an attacker can then only lower a rival's figure, and only with ticks inside the price path of the very order being priced. [derived] At tick spacing 1 each tick moves the price by a factor of 1.0001, so 256 steps cover $1.0001^{256} - 1 \approx 2.6\,\%$; past that the figure is a lower bound and is treated as one. Hooks are not modelled; a dynamic-fee pool whose hook runs before the swap (`beforeSwap`) quotes zero. Second, the wrapper row has no in-frame quote on purpose: the Router asks the wrapper for identity and measures what arrives, and the Router's floors never read a wrapper's quote. What separates a preview from a fill is therefore time: state that moved between the preview block and the execution frame. §12 measures that gap. ### §4.5 Venues behind the Gate *Plain:* some venues cannot be priced by reading a few storage slots, so the Core does not pretend to. *Precise:* the Gate is one factory row in the Hub in front of venues the Core cannot read natively: Balancer V2, Balancer V3, Curve StableSwap-NG, Curve Twocrypto-NG and Tricrypto-NG, Liquidity Book, PancakeSwap Infinity (CL and Bin) and Algebra Integral. For each venue it creates a thin immutable wrapper at a derived address. To the Router the wrapper looks like a Uniswap V3 pair (kind 9, §4.1): it speaks the V3 `swap` and `uniswapV3SwapCallback` ABI, and it forwards what it measured arriving to its family's adapter. The Hub admits kind 9 only as a `MODE_CREATE2_V3` factory row, so a wrapper can exist in the registry only at the address the Gate's own creation code derives. **What the Router trusts, and what it measures.** Nothing a wrapper or an adapter reports about its own output is an input to a floor. The Router measures the balance delta at the recipient, exactly as it does for a V3 pool, and enforces its floors against that. An adapter is immutable, leaves no allowance standing, and after each call may hold no more of either token than before. A venue that can only be priced by simulating it is quoted by `eth_call`; the quote is advice to the caller, and the Router's execution floors never read it. **How an adapter is admitted, and kept honest.** An adapter enters in two steps separated by `ADAPTER_DELAY = 48 hours`. At the proposal the Gate scans the adapter's runtime code opcode by opcode, stepping over `PUSH` data, and refuses `DELEGATECALL`, `CALLCODE` and `SELFDESTRUCT` (code that can run foreign code in its own context, or vanish and be redeployed, would make a pin meaningless), as well as empty code and an EIP-7702 delegation prefix; the scan is conservative and may refuse honest code, never admit dishonest code. The proposal records the adapter's code hash; the acceptance reverts if the code has moved since, and pins the hash. `liveAdapter` is the one producer of "which adapter may run for this family": it answers zero when none is set or when the code at the address is no longer the pinned code, and every swap reads it, so a changed adapter stops every wrapper of its family at the next call. The curator can clear a family at once, which is a brake and not a power over funds: every wrapper of the family reverts from the next call, and the other kinds are untouched. Control can be renounced: afterwards the curator keeps only the grow-only operations, and `familiesUsed` records every family that ever had an adapter, so a family that was live cannot be refilled and its wrappers cannot change hands. Creating a wrapper stays a curator act, because the first creation fixes the venue pool of its (token0, token1, venue key) for ever, and an open door would let anyone occupy every slot with a thin pool of a legitimate venue. **Capacity.** A pair holds at most `GATE_MAX_WRAPPERS = 4` wrappers. The reason is a cost, not a taste: the best door reads every wrapper of the pair on every solve, one identity check each, and every wrapper enters the Solver's funnel next to the native venues. Because a wrapper's mass is not measured from a reserve, it is never dropped as dust, so the cap bounds the work the Solver can be handed. **One producer for the price.** `gateQuote` is the only function that prices a wrapper, and it asks one question in order. First identity: `gateWrapperLive` requires that the Hub has admitted the wrapper's Gate and that the Gate still runs the code it was admitted with, that the wrapper sit at the address that Gate derives (CREATE2) from this hop's own tokens and fee, and that the family's adapter be live now. Then the wrapper's own `quote(bool,uint256)` is called by `staticcall` under a fixed gas ceiling, `GATE_QUOTE_GAS = 500,000`; a failure is a zero quote and the venue drops out. When the dispatcher asks for depth, it comes from the Gate's `vitalOf`: the adapter's declared depth, capped by the mass the venue's own pool holds, read under twice that ceiling. The Solver and the Quoter's preview both read `gateQuote`; if the Quoter finds a live wrapper whose direct answer is zero, it retries as a dry run in a frame that reverts, which is how a venue priced only by simulation gets a number. The Router, as §4.4 records, does neither: it checks identity and measures the delta. **What it costs in bytecode.** The Gate's runtime is 10,710 bytes (13,866 bytes under the EIP-170 limit of 24,576) and the wrapper it deploys is 4,408 bytes (20,168 under); the eight venue adapters run from 3,026 to 6,666 bytes. [measured] The Gate's initcode is 15,865 bytes against the 49,152-byte EIP-3860 limit. All figures are from the release-profile size guard at commit `969bcc6`, CI job 133367307770. ## §5 Uniswap V4 end to end *Plain:* V4 pools have no address, run other people's code inside the swap, may charge a fee that changes, and may hold the chain's native coin. *Precise:* Uniswap V4 is not a new pool contract; it is a new shape of venue, and it invalidates four assumptions every router built between 2020 and 2024 rests on. Pools are entries in one singleton's storage, keyed by a hash. A hook executes at defined points of the settlement the router is performing. A fee need not be constant. And a pool may hold the native currency, which has no `balanceOf`. This section answers all four structurally, so that a V4 leg is, to the Solver, to the floors and to the trader, indistinguishable from any other leg. ### §5.1 Locating a pool that has no address: derive, then prove The Deterministic Derivation 𝒟 computes addresses (§7), but a V4 pool has no address to compute. What it has is an identifier, the keccak hash of its `PoolKey`, so mode 9 of the derivation table derives *poolIds* rather than addresses, and then does something no address derivation can: it proves the pool exists, by reading the PoolManager's own storage for that id and requiring a non-zero square-root price and non-zero liquidity. Nobody can forge that proof, because nobody but the manager writes that storage. A fabricated id resolves to zeros and is discarded. **Worked example 4: a V4 pool identifier from its key.** The canonical id is $\mathrm{poolId} = \mathrm{keccak256}(\mathrm{abi.encode}(c_{0}, c_{1}, \mathrm{fee}, \mathrm{tickSpacing}, \mathrm{hooks}))$ (`computeV4PoolId`), five 32-byte words. Take the native ETH / USDC pool on Base at the 0.05 % tier: $c_{0} = \mathtt{0x0000…0000}$ (native currency sorts first), $c_{1} = \mathtt{0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913}$ (USDC), fee $= 500$, tickSpacing $= 10$, hooks $= \mathtt{0x0}$. 1. `abi.encode` lays out 160 bytes: the two currencies left-padded to 32 bytes each, then `500`, then `10` (an `int24`, sign-extended to 32 bytes), then the zero hook. 2. $\mathrm{poolId} = \mathtt{0x96d4b53a38337a5733179751781178a2613306063c511b78cd02684739288c0a}$. 3. The registry's `pool` field for a V4 row is the id's low 160 bits, $\mathtt{0x781178a2613306063c511b78cd02684739288c0a}$, an address with no code. That is why V4 rows are never asked `token0()`, never read for a balance, and prove themselves by re-derivation instead (§9). 4. The pool's storage base is $\mathrm{keccak256}(\mathrm{abi.encode}(\mathrm{poolId}, 6)) = \mathtt{0x13a3a697…73b2893d}$: slot 6 of the manager is the `pools` mapping. The Core reads word 0 at that slot and word 3 at $\mathrm{base} + 3$ (`v4SqrtAndLiq`, selector `extsload(bytes32)` = `0x1e2eaeaf`). 5. Word 0 packs $\sqrt{P}$ in bits [0, 160), the tick in [160, 184), the protocol fee in [184, 208) and the LP fee in [208, 232); word 3 carries the active liquidity in its low 128 bits. If either $\sqrt{P}$ or $L$ is zero, the pool does not exist for this protocol. The three hashes in steps 2 and 4 and the wrapped id below were recomputed for this edition with `cast keccak` over the encoding in step 1. [measured] The wrapped sibling of the same pair, $c_{0} = \mathtt{0x4200…0006}$ (WETH), same tier, has id $\mathtt{0x90333bb0…ebd943a0}$: a different pool with different depth, which is why the scan probes both keys. The layout in step 5 is not taken from documentation alone: the same pool read through this layout and through the canonical `StateView` contract returned the same numbers on a mainnet fork when the reader was written, and that identity is what the Core's comment cites. **The scan.** The scan that produces candidate ids has four stages, and none of them depends on another. Before the first cold probe of a pair, one measured read asks whether the PoolManager holds any of each token; if the manager's measured balance of a token is zero, the pair has no V4 pool and the search stops (`_pmHoldsNone`). An absent reading is not a zero: a manager inside an unlock, a failed read or a reply shorter than one word keeps the search going. Then, in order: | Stage | What it tries | Cost when it hits | |---|---|---| | Native pass | the same stages below with $c_{0}$ = the native currency; hits are rewritten to `KIND_V4_NATIVE` with token0 = WETH | folded into the stages below | | Learned codes | the tier pattern already learned for each token (`v4CodeOf`); equal codes deduplicate | one probe, the steady-state path | | Canonical tiers | the four Uniswap tiers (fee, tickSpacing) = (500, 10), (3,000, 60), (10,000, 200), (100, 1), through one batched `extsload(bytes32[])` | one call for the batch | | Row extras | the registration row's `fees[i]` paired with `spacings[i]`, never their cartesian product | one batched call | No count stops the scan early, and that is deliberate. An earlier design capped the scan at eight proven pools and probed a generator grid of forty tiers on every miss; a cap lets dust planted in the first cells use the places before a deep pool at a later cell is reached. The cap and the grid are gone. The table's own bound limits what a row emits (a V4 row emits at most `2 · fees.length + 10` candidates per call), the dust that gets through reaches the Solver, whose funnel weighs it against the pair's depth, and a learned hint can speed a search up but cannot suppress one. An exotic tier is reached by a learned code or by a row extra. The generator grid survives only in reverse: `V4_GRID_MAX = 99` bounds `_recoverV4Ts`, which recovers a tick spacing from the code learned out of a swap. Two properties fall out of the construction rather than out of a check. A hooked pool can never be emitted by this scan: it derives *hookless* ids, and a hooked pool's hookless id does not exist in the manager, so it fails the liveness proof before any policy question is asked (hooks are treated in §5.5). And duplicate ids from different tier guesses collapse to one candidate by pool address in `_admitV4`, so one pool cannot occupy the funnel twice by aliasing. `_admitV4` is also where the fee gate of §5.4 refuses a pool whose effective fee reaches 1,000,000 pips. Probe order is still a policy, because a pair against the chain's native asset has two keys in V4, native and wrapped, and the scan emits both and lets the funnel pick by depth. The native key was the deeper one in every case measured when the ordering was decided: 3.76 times on Base (USDC/ETH, 500/10) and 292 times on Robinhood Chain (USDG/ETH, 100/1). [measured, 2.3; source: the Hub's comment at the scan] Deriving only the wrapped key would never error; it would quote worse, silently. ![FIG-2 — The V4 derive-and-prove ladder](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-2.svg) *FIG-2: The V4 derive-and-prove ladder. A pair is cut off early only on a measured zero balance at the manager; otherwise the native pass, the learned codes, the four canonical tiers and the row's paired extras each propose ids, every id is proven live against the manager's storage, and hooked ids never exist on this path. No count stops the scan.* **The permissionless door.** Anyone may call `claimV4(c0, c1, fee, tickSpacing)` and have a hookless pool admitted, because the claim carries its own proof: the id is recomputed from the submitted key and read back from the manager's storage, so a false claim resolves to zeros and admits nothing (`HubE(9)`). Four further conditions gate the door. Neither currency may be the zero address: this door takes the wrapped key, and native rows come from the scan above. Claimed entries start provisional and are weighted by measured marginal output. One side of the pair must be a routable bridge coin, so that a seat in the capped registry is never spent on a pair the router can never cross. The effective fee must resolve under the fee gate of §5.4. And the claim must clear the same admission margin a swap-driven registration clears (§9), with the pool's measured liquidity, converted to token-denominated virtual reserves on the short side, as its depth. The call is idempotent, and it teaches the learned tier code only if it actually registered a row. The registry can be taught by the public and cannot be lied to by it. ### §5.2 Reading a pool that answers no calls With an id proven live, the dispatcher needs price and liquidity, and there is no `slot0()` to call. The Core reads the singleton's storage directly by `extsload`, as in worked example 4, and the V4 branch reduces to the concentrated-liquidity closed form of §4.2: the same mathematics, the same overflow discipline, and for the promise the same walk of the pool's own ticks that §4.2 describes. The singleton changes where the state lives, not what the state means. A manager with no code answers a static call with no return data, and `v4SqrtAndLiq` treats a codeless target as all-zero words: fail-closed, never a revert and never garbage read as a price. ### §5.3 Settling with a singleton Execution inverts the usual control flow. Instead of calling a pool and being called back for payment, the Router calls `unlock` on the manager and performs the entire swap inside the callback the manager grants it: swap, then settle the owed currency and take the received one (`sync`, transfer and `settle` for a token; `settle` with value for native), then release the lock. The callback accepts only the manager as caller (`RouterE(6)`). The in-flight currencies are carried across the unlock boundary in transient storage (`TSLOT_V4IN`, `TSLOT_V4OUT`), so the frame dirties no persistent state, and the callback clears both slots before it settles anything: a re-entry reads an empty context and reverts. The `BalanceDelta` the manager returns is packed, `amount0` in the high 128 bits and `amount1` in the low, and the Router decodes it as such before any settlement arithmetic runs. A pool that owes the wrong way, or asks for more input than the leg was committed, reverts (`RouterE(8)`): a malicious pool or hook is bounded to the current leg's budget and cannot draw on the input budgeted to its sibling legs. Native currency keeps the invariant that matters. The Router is WETH-canonical everywhere: native value entering `swapExactInNative` is wrapped exactly once at the door, the route must start in WETH, and the door is fail-closed until `weth` is wired (`RouterE(3)`). Native output is deliberately not implemented: the recipient receives WETH, which no swap path can silently trap. A native V4 leg unwraps just in time inside its own unlock frame (`WETH.withdraw`, then `settle` with value), and ETH received from a native `take` is re-wrapped in the same frame, so native ETH never exists at rest in the contract and every balance-delta measurement downstream sees only WETH. The one new surface this required is a `receive()` gated as narrowly as the requirement allows. A transient slot, `TSLOT_ETHOK`, holds the single address permitted to send raw ETH to the Router at that instant: the canonical WETH contract during the unwrap, the PoolManager during a native take, zero at every other moment. Bare ETH from anyone else reverts (`RouterE(3)`). ### §5.4 The fee that exists only at execution time A static-fee V4 pool carries its LP fee in its key, where it is immutable. The pool manager may in addition take a protocol fee, set per direction by Uniswap's fee controller, and a dynamic-fee pool carries the sentinel `0x800000` in its key while its real fee lives in `slot0`. Quoting the sentinel at face value would price the trade as free while execution paid the live rate; quoting a static key without the protocol fee would overstate the delivered output once a controller enables it. The Core resolves both in one pure function, `effV4Fee`, which takes four arguments (key fee, LP fee, protocol fee, direction) and returns pips: $$ f_{\mathrm{eff}} \;=\; \begin{cases} f_{\mathrm{key}} & f_{\mathrm{key}} \ne \mathtt{0x800000} \ \wedge\ p = 0 \\ p + f_{\mathrm{key}} - \lfloor p\, f_{\mathrm{key}} / 10^{6} \rfloor & f_{\mathrm{key}} \ne \mathtt{0x800000} \ \wedge\ p \ne 0 \\ \mathtt{0xFFFFFF}\ (\text{unquotable}) & f_{\mathrm{key}} = \mathtt{0x800000} \ \wedge\ f_{\mathrm{proto}} \ne 0 \\ f_{\mathrm{LP}}\ \text{read from } \mathtt{slot0} & f_{\mathrm{key}} = \mathtt{0x800000} \ \wedge\ f_{\mathrm{proto}} = 0 \end{cases} $$ ^e19 Here $p$ is the protocol fee of the swap's direction: the low 12 bits of the packed field for a swap from token0 (`zeroForOne`), the high 12 bits for the other direction. The second case is the composition of two fees charged one after the other on the input. A fraction $p/10^{6}$ goes to the protocol, so $(1 - p/10^{6})$ of the input remains, and the LP fee applies to what remains: the total retained fraction is $(1 - p/10^{6})(1 - f/10^{6})$, so the effective fee in pips is $p + f - pf/10^{6}$. The integer division floors the subtracted term, so the figure rounds up by less than one pip, the direction in which a quote can only under-promise. [derived; the composition rule is the one the code's comment cites from Uniswap v4-core's `ProtocolFeeLibrary.calculateSwapFee`] For illustration, $f = 3{,}000$ and $p = 500$ give $500 + 3{,}000 - \lfloor 1{,}500{,}000 / 10^{6} \rfloor = 3{,}499$ pips against an exact $3{,}498.5$. The PoolManager caps $p$ at 1,000 pips (0.1 %) per direction and refuses a larger setting from the fee controller (`ProtocolFeeLibrary.MAX_PROTOCOL_FEE`, `isValidProtocolFee`, Uniswap v4-core). A dynamic-fee key riding with a non-zero protocol fee returns a fee at or above $10^{6}$, and `outV3` returns zero for it: fail-closed, because the fee a hook may override inside `beforeSwap` is not anchored the way a key fee is. The measured protocol fee is zero on every chain served at the time of the 2.3 edition, so this branch cost nothing in practice. [measured, 2.3] The gate is applied where a pool enters the registry, not only where it is quoted: `_admitV4` and `claimV4` both refuse a pool whose direction-free effective fee reaches $10^{6}$ pips. The same rule closes the same seam one family over. Concentrated-liquidity forks whose fee lives on the pool are asked the pool first: `quoteV3Fee` asks the pool's own `fee()` before it consults the fee stored in the registry row, and the stored fee answers only for a pool whose `fee()` does not. The order matters because a registered row carries the fee of the block it was written in, while a dynamic-fee pool moves its fee from block to block: on Base, the Slipstream WETH/USDC pool with tick spacing 100 showed 549 and then 564 pips in consecutive blocks. [measured, 2026-10-27] Algebra pools are dynamic-fee by construction and register the zero sentinel, so they keep their own order: the fee measured with the price in the `globalState` read that already supplied it. When nothing answers, the result is `0xFFFFFF` and the quote fails closed. Static V3 pools take no extra read beyond the one staticcall. One seam is bounded rather than removed: a dynamic-fee hook can override its fee per swap inside `beforeSwap`, so the fee stored in `slot0` is not in every case the executed one. That residual is contained by the Hub's hook allow-list at admission and by the Iron-Law floor re-derived from realised output at execution, so a hostile override lands as a revert or a within-floor shortfall, never a fill below the floor (§14). ### §5.5 Hooks: screened by arithmetic, never by interrogation A hook is arbitrary code running inside the settlement the Router is performing. The intuitive defence, asking the hook what it intends, is not a defence, because a hostile hook lies or re-enters. BlazePhoenix never asks a hook anything. The checks are made on the hook's address, on a code hash, and on a list a human keeps, and §14 develops them. Three layers stand, cheapest first. 1. **Address arithmetic.** A hook's permission bits live in the low fourteen bits of its own address, fixed at deployment. The two bits that permit returning swap deltas, `1 << 3` and `1 << 2`, are refused by one AND before a token moves (`hookAltersDeltas`, `RouterE(9)`): a vanilla quote cannot price custom accounting, so quote and execution would diverge. A second AND, `hookRunsInSwap`, asks whether the manager enters the hook during a swap at all: `(uint160(hook) & 0xCC) != 0`, that is `beforeSwap` (`1 << 7`), `afterSwap` (`1 << 6`) and the two delta bits. A hook with none of them is never entered by its own pool's swap, because the manager dispatches on those immutable bits; its pools are admitted by the bits alone, and nothing an operator could judge about its code can change a swap, so they need neither list nor pin. 2. **List and pin, for a hook that runs.** The automatic door proposes a hook only while `isHookLive` holds: it is on the allow-list and its runtime code hash still equals the hash pinned at admission. At execution, a hook that runs in the swap and is paused, whether revoked by the curator or listed and since moved off its pinned code, is refused (`RouterE(9)`). A hook nobody listed is the caller's own signed choice on this door, bounded like every venue by the in-frame promise, the attestation gate and `userMinOut`. The pin does not cover a proxy whose implementation is swapped behind an unchanged code hash; the allow-list is the human judge of that case. 3. **The projector Ξ.** The Quoter returns zero for a hook that alters deltas, or one that runs in the swap and is paused, and the Solver filters delta-altering hooks out of its candidate set before ranking, so the route is never even representable. The residual is stated with the mechanism. An allow-listed, delta-free hook can still revert mid-swap and waste the gas of trying: that is the price of refusing, on principle, to call untrusted code to find out what it would have done. And a hook that does run in the swap can call the manager on any pool, entering that pool's hooks. That reach is bounded by the manager's own flash accounting (a delta left unsettled reverts the whole unlock; measured on a Base fork in `test/fork/NestedHookSettlementFork.t.sol`), by the same floors, and by the admission of the hook that makes the call, never by the bits of the hook it reaches. ### §5.6 What the integration is worth Every mechanism above is either a Core primitive already used elsewhere, applied to a new state layout, or a primitive that generalises beyond V4: proof-of-existence discovery. Nothing is a per-pool integration, and nothing is a curated list a human must keep current. V4 pools are discovered without a directory, proven against storage nobody else can write, priced by the same closed form as every other concentrated venue, fee-gated by measurement with a fail-closed refusal where measurement is not exact, screened for hostile hooks by immutable address arithmetic, settled through the singleton's own lock protocol, and reachable in native ETH without the Router holding a wei of it at rest. §17 carries the measurements: in the factory census on Arbitrum the V4 family won more hop-pairs than any other registered venue. [measured 2026-08, private census, Version 2.3] ## §6 The Solidly solver *Plain:* some pools are priced by a formula too delicate to copy safely, so the protocol asks the pool for its own answer and keeps a careful copy only for pools that cannot answer. *Precise:* some invariants have no closed form simple enough to reproduce without risk, and reproducing them is exactly the replication hazard the protocol refuses elsewhere. For such venues the dispatcher asks the pool, through the narrowest channel the venue exposes, and holds a replica in reserve for forks that do not answer. The Solidly family (Aerodrome, Velodrome and their forks) serves correlated assets on stable pairs with a quartic invariant that stays closer to the diagonal than constant product while still admitting divergence: $$ k(x, y) \;=\; x^{3}y \;+\; x\,y^{3} \;=\; x\,y\left(x^{2}+y^{2}\right) $$ ^e5 At the balance point the slope of the level set is $-1$, as for constant product: $\mathrm{d}y/\mathrm{d}x = -(3x^{2}y + y^{3})/(x^{3} + 3xy^{2}) = -4x^{3}/4x^{3}$ at $x = y$. What differs is the curvature, and the figure below plots it. A zero-fee pool with $X = Y = R$ and an input of 1 % of $R$ returns 99.99995 % of the input; constant product returns 99.0099 %. At 10 % the two return 99.950 % and 90.909 %. [derived: exact rational bisection of $k(R+a, R-\mathrm{out}) = k(R, R)$, 200 steps; constant product is $a\,R/(R+a)$] Volatile Solidly pairs are constant product, and the Core's volatile arm *is* `outV2`: one producer, which metamorphic relation MR7 pins (§15). ![FIG-3 — Output against input, balanced stable pair](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-3.svg) *FIG-3: Output against input for a balanced stable pair: the Solidly quartic against constant product and the zero-slippage diagonal, from the Core's own formulas.* ### §6.1 Primary path: ask the pool `getAmountOutWithTotalFee(uint256,address)` (selector `0x0ea099c1`) is asked first and, only when that ask fails, `getAmountOut(uint256,address)` (`0xf140a35a`). The answer is computed by the pair's own bytecode, with the live fee, curve and rounding it will apply at swap time, so a swap that requests no more than that figure sits inside the pair's own invariant check. The Core asks for that figure less one wei, the rounding margin that keeps the pair's K check satisfied; no proportional haircut applies on this path. [checked in code: C:1470-1490, 1516-1519, 1531-1536] [selectors recomputed with `cast sig`, 2026-11-16] Every such ask is bounded in the way every read the quote path makes of a pool is bounded: at most `GAS_CAP` = 100,000 gas, a fixed-size copy of one word, never the whole returndata, and a floor of `ASK_GAS_FLOOR` = 104,587 gas below which the ask reverts empty instead of answering "no". A starved ask therefore cannot pass for a pool that has nothing to say. [checked in code: C:215, 223, `_askWord` (C:1497) and its comment] The trigger for the fallback is an answer of at most 1 wei, or no answer at all. It is the same test in the three channels that ask (the quote dispatcher that serves the Solver and the Quoter, and the Router's execution), because all three reach one function, `_solidlyAsk` (the Router through its public wrapper `solidlyAskOut`), rather than each carrying a copy: the Router's call site says "the same producer the quote channel promises", and an earlier divergence, one channel falling back on an answer of exactly 1 while another did not, is the reason it is one producer. [checked in code: C:1516 and 2012, R:1983-1984; the earlier divergence is from the 2.3 text and is not re-derived here] ### §6.2 Fallback: replicate, then under-ask Only a pair that answers `stable()` (selector `0x22be3de1`, an ABI bool: a word above 1 is no answer) has a curve to replicate. For any other pair the `stable` flag is nobody's word: the volatile curve on a stable pool under-asks a balanced pool and over-asks a skewed one, so the ask is 0 and the venue is surrendered to the floors. When it does answer, the dispatcher reads the live fee, solves the invariant on decimal-normalised reserves (§6.3, §6.4) and multiplies the result by 9,800 / 10,000, a 200 bps haircut (`SOLIDLY_CURVE_ASK_BPS`), so that the pair's rounding, which the replica cannot observe, always has slack. The haircut is a property of the request and not of the curve: it applies on the fallback and never when the pool answered for itself. [checked in code: C:213, 717-722, 1516-1541] The live fee comes from a short ladder, and the ceiling applies to one rung only. | Rung | Source | Rule | |---|---|---| | 1 | the pair's `factory()` then `factory.getFee(pool, stable)` (selector `0xcc56b2c5`) | believed when $0 < \mathrm{fee} < 10{,}000$ bps; no ceiling | | 2 | the fee declared with the leg (calldata on the Router's doors) | believed only when it is at most 100 bps; 0 or above 100 bps is replaced by rung 3 | | 3 | a fixed default | 30 bps | | lie | `factory()` answers a word that is not an address | fee = 10,000 bps: the pair prices at zero and the pair's other venues plan as before | The ceiling exists because a Solidly-shaped pair with no `getAmountOut` and no working factory leaves the declared fee as the only fee source: an over-declared 99 % would collapse the leg's on-chain quote to about 1 % of the truth, and when that leg is the last hop it would drag the protocol floor down with it. The V2 arm closed the same hole with the same constant (`V2_FEE_CEILING_BPS` = 100), and the Solidly arm now reads through it. A `factory()` of zero (no contract behind the call) keeps the declared or default fee. [checked in code: C:1327, 1747-1778] The haircut is also a charge, and the price band must see it as one. The effective fee of the fallback ask, in pips (millionths), is $1 - (1 - f)\cdot 9800/\mathrm{BPS}$, written in the code as `1_000_000 - (BPS - fee) * 9800 / 100`. For the default $f$ = 30 bps this is $10^{6} - 9970 \cdot 98 = 22{,}940$ pips, 2.294 %. [derived from C:1541 and C:1522-1526; arithmetic checked] ### §6.3 The solve Given the post-trade input balance $x$ and the target invariant $K$ from the pre-trade reserves, the Core seeks the root in $y$ of $f(y) = x^{3}y + xy^{3} - K$, with $f'(y) = x(x^{2} + 3y^{2}) > 0$ for $x > 0$ (`_solY`, with $f'$ computed as `fp`). The seed is $y_{0} = Y$, the opposite pre-trade reserve. Two facts make that the right place to start. The root cannot lie above $Y$: $k$ is increasing in $x$, so $k(X + A, Y) \ge k(X, Y) = K$ and the root of $f$ is at or below $Y$. And $f'' = 6xy > 0$, so $f$ is convex and increasing, and Newton's method started to the right of the root of a convex increasing function stays to its right and converges monotonically. [derived; both statements are exact-arithmetic facts, and the integer code adds the guards below for rounding] $$ k(x, y_{n}) < K:\ \ y_{n+1} = y_{n} + \max\!\left(1,\ \left\lfloor \tfrac{K - k(x,y_{n})}{f'(y_{n})} \right\rfloor\right); \qquad k(x, y_{n}) \ge K:\ \ y_{n+1} = y_{n} - \delta_{n},\ \ \delta_{n} = \begin{cases} \lfloor y_{n}/2 \rfloor & \max(1, d_{n}) \ge y_{n} \\ \max(1, d_{n}) & \text{otherwise} \end{cases},\ \ d_{n} = \left\lfloor \tfrac{k(x,y_{n}) - K}{f'(y_{n})} \right\rfloor $$ ^e6 In the code $k$ and $f'$ are carried in WAD fixed point: `_solK` evaluates $a = xy/\mathrm{WAD}$, $b = (x^{2}+y^{2})/\mathrm{WAD}$ and $k = ab/\mathrm{WAD}$, each through a 512-bit `mulDiv`, and `fp` is $x(x^{2}+3y^{2})/\mathrm{WAD}^{2}$, so the step $(K - k)\cdot\mathrm{WAD}/f'$ is the real-number step of the formula above. [derived: units checked, $(\Delta K/\mathrm{WAD}^{3}) \cdot \mathrm{WAD}^{3}/(f'/\mathrm{WAD}^{2})/\mathrm{WAD}^{2}$ reduces to $\Delta K/f'$] Every step is bounded. A downward step that would cross zero is replaced by half the iterate; every step forces at least one unit of progress; a vanishing derivative, $x = 0$ or $K = 0$ returns the seed. The iteration exits when two successive iterates differ by at most one unit, and then lands on the side of the invariant that rounds against the taker: it climbs $y$ one wei at a time while $k(x, y) < K$, and gives up after two climbs; then it steps $y$ down one wei at a time, at most twice, while the wei below still holds $k(x, y - 1) \ge K$, so a last downward step that stopped one wei above the optimum is recovered and the exit stays on the safe side. The loop is capped at 64 iterations. Both the cap and the give-up fail closed in the same way: the solver returns the seed itself, equal to $Y$, so the caller's guard $y \ge Y$ maps it to a zero quote and the pool is treated as unpriceable. Returning zero there would make the caller compute $\mathrm{out} = Y - 0 = Y$, the whole output reserve, which is why the failure value is the seed and not zero. [checked in code: C:1832-1883 for every clause above; the "two climbs" figure is the code comment's, "two climbs covered every sampled exit"] Landing on $k(x, y) \ge K$ matters because $\mathrm{out} = Y - y$: a larger $y$ is a smaller payout, so an exit with $k(x, y) \ge K$ never promises an output that would leave the invariant below its pre-trade value. [derived from $k$ increasing in $y$ for $x > 0$; the integer floors can make $k$ flat across a step of $\mathrm{WAD}/x$ wei, which is what the climb handles, per the code comment] ### §6.4 Decimal normalisation The invariant is homogeneous of degree four: scaling both reserves and the input by $\lambda$ scales $k$ by $\lambda^{4}$ and the solution $y$ by $\lambda$, so a quote is scale-invariant in exact arithmetic. [derived: $k(\lambda x, \lambda y) = \lambda^{4}k(x, y)$] Integer arithmetic is not scale-free, and a pair such as DOLA (18 decimals) against USDC (6) would carry its mismatch into the quartic, so the ask path always evaluates on a common $10^{18}$ basis and de-scales afterwards. With $s_{\mathrm{in}} = 10^{18-d_{\mathrm{in}}}$ and $s_{\mathrm{out}} = 10^{18-d_{\mathrm{out}}}$: $$ X = r_{\mathrm{in}}\cdot s_{\mathrm{in}},\quad Y = r_{\mathrm{out}}\cdot s_{\mathrm{out}},\quad A = \left\lfloor\frac{x\cdot s_{\mathrm{in}}\,(\mathrm{BPS}-f)}{\mathrm{BPS}}\right\rfloor,\quad \mathrm{out} = \left\lfloor\frac{Y - y^{\star}(X+A,\,K)}{s_{\mathrm{out}}}\right\rfloor,\quad K = k(X, Y) $$ ^e7 The fee is taken from the input before the solve ($A$ already nets it), and the output is floored when de-scaled. [checked in code: C:1722-1738] Two entries reach this arithmetic. `outSolidlyStable` takes the decimals explicitly; `outSolidly`, the equal-decimals entry, passes 18 for both sides, which is the identity scaling, and returns the volatile `outV2` for a pair that is not stable. The ask path (`solidlyCurveOut`) takes the real decimals of the input token and of the other token: the other token is identified from the pool's own `token0()` and `token1()` and not from the caller, because a single-producer primitive that accepted its caller's coordinate would reopen the divergence it exists to close. Decimals come from `decimals()` under the same bounded read as every other ask; an answer of 78 or more, or no answer, is read as 18, and a token reporting 19 to 77 decimals quotes zero rather than underflow `10 ** (18 - d)`. A 0-decimal token is a real value and is scaled by $10^{18}$; an earlier form that read zero as "already normalised" no longer exists. [checked in code: C:1544-1560, 1655-1681, 1683-1700 (comment "NO SENTINEL"), 1048-1070 (`_decimalsOf`)] ### §6.5 Fail-closed on the whole domain Every test that decides whether the curve is evaluated at all returns zero rather than reverting, because a revert inside a quote is a library `DELEGATECALL` unwinding the Solver's whole plan for the pair: one unquotable pool must cost the pool and not the pair. In the order the code asks them, all on the normalised values of §6.4: 1. A token reporting more than 18 decimals quotes zero; a zero input, a zero reserve or a fee of 10,000 bps or more quotes zero. 2. $X$ and $Y$ must each be at most $3.4 \times 10^{38}$, and $X + A$ must be too. The constant is the decimal literal `3.4e38`, which is $2^{128}$ to two figures ($2^{128} = 340{,}282{,}366{,}920{,}938{,}463{,}463{,}374{,}607{,}431{,}768{,}211{,}456$), the largest value whose square fits a 256-bit word. [derived] 3. `_solKFits(X + A, Y)` must hold: both the invariant $k = xy(x^{2}+y^{2})/\mathrm{WAD}^{3}$ and the derivative $x(x^{2}+3y^{2})/\mathrm{WAD}^{2}$ must fit a word at the seed, which the code comment names the largest point the iteration sees, so that one check covers the loop. [checked in code: C:1731-1735, 1801-1809; the "largest point" statement is the code's comment] The first constant is a sentinel and the third test is the real bound, and the difference is quantitative. For a balanced pool $x = y = Z$, $k = 2Z^{4}/10^{54}$, which leaves 256 bits when $Z^{4} > 2^{255}\cdot 10^{54}$, that is for $Z > 4.905 \times 10^{32}$ in 18-decimal units, about $4.9 \times 10^{14}$ tokens per side. [derived] Between $4.9 \times 10^{32}$ and $3.4 \times 10^{38}$ the sentinel alone would admit a pool and `mulDiv` would revert inside the computation; the code comment on the constant records exactly this, and `_solKFits` is the test written in the term's own units rather than in reserves. `_solKFits` asks its question without a division, which is what lets it be asked on dust. `mulDiv(a, b, WAD)` reverts exactly when the high word of the 512-bit product $a \cdot b$ is at least $\mathrm{WAD}$: writing $a b = h\cdot 2^{256} + l$, the quotient fits a word iff $h < \mathrm{WAD}$. `_mulFitsWad` computes $h$ with the standard identity ($\mathrm{mulmod}(a, b, 2^{256}-1) - (ab \bmod 2^{256})$, less one on borrow) and compares it with one WAD; two multiplications, no division, no overflow on any input. [derived; checked: C:1785-1789] The earlier form, $a \le \max\cdot\mathrm{WAD}/b$, itself overflowed on a pool holding under one unit of a token. The N-version lane of §15 found that escape on 2026-09-05, and a whale input reserve against a dust output reserve, which passed the $k$ test and overflowed the derivative on the first step, is why the derivative is asked as well. The repair went in red-first, with three named tests, a 5,000-run fuzz over the full domain, a 60,000-sample sweep of the same arithmetic in Python and three mutants in the guard; it is 35 bytes smaller than the code it replaced. [checked in code: ASSURANCE.md section 4n (N-version), lines 700-720, VERIFICATION-REPORT-2026-09.md:59] ### §6.6 The measured residual, and the 200 bps margin The replica was measured against live Aerodrome pools with the pool's own `getAmountOut` as ground truth, replica output taken before the haircut: | Pool | State | Ground truth | Replica output | Deviation | |---|---|---|---|---| | USDC / USDbC | balanced (6 / 6 dec) | 999,534,071 | 999,534,071 | 0.000 % | | DOLA / USDC | skewed (18 / 6 dec) | 985,528,437 | 987,998,286 | 0.251 % | | USDz / USDC | skewed (18 / 6 dec) | 899,325,141 | 901,565,830 | 0.249 % | [measured against live Aerodrome pools on Base before 3 August 2026; first published as Table 6 of the previous whitepaper] The deviations are recomputed here from the three pairs of figures: 0 and $+0.2506$ % and $+0.2492$ %. [derived] The balanced pair matches to the integer; the skewed pairs sit about a quarter of a percent above the truth, on the side that would over-promise, because the pool's post-fee balance rounding is invisible from outside. That is why the fallback under-asks by 200 bps: after the haircut the three rows become 979,543,389, 968,238,320 and 883,534,513, which are $-2.000$ %, $-1.754$ % and $-1.756$ % of the truth, so the margin is about eight times the largest residual measured and the replica's over-promise cannot reach the pair's own check. [derived: $200/0.2506 = 798$ per cent of the residual; one measurement set of three pools, not a bound] The margin is applied identically on the preview and in-frame surfaces, since both reach it through the one function `_solidlyAsk` (the Router through its wrapper `solidlyAskOut`), so the number a trader is shown is the number the Router requests, and the planner ranks the venue on that same figure. The cost of the haircut is therefore visible in the ranking and in the fee the band sees (§6.2), not hidden in execution. The canonical-oracle lane of §15 bounds the curve independently: against an implementation of the venue's published invariant solved by Newton's method, the Core never exceeds the curve by more than the solver's own last step, and measured within 4 wei over 5,000 fuzzed inputs. [checked in code: ASSURANCE.md section 4k table] ## §7 Deterministic Derivation 𝒟 *Plain:* before a pool can be quoted it has to be found, and there are two ways to find it: ask the factory, or work the address out. An answer from a factory is a claim; an address worked out is a result anyone can check. The protocol works the address out wherever the arithmetic allows and asks only where it does not. *Precise:* the industry's answer is to ask: a call to the venue's factory reads a storage mapping and returns an address, and the caller takes the factory's word. BlazePhoenix supports that answer, with four factory-call modes for venues whose deployments are not reproducible, and prefers a stronger one wherever the arithmetic allows: compute the address with no external call. An address that is computed can be verified by anyone holding the same three inputs; an address that is fetched can only be trusted. ### §7.1 The mechanism and the table The mechanism is CREATE2. The EVM makes a contract's address a pure function of its deployer, a salt and the hash of its init code: $$ \mathrm{pool} \;=\; \mathrm{addr}_{20}\!\left(\mathrm{keccak256}(\mathtt{0xff}\,\Vert\,\mathrm{origin}\,\Vert\,\mathrm{salt}\,\Vert\,\mathrm{initCodeHash})\right) $$ ^e8 where $\mathrm{addr}_{20}$ takes the last twenty bytes of the hash. The preimage is $1 + 20 + 32 + 32 = 85$ bytes (0x55) [derived]. The Core spells it out exactly once, in `create2Address`, which hashes the 0x55 bytes at its memory offset and masks the result to twenty bytes; `deriveAddress` selects the salt and the origin from the mode, and the Hub's attested Algebra derivation (§7.3) calls the same producer. One producer means the live derivation and the attested one cannot drift apart. The table below is the whole resolution surface. The selectors are recomputed with `cast sig`, 2026-11-16. | Mode | Family | Resolution | Salt or probe detail | |---|---|---|---| | 0 | V2 | factory call `getPair(address,address)`, selector `0xe6a43905` | none | | 1 | V3 / Algebra | factory call `getPool(address,address,uint24)`, `0x1698ee82`; on an empty answer, `poolByPair(address,address)`, `0xd9a641e1` | none | | 2 | Solidly | factory call `getPool(address,address,bool)`, `0x79bc57d5`; on an empty answer, `getPair(address,address,bool)`, `0x6801cc30` (classic Velodrome V1 shape) | none | | 3 | Concentrated Solidly forks (Slipstream, Velodrome CL) | factory call `getPool(address,address,int24)`, `0x28af8d0b` | none | | 4 | V2 CREATE2 | pure arithmetic | salt `keccak256(abi.encodePacked(t0, t1))`; origin = the factory | | 5 | V3 CREATE2 | pure arithmetic | salt `keccak256(abi.encode(t0, t1, fee))`; `fee == 0` is the Algebra sentinel: salt `keccak256(abi.encode(t0, t1))`, origin = the factory's `poolDeployer()` (`0x3119049a`), attested at admission | | 6 | Solidly clone CREATE2 | pure arithmetic | salt `keccak256(abi.encodePacked(t0, t1, stable))`; origin = the factory | | 7 | Concentrated-liquidity CREATE2 | pure arithmetic | salt `keccak256(abi.encode(t0, t1, tickSpacing))`; origin = the factory | | 8 | retired | a tombstone left by the Curve excision: `MODES_VALID = 0x2FF` refuses it at admission, and discovery stops on it without producing a hit | none | | 9 | V4 derive-scan | derive hookless poolIds and prove each live on the PoolManager (§5.1, §7.5) | learned codes, four canonical tiers, the row's paired extras; every candidate proven live | `t0 < t1` throughout: `deriveAddress` sorts the pair before use. Modes 0-3 are one `staticcall` each (two when the dialect fallback of §7.3 fires); modes 4-7 are zero calls and need only the correct init-code hash; mode 9 serves the one family whose pools can be located neither way. ### §7.2 A theorem, a claim, and a proof A derived address is a theorem over the pair: given the origin, the salt and the init-code hash, the address follows by keccak alone, and anyone who disputes it can recompute it. An asked address is a factory's claim about its own storage, and a factory can answer with a pool on other tokens. So an asked pool (modes 0-3) proves its own pair before discovery lists it. In the probe, after the candidate is known to carry code, the Hub reads the pool's `token0()` (selector `0x0dfe1681`) and `token1()` (`0xd21220a7`) and compares each full 32-byte word with the sorted pair; any difference drops the candidate. The reads are the same two the Router makes at the seam that pays, so a pool the executor would refuse is never listed, planned or ranked. [checked in code: H:1238-1240, C:1377-1395] Three properties follow from that shape, each readable in the code and none a claim about the venue. The proof runs on asked pools only, because a derived address is already a function of the pair. A pool whose `token0()` fails, runs out of gas under the cap, or answers fewer than 32 bytes yields the zero address, which differs from every real token, so the candidate is dropped: the check fails closed. And the comparison is against the Hub's own sorted pair, not against anything the factory returned. [derived from H:1240 and C:1377-1395] The hostile-venue matrix of §15 is what asked for this proof. It holds one misbehaviour per venue, among them a factory whose `getPair()` answers with a pool on other tokens, and crosses each with the calldata door and the solve-in-transaction door: settle with the delivered amount equal to the balance delta and nothing left on the Router, or refuse with a selector of ours. Its first run listed the impostor pool and the planner ranked it; the executor refused it at the seam that pays, so funds were never at risk, but the pair was refused while the impostor won the split. The pair proof at discovery was added to close that (2026-09-05). [measured, ASSURANCE.md section 4i; the dated commit is 917f1ea, 2026-09-05] ### §7.3 Two subtleties in the V3-shaped rows, and one in the asked ones *Algebra's origin.* Algebra (Camelot-class) charges a dynamic fee, so a fee can never be part of its identity. An Algebra registration therefore declares every fee as the zero sentinel (admission refuses a non-zero fee on an Algebra row in mode 5), mode 5 drops the fee from the salt, and the CREATE2 origin is the separate `poolDeployer()` contract Algebra factories expose rather than the factory. That origin is the one derivation input a factory could still steer after admission: a proxy changes its answer while its code hash stays intact. So the Hub asks `poolDeployer()` (selector `0x3119049a`) once, at `addFactory`, stores the answer as `factoryDeployer`, and derives from the stored origin ever after; a zero stored value means the factory itself is the origin. After control is renounced the attestation is frozen: a row already admitted cannot take a first pin, an existing pin never follows the live answer, and a resolver that stops answering never demotes a good pin to zero. [checked in code: H:904-933 (mayPin), H:1215-1230, C:678-692] *The dialect fallbacks.* Two families spell the factory lookup differently from the canonical selector. Algebra factories expose `poolByPair(address,address)` rather than `getPool`, so a mode-1 lookup that returns nothing retries under `0xd9a641e1` before giving up. Classic Solidly factories (Velodrome V1) expose `getPair(address,address,bool)` rather than `getPool`, so a mode-2 lookup that returns nothing retries under `0x6801cc30`. A factory that answers the canonical selector never pays either retry, and each ask is one `staticcall` under `GAS_CAP` = 100,000 gas that accepts exactly one 32-byte word. [checked in code: C:745-780, C:215] *The asked rows are pinned by code, then proved.* A factory-call row (modes 0-3) depends on what the factory answers later. Two independent checks stand between that answer and a listing. At admission the Hub stores the factory's code hash, and discovery skips a factory-call row whose factory no longer carries it; the skip fails closed and never reverts, so a changed dependency stops producing candidates while every other factory keeps serving the pair. And every answer that does come back is proved against the pair (section 7.2). The first check watches the factory's code, the second watches what it returns; neither relies on the other. [checked in code: H:891, H:1162, H:1240] ### §7.4 The final gate, and where deriving stops *Every candidate passes one gate.* The Hub discards any derived or asked address that carries no runtime bytecode. `extcodesize > 0` is the whole check (`hasCode`), so a wrong init-code hash, a stale registration or a chain where a family was never deployed produces nothing rather than a phantom venue. Bytecode at the address proves existence, not honesty, which is why admission, the believability band and the floors still stand between a located pool and a filled trade. The same pool derived under several `(fee, spacing)` combinations is listed once: before a hit is stored, the probe compares its address with every hit already stored. Admission also closes the other end: a CREATE2 mode with a zero init-code hash is refused (HubE(5)), and discovery repeats the test, so the derivation stays closed if admission ever changes. [checked in code: C:837-841, H:1210, H:1234, H:1243-1247, H:777-783] *The boundary between deriving and asking is empirical.* Clone-based venues such as Velodrome and Aerodrome stay on factory-call even though their init-code hash is known, because their CREATE2 origin lives inside an internal deterministic-clone deployer rather than the factory: the address is not reproducible from the public inputs, so the protocol asks. [carried from the 2.3; the table's modes 2 and 3 carry that choice, C:745-775] Uniswap V3 is the case in the other direction: its init-code hash is one constant wherever the canonical deployment is used, and the fork lane registers that one constant by derivation on Base, Optimism and Arbitrum, where routes found through the derived addresses are previewed and executed against live liquidity; Robinhood Chain's V3 is a separate deployment, so there the protocol asks the factory (§17). Derive where the arithmetic is sound, ask where it is not, and verify everything either way. ### §7.5 Discovery consumes the table row by row For each of at most `MAX_FACTORIES` = 16 registered factories, `discoverFor` runs one scan, and the scan's worst case is fixed by the registration, not by the chain's mood. A known factory is refreshed in place and never given a second row, so one address cannot fill the sixteen seats. [checked in code: H:144, H:803-818] The grid a row probes is its fee cells by its spacing cells, and an axis the row's mode never reads collapses to one cell: modes 1 and 5 read the fee axis, modes 3 and 7 read the spacing axis, and a mode that reads neither (0, 2, 4, 6) probes a single cell. Solidly rows (modes 2 and 6) probe each cell in both flavours, stable and volatile. The ceiling that `discoverFor` allocates is the sum over rows of cells $\times$ flavours, and it is computed by the same helper (`_axes`) that the scan loop uses, so the allocation and the loop cannot drift apart. [checked in code: H:285-286, H:1108-1117, H:1164-1180, H:1192-1198] Mode 9 is bounded by its table too, not by a count. A V4 row is scanned in up to four stages, and no stage is gated on the hits of another: | Stage | What is probed | Probe cost | |---|---|---| | native pass (only when the pair contains the wrapped native token) | the pair with the native currency in place of the wrapped one: the four canonical tiers (fee/spacing 500/10, 3000/60, 10000/200, 100/1), then the row's paired extras | one batched read each | | learned codes | the packed tier code learned for each of the two tokens (identical codes probed once) | one probe each, warm in the steady state | | canonical tiers | the same four tiers for the pair as given | one batched read | | the row's extras | `fees[i]` paired with `spacings[i]`, never a cross-product; admission requires equal lengths | one batched read | Every candidate is hookless: its poolId is recomputed from `(currency0, currency1, fee, tickSpacing, hooks = 0)` and is emitted only if the PoolManager's own storage shows it live (nonzero sqrt price and nonzero liquidity, read by `extsload`). A hooked pool cannot be emitted, because its hookless poolId does not exist in the manager. A learned code is a hint and never suppresses a search: the table is probed in every case, so a code planted by anyone cannot switch off a stage. [checked in code: H:1257-1344, H:1428-1448, H:1350-1405] The worst case for a V4 row with $n$ paired extras follows from that table: the native pass and the wrapped pass each probe $4 + n$ tiers, and the two learned codes add at most two, so the row can contribute at most $$ 2\,(4 + n) + 2 \;=\; 2n + 10 $$ ^e8a pools [derived]; the allocation in `discoverFor` is `2 * fac.fees.length + 10`, the same expression. The 2.3's "a V4 row reserving up to eight" is replaced by this: the reservation grows with the registered extras instead of capping at a constant, and a cap that dust at early tiers could exhaust is gone. The configuration surface is guarded at the door (§9): a structurally impossible venue cannot be stored. ## §8 The Monoslot *Plain:* the registry keeps everything it knows about a pool in one 256-bit word, so remembering a pool costs one storage read and one storage write, not a dozen. *Precise:* storage is the dominant cost of doing anything on the EVM: a cold `SLOAD` is 2,100 gas, and a registry that scattered a pool's attributes across separate slots would pay it again for every attribute, for every pool, on every route evaluated. BlazePhoenix packs a pool's routing state into a single word, the Monoslot, read once and decoded by pure arithmetic. [checked in code: C:2813-2866] | Bits | Field | Width | Meaning | |---|---|---|---| | 0 | `active` | 1 | slot is live | | 1–7 | reserved | 7 | bit 5 = stable curve (measured from the pool's own `stable()` at registration); bit 6 = native side swapped; bit 7 formerly the bridge flag, no longer written: the bridge bonus is read live from the pair (§9.2) | | 8–31 | `fee` | 24 | fee tier, in the venue's native unit; 0 is the sentinel for "measure the live fee" | | 32–39 | `kind` | 8 | venue kind (§4) | | 40–47 | `tier` | 8 | 0 = curated (seeded by an operator), 2 = permissionless (learned by trading or claimed) | | 48–59 | `conc` | 12 | concentration field, masked to `0xFFF` before packing; packed but not read by the score | | 60–63 | `bucket` | 4 | logarithmic depth bucket | | 64–95 | `lastUpdateTs` | 32 | wall-clock timestamp of the last anchored tick | | 96–127 | `emaIn` | 32 | reserved; written as zero at registration, not updated by the shipped tick | | 128–159 | `emaOut` | 32 | reserved; as above | | 160–191 | `swapCount` | 32 | activity count, saturating at $2^{32}-1$ | | 192–223 | `regBlk` | 32 | registration block | | 224–255 | `tau` | 32 | the pool's own clock: a moving mean of the seconds between its anchored ticks; 0 = not yet measured | ![FIG-4 — Monoslot bit layout: one 256-bit word, 13 fields](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-4.svg) *FIG-4 — Monoslot bit layout: one 256-bit word, thirteen fields, the concentration field masked to twelve bits so it can never bleed into the depth bucket.* The top field changed after the 2.3. It used to carry the block of the last touch, written on every tick and read by nothing; a block is a different amount of time on every chain, so the field now carries `tau`, the pool's own measured rhythm, which the score reads (§9.2). The encoding is still a sequence of shifts and ORs (`encodeSlot`, with the depth bucket written by `setBucket`): $$ s \;=\; a \;\vert\; f\!\ll\!8 \;\vert\; k\!\ll\!32 \;\vert\; r\!\ll\!40 \;\vert\; (c \wedge \mathtt{0xFFF})\!\ll\!48 \;\vert\; b\!\ll\!60 \;\vert\; t\!\ll\!64 \;\vert\; e_{\mathrm{in}}\!\ll\!96 \;\vert\; e_{\mathrm{out}}\!\ll\!128 \;\vert\; n\!\ll\!160 \;\vert\; B_{\mathrm{reg}}\!\ll\!192 \;\vert\; \tau\!\ll\!224 $$ ^e9 [checked in code: C:2840-2867; the term $B_{\mathrm{last}}\!\ll\!224$ of the 2.3 is replaced by $\tau\!\ll\!224$] One detail is a guard, not a convenience: the concentration field is masked to twelve bits *before* shifting, so it can never bleed into the depth bucket at bits [63:60]. The packing forbids the class of silent field overlap that corrupts packed state, rather than trusting callers to stay in range. Decoding is equally mechanical: each accessor is a shift and a truncation; the bucket writer clears its four bits before setting them; the swap count saturates instead of wrapping, so a full slot can never roll a busy pool's history over to zero. [checked in code: C:2860, C:2885-2890, C:3286-3319] The `tickSlot` writer clears the count, `tau` and timestamp fields together and writes the three back, so a tick cannot leave a half-updated clock. [checked in code: C:3286-3319] Notice what the word does not contain: a price. The Monoslot carries what is needed to rank a pool (activity, depth class, fee, kind, flags, recency) and nothing that could be mistaken for a quote, so the registry's memory cannot price a trade. Prices are computed fresh, from live reserves, inside the frame that trades on them; the packed word only decides which pools are worth asking. [derived from §4.4 and §9.6: no quote path reads a Monoslot field as a price] The update path honours the same economy: a swap through a known pool rewrites the word once, one `SSTORE` over one `SLOAD`. The bucket is re-computed on every tick; the clock fields (count, `tau`, timestamp) move only on an *anchored* tick, one whose smaller side moved at least $2^{-16}$ of the pool's mass (`MATERIAL_SHIFT` = 16), so dust pays gas and moves no clock (§9.2). [checked in code: H:1796-1813, C:2932-2936, C:3234-3247, C:3286-3296] Why one word matters is a question of multiplication. For each pair the Solver scores the registered pools of up to four topologies: the direct one and one per bridge slot (`TOPOLOGIES = 1 + BRIDGE_SLOTS` = 4, with `BRIDGE_SLOTS` = 3, the Hub's `MAX_BRIDGE_ROUTES`). [checked in code: S:113-114] The 2.3 stated a per-pair candidate cap of eight and "about thirty pools" scored per trade; no `MAX_CANDIDATES` constant exists in the Solver, Hub or Core at the commit this paper cites, so the cap and the product are not restated. The ceilings the code names are per pair and per route: at most `MAX_SLOTS` = 16 registered pools per pair (§9.3), at most four Gate wrappers per pair, and at most `MAX_LEGS_PER_HOP` = 5 legs on each of at most `MAX_HOPS` = 2 hops. At 2,100 gas per cold slot, a five-slot-per-pool layout would price a scoring pass of $N$ pools at $5N \times 2{,}100$ gas, and the Monoslot at $N \times 2{,}100$: a fivefold saving that grows with $N$ [derived: the five-slot layout is a counterfactual, not a measured design]. The Hub's `psisOf` returns every candidate's score in one batched call. [checked in code: H:1672] The Monoslot is not an optimisation applied to on-chain routing; it is one of the reasons on-chain routing is affordable. ## §9 The Self-Healing Registry and the Vitality Field Ψ *Plain:* the registry learns which pools are alive by watching them trade, and forgets the ones that go quiet; nobody has to feed it a list. *Precise:* most aggregators know their venues because a keeper indexes pools off-chain and pushes lists on-chain: a trusted process, a staleness window and an operational dependency, three things a protocol that solves routes on-chain cannot accept. BlazePhoenix takes the opposite stance: the registry learns liquidity by trading it. ### §9.1 Learning by trading, and the pair-proof On every executed leg the Router calls the Hub's `recordSwap` (`onlyRouter`, `whenLive`), passing the pool, its kind, its fee, the pair, the amounts and the depth it measured. The Hub first refuses any kind the Router could not have executed (`KINDS_EXECUTABLE`: kinds 0, 1, 4, 5, 6 and 8), a local defence that does not depend on the Router staying what it was at deploy, and then takes one of two paths. [checked in code: H:1796, H:209-215] A known pool's Monoslot is ticked, once, through `tickSlot`. Before that, a row that lies is not refreshed: the Hub asks the *row's own* kind whether the pool still holds what it declares, and a pool that now declares more than it holds stops ageing in, so its score decays and `_canInsert` takes the seat back. The swap itself already executed and is unaffected. [checked in code: H:1810-1813] The tick re-buckets depth every time; the count, `tau` and timestamp move only on an anchored tick (§8), counted from the *currently decayed* base, never from the raw historical total. [checked in code: C:3286-3319] An unknown pool takes the cold path. It must first clear admission (`_canInsert`, §9.3). Then it must prove the claim it is about to store: for every pair-shaped kind (`KINDS_PAIR_PROOF`: V2, V3, Solidly, Algebra) the Hub reads the pool's own `token0()` and `token1()` and requires them to match the pair, at most two `staticcall`s, on the cold path only. Every argument to `recordSwap` is caller-controlled calldata carried in the Router's route, so without this proof an attacker could register a contract they wrote, under a pair they picked, at a depth they picked, holding neither token. For the two V4 kinds, whose `pool` field is a truncated id with no bytecode, the proof is re-derivation: the tick spacing is recovered, the id recomputed and matched, hookless-only, so a hooked pool can never register through this door; a native V4 pool is matched in both orientations of `(address(0), T)`. A mismatch *skips* registration and never reverts, because the user's swap has already settled and must never fail over a registry decision. [checked in code: H:1845-1895] What the row stores is also measured, not declared. The `fee` and `hooks` that arrive in calldata do not enter the row: the hooks field is written as zero (every path to this point has either proven the pool hookless or belongs to a hookless kind); the fee is the authenticated one for V4, the sentinel 0 for Algebra and for a V3 pool whose live fee must be read, and for V2 and Solidly (which have no `fee()`) also 0, so the house's single fee producer answers instead of the caller; and the *kind* is refuted by the pool's own shape (`provenShape`), because a kind planted by whoever front-runs the first swap would otherwise be read as the pool's shape for ever. [checked in code: H:1898-2032 (the comment block REG-01/REG-02 and the derive-don't-declare rule), C:3025] This is the "coordinates, not facts" rule of §2.4 applied to the registry's own door. The pair-proof at registration dates from September 2026. The Hub campaign offers the Hub pools trading other tokens on every run (the pair reversed, one token shared, two foreign) and `invariant_ActiveEntriesTradeThePair` reads every active entry's `token0`/`token1`; the mutant is a guard entry that dies to it (§15.3). Discovery carries the same proof for asked pools (§7). There is no indexer to run and no moment at which the protocol is blind because a server is down. An operator `seedPool` door pre-populates pairs at deployment (tier 0, curated), and a permissionless `claimV4` door admits hookless V4 pools under their own proof (§5.1): the pool must pair with a routable bridge, show a nonzero price and nonzero liquidity in the manager's own storage, and be quotable at its fee (`HubE(9)` otherwise). [checked in code: H:1036-1054] Both doors are optimisations, not dependencies: an empty registry heals itself into a populated one through ordinary trading. ### §9.2 The score The Vitality Field Ψ separates quality from capacity, reading only the Monoslot and the pair's live bridge status (Core `psi`): $$ \Psi(s, t) \;=\; V(s, t)\cdot 2^{\,b(s)} \cdot \left(1 + \tfrac{2{,}500}{10^{4}}\,\mathbf{1}_{\mathrm{bridge}}\right)\cdot\left(1 + \tfrac{500}{10^{4}}\,\mathbf{1}_{\mathrm{conc}}\right) $$ ^e10 [checked in code: C:2961-2973] The depth bucket $b = \min(15, \lfloor \log_{10}(d / 10^{15}) \rfloor)$ enters through its weight $2^{b}$: each decade of depth doubles the weight, so depth counts sub-linearly. A deep pool is firmly favoured, but a merely healthy pool is not erased by a giant. A pool on a bridge pair earns +25 %, because bridges are the connective tissue of the liquidity graph; a concentrated pool earns a further +5 %. The bridge bonus is read live from the pair by one producer (`_pairBridged`) rather than from a bit frozen at registration, and within a pair it is uniform, so it can never reorder pools of the same pair. [checked in code: H:2112-2114] **The decay, on the pool's own clock.** In the 2.3 every pool decayed by one fixed step, 24,576 s. That treats a pool that trades every minute and a pool that trades every week the same way: the busy one keeps a stale row for days, and the weekly one dies between two honest trades. Each row now carries $\tau$, a moving mean of the time between its own anchored ticks (§8), and the decay runs in steps of $h = 4\tau$ (`VITALITY_STEPS_PER_TAU` = 4); while $\tau$ is unmeasured the step is the old 24,576 s. [checked in code: C:2925-2926, C:2985-3004] With age $a = t - t_{\mathrm{last}}$: $$ h \;=\; \begin{cases} 4\tau & \tau > 0 \\ 24{,}576\ \mathrm{s} & \tau = 0 \end{cases} \qquad \sigma = \left\lfloor a / h \right\rfloor, \qquad c(s,t) \;=\; \mathrm{swapCount}(s) \gg \sigma \;-\; \left\lfloor \frac{c\,(a \bmod h)}{2h} \right\rfloor, \qquad V = \max\!\left(1,\ \left\lfloor \frac{c \cdot 24{,}576}{h} \right\rfloor\right), $$ ^e11 and the pool is dead ($V = 0$) once $\sigma > 31$. [checked in code: C:2945-2959, C:2985-3004] Inside a step the count falls along the chord from $c$ to $c/2$ instead of waiting for a stair at the step's end. Dividing by the step turns the count into a *rate*, trades per 24,576 s, so scores compare across pools and chains. A pool trading at its own pace settles at a decayed count of $2m = 8$ whatever that pace is [derived in the code comment: an interval is $1/m$ of a step, each tick keeps $c - c/(2m)$ and adds one, the fixed point is $c = 2m$ with $m = 4$], which is why the rate, not the count, ranks. A silent pool reaches zero and full evictability after $32h = 128\tau$: 786,432 s, about 9.1 days, on the unmeasured step; 7,680 s, about 2.1 hours, for a pool that trades every 60 s ($\tau$ = 60 s, $h$ = 240 s); 128 days for a pool that trades daily ($\tau$ = 86,400 s, $h$ = 345,600 s) [derived]. The clock itself is a moving mean. An anchored tick that closes an interval $\Delta t$ moves $\tau$ one eighth of the way to $\Delta t$, rounded up (`TAU_EMA_SHIFT` = 3), so a steady cadence is reached instead of stalling in a dead zone; the first interval starts from $24{,}576 / 4 = 6{,}144$ s so that no single interval is read whole. A tick is *anchored* only if the smaller side of the swap moved at least $2^{-16}$ of the pool's mass, so dust pays gas and moves no clock. [checked in code: C:3286-3319, C:2932-2936] The constants were fixed on a replay of 11,761 real swap intervals (2026-10-27: a fast and a medium pool on Base and on Arbitrum, one long-tail pool on Arbitrum): at $m = 4$, no live pool died between two of its own swaps (0 of 11,761; $m = 2$ lost 3, $m = 3$ lost 1), and a stopped pool died after 83 to 249 of its mean intervals. [recorded with the constants: code comment C:2915-2924] A single swap revives a decayed pool, and revival is honest: the count resumes from what the decay left standing, never from the pre-decay total, so one dust swap after a long silence cannot restore a pool's accumulated rank (and a dust swap is not even anchored). The scorer keeps two zeros apart: a *dead* slot (empty, never ticked, or past the horizon) scores a true zero, drops to the back of the probe order and loses its seat first, while a *live* slot whose small rate merely rounded away is floored to one, so a real, recently touched pool never vanishes on a rounding artefact. The window is wall-clock seconds deliberately: a block-counted window means a different real duration on every chain, and an earlier implementation that shifted every 16 blocks decayed to zero about 128× faster than documented. ![FIG-5 — Vitality decay on the pool's own clock](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-5.svg) *FIG-5 — Vitality decay on the pool's own clock. Three curves of the decayed count against idle time, one per pool: $\tau$ = 60 s ($h$ = 240 s, dead at 2.1 h), the unmeasured step ($h$ = 24,576 s, dead at 9.1 d), and $\tau$ = 86,400 s ($h$ = 345,600 s, dead at 128 d); each starts at an illustrative 4,096 and halves per step with the chord inside it; a swap on the middle curve revives it from the decayed base.* *TAB-9.2 — worked example, derived above: the same 32-step horizon on three pools, in the pool's own seconds. A pool with a measured $\tau$ dies after $32h$, which is 128 mean intervals.* | $\tau$ | Step $h$ ($= 4\tau$ when $\tau$ is measured) | Dies after $32h$ | In mean intervals | |---|---|---|---| | 60 s | 240 s | 7,680 s (2.1 h) | 128 | | unmeasured | 24,576 s | 786,432 s (9.1 d) | n/a | | 86,400 s | 345,600 s | 11,059,200 s (128 d) | 128 | ^tab-9-2 ### §9.3 Eviction Each pair holds at most `MAX_SLOTS` = 16 pools. When a seventeenth wants in, the Hub scores every incumbent by full Ψ (depth, bonuses and all, so a deep newcomer can displace a shallow-but-warm squatter) and admits the newcomer only if its projected score clears the weakest incumbent by a margin (`_canInsert`): $$ \Psi_{\mathrm{new}} \;>\; \Psi_{\mathrm{worst}} + \left\lfloor \Psi_{\mathrm{worst}}/4 \right\rfloor, \qquad \Psi_{\mathrm{new}} = 2^{\,b(d_{\mathrm{new}})}\Big(1 + \tfrac{2{,}500}{10^{4}}\,\mathbf{1}_{\mathrm{bridge}}\Big) $$ ^e13 [checked in code: H:93, H:2037-2075] The newcomer is scored conservatively: vitality one, its own depth bucket, no concentration bonus, and a zero-depth newcomer is refused outright. It now *does* carry the pair's bridge term, because the term is uniform across the pair: scored without it, the newcomer met a bar raised by a term only its rivals were given. The margin closes a griefing vector: under a bare displace-the-lowest rule, an adversary could hold sixteen shallow slots barely active and keep a deep competitor out; ranked by Ψ with a margin, the genuinely deeper pool still wins. The constant's limit is stated where it is enforced: the newcomer's weight is a power of two, times 1.25 on a bridge pair, while the incumbent's score is continuous, so the effective margin runs from about 100 % (an incumbent just above one) down to about 25 % (an incumbent at 51, smallest admissible newcomer 64); the rule's 25 % is also the floor of the behaviour, never undercut. When the seat is actually taken, the eviction ranks by $(\Psi \ll 4) \,|\, \text{bucket}$, so when every row has aged to $\Psi = 0$ the shallowest row goes, not the lowest index. [checked in code: H:2149-2170] A heavily traded incumbent is hard to displace until its decay does its work: on the unmeasured step, two idle days cost it seven halvings [derived: 172,800 / 24,576 = 7.03]; on a fast pool's own clock the same idleness is far longer in its own intervals. A permissionless V4 claim clears the same margin with the pool's measured liquidity, converted to token-denominated virtual reserves on the short side, as its depth. ### §9.4 Discovery, and its gas knob Discovery is a public view: for any pair the Hub walks its factory list, derives candidates by the modes of §7, applies `hasCode` and the pair-proof, and the Solver merges the result with the registered set, deduplicated by address, so neither source can suppress the other. To bound gas, the Solver applies a freshness gate (`_registryFresh`): when at least `MIN_FRESH_VENUES` = 3 *curated* registered venues for the pair have been touched within `DISCOVERY_TTL_SECONDS` = 3,600, it trusts the registry and skips the derivation sweep. [checked in code: S:123, S:130, S:1658-1687] Only curated rows (tier 0) can vouch: a permissionless row is written by whoever swapped first, and counting it let three self-registered dust pairs, kept fresh by three dust swaps an hour, switch discovery off for a pair and hide every honest venue never registered. The permissionless row stays a candidate; it no longer chooses the path. The gate is a gas and coverage knob and never a safety parameter: the Iron-Law floor and the user's minimum protect every fill regardless of how stale the registry is, because neither reads the registry at all. [derived from §11 and §9.6] ### §9.5 The configuration surface The Hub's registration doors are guarded on the way in. `addFactory` rejects, before any state is written (`HubE(5)`): a kind outside `KINDS_ROUTABLE`; a mode outside `MODES_VALID` (0x2FF); a CREATE2 mode with a zero init-code hash; a mode bound to a kind its row of `MODE_KINDS` does not allow (a V2-salt slot to anything but V2 or Solidly, a clone slot to a non-Solidly kind, a V3-salt slot to anything but V3, Algebra or the Gate's kind 9, and kind 9 on no other line); an Algebra registration that does not declare every fee as the zero sentinel; and a V4 derive-scan row bound to any kind but V4 or with mispaired fee and spacing lists. A known factory is refreshed in place, never given a second row, so one address cannot exhaust the sixteen seats (`HubE(4)`); after control is renounced, a live row accepts only an identical re-add, so a factory whose runtime code moved cannot be re-armed and a derive row cannot be converted into an ask row. [checked in code: H:704-832, H:877-887] `allowHook` pins the hook's codehash at admission, and a hook is routable only while allow-listed *and* unchanged (`isHookLive`); after renunciation, de-listing is gone and a moved hook stays paused for ever. [checked in code: H:543-562, H:621-624] Bridges are at most `MAX_BRIDGES` = 3; `addBridge` is a curator power that survives renunciation (a duplicate add is a no-op, a fourth is `HubE(7)`), `removeBridge` a control power that dies with it. [checked in code: H:649-668] ### §9.6 The structural boundary One sentence bounds everything above: **Ψ can hide a venue; it can never misprice one.** The score orders the probe and decides eviction; it truncates nothing; no quote, no floor and no allocation reads it, because those are computed from in-transaction measurements, so memory reaches route selection only by omission. [derived from §4.4, §11 and §9.2: Ψ is an argument of the probe order and of eviction only] Whatever the registry believes, the worst it can surface is a worse-but-real live price, and the value such a price can pass through is capped by the strictest of the believability band, the Iron-Law floor re-derived in-frame, and the minimum the user set. The registry decides what is seen; it has no vote on what is paid. This is the monotonicity rule of §2.4 stated for the registry: nothing the caller can write into memory improves what the caller is paid. For a Gate wrapper the property is also pinned by test: its quote is the same at Ψ = 0 and at Ψ ≥ 2^22 (`test_GatedAuto_GateQuoteIsFlatInPsi`). ## §26 The machine underneath *Plain:* this chapter lists the engineering choices that let the rules of the earlier chapters hold on a real chain, and says what each one costs. *Precise:* the invariants of Part I are only as strong as the substrate that carries them, so each choice below is stated with the check that would catch its failure. ### §26.1 The size gate, measured in the build Every deployed contract must fit EIP-170 (24,576 bytes of runtime code). The CI job "EIP-170 size guard (release profile)" runs `forge build --sizes src` with solc 0.8.36 and fails at 24,000 bytes, 576 bytes before the protocol limit; the same limit is enforced in `test/DeployedSizeGate.t.sol`. [checked in code: README:160; measured: CI job 137472871936, 6387350, 2026-11-23] At the commit this paper cites the runtime sizes (bytes, with margin to 24,576) are: Router 22,717 (1,859), Hub 21,780 (2,796), Core 19,303 (5,273), Solver 21,349 (3,227), Quoter 19,892 (4,684), Gate 10,758 (13,818), Math 9,768 (14,808), GateWrapper 4,414 (20,162); the eight adapters range from 3,014 to 6,347. [measured: equal to the README table and to `.sizes-snapshot`] The largest initcode is the Solver's, 31,508 bytes, under the EIP-3860 limit of 49,152. [measured] The margins are small on purpose to see: the Router has 1,859 bytes left, so every guard added is paid for in bytes, which is why §2.7's rule "each guard with its mutant" is also a size budget. [derived: margin column] *TAB-26.1 — runtime sizes at the cited commit, in bytes, with the margin to EIP-170 (24,576).* | Contract | Runtime (bytes) | Margin to 24,576 | |---|---|---| | Router | 22,717 | 1,859 | | Hub | 21,780 | 2,796 | | Core | 19,303 | 5,273 | | Solver | 21,349 | 3,227 | | Quoter | 19,892 | 4,684 | | Gate | 10,758 | 13,818 | | Math | 9,768 | 14,808 | | GateWrapper | 4,414 | 20,162 | ^tab-26-1 ![FIG-26 — Runtime bytes against the 24,000 and 24,576 lines](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-26.svg) *FIG-26 — bar chart of runtime bytes against the 24,000 and 24,576 lines.* ### §26.2 The transient lock The Router keeps its re-entrancy lock, and nine other per-swap slots, in transient storage (`tload`/`tstore`), which the EVM clears at the end of the transaction: a lock that cannot outlive the call that set it. The modifier `nrEntrant` reads the slot `keccak256("blaze.r.lock")`, reverts `RouterE(7)` if it is non-zero, sets it to 1, runs the body and sets it to 0. [checked in code: Router:193, 307-314] The scope is one lock per top-level entry, not one per hop. Five entry points carry it: `swapExactIn`, `swapExactInWithPermit2`, `swapExactInNative`, `swapBestExactIn` and `claimFee`. [checked in code: Router:347, 444, 465, 518, 558] The one internal bridge, `selfExecutePrePulled`, is deliberately not guarded: it is callable only by the Router itself (`RouterE(1)`) and the outer entry already holds the lock, so a guarded inner call would always trip `RouterE(7)`. [checked in code: Router:597-606] A revert rolls the lock back with the rest of the transient writes (EIP-1153 semantics, as the comment at Router:2060 relies on), so a failed swap cannot leave the Router locked. What the lock costs is derivable from the EVM, not measured here: `TLOAD` and `TSTORE` cost 100 gas each (EIP-1153), so the lock is one load and two stores, 300 gas of opcodes; a persistent-storage lock would pay 20,000 for the first `SSTORE` from zero plus 2,100 for the cold slot, 22,100 before any refund (EIP-2200, EIP-2929). [derived: EIP constants; no test in the repo isolates the lock's gas, the gas instrument measures whole transactions, `isolate = true` in foundry.toml] The refusal is witnessed from the side that is easy to forget: `ReentryFromTheOutputTransfer` re-enters from the output token's `transfer`, mid-swap, and asserts the nested call is refused by `RouterE(7)` itself and not by a later guard. [checked in code: test/ReentryFromTheOutputTransfer.t.sol header] The README lists "transient lock" among the public guarantees; this section adds no guarantee beyond the code lines above. ### §26.3 The callback is authenticated by a committed pool 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, so long as the calldata holds at least 4 + 64 bytes, and hands the two words to `_v3Callback`. [checked in code: Router:2107-2117] The authentication is a committed address, not a derived one. Just before it calls `pool.swap`, `_execV3Amt` 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. [checked in code: Router:1998-2003] The callback then requires `msg.sender == expected` and `expected != 0`, else `RouterE(6)`; it takes the amount owed from the callback, refuses zero and anything above the committed maximum with `RouterE(8)`; and it clears all three values before it pays, so a pool that re-enters the callback reads `expected == 0` the second time and reverts `RouterE(6)`. [checked in code: Router:2146-2165] After `pool.swap` returns, the three slots are cleared again, and a pool slot that is still set means no callback ran: the leg's input is then counted as zero, never as paid. [checked in code: Router:2010-2019] The Router also measures that the pool received what the callback paid (`RouterE(13)` for a fee-on-transfer input). [checked in code: Router:2172-2174] CREATE2 is therefore not part of this check. The derivation of §7.1 (`create2Address`, `deriveAddress`) lives where a pool is discovered and attested, in the Hub and the Core, and the Router never calls either of them. [derived: `grep -n 'create2Address\|deriveAddress'` on the Router at 6387350 returns nothing] What bounds a fake pool in the Router is the committed maximum (a callback can never take more than this leg's input), the single-shot clear, the measured delta, and the per-leg floor, which requires the leg to deliver at least `BPC.LEG_FLOOR_BPS` of its bound (80 %, rounded up) whenever the leg has a bound (an attestation or an in-frame quote), or the whole swap reverts `RouterE(5)`. [checked in code: Router:1748-1749, 1894; Core:405] Three tests keep the guard honest: `CallbackAuthImpostorDrain` (a swap is in flight, a different contract asks to be paid, the assertion is the impostor's balance), `V3ContextDiesWithTheSwap` (the context is cleared when a pool returns without calling back) and `FallbackCalldataLengthGate`. [checked in code: the three files' headers at 6387350] The mutant that each kills is stated in those headers for the first two (deleting the sender check; deleting the clear after the swap). ### §26.4 Assembly where it is measured The contracts are Solidity 0.8.36 with inline Yul, built with `via_ir = true`, `optimizer_runs = 200` and `evm_version = "cancun"` (the version that has `tload`, `tstore` and `mcopy`) in both the default and the release profile, with `bytecode_hash = "none"`. [checked in code: foundry.toml:6-20, 53-77] There are 96 inline-assembly blocks in the seven top-level source files of `src/` (eight contracts: the GateWrapper lives in Gate.sol), by contract Core 37, Router 33, Solver 12, Quoter 7, Hub 4, Math 3, Gate 0, GateWrapper 0. [measured: `grep` for an `assembly` opener outside comments, 969bcc6] The comment in `foundry.toml` says why `via_ir` stays on: several functions (`Solver._buildHop`, `Math._weights`, `Router._execute`) are written assuming the stack-slot folding of that pipeline, and without it the build would likely hit "stack too deep". [checked in code: foundry.toml:10-12] Three uses, each with the reason the source gives. (1) Transient context: the lock and the callback's committed pool are `tload`/`tstore` blocks written by hand (§26.2, §26.3). (2) Exact gas arithmetic: `Solver._walkOnItsOwnBudget` rebuilds a plan as a static self-call and sizes its gas by hand, W = min((SOLVE_B - s - 20,000) * 63 / 64, WALK_CAP), so that EIP-150's 63/64 rule hands the call the whole W; it splices the answer back without ABI decoding. [checked in code: Solver:317-353; the threshold is tested in test/CapacityWalkBudget.t.sol, named in the Solver comment] (3) Memory moves: `mcopy` for the candidate arrays in the Solver and the Math. [checked in code: Solver:335, 348; Math:128] The one gas figure the source itself gives for a choice of this kind is not an assembly figure: merging the two reads `token0()` and `token1()` of a leg's pool into one snapshot saves 1,498 gas for one leg up to 7,355 for five (1.65 % of that transaction) and 58 bytes of Router code, and closes a crack, since a pool that answered the two reads differently could fabricate `legOut == tokenIn` and switch the leg floor off. [as stated in the code comment, Router:1905-1915] The G7/G8 gas campaign (`docs/GAS_CAMPAIGN_G7_G8.md`) measures whole routes per chain, venue kind and discovery mode (quote, record, execute); no cell in it isolates an assembly block, so this paper gives no gas figure for Yul as such. [checked in code: that document's section 1 and 4] ### §26.5 A stateless library, pinned by hash The per-hop choice lives in `BlazePhoenixMath`, a library with no storage of its own (no `sload`, `sstore` or `storage` pointer in it), called by the Solver. [measured: grep of the Math source at 969bcc6, 0 hits] The Solver reaches it by `delegatecall`, one per hop: `select` is a `public view` function of the library, and the Solver's own comment says "ONE delegatecall per hop, static inside the solve's staticcall (EIP-214)". [checked in code: Math:20-23 (header: the Solver delegatecalls it once per hop; called from a STATICCALL the delegatecall stays static, EIP-214), Math:120-123, Solver:790-795] The library works on its own ABI copy of the arrays and answers with a permutation `map`, which the Solver replays on its own arrays. The Solver then checks that the returndata length is exactly the canonical ABI encoding of the values it decoded, and reverts `SolverE(7)` otherwise, because the ABI decoder alone would accept a longer returndata. [checked in code: Solver:812-816] The Solver refuses to deploy if the library's deployed code differs from the code it was built with: the constructor compares `address(BlazePhoenixMath).codehash` with `keccak256(type(BlazePhoenixMath).runtimeCode)` and reverts `SolverE(6)` on a mismatch. [checked in code: Solver:200-206] The comment gives the reason the pin is sufficient: a library with no state-changing function carries no deploy-address guard and links no other library (the Core it uses is all internal), so its deployed code is exactly `runtimeCode`. The linker puts the library's address as a `PUSH20` at every call site, so there is no storage slot and no setter by which it could change. [checked in code: Solver:200-205] The Gate and the adapters declare no `VERSION`.