ECDSA: add parse and tryParse#5814
Conversation
🦋 Changeset detectedLatest commit: 23c393f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| * @dev Parse a signature into its `v`, `r` and `s` components. Supports both 65 bytes and 64 bytes (eip-2098) | ||
| * signature formats. Returns 0, 0, 0 is the signature is not in a proper format. | ||
| */ | ||
| function parse(bytes memory signature) internal pure returns (int8 v, bytes32 r, bytes32 s) { |
There was a problem hiding this comment.
For discussion (I'm undecided): should this have a special name given that, unlike the rest of this library, it allows 64-65 byte malleability? E.g., parseMalleable.
There was a problem hiding this comment.
Would that note be good enough ?
IMO not using signatures as unique identifier is basic good practices, and I'm not sure we should complexify the name of the functions (creating possible confusion?) as a way to "help enforce" these basic good practices.
There was a problem hiding this comment.
not using signatures as unique identifier is basic good practices
Yeah I agree and we should move towards this assumption. My point is only about how this breaks from the existing library design.
How about deprecating malleability protection in all of the ECDSA library?
There was a problem hiding this comment.
How about deprecating malleability protection in all of the ECDSA library?
YES !
There was a problem hiding this comment.
Why is v a signed integer?
Because I made a mistake. Thanks for spotting it !
Following discussion with @frangio, we believe that this could be usefull for someone that wants to re-implement
isValidSignatureNowin a way taht supports both 65 and 64 bytes signatures.We should add this support nativelly in v6.0, but for the same reason as the one mentioned in this GHSA this is not a change that should happen in a minor release.
PR Checklist
npx changeset add)