Skip to content

fix: port recent viem fixes to Siwe and Authorization - #530

Merged
jxom merged 6 commits into
mainfrom
jxom/trusting-noether-pwtp01
Oct 26, 2026
Merged

jxom merged 6 commits into
mainfrom
jxom/trusting-noether-pwtp01

Conversation

@jxom

@jxom jxom commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Ports the viem main fixes of the past day (wevm/viem#5298 to wevm/viem#5304) that apply to Ox. #531 backports the same changes to 0.x.

Fix Ox 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. Same regex as viem, except that the new alternation is non-capturing, so the port stays in group 3 of the exported Siwe.domainRegex.
wevm/viem#5304 EIP-7702 permits any authorization y_parity below 2**8. Authorization.fromRpc, Authorization.fromTuple, and Authorization.toTuple threw Signature.InvalidYParityError for a yParity above 1, so TxEnvelopeEip7702.deserialize, serialize, and hash, and Transaction.fromRpc, failed on valid mainnet transactions. They now read and encode yParity as is. These three and Authorization.toRpc reject a value above 255 with Hex.IntegerOutOfRangeError. r and s keep their validation.
TxEnvelopeEip7702.hash(TxEnvelopeEip7702.deserialize('0x04f8c901…')) // mainnet 0xaec84209…
// Before: Signature.InvalidYParityError: Value `28` is an invalid y-parity value.
// After:  '0xaec8420968abd74e70ef5b3099d6ba7baa3f069c4f718d7c4d729d591cffcb09'

Needs a reviewer's attention: the zod Authorization schemas (Signed, SignedToRpc, TupleSigned) now accept an 8-bit yParity instead of only 0 or 1, so they stay consistent with the core codecs. Their rejection tests now use 0x100. The zod Signature schemas still accept only 0 or 1. Ox also decodes these tuples, which viem's parseTransaction still rejects.

Not ported:

Validation: pnpm check:types and vp check on the changed files pass. The core project passes with SKIP_GLOBAL_SETUP=1, except tests that need a local Anvil node and fail the same way on main 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, and the zod
`Authorization` schemas accept an 8-bit `yParity`.

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:57am 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:54:03.313989Z 143e2ad 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@530

commit: 143e2ad

@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: a613dfa737

ℹ️ 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
Comment thread src/core/Siwe.ts Outdated
…Rpc` and `Authorization.fromTuple`

Both now reject a `yParity` of 2**8 or more, which EIP-7702 forbids, with
the same `Hex.IntegerOutOfRangeError` as `Authorization.toTuple`.

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

jxom commented Oct 26, 2026 •

Copy link
Copy Markdown
Member Author

Update: Vercel deployed 5312346 without errors, so the earlier failures were not a persistent break in this PR. The note below stays for reference.

The Vercel deployment of the docs site failed on this PR at a613dfa and c91f602, but this PR does not cause it:

The Vercel build logs need access to the Vercel project, which I don't have, so the cause of the earlier failures is unknown.


Generated by Claude Code

`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: 5312346329

ℹ️ 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
`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 e8f3251 into main Oct 26, 2026
15 of 16 checks passed
@jxom
jxom deleted the jxom/trusting-noether-pwtp01 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 — 143e2adf 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