Skip to content

fix: port recent viem fixes to Bytes, Hex, Siwe, TypedData, AbiItem, AbiEvent and RpcTransport - #600

Merged
jxom merged 6 commits into
mainfrom
jxom/port-viem-fixes-2026-11-08
Nov 8, 2026
Merged

jxom merged 6 commits into
mainfrom
jxom/port-viem-fixes-2026-11-08

Conversation

@jxom

@jxom jxom commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Ports the viem fixes merged over the past week (wevm/viem#5318 to wevm/viem#5444) that ox did not have yet. One commit per fix.

viem ox change
wevm/viem#5444 Bytes.fromHex and Hex.toBytes with size put an odd-length value's extra nibble at the end: 0x1 with size 2 became [16, 0], 0xabc became [171, 192]. The leading 0 is now added before padding, so they return [1, 0] and [10, 188]. Unsized odd-length input still throws Hex.InvalidLengthError.
wevm/viem#5440 Siwe.validateMessage returns false for a nonce shorter than 8 alphanumeric characters or a version other than 1. Absent fields are still skipped.
wevm/viem#5403 TypedData accepts struct names that contain :, such as HyperliquidTransaction:SendAsset. The struct-name check added in #560 rejected them.
wevm/viem#5384 AbiItem.fromAbi matched any string to dynamic bytes, so string/bytes overloads threw AbiItem.AmbiguityError for 'hello'. bytes now matches only hex strings and Uint8Array. Hex strings still throw when both overloads match.
wevm/viem#5428 AbiEvent.assertArgs and AbiEvent.extractLogs compared integer arguments with ===, so a number never matched a decoded bigint and a bigint never matched a small integer decoded as number. Integers now compare by value. A non-integer number such as 5.5 still mismatches instead of throwing a RangeError.
wevm/viem#5404 RpcTransport.fromHttp already accepted Headers and tuple arrays on main, but it lowercased the caller's headers next to the default Content-Type, so a caller's Content-Type was sent as application/json, <value>. Headers are now merged through Headers, so the caller's value replaces the default.
AbiItem.fromAbi(Abi.from(['function foo(bytes)', 'function foo(string)']), 'foo', { args: ['hello'] })
// Before: throws AbiItem.AmbiguityError
// After:  function foo(string)

Review note: the Bytes.fromHex/Hex.toBytes change replaces a comment that said the right-padding kept the old odd-nibble behavior on purpose. The new output matches viem and the unsized conversion followed by zero bytes.

Not ported, because ox already has the fix or has no counterpart:

0.x counterpart: #601.

Validation: pnpm check:types and vp check on the changed files pass. Every new test fails without its fix. The core and tempo-unit projects pass with SKIP_GLOBAL_SETUP=1, except tests that need a local Anvil node, which fail the same way on unmodified main.

ampagent and others added 6 commits November 8, 2026 20:04
…ytes

Ports wevm/viem#5444. An odd-length value now gets its leading 0 before it is right-padded to size, so 0x1 with size 2 decodes to [1, 0] instead of [16, 0].

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
…Message

Ports wevm/viem#5440. EIP-4361 requires an alphanumeric nonce of at least 8 characters and version 1. Absent fields are still skipped.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5403. Payloads such as HyperliquidTransaction:SendAsset failed TypedData.assert. The encoded type and hash are unchanged.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5384. Dynamic bytes now matches only hex strings and Uint8Array values, so a plain string selects the string overload instead of throwing AbiItem.AmbiguityError. Hex strings still throw when both overloads match.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5428. Integer arguments compare by value, so a number matches a decoded bigint and a bigint matches a small integer decoded as a number. A non-integer number still mismatches.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5404. Default and caller headers are merged through Headers into a plain object, so a caller's Content-Type replaces the default whatever its casing, and Headers instances and tuple arrays keep their entries.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
@vercel

vercel Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ox Error Error Nov 8, 2026 8:07pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T20:05:53.987994Z d24a038 PR opened
ℹ️ 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.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Published ox@0.0.0-pr-600-d24a038 under the pr-600 dist-tag, which follows this pull request until it closes.

pnpm add ox@pr-600
pnpm add ox@0.0.0-pr-600-d24a038

@jxom
jxom merged commit 8228e04 into main Nov 8, 2026
15 of 16 checks passed
@jxom
jxom deleted the jxom/port-viem-fixes-2026-11-08 branch November 8, 2026 20:11
@github-actions github-actions Bot mentioned this pull request Nov 8, 2026

This branch had an error being deployed

1 failed deployment
Preview — d24a0382 Deployed Nov 8, 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