fix: align approval hooks and permit spender checks#7620
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying explorer-dev with
|
| Latest commit: |
e579f42
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://791de3b3.explorer-dev-dxz.pages.dev |
| Branch Preview URL: | https://deepsec-medium-04-approval-p.explorer-dev-dxz.pages.dev |
Deploying swap-dev with
|
| Latest commit: |
e579f42
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0c0e309b.swap-dev-5u6.pages.dev |
| Branch Preview URL: | https://deepsec-medium-04-approval-p.swap-dev-5u6.pages.dev |
- key permit support caches by spender - bypass default pre-generated permit data for custom spenders - restore eth-flow approval typing so app checks pass
fairlighteth
left a comment
There was a problem hiding this comment.
✅ AI Review (Codex GPT-5, worked 4m): no new non-duplicate findings
Review completed. I found no new non-duplicate comments worth posting.
Review scope and related context
Related context checked:
usePermitInfo,permittableTokensAtom, andgetTokenPermitInfo: current code now keys permit support lookup/cache by spender and avoids reusing default pre-generated permit data for custom spenders.- Approval-gate call sites in classic approval, permit pre-generation, ETH-flow, and Safe bundle paths: current diff looks internally consistent with the updated PR description.
- Existing PR comments: only bot/deploy comments are present, so there were no active human review threads to de-duplicate against.
…approval-permit-integrity # Conflicts: # apps/cowswap-frontend/src/modules/tradeFlow/services/safeBundleFlow/safeBundleEthFlow.ts
|
Superseded by the smaller draft waterfall:
Review order: |



Summary
Addresses the approval/permit integrity findings in
cowswap-frontendby making spender handling, widget approval gating, and permit cache keys explicit across the approval paths.This also includes follow-up hardening found during review:
Review guide
Shared approval gate/helper
callOnBeforeApprovalWidgetHook; it centralizes the widgetON_BEFORE_APPROVALpayload and keeps the actual spender/approval amount explicit.Classic + permit approval paths
useNeedsApproval, permit-in-advance, and permit info lookup. These paths should now use the same spender for allowance, pending approval, hook payload, and permit cache lookups.ETH-flow + Safe bundle paths
Permit cache/storage changes
QA Testing
Automated checks passed on head
e579f425f:pnpm exec jest --config apps/cowswap-frontend/jest.config.mjs --runInBand --runTestsByPath apps/cowswap-frontend/src/modules/ethFlow/containers/EthFlow/utils/getEthFlowCurrencyToApprove.test.ts apps/cowswap-frontend/src/common/hooks/useNeedsApproval.test.ts apps/cowswap-frontend/src/modules/erc20Approve/hooks/useApproveCurrency.test.ts apps/cowswap-frontend/src/modules/erc20Approve/hooks/useGeneratePermitInAdvanceToTrade.test.ts apps/cowswap-frontend/src/modules/permit/hooks/usePermitInfo.test.ts apps/cowswap-frontend/src/modules/permit/hooks/usePermitCompatibleTokens.test.tspnpm exec nx run permit-utils:test --runInBand --runTestsByPath=libs/permit-utils/src/lib/generatePermitHook.test.ts --runTestsByPath=libs/permit-utils/src/lib/getTokenPermitInfo.test.tspnpm exec nx run common-utils:test --runInBand --runTestsByPath=libs/common-utils/src/getIsNativeToken.test.tspnpm exec tsc --noEmit -p apps/cowswap-frontend/tsconfig.app.jsonpnpm exec tsc --noEmit -p libs/permit-utils/tsconfig.lib.jsonpnpm exec tsc --noEmit -p libs/common-utils/tsconfig.lib.jsonGitHub checks for
e579f425fwere still running when this body was updated.Known QA gaps
Preview URLs