Skip to content

fix: map OutOfFunds node errors to InsufficientFundsError - #5303

Merged
jxom merged 4 commits into
mainfrom
fix/insufficient-funds-out-of-funds
Oct 26, 2026
Merged

jxom merged 4 commits into
mainfrom
fix/insufficient-funds-out-of-funds

Conversation

@jxom

@jxom jxom commented Oct 26, 2026

Copy link
Copy Markdown
Member

Supersedes #5293 by @mortezashojaei; their two commits are kept as-is, plus one commit that fixes the fork test #5293 missed.

reth reports an insufficient balance in eth_call as -32003 EVM error: OutOfFunds (confirmed against https://ethereum.reth.rs/rpc, reth v2.8.1). InsufficientFundsError.nodeMessage didn't match it, so the error fell through to UnknownNodeError and the mainnet fork insufficient funds tests failed on unrelated PRs.

  • src/errors/node.ts: adds outoffunds to InsufficientFundsError.nodeMessage. getNodeError lowercases details before matching; revert text such as execution reverted: OutOfFunds still resolves to ExecutionRevertedError first.
  • src/utils/errors/getNodeError.test.ts: new OutOfFunds case.
  • src/actions/public/call.test.ts and src/actions/public/simulateContract.test.ts: the fork assertions checked Geth's raw insufficient funds for gas * price + value text; they now assert the error chain ends in InsufficientFundsError. The simulateContract one is what failed fix: map OutOfFunds node errors to InsufficientFundsError #5293's CI (Test Local (http, multicall: true, 3/3)).
  • Patch changeset.

Both fork assertions were run against live reth: they pass with the matcher and fail without it.


Generated by Claude Code

@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
viem Ready Ready Preview Oct 26, 2026 5:32am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4896e0b

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 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-26T05:29:00.100438Z 4896e0b 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.

@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: 0ce1addddd

ℹ️ 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/utils/errors/getNodeError.test.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/viem@5303

commit: 0ce1add

@jxom
jxom merged commit d10dc3c into main Oct 26, 2026
33 of 35 checks passed
@jxom
jxom deleted the fix/insufficient-funds-out-of-funds branch October 26, 2026 05:26

@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: 4896e0b1aa

ℹ️ 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".

encodeFunctionResult,
type Hex,
http,
InsufficientFundsError,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Import the error through the package alias

Import InsufficientFundsError from 'viem' instead of adding it to the relative ../../index.js import. Public-surface tests are required to use package aliases rather than relative imports, which keeps this assertion aligned with the consumer-facing module resolution path.

AGENTS.md reference: AGENTS.md:L186-L188

Useful? React with 👍 / 👎.

This branch was successfully deployed

1 active deployment
Preview — 4896e0b1 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.

3 participants