fix(STX-340): use medium fee for gas fee in submission #7582
+39
−5
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.
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:
bridge-controller) usesmediumgas price estimatesbridge-status-controller) was usinghighgas price estimatesThis 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
highgas price at submission.Fix
Changed
bridge-status-controllerto usemediumgas estimates on submission (matching validation):An alternate fix would be to use
highon 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
Note
Aligns gas estimation used at submission with validation to prevent mismatches (e.g., insufficient funds).
gas.ts, selectmaxFeePerGas/maxPriorityFeePerGasfromtxGasFeeEstimates[BRIDGE_PREFERRED_GAS_ESTIMATE]instead of hardcodedhighgas.test.tsto validate preferred estimate usage, adjust fixtures toMedium, and improve missing-estimate handlingWritten by Cursor Bugbot for commit fcfac09. This will update automatically on new commits. Configure here.