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

Problem: tx index is incorrect when there's failed tx in block #705

Closed
yihuang opened this issue Oct 27, 2021 · 3 comments · Fixed by #741
Closed

Problem: tx index is incorrect when there's failed tx in block #705

yihuang opened this issue Oct 27, 2021 · 3 comments · Fixed by #741
Labels
C:JSON-RPC JSON-RPC client

Comments

@yihuang
Copy link
Contributor

yihuang commented Oct 27, 2021

System info: ethermint main branch

Steps to reproduce:

Since failed tx don't increase the tx index in transient store, so the tx index recorded in the log is actually excludes the failed tx, so don't match the tx list in getBlock where there are failed tx in present.

Expected behavior: web3 apis should be consistent with each other

Actual behavior: tx index could be inconsistent

Additional info:

Proposal:

  • exclude failed tx from all the web3 apis: getBlock and eth_getTransactionByBlockHashAndIndex, GetTransactionByBlockNumberAndIndex, etc.
@yihuang yihuang changed the title Problem: failed tx not excluded from web3 api Problem: tx index is incorrect when there's failed tx in block Oct 27, 2021
@fedekunze
Copy link
Contributor

I see the issue you mention but I don't understand your suggested proposal, can you elaborate? @yihuang

@yihuang
Copy link
Contributor Author

yihuang commented Oct 27, 2021

I see the issue you mention but I don't understand your suggested proposal, can you elaborate? @yihuang

  • exclude the failed tx from getBlock API response, so web3 clients don't see the failed tx at all, and the index of the tx list is consistent with what's recorded in the logs.
  • fix the eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockNumberAndIndex to return correct tx, by skipping the failed tx in the block. currently when there's failed tx in block, it could return wrong tx.

@tomtau tomtau added the C:JSON-RPC JSON-RPC client label Oct 28, 2021
@leejw51crypto
Copy link
Contributor

leejw51crypto commented Oct 29, 2021

and those two tx has exactly the same txhash

failedtx , successfultx
txhash == txhash

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C:JSON-RPC JSON-RPC client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants