fix(Secp256k1): resolve yParity type mismatch in verify#189
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. |
|
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! |
|
Hi — following up on this yParity fix. The only CI blocker is the Vercel deployment auth. Code changes and security checks all pass. Could a maintainer authorize the Vercel bot? Happy to address any code feedback. Thanks! |
|
Friendly ping — looks like the Vercel deployment check needs team authorization to run for external PRs. Could someone trigger it? The code changes and Socket Security checks are all passing. |
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