mantis
mantis copied to clipboard
eth_getTransactionCount errors with code:100 message:"State node doesn't exist"
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:
npm install ethers-- (for convenience I chose to do this in themalletrepo)- Create 2 accounts via
malleton thekevmtestnet & fund them with the faucet. - Get the secret keys of the 2 accounts. (I used https://github.com/input-output-hk/mallet/pull/21 to assist with this)
- in a
noderepl (or themalletrepl):
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.
Hi @jmendiola222 @loverdos @rtkaczyk could you provide a rough estimate how hard or easy it is to do and rough ETA? Reach team is very keen to continue working but they are blocked on those issues. We are hoping this is not an architectural problem and a small bug...
Hello @DanBurton , we could assume this is caused by the KEVM incompatibility mentioned here https://github.com/input-output-hk/mantis/issues/864 could you please try you're using solc 0.5.1, which is not supported by this testnet and let us know?
@drospa the instructions for how to reproduce this issue do not involve solc. I'm just trying to use sendTransaction from an ethers.Wallet. Is there an older version of ethers.js with which the KEVM is compatible?
@DanBurton hi there! thanks for the report and for your interest in mantis. As mentioned in #864 this particular test net is lagging heavily behind the current development version of mantis. I understand that this is unfortunate but we are currently unable to support it because we are focusing on the current development version. Judging by your description I assume that it's a bug in mantis that results in this response. Would it be possible for you to test this same code against another test net (eg. https://docs.mantisclient.io/learn/sagano-mantis-testnet)?