Skip to content

fix(0.x): AbiFunction.decodeData drops args when a name overload has zero inputs - #599

Merged
jxom merged 1 commit into
0.xfrom
fix/abi-decode-data-zero-arg-overload-0.x
Nov 8, 2026
Merged

jxom merged 1 commit into
0.xfrom
fix/abi-decode-data-zero-arg-overload-0.x

Conversation

@jxom

@jxom jxom commented Nov 8, 2026

Copy link
Copy Markdown
Member

Supersedes #448 (thanks @gomesalexandre, whose commits are kept here).

AbiFunction.decodeData(abi, name, data) returned undefined when name had a zero-input overload and data was calldata for another overload, e.g. WETH-style deposit() + deposit(uint256). AbiItem.fromAbi returned the zero-input overload early without attaching the others, and decodeData short-circuited on it before resolving by selector.

  • AbiItem.fromAbi: without args, the zero-input overload is still the preferred pick, but the other overloads are now attached as overloads, like the existing fallback.
  • AbiFunction.decodeData: the zero-input check runs on the selector-resolved overload.
  • Types: fromAbi now types overloads on a zero-input pick, and decodeData includes overload inputs in its result (readonly [bigint] | undefined for the example above, previously undefined).

Behavior notes: fromAbi results gain an overloads field in this case; decodeData(abi, name, data) with a selector matching no overload of name now throws AbiItem.NotFoundError (matching overload sets without a zero-input member); encodeData(fromAbi(abi, 'deposit'), [123n]) now encodes deposit(uint256).

…inputs

Backport of the main fix. AbiItem.fromAbi no longer returns early on a
zero-input overload when args are omitted; it keeps the other overloads
attached so decodeData can resolve the real overload by selector. The
fromAbi and decodeData types now reflect the attached overloads.

Co-authored-by: gomes <17035424+gomesalexandre@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1bc8e-e129-76ad-b0c4-3188e7e62ad9
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 Building Building Preview Nov 8, 2026 8:03pm 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:04:21.684935Z 019d005 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-599-019d005 under the pr-599 dist-tag, which follows this pull request until it closes.

pnpm add ox@pr-599
pnpm add ox@0.0.0-pr-599-019d005

@jxom
jxom merged commit 942c3a3 into 0.x Nov 8, 2026
13 of 14 checks passed
@jxom
jxom deleted the fix/abi-decode-data-zero-arg-overload-0.x branch November 8, 2026 20:09
@github-actions github-actions Bot mentioned this pull request Nov 8, 2026

This branch was successfully deployed

1 active deployment
Preview — 019d0051 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