Hooks
No-op
A built-in hook that is called and changes nothing. It exists to measure what a hook costs a swap.
The no-op hook answers every call with an unchanged reply. A pool with it behaves exactly like a pool with no hook, except that each swap pays for the calls. That makes it the baseline for any hook's overhead: whatever a real hook costs above the no-op is the cost of its logic, not of being a hook.
What a hook costs#
Measured in a Solana test VM (LiteSVM) on the tested binaries, with matching pool, liquidity and swap parameters:
| Swap | Compute units | vs. no hook | Swap accounts |
|---|---|---|---|
| No hook, one range | 78,806 | — | 10 |
| No-op hook, one range | 132,865 | +69% | 10 + 1 hook account |
| Dynamic-fee hook, one range | 123,364 | +57% | 10 + 1 hook account |
| No hook, crossing ticks | 80,828 | — | 10 |
| No hook, all 64 boundaries | 349,923 | — | 10 |
| No-op hook, all 64 boundaries | 419,966 | +20% | 10 + 1 hook account |
The numbers include transaction plumbing and token transfers. Program-address searches vary between runs, which is why the dynamic-fee swap can come out cheaper than the no-op one. Treat them as a measurement of this build, not as a routing guarantee; a router should simulate the route it sends.
The hook's share is fixed per call, so it matters most on small swaps that cross no ticks and least on swaps that cross many.
Permissions#
The no-op needs no bits. Pools created with it in the app use before swap and after swap (mask 3) so the calls actually happen.