-
Notifications
You must be signed in to change notification settings - Fork 149
fix(permit): nonce not supported #5653 #5672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes update the version of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Eip2612PermitUtils
participant EthereumNode
User->>Eip2612PermitUtils: Request permit signature
loop Fetch nonce
Eip2612PermitUtils->>EthereumNode: Get nonce (method index N)
EthereumNode-->>Eip2612PermitUtils: Return nonce
alt Nonce is '0x' or NaN
Eip2612PermitUtils->>Eip2612PermitUtils: Try next method index (N+1)
else Valid nonce
Eip2612PermitUtils-->>User: Return permit signature
end
end
Assessment against linked issues
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
7d69a6a to
79bbbe2
Compare
apps/cowswap-frontend/src/modules/permit/hooks/usePreGeneratedPermitInfo.ts
Outdated
Show resolved
Hide resolved
| .catch(() => this.getTokenNonceByMethod(tokenAddress, walletAddress, nonceMethodNameIndex + 1)) | ||
| .then((res) => { | ||
| if (res === '0x' || Number.isNaN(Number(res))) { | ||
| - return Promise.reject(new Error('nonce is NaN')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which cases res is not a valid number? Some specific tokens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That I don't know.
In the AAVE case specifically, it's returning 0x instead of throwing, which is a problem because it doesn't check the other nonce methods.
To be honest, I don't know why it started to not throw either, as I assume before it did given that we were able to call the right method in the past.
OR the AAVE token implementation changed 🤷
|
Hey @alfetopito , I don't see 'gas-fee' labels in token lists in this PR: The label appears when I sign a permit only for a token |
That's expected. |
|
Changes LGTM then! |
bb1b5c1 to
79bbbe2
Compare
Great! I have reverted the change to make use of the pre-generated permit again. Also, I think DAI should work again 🤞 I'd like to check the DAI issue in another task to not block this fix. |
elena-zh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving since you will investigate DAI issue in a separate task



Summary
Fixes #5653
Permits should work again for AAVE and like tokens
To Test
See test instructions in the linked issue
Permits should continue working for other tokens other than AAVE, like DAI, USDC, etc.
Summary by CodeRabbit