Risk & known gaps
This code is unaudited and has never held value. What follows is the list of things that could go wrong and have not been ruled out — stated here rather than left for a reader to discover.
Known gaps
- No independent audit. Reentrancy through
donateand cross-swap fee manipulation via the tick recorded inafterSwaphave been reasoned about and partially mutation-tested, but not reviewed by a third party. - The deviation cap is reasoned, not calibrated. Its bound comes from tick-space reasoning about the gap between real volatility and order-of-magnitude feed errors, not from fitted feed-failure data. It catches gross errors, not a subtly wrong value inside the tolerance.
- No L2 sequencer uptime check. Analysed and accepted: the aggregator cannot update while the sequencer is down, so the existing staleness check fires and the pool over-charges rather than under-charges. The residual cost is a window of ceiling-priced swaps after a restart.
- Aggregator circuit breakers unchecked. Non-binding on the deployed feed, where the bounds are sentinel defaults orders of magnitude outside any reachable price. Would need revisiting against a different feed.
- The capture share's elasticity is bounded, not measured. See the mechanism page.
Anticipated attacks
| Attack | Mitigation |
|---|---|
| Attaching the hook to a foreign pool | Currency-pair binding in beforeInitialize, both halves covered by tests |
| Unsettled delta bricking every swap | donate plus the returned positive delta net to exactly zero |
| Surcharge donation with zero in-range liquidity | Pool.donate reverts there; guarded and skipped rather than reverting the swap |
| Self-dealing: attacker is the sole in-range LP | Net cost (1−s)·S; at s=1 there is no counterparty left to extract from |
| Oracle manipulation of the mispricing signal | Staleness bound, degrade to the ceiling, and a deviation cap against a block-sampled pool average |
| Intra-block price manipulation of that average | The average samples the block-open tick, so a same-block swap cannot move it |