Skip to content

eth_getTransactionCount errors with code:100 message:"State node doesn't exist" #872

@DanBurton

Description

@DanBurton

I am using ethers.js to try and send a simple transaction from one account to another on the KEVM testnet. This appears to not be possible due to an error with the implementation of eth_getTransactionCount.

To Reproduce
Steps to reproduce the behavior:

  1. npm install ethers -- (for convenience I chose to do this in the mallet repo)
  2. Create 2 accounts via mallet on the kevm testnet & fund them with the faucet.
  3. Get the secret keys of the 2 accounts. (I used expose recoverPrivateKey mallet#21 to assist with this)
  4. in a node repl (or the mallet repl):
mallet> ethers = require('ethers');
mallet> p = new ethers.providers.JsonRpcProvider('https://david.kevm.dev-mantis.iohkdev.io:8546');
mallet> p.send('net_version').then(console.log);  # make sure it is connected and working
Promise { <pending> }
41390

mallet> w = new ethers.Wallet('<< secret key 1 goes here >>', p);
mallet> w2 = new ethers.Wallet'<< secret key 2 goes here >>', p);
mallet> w.sendTransaction({to: w2.address, value: '1000000000'}).then(console.log);

The following error appears:

mallet> (node:75341) UnhandledPromiseRejectionWarning: Error: processing response error (body="{\"jsonrpc\":\"2.0\",\"error\":{\"code\":3,\"message\":\"Execution error\",\"data\":[{\"code\":100,\"message\":\"State node doesn't exist\"}]},\"id\":84}", error={"code":3,"data":[{"code":100,"message":"State node doesn't exist"}]}, requestBody="{\"method\":\"eth_getTransactionCount\",\"params\":[\"0x44a609c5791ab0ce949d04c863760b8a6533dc2d\",\"pending\"],\"id\":84,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://david.kevm.dev-mantis.iohkdev.io:8546", code=SERVER_ERROR, version=web/5.0.11)
    at Logger.makeError (/Users/dan/github.com/input-output-hk/mallet/node_modules/@ethersproject/logger/lib/index.js:179:21)
    at Logger.throwError (/Users/dan/github.com/input-output-hk/mallet/node_modules/@ethersproject/logger/lib/index.js:188:20)
    at /Users/dan/github.com/input-output-hk/mallet/node_modules/@ethersproject/web/lib/index.js:265:32
    at step (/Users/dan/github.com/input-output-hk/mallet/node_modules/@ethersproject/web/lib/index.js:33:23)
    at Object.next (/Users/dan/github.com/input-output-hk/mallet/node_modules/@ethersproject/web/lib/index.js:14:53)
    at fulfilled (/Users/dan/github.com/input-output-hk/mallet/node_modules/@ethersproject/web/lib/index.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:75341) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 12)

The same error may sometimes be observed in isolation by sending eth_getTransactionCount manually:

mallet> p.send('eth_getTransactionCount', [w.address, 'pending']).then(console.log);

(HOWEVER, when you call eth_getTransactionCount manually, it appears that after some amount of time has elapsed, eth_getTransactionCount eventually stops erroring and returns 0. The error seems to be reliably reproducible for some period of time after a new account is created.)

Expected behavior
The eth_getTransactionCount method is supported and returns zero for accounts with no transactions.

Metadata

Metadata

Labels

KEVMKEVM branch related

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions