Skip to content

fix: set gas floor for swaps to prevent out of gas#930

Open
owen-eth wants to merge 1 commit into
mainfrom
fastswap-gas-limit-floor
Open

fix: set gas floor for swaps to prevent out of gas#930
owen-eth wants to merge 1 commit into
mainfrom
fastswap-gas-limit-floor

Conversation

@owen-eth
Copy link
Copy Markdown
Contributor

Describe your changes

Adds a 400k floor on the fastswap executor gasLimit to prevent OOG reverts on simple single-hop routes.

Why

For simple routes, Barter returns a small GasEstimation (~70k), and the formula × 2.5 + 135k/152k lands at ~310-330k — right at the median observed natural
gasUsed (316,980 across 29 on-chain samples). With the EIP-150 63/64 cascade through nested CALLs, inner calls OOG before the swap completes. Reproduced
against revm directly (anvil eth_simulateV1) and Tenderly archive.

Why a floor (not a multiplier bump)

Distribution is bimodal: simple routes ~272-320k natural gas, multi-hop ~600-700k. Barter's estimate already scales for the larger ones — only the simple
cluster hits the cliff. Floor at 400k touches only Barter estimates ≤ ~106k; everything above is unchanged.

Issue ticket number and link

Fixes # (issue)

Checklist before requesting a review

  • I have added tests that prove my fix is effective or that my feature works
  • I have made corresponding changes to the documentation

@owen-eth owen-eth requested a review from harshsingh1002 May 11, 2026 20:55
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