fix(Secp256k1): resolve yParity type mismatch in verify#189
Open
fix(Secp256k1): resolve yParity type mismatch in verify#189
Conversation
Destructuring the OneOf union in verify() lost TypeScript's ability to correlate address with the correct Signature type. Access branch-dependent properties from the options object instead so the type checker can narrow correctly. Fixes wevm/viem#4379
|
@Aboudjem is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
The only CI failure is the Vercel deployment which needs team authorization — the code changes and Socket Security checks pass. Could a maintainer approve the Vercel bot when you get a chance? Happy to address any feedback on the code itself. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Destructuring the
OneOfunion inverify()causes TypeScript to lose the correlation betweenaddressand the correctSignaturetype. After destructuring,signaturebecomesSignature<true> | Signature<false>, butrecoverAddressexpectsSignature<true>(with requiredyParity).This surfaces as a build error in downstream projects that type-check
node_modulessource files (e.g.next build), since ox ships raw.tsfiles.The fix avoids destructuring branch-dependent properties upfront and instead accesses them from the options object after narrowing, so the type checker can resolve the correct union member.
Fixes wevm/viem#4379