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

Investigate JSON RPC eth_getTransactionCount on eth_sendRawTransaction #1348

Closed
eduardonunesp opened this issue Jul 16, 2019 · 1 comment
Closed
Assignees
Labels
help wanted Extra attention is needed

Comments

@eduardonunesp
Copy link
Contributor

Investigate if the eth_getTransactionCount is working correctly when sending a transaction via eth_sendRawTransaction (using the PR issue1177)

The issue can be reproduced by using the following command:

curl -X POST --data '{"id": 0, "jsonrpc":"2.0", "method": "eth_sendRawTransaction", "params": ["0xf901420185174876e8008347e7c48080b8f06060604052341561000f57600080fd5b60d38061001d6000396000f3006060604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c14606e575b600080fd5b3415605857600080fd5b606c60048080359060200190919050506094565b005b3415607857600080fd5b607e609e565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058202b229fba38c096f9c9c81ba2633fb4a7b418032de7862b60d1509a4054e2d6bb00291ba0a95245f87232aecc767af6a48309ac2047f18870f3c071dc0c69d8c306f6e493a044c40985cacd98ec81e3522b01872e7aa66d05e695a3a54358e9611e78ffadd4"]}' http://localhost:46658/eth

It will return the receipt that can be used to check the from address.

{
  "result": "0xd93c44702f5bdbdf9652fe82f6e94b7684eea4227161f9c11f5139786c19ed1a",
  "jsonrpc": "2.0",
  "id": 0
}

Check the receipt:

>> {"id": 0, "jsonrpc":"2.0", "method": "eth_getTransactionReceipt", "params": ["0xd93c44702f5bdbdf9652fe82f6e94b7684eea4227161f9c11f5139786c19ed1a"]}
<< {
  "result": {
    "transactionHash": "0xd93c44702f5bdbdf9652fe82f6e94b7684eea4227161f9c11f5139786c19ed1a",
    "transactionIndex": "0x0",
    "blockHash": "0xdb4d46b3d1a6afe3bf8df99a2a21b0f4c289ceb0ce9f52b2db77983e017ad113",
    "blockNumber": "0x5",
    "from": "0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1",
    "cumulativeGasUsed": "0x0",
    "gasUsed": "0x0",
    "contractAddress": null,
    "to": null,
    "logs": [],
    "logsBloom": "0x0000000000000000",
    "status": "0x1"
  },
  "jsonrpc": "2.0",
  "id": 0
}

Then check the transaction count:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1","latest"],"id":1}' http://localhost:46658/eth

Currently it's returning

{
  "result": "0x0",
  "jsonrpc": "2.0",
  "id": 1
}

The expected behavior is to return "0x1" (considering that the address just sent his first transaction)

{
  "result": "0x1",
  "jsonrpc": "2.0",
  "id": 1
}
@Sriep
Copy link
Contributor

Sriep commented Jul 18, 2019

The problem is that both eth_sendRawTransaction eth_getTransactionCount do not provide the chain id in their input address. So, for both API methods, we can change to use the chain id associated with EthereumSignedTxType in the loom.yaml file. #1227 updated to handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants