Skip to content

do not charge the relayer's gas twice, nor a deduction nobody took - #3154

Merged
Flotapponnier merged 1 commit into
devfrom
fix/pump-gas-and-funding
Oct 22, 2026
Merged

Flotapponnier merged 1 commit into
devfrom
fix/pump-gas-and-funding

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Two blockers from the deep audit of bench 268, both introduced by the gross-up.

The gas was charged twice

methodVersion 5 exists because v4 did this on Solana: it added the whole network cost, including a relayer's on a sponsored swap, where the user spends no SOL and the terminal takes the gas out of the fee they already paid — charging those rows twice by a median of 52 bps.

The gross-up walked back into it on pump's EVM rows. The audit measured network alone at 161.1 bps on a $2.03 buy.

The accounting now follows FOMO's rule, already in the spec. For a user committing G, pump deducting D, the relayer paying g out of D:

before now
base G + g G
network g g
terminal D D − g

The two still sum to the deduction, so nothing is invented and nothing is lost. A swap the user sent themselves is untouched: there the gas is their own outlay on top.

The gross-up had no funding test

It checked the slug alone. The deduction is a property of the router rather than of the bridge path — 6 of the 7 exactly readable spends were not relayer-sent, and a locally funded trade would not land on level − (0.05 + r·level) to 5e-7 at five different levels — but that is a reason to believe it, not a reason to skip a test that is cheap and per-swap.

If anything arrives at the router in the transaction, its sender funded the trade there and the spend is already what they committed. 4 of 40 looked like that. Grossing one adds 62 bps at $25 and 142 at $5, in the direction that makes the product look dearer.

Tests

The gas test is written against the swap the audit recomputed from the chain (40.872485 → 41.097145, deduction 0.224660), so the audit's own figures are the fixture. It asserts that terminal plus network equals the deduction exactly, and that the base did not grow by the gas.

Two blockers from the deep audit, both mine.

methodVersion 5 exists because v4 added a relayer's gas to the base on
sponsored swaps, charging those rows twice by a median of 52 bps. The gross-up
walked straight back into it on pump's EVM rows: the relayer signs and pays,
its costs come out of the deduction already inside the grossed amount, and the
gas was added on top. The audit measured network alone at 161.1 bps on a $2.03
buy.

The accounting now follows FOMO's rule, which the spec already states. For a
user committing G, pump deducting D, and the relayer paying g out of D: base G
rather than G+g, network g, terminal D-g. The two still sum to the deduction,
so nothing is invented and nothing is lost. A swap the user sent themselves is
untouched, because there the gas is their own outlay on top.

And the gross-up had no funding test: it checked the slug alone. The deduction
is a property of the router rather than of the bridge path, which is why 6 of
the 7 exactly readable spends were not relayer-sent, but that is a reason to
believe it, not a reason to skip a test that is cheap and per-swap. If anything
arrives at the router in the transaction, its sender funded the trade here and
the spend is already what they committed: 4 of 40 looked like that. Grossing
one of those adds 62 bps at $25 and 142 at $5, in the direction that makes the
product look dearer.

The gas test is written against the swap the audit recomputed from the chain,
so its figures are the fixture.
@Flotapponnier
Flotapponnier merged commit 063a242 into dev Oct 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant