Skip to content

fix(typedData): accept struct names that contain : - #5403

Merged
jxom merged 1 commit into
wevm:mainfrom
A-G0D:fix/5399-validatetypeddata-rejects-struct-names
Nov 3, 2026
Merged

jxom merged 1 commit into
wevm:mainfrom
A-G0D:fix/5399-validatetypeddata-rejects-struct-names

Conversation

@A-G0D

@A-G0D A-G0D commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

validateTypedData began rejecting struct names that contain : in 2.57.12, so Hyperliquid payloads such as HyperliquidTransaction:SendAsset throw before hashTypedData, signTypedData, or recoverTypedDataAddress can run. This allows : in the struct-name check and updates the error message to match; the encoded type and hash are unchanged. Added a hashTypedData test with a colon-named struct that fails before the change. Ran the focused tests, Biome on the touched files, and a targeted tsc over the source and tests.

Fixes #5399.

I used DeepSeek V4 to draft this patch; I reproduced the bug and ran the tests locally.

`validateTypedData` rejected any struct name containing `:`, so
Hyperliquid typed data such as `HyperliquidTransaction:SendAsset` could
not be hashed or signed. Widen the struct-name check to accept `:` and
update the error message to match. The encoded type and resulting hash
are unchanged.

Fixes wevm#5399

Signed-off-by: A-G0D <[email protected]>
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

@A-G0D is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8306616

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jxom
jxom merged commit 2a5d1a1 into wevm:main Nov 3, 2026
2 of 3 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
@aaronmboyd

Copy link
Copy Markdown

@jxom Cheers, I've been downgrading my viem all day but can now stop and wait for .17

jxom added a commit to wevm/ox that referenced this pull request Nov 8, 2026
…a`, `AbiItem`, `AbiEvent` and `RpcTransport` (#601)

* fix: preserve odd-length hex bytes in sized Bytes.fromHex and Hex.toBytes

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: reject a short nonce and a version other than 1 in Siwe.validateMessage

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: accept struct names that contain : in TypedData

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: resolve string overloads when the argument is not bytes

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: match number and bigint integer arguments in AbiEvent

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: merge RpcTransport.fromHttp headers through Headers

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

---------

Co-authored-by: Amp <[email protected]>
Co-authored-by: jxom <[email protected]>
jxom added a commit to wevm/ox that referenced this pull request Nov 8, 2026
…AbiItem`, `AbiEvent` and `RpcTransport` (#600)

* fix: preserve odd-length hex bytes in sized Bytes.fromHex and Hex.toBytes

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: reject a short nonce and a version other than 1 in Siwe.validateMessage

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: accept struct names that contain : in TypedData

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: resolve string overloads when the argument is not bytes

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: match number and bigint integer arguments in AbiEvent

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

* fix: merge RpcTransport.fromHttp headers through Headers

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 <[email protected]>
Co-authored-by: jxom <[email protected]>

---------

Co-authored-by: Amp <[email protected]>
Co-authored-by: jxom <[email protected]>
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.

validateTypedData rejects struct names that contain : since 2.57.12, so Hyperliquid typed data cannot be signed

3 participants