Repository navigation
fix(0.x): port recent viem fixes to Siwe and Authorization - #531
Conversation
Ports wevm/viem#5299. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
…ion` Ports wevm/viem#5304. EIP-7702 permits any `y_parity` below 2**8 in an authorization tuple. `Authorization.fromRpc`, `Authorization.fromTuple`, and `Authorization.toTuple` now read and encode it as is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc90dcb7a4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { address, chainId, nonce, r, s, yParity } = authorization | ||
| const signature = Signature.extract({ r, s }) |
There was a problem hiding this comment.
Require yParity when r and s are present
If an Authorization has r and s but omits yParity—which the unsigned Authorization type permits—extracting only { r, s } succeeds as an unrecovered signature, after which the encoder treats the missing parity as zero and emits a signed six-element tuple. Previously extracting the full authorization rejected this malformed partial signature, so this change can silently serialize a different authorization instead of reporting the missing field; check that yParity is defined while bypassing only the 0-or-1 restriction.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This doesn't reproduce as a regression. Before this PR, Signature.extract(authorization) with r and s but no yParity also passed: Signature.from returned { r, s }, and assert only requires yParity with recovered: true. Signature.toTuple then encoded the missing parity as 0x. I ran the 0.x base code with { address, chainId: 1, nonce: 6n, r: 1n, s: 2n }, and it returned the same six-element tuple ([..., '0x', '0x1', '0x2']) as this branch. The behavior is unchanged, so I'm leaving it out of this backport.
Generated by Claude Code
…ization.toRpc` `Authorization.fromRpc` and `Authorization.fromTuple` reject a `yParity` of 2**8 or more, which EIP-7702 forbids, with the same `Hex.IntegerOutOfRangeError` as `Authorization.toTuple`. `Authorization.toRpc` encodes `yParity` as is instead of through `Signature.toRpc`, which writes 0 or 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
The top-level domain alternation is non-capturing, so the capture groups of the exported regex stay as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
`check:tsdoc` requires an `@example` in every JSDoc block, and the helper is not part of the public API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
…eset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8705a7b69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
`Authorization.toRpc` now rejects a `yParity` of 2**8 or more with the same `Hex.IntegerOutOfRangeError` as the other `Authorization` codecs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c19230d0a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
`Authorization.toTuple` encoded a `NaN` `yParity` as the zero parity. It now rejects any `yParity` that is not an integer from 0 to 255, like the other `Authorization` codecs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM
Backports #530 to
0.x.0.xchangeSiwe.createMessageaccepts a punycode top-level domain, such asexample.xn--p1ai, and rejects a top-level domain label longer than 63 characters. The new alternation is non-capturing, so the port stays in group 3 of the exportedSiwe.domainRegex. Same asmain.Authorization.fromRpc,Authorization.fromTuple, andAuthorization.toTupleread and encode an EIP-7702 authorizationyParityabove 1 as is. These three andAuthorization.toRpcreject a value above 255 withHex.IntegerOutOfRangeError.TxEnvelopeEip7702.deserialize,serialize, andhashno longer throwSignature.InvalidYParityErroron valid mainnet transactions. Same asmain, adapted to thebigintrandsof0.x.0.xonlyAuthorization.toRpcencodesyParityitself, sinceSignature.toRpcon0.xwrites every nonzero value as0x1.mainalready keeps it.0.xhas no zod schemas, so only the core codecs change.wevm/viem#5300 needs no port (
0.xalready stripserrorinnormalizeSignature). wevm/viem#5298, wevm/viem#5301, wevm/viem#5302, and wevm/viem#5303 have no Ox counterpart.Validation:
pnpm check:types,pnpm check:tsdoc, andbiome checkon the changed files pass. Thecoreproject passes without the Anvil global setup, except tests that need a local Anvil node and fail the same way on0.xwithout these changes. The new tests fail without the fixes.🤖 Generated with Claude Code
https://claude.ai/code/session_01VLjvB9RWejr3jdFDh3WjiM