fix: match permit deadline to order validTo for CoW limit orders#2888
Open
fix: match permit deadline to order validTo for CoW limit orders#2888
Conversation
The permit deadline was hardcoded to 1 hour while CoW order validTo can be up to 1 year. This caused orders with long expiries to become permanently unfillable once the permit expired, since the post-hook's permit() call would revert and solvers would skip the order. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
grothem
approved these changes
Feb 27, 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
useSwapTokenApprovalwas hardcoded to 1 hour (Date.now() + 3600), while CoW Protocol ordervalidTocan be set up to 1 year by the userpermit()call reverts, and they skip the ordervalidTotimestamp as the permit deadline, ensuring the permit stays valid for the order's entire lifetimeRoot cause (traced from a real stuck order)
Order:
0xcaa1f0...Simulation: Tenderly
validTo= Feb 2027aWBTC.permit()→ reverts (deadline passed)"ERC20: transfer amount exceeds balance"openwith 0 fills foreverChanges
validToparam toSwapTokenApprovalParamsvalidTois provided, it's used as the permit deadline instead of the 1-hour defaultvalidToto the approval hookvalidTo, param is optional, falls back to 1 hour)Test plan
validTo🤖 Generated with Claude Code