fix(swapper): buffer BobGateway EVM gas limit and raise default slippage - #12428
Conversation
Pad only the gas limit of the broadcast tx (a ceiling) to reduce the risk of out-of-gas reverts. The displayed network fee (getEvmTransactionFees) is left unbuffered, and unused gas is refunded, so the fee actually paid is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughTwo numeric parameter adjustments for the BobGateway swapper: the default slippage decimal percentage is raised from ChangesBobGateway Parameter Adjustments
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/swapper/src/swappers/BobGatewaySwapper/endpoints.ts`:
- Around line 100-102: The gasLimit calculation in the file uses toFixed(0)
which performs standard rounding and can round down, potentially undermining the
intended 20% padding buffer. Replace the toFixed(0) rounding with an explicit
ceiling operation (using a method like Math.ceil or equivalent BigNumber ceiling
method) to ensure the padded gas limit is always rounded up and never falls
below the computed 1.2x multiplier result.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 98331311-0229-4a19-9cf3-34de14837464
📒 Files selected for processing (2)
packages/swapper/src/constants.tspackages/swapper/src/swappers/BobGatewaySwapper/endpoints.ts
Description
Two small, focused fixes for the BOB Gateway swapper:
Buffer the EVM broadcast gas limit by 20% —
getUnsignedEvmTransactionnow pads the gas limit of the tx we actually sign/broadcast by1.2×. This reduces the risk of out-of-gas reverts on the final tx, since the quote-time gas estimate can under-estimate actual execution.getEvmTransactionFees) is intentionally left unbuffered so quote fee comparisons stay honest, and unused gas is refunded — so the fee actually paid by the user is unaffected.Raise BOB Gateway default slippage to 3% (
0.005 → 0.03) — aligns with the higher default already used for other bridge-style swappers where off-chain quote estimates can drift.Issue (if applicable)
closes #
Risk
Low-to-moderate. Touches the on-chain EVM transaction for BOB Gateway sells (gas limit only — no change to
to/value/data), plus a default slippage tolerance bump.BOB Gateway swapper only (EVM → BOB / EVM sells, and EVM→BTC offramp). Gas-limit padding affects every BOB Gateway EVM broadcast tx; slippage change affects BOB Gateway quotes.
Testing
Engineering
gasLimitis ~1.2× the raw estimate, while the network fee shown in the trade input is unchanged (uses the unbuffered estimate).Operations
Screenshots (if applicable)
N/A
🤖 Generated with Claude Code
Summary by CodeRabbit