-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Optimize EOA signature verification #2661
Conversation
Prev gas: EOA: 2000 + 3500 SC: 2000 Now gas: EOA: 3500 SC: (signature.length is 64 or 65 ? 3500 : 0) + 2000
Hello @k06a, First of all, thank you for this PR, we noticed it a while back and failed to let you know. For that I am sorry.
Unfortunatelly, we have no way to catch an internal library call :/ We will investigate other options (like having a non reverting ecrecover that returns an "error" enum + the recovered address). What do you think ? |
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.
[duplicate]
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.
We should ensure that, if signer is an ERC1271 implementing contract, the initial ecrecover doesn't revert and the contract call is performed.
@Amxx WDYT about ECDSA-tryRecover introduced in the latest commit? |
Conflicts: contracts/utils/cryptography/ECDSA.sol contracts/utils/cryptography/SignatureChecker.sol
@Amxx nice changes! I believe this |
The problem I see with this As far as I know custom errors cannot be passed around as values. Perhaps this is something we should raise with the Solidity team. |
@frangio possibly we could return ABI-encoded version ( |
@frangio
In the futur we can remove the |
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! Thanks everyone.
Good |
Optimize EOA signature verification. Since Berlin HF
isContract()
would cost 2000 gas.Prev gas:
Now gas: