Skip to content

Missing transactions while looping through eth_getBlockByNumber #268

Closed
@garyorz

Description

@garyorz

Background

We are indexing transactions related to VVS-LP ownership and found that some of the owners are having negative balance. For example, this wallet 0xf6173b4D45B5052650e252499b80F02C24b9d14e, when we check its Token Transfers history, it is able to send out 1,889.994 VVS-LP in transaction 0x8228af30adf6a0bade750573b8f05d2d05472b83d4f7b9bb9a3616df6bb76477 (block number: 114172) without any transfers going in before that. By studying the balanceOf the wallet in the LP token contract, we found that the balance changed from 0 to 1889994255148034566603 at block 114161, which leads to the following bug we found.

Describe the bug

Previously, when we call eth_getBlockByNumber(114161), we are able to get 47 transactions. When we further query the last 15 transactions, 14 of them are actually in the block with height 114162 and one of them (with hash 0x9f1dd8a13508658db35f21bc00e7c490a79aa8686fc1ba4669eea4b479a7fb3b) doesn't seem to be in any block. This behaviour cannot be reproduced anymore and eth_getBlockByNumber(114161) now will return 32 transactions. (Note: this is a behaviour in cronos node 0.6.2)

However, 0x9f1dd8a13508658db35f21bc00e7c490a79aa8686fc1ba4669eea4b479a7fb3b is still missing in any blocks and we are not able to retrieve that by calling eth_getTransactionByHash. This transaction is important because it is the transaction that the wallet address mentioned above 0xf6173b4D45B5052650e252499b80F02C24b9d14e minting the VVS-LP token. So we think the eth_getBlockByNumber and eth_getTransactionByHash is missing out some transactions.

To Reproduce

  1. With cronos-node 0.6.2, call eth_getBlockByNumber('0x1BDF1', true) and you will be able to see transaction 0x9f1dd8a13508658db35f21bc00e7c490a79aa8686fc1ba4669eea4b479a7fb3b at index 32
  2. With cronos-node 0.6.2, call eth_getTransactionByHash('0x9f1dd8a13508658db35f21bc00e7c490a79aa8686fc1ba4669eea4b479a7fb3b') will return null
  3. With cronos-node 0.6.4, call eth_getBlockByNumber('0x1BDF1', true) and the transaction will not appear anymore
  4. With cronos-node 0.6.4, call eth_getTransactionByHash('0x9f1dd8a13508658db35f21bc00e7c490a79aa8686fc1ba4669eea4b479a7fb3b') will return null

Expected behavior

0x9f1dd8a13508658db35f21bc00e7c490a79aa8686fc1ba4669eea4b479a7fb3b should appear in eth_getBlockByNumber('0x1BDF1', true) and eth_getTransactionByHash('0x9f1dd8a13508658db35f21bc00e7c490a79aa8686fc1ba4669eea4b479a7fb3b') should return transaction details.

Screenshots

N/A

Additional context

See Background.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions