-
Notifications
You must be signed in to change notification settings - Fork 78
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
Allowance Module: use signTypedData to sign a Transfer Authorization #70
Comments
You don't need to add 4 to the V byte in the first snippet. V > 30 is only required for EIP-191 signatures: https://docs.safe.global/learn/safe-core/safe-core-protocol/signatures |
Thanks for the feedback! I actually initially tried without changing the v byte - the signature produced is also not valid in this case unfortunately. i.e. the code below also doesn't produce a valid signature:
|
Have you verified that the hash generated by your code matches the hash produced by contract's |
Also, I noticed that in the second snippet, the typehash is missing the
Perhaps the contract contains an incorrect type hash if the second snippet works? 🤔 Edit: |
Yes, I verified the raw hash produced by my code with the I think you are right and there may be an error in the contract. To produce the right hash you do need to pass It would therefore not be possible to produce a valid signature with standard EIP-712 signing. Does that make sense? |
Also doubled checked the contract code and this seems to confirm this issue:
|
We'll discuss this internally tomorrow and devise a plan to fix the issue. It's true that right now, the contract is unusable with eip-712. Thank you for flagging this sir! |
Great! Thanks for taking this up so quickly :) |
I was unable to create a valid Transfer Authorization signature for the Allowance module using ethers'
signTypedData
EIP-712 signing function.Both the signature produced with the EIP-712 schema described in this module's readme as well as an adjusted version (based on the correction of an error I highlighted in this pull request) return:
execution reverted: expectedDelegate == signer && delegates[address(safe)][uint48(signer)].delegate == signer
I was able to find a workaround by producing a hash that, when signed, produces a valid signature. I've attached the code at the bottom of this issue.
Letting end users sign raw hashes is however not good UX- and security-wise, hence my question regarding a way to properly sign with signTypedData (or another EIP-712 method to sign it, I'm not set on using ethers).
This is the code with signTypedData that returns incorrect signatures (I have tried a few variations that also failed):
This is the code producing the raw hash and valid signatures:
I've tried to find any other discussions about this but was unfortunately unsuccessful - any help / pointers would be greatly appreciated. I saw answers on related discussions from you @rmeissner, I hope it's okay to tag you here :)
The text was updated successfully, but these errors were encountered: