fix(simulation): charge forward overhead on signed exclusive Ekubo pools - #1257
Merged
Merged
Conversation
louise-poole
approved these changes
Jul 31, 2026
louise-poole
left a comment
Collaborator
There was a problem hiding this comment.
Makes sense. Looks good to me 👍
A SignedExclusiveSwap pool reverts in beforeSwap, so every swap on it goes through Core.forward with a signature the extension recovers and a nonce it writes. The concentrated math is identical either way, so the simulated gas missed the whole overhead and an exclusive route was costed as a direct swap. Measured at 62373 in Ekubo's own harness against a plain-swap baseline added alongside the existing signed cases, so lock, settle, fee, tick spacing, position and amount match on both sides.
cargo fmt ran on stable, but this repo formats with nightly, so the whole crate was reformatted. Restores every file except the one this branch changes.
The constant is the non-zero-fee delta: `forward` plus the signature check is 37,852 and charging the signed fee is another 24,521. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tamaralipows
force-pushed
the
tnl/ekubo-signed-swap-gas
branch
from
August 3, 2026 16:19
d911145 to
9347bfb
Compare
tamaralipows
enabled auto-merge
August 3, 2026 16:20
Contributor
|
This PR is included in version 0.348.2 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
SignedExclusiveSwappool reverts inbeforeSwap, so every swap goes throughCore.forwardwith a signature to recover and a nonce to write. The curve math is identical either way, so the simulated gas missed all of it and an exclusive route was costed as a direct swap.The number
Measured in Ekubo's harness (
SignedExclusiveSwap.t.sol,--isolate), adding a plain-swap baseline so the lock, settle, fee, tick spacing, position and amount match on both sides:forward+ signature = 37,852; fee accounting = 24,521. The constant is the non-zero-fee delta, 62,373 — Fynd normally signs a fee above zero, and erring high is the safe direction.Why here, not the estimator
estimate_gas_usagedocuments the split: pool gas comes fromget_amount_out; the estimator adds only whatget_amount_outcannot see (transfers, approvals, router). This overhead is inside the pool call, and the estimator addsgroup.estimated_gasto its own total, so it flows through either way. Execution's per-protocol lists classify token movement, not pool execution cost.Happy to move it if you'd rather all gas accounting live in the estimator — that needs an address in
protocol_specific_addresses.jsonand achainparam on a public function.Impact
Fynd uses output net of gas both to select exclusive routes and to set the taker's committed amount, so understating it biases against the taker twice. ~19 bps on a $1,000 trade at 10 gwei.
Dormant until
SIGNED_EXCLUSIVE_SWAP_ADDRESSis the deployed address. Found via fynd#365; tracks ENG-6283.🤖 Generated with Claude Code