foundry icon indicating copy to clipboard operation
foundry copied to clipboard

pending transaction on remote anvil

Open henry-hz opened this issue 3 years ago • 2 comments

Component

Anvil

Have you ensured that all of these are up to date?

  • [x] Foundry
  • [x] Foundryup

What version of Foundry are you on?

anvil 0.1.0 (307576d 2022-08-29T00:07:45.642497737Z)

What command(s) is the bug in?

anvil --host 0.0.0.0 --chain-id 1337

Operating System

No response

Describe the bug

When sending transaction to an anvil that is installed in a remote machine, using

anvil --host 0.0.0.0 --chain-id 1337

the transaction simply does not occur, and it keep requesting the getTransactionByHash, but... when running in a local machine, it works perfectly.

eth_getTransactionByHash
eth_getTransactionByHash
eth_blockNumber
eth_networkId
eth_chainId
eth_chainId
eth_getTransactionCount
eth_getBlockByNumber
eth_feeHistory
eth_estimateGas
eth_sendRawTransaction
eth_getTransactionByHash
eth_getTransactionByHash
eth_getTransactionByHash
eth_getTransactionByHash

The machine is a debian in aws with enough memory and good latency:

64 bytes from 52.29.64.130: icmp_seq=332 ttl=47 time=66.9 ms
64 bytes from 52.29.64.130: icmp_seq=333 ttl=47 time=67.0 ms                                                                          
64 bytes from 52.29.64.130: icmp_seq=334 ttl=47 time=66.9 ms  

henry-hz avatar Aug 29 '22 11:08 henry-hz

When sending transaction to an anvil that is installed in a remote machine

sending the tx works? the node accepts the tx?

could you enable logs

RUST_LOG=backend,api,node,rpc=warn anvil ...

are those the logs of the remote or local node?

mattsse avatar Aug 29 '22 12:08 mattsse

@mattsse thanks for the followup. the log above was from the remote. I am almost sure I got what happened, and now it's working. it was a bug on my side, difficult to catch, once I had a vage error message. My bash script check the nonce, before sending the deploys and transactions, but.... the 'cast nonce' a vage error mesage, and was showing:

Error: 
error sending request for url (http://localhost:8545/): error trying to connect: tcp connect error: Connection refused (os error 111)

Context:
- Error #0: error trying to connect: tcp connect error: Connection refused (os error 111)
- Error #1: tcp connect error: Connection refused (os error 111)
- Error #2: Connection refused (os error 111)

the problem with this message is that I didn't catch WHO is sending it, so I got nonce from other network when it was up, and used in the intened network, so I had a spaghetti nonce.

using seth, it's possible to identify WHO is failing, once the 'seth-rpc-curl' is printed:

seth nonce 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266                                                              10:49:31
curl: (7) Failed to connect to 127.0.0.1 port 8545: Connection refused
seth-rpc-curl: Please make sure that you are running a local Ethereum node:
seth-rpc-curl:   For example, try running either `parity' or `geth --rpc'.
seth-rpc-curl: You could also try connecting to an external Ethereum node:
seth-rpc-curl:   For example, try `export ETH_RPC_URL=https://mainnet.infura.io'.
seth-rpc-curl:   If you have an Infura API key, add it to the end of the URL.

so let me change this bug request [it seems to work right now] to a feature request: once all the cast and forge commands are in principle to be used with bash, and bash is not the most cozy environment that exits out there, let me suggest the following: normalized and detail error message for every request, showing:

  • command call
  • parameters
  • why it happened
  • private error number [the os error 111 is far from informative].

henry-hz avatar Aug 30 '22 08:08 henry-hz

@henry-hz Sorry how did you fix this issue, I got the same issue here.

vanillaHill avatar Nov 14 '22 10:11 vanillaHill

Hi @vanillaHill , my nonce was wrong, check step by step if you get the right nonce before sending the transaction.

henry-hz avatar Nov 14 '22 20:11 henry-hz

Closing as invalid as bug was unrelated to Anvil

zerosnacks avatar Jun 26 '24 11:06 zerosnacks