Skip to content

fix: match number and bigint integer filters in parseEventLogs - #5428

Merged
jxom merged 4 commits into
mainfrom
fix/parse-event-logs-integer-args
Nov 6, 2026
Merged

jxom merged 4 commits into
mainfrom
fix/parse-event-logs-integer-args

Conversation

@jxom

@jxom jxom commented Nov 6, 2026

Copy link
Copy Markdown
Member

Supersedes #5415 (original commits by @mortezashojaei are kept with their authorship).

parseEventLogs compared integer args filters with ===. A JS number filter never matched a decoded bigint, and a bigint filter never matched a small integer that decodes as a number. encodeEventTopics had often already accepted the number for the RPC topic filter, so matching logs got dropped. This affects getLogs, getFilterLogs and getFilterChanges, which all call parseEventLogs.

isEqual now compares ABI integer types via BigInt. If BigInt() throws (for example on 1.5), the existing try/catch returns false.

The only change on top of #5415 is in the test file. The new tests use non-const ABIs, so encodeEventTopics returns (Hex | Hex[] | null)[], and casting that straight to Log failed the Types CI job with TS2352. The encoded topics are now cast to Log['topics'].

Note: typed (const) ABIs still reject number for uint256 args at the type level, so this fix only reaches loosely typed ABIs at runtime.

Tests:

  • With a vitest config that skips the anvil-backed global setup, all args: args tests pass. With parseEventLogs.ts reverted to main, the 3 new tests fail.
  • A targeted tsc over parseEventLogs.test.ts with test/tsconfig.json is clean.
  • biome check on the changed files is clean.
  • I could not run the anvil-backed tests (default, args: eventName, args: strict) or the full pnpm check:types in this environment.

Generated by Claude Code

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
viem Error Error Nov 6, 2026 5:59am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: db22e83

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 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-11-06T06:01:11.187449Z db22e83 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.

@jxom
jxom merged commit 29a0d84 into main Nov 6, 2026
12 of 39 checks passed
@jxom
jxom deleted the fix/parse-event-logs-integer-args branch November 6, 2026 06:10
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]>

This branch had an error being deployed

1 failed deployment
Preview — db22e837 Deployed Nov 6, 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.

3 participants