Skip to content

feat: estimate gas batch action#7405

Merged
matthewwalsh0 merged 4 commits intomainfrom
feat/estimate-gas-batch
Dec 9, 2025
Merged

feat: estimate gas batch action#7405
matthewwalsh0 merged 4 commits intomainfrom
feat/estimate-gas-batch

Conversation

@matthewwalsh0
Copy link
Copy Markdown
Member

@matthewwalsh0 matthewwalsh0 commented Dec 8, 2025

Explanation

Add TransactionController:estimateGasBatch messenger action to estimate gas for transactions batches.

Use in Relay quotes to more accurately estimate gas limit for source transaction batches, in addition to existing TransactionController:estimateGas messenger action for single source transactions.

References

Related to #23563

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

Introduce batch gas estimation (estimateGasBatch) in TransactionController and use it in Relay to compute buffered gas limits and drive submission (including optional EIP‑7702 gasLimit7702).

  • Transaction Controller:
    • API: Add estimateGasBatch method and messenger action TransactionController:estimateGasBatch to estimate gas for batches (returns totalGasLimit and per-tx gasLimits).
    • Utils: Implement estimateGasBatch and update simulateGasBatch to return both total and per-transaction limits; support EIP-7702 batching and upgrade checks.
    • Batch Flow: Use totalGasLimit from simulation; accept optional gasLimit7702 in TransactionBatchRequest.
    • Types/Exports: Export new action type; add TransactionType.relayDeposit.
    • Tests: Add coverage for new action and gas batch logic.
  • Transaction Pay (Relay):
    • Quotes: Estimate gas via messenger (estimateGas/estimateGasBatch), apply per-chain gasBuffer feature flag, and attach original.metamask.gasLimits to quotes.
    • Submit: Use provided gas limits; when a single limit is present for EIP-7702 batches, pass gasLimit7702; tag deposits as relayDeposit.
    • Feature Flags: Add getGasBuffer with default and per-chain overrides.
    • Tests/Changelog: Update tests and changelog accordingly.

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

@matthewwalsh0 matthewwalsh0 changed the base branch from main to temp/lint December 8, 2025 23:19
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review December 8, 2025 23:41
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners December 8, 2025 23:41
Comment thread packages/transaction-controller/src/utils/gas.ts
@matthewwalsh0 matthewwalsh0 force-pushed the feat/estimate-gas-batch branch from 56f5eb4 to 01b4824 Compare December 9, 2025 12:37
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners December 9, 2025 12:37
@matthewwalsh0 matthewwalsh0 changed the base branch from temp/lint to main December 9, 2025 12:57
@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Dec 9, 2025
Merged via the queue into main with commit 206599b Dec 9, 2025
281 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/estimate-gas-batch branch December 9, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants