Skip to content

fix: Use original tx gas#7933

Open
dan437 wants to merge 4 commits intomainfrom
fresh-gas-estimation
Open

fix: Use original tx gas#7933
dan437 wants to merge 4 commits intomainfrom
fresh-gas-estimation

Conversation

@dan437
Copy link
Contributor

@dan437 dan437 commented Feb 13, 2026

Explanation

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

Medium Risk
Touches gas-limit selection and batch submission behavior in Relay post-quote flows; incorrect gas propagation could cause failed or suboptimal transactions, but changes are scoped and covered by tests.

Overview
Fixes post-quote Relay batch submission to use the live transaction.txParams.gas for the original (prepended) transaction, ensuring any beforeSign-hook gas updates are respected instead of relying on quoted gasLimits.

Adjusts Relay batch gas estimation to handle EIP-7702 returning a single combined gas limit by expanding it into per-transaction limits (prepending the original tx gas), and updates/extends tests and the package changelog accordingly.

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

@dan437 dan437 requested a review from a team as a code owner February 13, 2026 13:55
// the TransactionController re-estimates it at submit time with fresh
// on-chain state. The quote-time estimate in gasLimits[0] is still used
// for fee display via relay-quotes, but must not be locked in here.
const isOriginalTx = isPostQuote && index === 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mismatched conditions cause incorrect gas removal for relay step

Medium Severity

The isOriginalTx flag checks isPostQuote && index === 0, but the original transaction is only prepended to allParams when isPostQuote && transaction.txParams.to is truthy. If isPostQuote is true but transaction.txParams.to is falsy, the original tx isn't prepended, yet isOriginalTx would still be true for index 0 — incorrectly setting gas to undefined on the first relay step instead.

Additional Locations (1)

Fix in Cursor Fix in Web

@dan437 dan437 force-pushed the fresh-gas-estimation branch from 1227b66 to b895a33 Compare February 13, 2026 14:27
@dan437 dan437 changed the title fix: Get fresh gas estimation fix: Use original tx gas Feb 13, 2026
@dan437 dan437 force-pushed the fresh-gas-estimation branch from b895a33 to b17637e Compare February 13, 2026 14:28
@dan437 dan437 requested a review from a team as a code owner February 13, 2026 14:31
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
…essary code

Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
…h submission, update changelog

Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
@dan437 dan437 force-pushed the fresh-gas-estimation branch from da405bd to e1cbc8b Compare February 13, 2026 17:46
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

expandedGasLimits: finalGasLimits,
});
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EIP-7702 expansion unscoped to post-quote flows

Medium Severity

The gas limit expansion in calculateSourceNetworkGasLimitBatch is not scoped to post-quote flows. For non-post-quote calls with 2+ relay params (e.g., approve + deposit) and an EIP-7702 single combined gas limit, params[0] is the first relay step — not the original transaction — so paramGasLimits[0] is the wrong value. The expansion changes gasLimits from [combinedLimit] to [relay1Gas, combinedLimit], which causes the gasLimit7702 check in relay-submit.ts to evaluate to undefined, inadvertently disabling 7702 batch mode for non-post-quote flows.

Additional Locations (1)

Fix in Cursor Fix in Web

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