Skip to content

fix: batch transactions for delegated accounts to avoid in-flight tx …#8125

Open
cloudonshore wants to merge 1 commit intomainfrom
fix/batch-delegated-accounts
Open

fix: batch transactions for delegated accounts to avoid in-flight tx …#8125
cloudonshore wants to merge 1 commit intomainfrom
fix/batch-delegated-accounts

Conversation

@cloudonshore
Copy link

@cloudonshore cloudonshore commented Mar 5, 2026

…limit

Ethereum nodes only allow 1 pending transaction for EIP-7702 delegated accounts. When a swap requires token approval, the approve and swap transactions are submitted separately, causing the second to be rejected.

This fix detects delegated accounts via isAtomicBatchSupported and routes them through the batched transaction path, combining approve + swap into a single transaction.

Changes:

  • Expose isAtomicBatchSupported as a TransactionController messenger action
  • Add delegation check in BridgeStatusController before tx submission
  • Allow 7702 batching for delegated accounts without requiring gas sponsorship

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
Changes transaction submission routing for some EVM swaps/bridges by forcing batched execution when an account is detected as EIP-7702 delegated. Risk is moderate because it touches swap/bridge transaction batching and 7702 fee-handling paths, which could impact submission behavior on supported chains.

Overview
Ensures EVM swaps/bridges for EIP-7702 delegated accounts are submitted via the batched path so approval + trade are combined into a single in-flight transaction (avoiding node rejections due to the delegated-account pending-tx limit).

Exposes TransactionController:isAtomicBatchSupported as a messenger action and wires it into BridgeStatusController.submitTx to detect delegated accounts, and updates batch construction (getAddTransactionBatchParams) to allow 7702 batching when the account is already delegated even if the quote isn’t gas-sponsored (gasIncluded7702).

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

…limit

Ethereum nodes only allow 1 pending transaction for EIP-7702 delegated
accounts. When a swap requires token approval, the approve and swap
transactions are submitted separately, causing the second to be rejected.

This fix detects delegated accounts via isAtomicBatchSupported and routes
them through the batched transaction path, combining approve + swap into
a single transaction.

Changes:
- Expose isAtomicBatchSupported as a TransactionController messenger action
- Add delegation check in BridgeStatusController before tx submission
- Allow 7702 batching for delegated accounts without requiring gas sponsorship
@cloudonshore cloudonshore requested review from a team as code owners March 5, 2026 17:40
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.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

// Enable 7702 batching when the quote includes gasless 7702 support,
// or when the account is already delegated (to avoid the in-flight
// transaction limit for delegated accounts)
const disable7702 = gasIncluded7702 !== true && !isDelegatedAccount;
Copy link

Choose a reason for hiding this comment

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

7702 batch matching misses bridge transaction types

High Severity

The findAndUpdateTransactionsInBatch function's 7702-specific matching only handles TransactionType.swap and TransactionType.swapApproval, but the new isDelegatedAccount condition now also routes cross-chain bridge transactions (using TransactionType.bridge / TransactionType.bridgeApproval) through the 7702 batch path. For delegated accounts, the transaction meta will have delegationAddress set, entering the is7702Transaction block — but since neither TransactionType.bridge nor TransactionType.bridgeApproval is matched there, it falls through to the default data-comparison check, which fails for 7702 batch-execute calls whose data differs from the original trade data. This causes tradeMeta to be undefined, throwing "tradeMeta not found" and breaking bridge transactions from delegated accounts.

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