fix: batch transactions for delegated accounts to avoid in-flight tx …#8125
fix: batch transactions for delegated accounts to avoid in-flight tx …#8125cloudonshore wants to merge 1 commit intomainfrom
Conversation
…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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.


…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:
Explanation
References
Checklist
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:isAtomicBatchSupportedas a messenger action and wires it intoBridgeStatusController.submitTxto 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.