Skip to content

fix: map OutOfFunds node errors to InsufficientFundsError - #5293

Closed
mortezashojaei wants to merge 2 commits into
wevm:mainfrom
mortezashojaei:fix/insufficient-funds-out-of-funds
Closed

mortezashojaei wants to merge 2 commits into
wevm:mainfrom
mortezashojaei:fix/insufficient-funds-out-of-funds

Conversation

@mortezashojaei

@mortezashojaei mortezashojaei commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

reth nodes report an insufficient balance in eth_call as EVM error: OutOfFunds, which InsufficientFundsError.nodeMessage does not match, so the error falls through to a generic TransactionRejectedRpcError:

await call(client, { account, to: account, value: parseEther('100000') })
// CallExecutionError: Transaction creation failed.
// Details: EVM error: OutOfFunds

This is what currently fails the call > errors > insufficient funds test against the mainnet fork RPC on unrelated PRs (e.g. #5290, #5291). Replaying that request against https://ethereum.reth.rs/rpc (reth v2.8.1) returns {"code":-32003,"message":"EVM error: OutOfFunds"} consistently, at latest and at a pinned block.

This adds outoffunds to InsufficientFundsError.nodeMessage and a getNodeError.test.ts case for it. The fork assertion in call.test.ts checked for Geth's raw insufficient funds for gas * price + value sentence, so it now asserts a CallExecutionError caused by an InsufficientFundsError instead. That assertion fails without the change and passes with it; the local Anvil snapshot is unchanged.

@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown

@mortezashojaei 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 Oct 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d17c101

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: d17c101

jxom commented Oct 26, 2026

Copy link
Copy Markdown
Member

Thanks @mortezashojaei, the fix is right (confirmed reth v2.8.1 returns -32003 EVM error: OutOfFunds). The same Geth-text assertion in src/actions/public/simulateContract.test.ts:771 was still failing CI, so this continues in #5303 with your two commits kept as-is plus that test fix. Closing in favor of it.


Generated by Claude Code

@jxom jxom closed this Oct 26, 2026
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