-
Notifications
You must be signed in to change notification settings - Fork 24
Add SignerERC7913 and verifiers for P256 and RSA #98
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
…ier for P256 keys
* @dev Helper library to verify key signatures following the ERC-7913 standard, with fallback to ECDSA and ERC-1271 | ||
* when the signer's key is empty (as specified in ERC-7913) | ||
*/ | ||
library ERC7913Utils { |
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.
I think I would prefer having just one implementation of the isValidSignatureNow
function. The rationale is that signature
always ends up in memory for any valid verification, and a portion of signer
will be copied too. So I doubt there's actual benefits in having two versions. I'll simplify for now following #109
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.
The memory version uses a slice, that does a memory copy.
Overall, calldata versions are often cheaper because they don't copy to memory until the very last point (when the Abi call is encoded) contrary to the memory version that copy to memory at least once more (in this case 2 times)
Overall not a big deal. Having a single "memory" version is probably good enough. Just explaining the initial idea
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.
Yeah I saw the memory version is required, so I'd agree with just one "memory" version for now unless there are significant savings measured.
Thanks for answering though, now please you go 👨🍼
Includes
contracts/interfaces/IERC7913.sol
: ERC-7913 interfacecontracts/utils/cryptography/ERC7913SignatureVerifierP256.sol
a stateless verifier for P256 keys. This is unopinionated and production ready, so I don't think it needs to be a mockcontracts/utils/cryptography/ERC7913SignatureVerifierRSA.sol
a stateless verifier for RSA keys. This is unopinionated and production ready, so I don't think it needs to be a mockcontracts/utils/cryptography/ERC7913Utils.sol
library for checking signer's signatures using ERC-7913 (with ECDSA/ERC-1271 fallback)contracts/utils/cryptography/SignerERC7913.sol
abstract signer that uses an ERC-7913 signer.