Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient funds being reported as a CALL_EXCEPTION #4924

Open
TylerEther opened this issue Jan 22, 2025 · 2 comments
Open

Insufficient funds being reported as a CALL_EXCEPTION #4924

TylerEther opened this issue Jan 22, 2025 · 2 comments
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@TylerEther
Copy link

Ethers Version

6.13.4

Search Terms

No response

Describe the Problem

An insufficient funds error is being reported as "CALL_EXCEPTION" with a short message of "missing revert data."

This occurs when simulating a transaction, i.e. making a static call with a hard-coded gas limit (I don't know if the hard-coded gas limit has any impact).

Call stack:

    at makeError (REDACTED/node_modules/ethers/src.ts/utils/errors.ts:694:21)
    at getBuiltinCallException (REDACTED/node_modules/ethers/src.ts/abi/abi-coder.ts:118:21)
    at Function.getBuiltinCallException (REDACTED/node_modules/ethers/src.ts/abi/abi-coder.ts:235:16)
    at JsonRpcProvider.getRpcError (REDACTED/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:989:32)
    at REDACTED/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:563:45
    at processTicksAndRejections (node:internal/process/task_queues:105:5)",

Code Snippet

Contract ABI

Errors

"error": {
				"code": "CALL_EXCEPTION",
				"shortMessage": "missing revert data",
				"action": "call",
				"transaction": {
					"data": REDACTED,
					"from": REDACTED,
					"to": REDACTED
				},
				"info": {
					"payload": {
						"method": "eth_call",
						"id": 42,
						"jsonrpc": "2.0",
						"params": [
							{
								"data": REDACTED,
								"gas": "0x989680",
								"from": REDACTED,
								"to": REDACTED,
								"type": "0x0",
								"nonce": "0x0",
								"gasPrice": "0xf4482"
							},
							"latest"
						]
					},
					"error": {
						"code": -32000,
						"message": "err: insufficient funds for gas * price + value: address REDACTED have 0 want 10005780000000 (supplied gas 10000000)"
					}
				}
			},

Environment

node.js (v12 or newer)

Environment (Other)

No response

@TylerEther TylerEther added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Jan 22, 2025
@ricmoo
Copy link
Member

ricmoo commented Jan 23, 2025

I don't believe the static gasLimit is the issue. The node is checking the sender has sufficient ether to execute the transaction, which it doesn't.

Does the simulated sender have ether? I also notice that the type is 0. What network are you interacting with?

At the very least, this looks like it is returning the wrong error, as it is a protocol error, not a call revert. Occasionally the nodes change the wording of errors, and ethers uses a plethora of string matching to coalesce the human-readable errors from nodes into consistent errors. What node and network are you working with? Usually an insufficient funds error is only caused by sending a transaction or estimateGas. I may have to add call to that list... :s

@TylerEther
Copy link
Author

Thanks for taking a look at this @ricmoo.

The account indeed did not have any Ether. The problem is that Ethers is returning the wrong error. For me, this misclassification makes it challenging to diagnose and respond to issues with the infrastructure that I run.

I experienced this issue when interacting with Optimism and all of the following RPC providers: DRPC, Blast API, Nodies, Infura, Ankr, mainnet.optimism.io, and Alchemy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants