Skip to content

Conversation

@rarquevaux
Copy link
Contributor

@rarquevaux rarquevaux commented Jan 7, 2026

Explanation

Fix: Align bridge transaction gas price with validation

Problem

Users could submit bridge/swap transactions that fail with "insufficient funds" despite the UI showing sufficient balance. This occurred because:

  • Validation (in bridge-controller) uses medium gas price estimates
  • Submission (in bridge-status-controller) was using high gas price estimates

This mismatch allowed transactions to pass validation but fail immediately at submission time. In the STX case it times-out in Sentinel.

Example (uses a non STX transaction for simplicity but the same happens with STX)

A swap of ~0.002854 ETH → USDC on Base:

{
"quote": {
"srcTokenAmount": "2829027500000000",
"gasLimit": 726516,
"effectiveGas": 431877
}
}Submission failed with:

{
"error": {
"code": -32003,
"message": "insufficient funds for gas * price + value: have 2860507066881008 want 2864770358251460"
}
}The user had 0.00286 ETH but the transaction required 0.00286 ETH (4.26 gwei more than available) due to the higher high gas price at submission.

Fix

Changed bridge-status-controller to use medium gas estimates on submission (matching validation):

An alternate fix would be to use high on validation but it would prevent more swaps to go through.
NB: this happens in the non-gasless cases so irrespective of the fix we will see less and less occurrences of this issue as we release gasless swaps and auto-upgrade on all networks and clients.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Aligns gas estimation used at submission with validation to prevent mismatches (e.g., insufficient funds).

  • In gas.ts, select maxFeePerGas/maxPriorityFeePerGas from txGasFeeEstimates[BRIDGE_PREFERRED_GAS_ESTIMATE] instead of hardcoded high
  • Tests updated in gas.test.ts to validate preferred estimate usage, adjust fixtures to Medium, and improve missing-estimate handling
  • Changelog updated under Unreleased to note the fix

Written by Cursor Bugbot for commit fcfac09. This will update automatically on new commits. Configure here.

@rarquevaux rarquevaux requested a review from a team as a code owner January 7, 2026 23:07
@rarquevaux rarquevaux force-pushed the feat/STX-340-medium-gas-price-swap-submission branch 2 times, most recently from dde907b to 8f0f7cf Compare January 7, 2026 23:15
@rarquevaux rarquevaux requested a review from a team as a code owner January 7, 2026 23:15
@rarquevaux rarquevaux force-pushed the feat/STX-340-medium-gas-price-swap-submission branch 3 times, most recently from 568c31e to 41d37dc Compare January 8, 2026 17:32
@rarquevaux rarquevaux force-pushed the feat/STX-340-medium-gas-price-swap-submission branch from 41d37dc to 874f50a Compare January 9, 2026 00:19
@rarquevaux rarquevaux force-pushed the feat/STX-340-medium-gas-price-swap-submission branch from 874f50a to fcfac09 Compare January 9, 2026 00:41
@rarquevaux rarquevaux added this pull request to the merge queue Jan 9, 2026
Merged via the queue into main with commit 54faead Jan 9, 2026
286 checks passed
@rarquevaux rarquevaux deleted the feat/STX-340-medium-gas-price-swap-submission branch January 9, 2026 15:45
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.

3 participants