Skip to content

fix(0.x): port recent viem fixes to Siwe and Authorization - #531

Merged
jxom merged 8 commits into
0.xfrom
jxom/trusting-noether-pwtp01-0.x
Oct 26, 2026
Merged

jxom merged 8 commits into
0.xfrom
jxom/trusting-noether-pwtp01-0.x

Conversation

@jxom

@jxom jxom commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Backports #530 to 0.x.

Fix 0.x change
wevm/viem#5299 Siwe.createMessage accepts a punycode top-level domain, such as example.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 exported Siwe.domainRegex. Same as main.
wevm/viem#5304 Authorization.fromRpc, Authorization.fromTuple, and Authorization.toTuple read and encode an EIP-7702 authorization yParity above 1 as is. These three and Authorization.toRpc reject a value above 255 with Hex.IntegerOutOfRangeError. TxEnvelopeEip7702.deserialize, serialize, and hash no longer throw Signature.InvalidYParityError on valid mainnet transactions. Same as main, adapted to the bigint r and s of 0.x.
0.x only Authorization.toRpc encodes yParity itself, since Signature.toRpc on 0.x writes every nonzero value as 0x1. main already keeps it. 0.x has no zod schemas, so only the core codecs change.
TxEnvelopeEip7702.hash(TxEnvelopeEip7702.deserialize('0x04f8c901…')) // mainnet 0xaec84209…
// Before: Signature.InvalidYParityError: Value `28` is an invalid y-parity value.
// After:  '0xaec8420968abd74e70ef5b3099d6ba7baa3f069c4f718d7c4d729d591cffcb09'

wevm/viem#5300 needs no port (0.x already strips error in normalizeSignature). wevm/viem#5298, wevm/viem#5301, wevm/viem#5302, and wevm/viem#5303 have no Ox counterpart.

Validation: pnpm check:types, pnpm check:tsdoc, and biome check on the changed files pass. The core project passes without the Anvil global setup, except tests that need a local Anvil node and fail the same way on 0.x without these changes. The new tests fail without the fixes.

🤖 Generated with Claude Code

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
@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ox Ready Ready Preview Oct 26, 2026 6:58am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T06:53:34.066955Z 01680c6 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/ox@531

commit: 01680c6

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/core/Authorization.ts Resolved
Comment thread src/core/Authorization.ts Resolved
Comment thread src/core/Authorization.ts
Comment on lines +555 to +556
const { address, chainId, nonce, r, s, yParity } = authorization
const signature = Signature.extract({ r, s })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/core/Authorization.ts Resolved
`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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/core/Authorization.ts Resolved
`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
@jxom
jxom merged commit b1b39ac into 0.x Oct 26, 2026
13 of 14 checks passed
@jxom
jxom deleted the jxom/trusting-noether-pwtp01-0.x branch October 26, 2026 06:53
@github-actions github-actions Bot mentioned this pull request Oct 26, 2026

This branch was successfully deployed

1 active deployment
Preview — 01680c65 Deployed Oct 26, 2026 by vercel[bot]
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.

2 participants