-
Notifications
You must be signed in to change notification settings - Fork 369
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
Add all uint/int/bytes primitive types for EIP-712 signing #10224
Merged
Conversation
This file contains 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
jeanregisser
commented
Mar 16, 2023
jeanregisser
commented
Mar 16, 2023
jeanregisser
added a commit
to valora-inc/wallet
that referenced
this pull request
Mar 17, 2023
### Description This fixes swaps always failing on Uniswap. Uniswap started using [Permit2](https://uniswap.org/blog/permit2-and-universal-router) for their swaps and it requires a signed EIP-712 message with some types which were unsupported by our implementation (specifically `uint160` and `uint48`). I've submitted a PR to support the needed types in `sign-typed-data-utils` from `@celo/utils`: celo-org/celo-monorepo#10224 This PR includes a patch, so we don't have to wait for a release of the Celo SDK. ### Test plan - Updated e2e tests https://user-images.githubusercontent.com/57791/225853763-5a35d4ca-3e55-4005-9051-ba48b3d05be7.mp4 This shows someone who's never swapped on Uniswap: - First "Allow" is a one time max approval of cUSD for [Permit2](https://uniswap.org/blog/permit2-and-universal-router) - Second "Allow" is the Permit2 signature - Third "Allow" is the actual transaction signing Subsequent swaps (of cUSD) won't need the one time approval. And the Permit2 signature will only be needed if the existing one expired. Right now Uniswap Permit2 signed messages are valid for 1 month with max approval. The benefit is that if the user interacts with another app using Permit2, they won't need the initial transaction for the approval. They can just sign a Permit2 message which doesn't cost anything. ### Related issues - Fixes RET-664 ### Backwards compatibility Yes
eelanagaraj
approved these changes
Mar 17, 2023
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.
nice!
aaronmgdr
approved these changes
Mar 20, 2023
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.
Description
This adds all uint/int/bytes primitive types for EIP-712 signing.
Swapping on Uniswap with Valora was failing with the following error:
Unrecognized type uint160 is not included in the EIP-712 type list
Uniswap started using Permit2 which requires signing a message containing
uin160
anduint48
types which were missing in the implementation.See also ethereum/go-ethereum#26770
Other changes
Also added support for all the added types for
zeroValue
Tested
Related issues
N/A
Backwards compatibility
Yes
Documentation
N/A