Skip to content

refactor: narrow secp256k1 verify signature branches#227

Open
Genmin wants to merge 1 commit intowevm:mainfrom
Genmin:codex/narrow-secp256k1-verify-signature
Open

refactor: narrow secp256k1 verify signature branches#227
Genmin wants to merge 1 commit intowevm:mainfrom
Genmin:codex/narrow-secp256k1-verify-signature

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 28, 2026

Summary

  • Narrow Secp256k1.verify before passing signatures to address recovery or public-key verification
  • Avoid leaking the address/public-key OneOf union into recoverAddress, where yParity must be present
  • Add a focused type/runtime regression covering recovered address verification and unrecovered public-key verification

Why

When verify destructures options before the branch check, TypeScript sees signature as a union of recovered and unrecovered signatures. The address branch passes that union to recoverAddress, which requires yParity, causing the optional/required mismatch reported downstream by viem users.

Related: wevm/viem#4379.

Validation

  • pnpm check
  • pnpm check:types
  • pnpm test:types src/core/_test/Secp256k1.snap-d.ts
  • pnpm test src/core/_test/Secp256k1.test.ts

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

@Genmin is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant