Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

RPC method "SendRawTransaction" does not work #79

Closed
thomas-nguy opened this issue Jun 7, 2021 · 8 comments
Closed

RPC method "SendRawTransaction" does not work #79

thomas-nguy opened this issue Jun 7, 2021 · 8 comments
Projects

Comments

@thomas-nguy
Copy link
Contributor

thomas-nguy commented Jun 7, 2021

System info:

MacOS

Steps to reproduce:

This is quite critical bug, but I am unable to find the root cause.

Basically the RPC endpoint "eth_SendRawtransaction" seems to function correctly, the handler receives the ethereum tx, create a cosmos type tx and broadcast it succesfully til

	asyncCtx := e.clientCtx.WithBroadcastMode(flags.BroadcastAsync)

No error is returned.

However the transaction is never processed by the node. By adding a checkpoint or adding logs in the evm/MsgEthereumTx handler we notice that the transaction never reach.

Is it some networking issue?

Another way to test is to use truffle to upload a contract.
The code will be stuck waiting to receive the transaction receipt checking every block

Expected behavior:

Transaction is received and processed by the node

Actual behavior:

Broadcasted transaction never received

Additional info: [Include gist of relevant config, logs, etc.]

sometime the node display the message

E[2021-06-02|16:07:08.226] Failed to read request                       module=rpc-server protocol=websocket remote=127.0.0.1:57180 err="websocket: close 1006 (abnormal closure): unexpected EOF"
I[2021-06-02|16:07:08.226] Stopping wsConnection service                module=rpc-server protocol=websocket remote=127.0.0.1:57180 impl=wsConnection
E[2021-06-02|16:07:08.226] error while stopping connection              module=rpc-server protocol=websocket error="already stopped"
E[2021-06-02|16:07:08.347] Failed to read request                       module=rpc-server protocol=websocket remote=127.0.0.1:57181 err="websocket: close 1006 (abnormal closure): unexpected EOF"
I[2021-06-02|16:07:08.347] Stopping wsConnection service                module=rpc-server protocol=websocket remote=127.0.0.1:57181 impl=wsConnection
E[2021-06-02|16:07:08.347] error while stopping connection              module=rpc-server protocol=websocket error="already stopped"

maybe it is related

Linked to this issue

#52

@fedekunze
Copy link
Contributor

fedekunze commented Jun 7, 2021

the transaction receipt logic is pretty broken. I wanted to fix it on #65 before attempting to fix all the other rpc endpoints because most of the txs ones depend on it.

No error is returned.

that is expected as the tx is sent using the sync mode, you would have to query the tx by hash to see if it was processed. Although there's another compatibility issue with Tendermint (see #67)

@fedekunze fedekunze added the bug label Jun 7, 2021
@thomas-nguy
Copy link
Contributor Author

Yes maybe its related to #67

The eth_getTransactionByHash cannot find the transaction and no trace of logic getting through the evm handler (I added logs)

@fedekunze fedekunze added this to Backlog in Core Jun 8, 2021
@fedekunze fedekunze moved this from Backlog to To do in Core Jun 8, 2021
@khoslaventures khoslaventures moved this from To do to Triage in Core Jun 8, 2021
@thomas-nguy
Copy link
Contributor Author

Some more insight about the bug

It seems that the "from" field in the transaction is always empty.

eth_api. line 420

	tx, err := e.clientCtx.TxConfig.TxDecoder()(data)

@fedekunze fedekunze moved this from Triage to Backlog in Core Jun 11, 2021
@fedekunze
Copy link
Contributor

@thomas-nguy can you still reproduce this ?

@thomas-nguy
Copy link
Contributor Author

I can close this ticket.

The error are related to #118

I came across another issue related to signature on legacy tx. will document it in another ticket

Core automation moved this from Backlog to Done Jun 15, 2021
@ksbomj
Copy link

ksbomj commented Sep 21, 2021

Hi @thomas-nguy

I still have this issue with the current main branch. I run a testnet with docker-compose and trying to move tokens over Metamask. I have a bunch of errors like this in the log:

first-node              | 3:38PM ERR error while stopping connection error="already stopped" module=rpc-server protocol=websocket server=node
first-node              | 3:38PM ERR Failed to read request err="websocket: close 1006 (abnormal closure): unexpected EOF" module=rpc-server protocol=websocket remote={"IP":"127.0.0.1","Port":57248,"Zone":""} server=node

Debug error:

failed to broadcast tx error="couldn't retrieve sender address ('') from the ethereum transaction\n --- at github.com/tharsis/ethermint/app/ante/eth.go:79 (EthSigVerificationDecorator.AnteHandle) ---\nCaused by: invalid chain id for signer: tx intended signer does not match the given signer

I have read all the corresponding issues but cannot understand why it's failing now. Could you please provide a reference to why it's failing?

@xwjahahahaha
Copy link

@ksbomj I have the same issue,When I want to deploy contract in Remix.

log is:

ERR failed to broadcast tx error="couldn't retrieve sender address ('') from the ethereum transaction\n --- at github.com/tharsis/ethermint/app/ante/eth.go:82 (EthSigVerificationDecorator.AnteHandle) ---\nCaused by: invalid chain id for signer: tx intended signer does not match the given signer" client=json-rpc t=2021-10-05T13:17:16+0800 lvl=warn msg="Served eth_sendRawTransaction" conn=192.168.31.214:59126 reqid=9136769938060 t=3.430958ms err="couldn't retrieve sender address ('') from the ethereum transaction\n --- at github.com/tharsis/ethermint/app/ante/eth.go:82 (EthSigVerificationDecorator.AnteHandle) ---\nCaused by: invalid chain id for signer: tx intended signer does not match the given signer"

@xwjahahahaha
Copy link

@ksbomj my god, Just found the cause, our chain ID does not match, need to match 9000 in init.sh or your own set chain ID. Example Change the chain ID on the MetaMask

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Core
Done
Development

No branches or pull requests

4 participants