-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(forge): cheatcode eip712 #10570
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
base: feat/eip712-with-solar
Are you sure you want to change the base?
Conversation
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.
Please run cargo cheats
twice to fix failing tests
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.
looks good, left couple of comments / nits!
So if I get this right the DX would be:
- generate bindings with
forge bind-json
(by default goes toutils/JsonBindings.sol
but could be configurable to differentpathToJsonBindings
path) - use
vm.eip712HashType(typeDefinition)
orvm.eip712HashType(pathToJsonBindings, typeDefinition)
to generate EIP-712 representation
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.
looks good, only some nits from my side before sending.
others, pls chime in re how the EIP-712 cheatcodes are designed to work and if you see any issue #10570 (review)
CC @klkvr
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.
lgtm!
cool, let's wait for others to review and i'll merge it with the main feature branch. |
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.
sorry, just realized params should be calldata and not memory
Adds a new cheatcode to safely generate hashes following the EIP-712 spec.
implementation details
ref #4818
due to the lack of polymorphism, it is not possible for the cheatcode to accept a struct. Because of that, users must provide a string.
this impl allows users to either pass:
forge bind-json
example usage