fix(cdp): exact Permit2 allowance and no swap-submit retry - #1409
Open
SashaMIT wants to merge 1 commit into
Open
fix(cdp): exact Permit2 allowance and no swap-submit retry#1409SashaMIT wants to merge 1 commit into
SashaMIT wants to merge 1 commit into
Conversation
Approve only the swap fromAmount to Permit2 (TS+Python, EVM+smart) instead of maxUint256, and submit swap once so a post-broadcast throw cannot double-execute. Co-authored-by: Cursor <cursoragent@cursor.com>
🟡 Heimdall Review Status
|
This was referenced Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
approve(PERMIT2, maxUint256)/2**256-1whenever the quote reported an allowance issue. This PR approves only the swapfromAmountatomic units, matching the hygiene already proposed for the 0x provider in fix(zerox): exact Permit2 allowance and EIP-712 bind checks #1394.account.swap()/swap_quote.execute()inretryWithExponentialBackoff. A throw after broadcast can submit a second swap. Submission is now at-most-once (same economic class as fix(sushi): report executed swap when Route event is missing from receipt #1401's false-failure retry, different root).Test plan
pnpm exec jest --testPathPattern='cdp/(cdpEvmWallet|cdpSmartWallet)ActionProvider' --coverage=false(49/49)approveamount equalsfromAmountatomic units and is notmaxUint256Related: #1394 (zeroX Permit2), #1401 (sushi false-failure retry). Distinct providers / roots.
Made with Cursor