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

transactionIndex differs between eth_getBlockByNumber and eth_getTransactionReceipt #10403

Closed
raulk opened this issue Mar 7, 2023 · 1 comment
Assignees
Milestone

Comments

@raulk
Copy link
Member

raulk commented Mar 7, 2023

The transactionIndex returns different results in the eth_getBlockByNumber and eth_getTransactionReceipt interfaces. The reason is that txIdx did not ignore system messages, and this is not as expected.

Example in hyperspace:

 curl -s --location 'http://localhost:8839/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_getTransactionReceipt",
    "params":["0xcc502ba55e9d312349c647783964c7edb00c3890b96842bd53e718475dc8c71e"],
    "id":1
}' |gojq
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "blockHash": "0x52206698ebadc31c0e3e211a9cd3f02dc81603f74e8a604dc460fa3cab1f597b",
    "blockNumber": "0x1f302",
    "contractAddress": null,
    "cumulativeGasUsed": "0x0",
    "effectiveGasPrice": "0x48724a74",
    "from": "0xff000000000000000000000000000000000005e4",
    "gasUsed": "0x135482a",
    "logs": [],
    "logsBloom": "0x09000c0000085003840012000100102008204100010000002105018000100000040000400024000100800000003000000010001002001110500000020016a0048880004040800081488100088e80400208048011010410000120000180002086200000280a022004000000812068490000002004000400000a01001000420800010000440400000002410100000004045800200500b000a0800140024001000060081000008109000000001800020800000420008083800060888044000040000200840a00002010600000000010d0800400000000080048081408000800600028400800048000400000400000a1000108000020001003440504088000026000",
    "root": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "status": "0x1",
    "to": "0xff0000000000000000000000000000000000088a",
    "transactionHash": "0xcc502ba55e9d312349c647783964c7edb00c3890b96842bd53e718475dc8c71e",
    "transactionIndex": "0x0",
    "type": "0x2"
  }
}
curl -s --location 'http://localhost:8839/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"id": 1,
"params": ["0x1f302", true]
}
' |gojq
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "baseFeePerGas": "0x64",
    "difficulty": "0x0",
    "extraData": "0x",
    "gasLimit": "0x2540be400",
    "gasUsed": "0x135482a",
    "hash": "0x52206698ebadc31c0e3e211a9cd3f02dc81603f74e8a604dc460fa3cab1f597b",
    "logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
    "miner": "0x0000000000000000000000000000000000000000",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0000000000000000",
    "number": "0x1f302",
    "parentHash": "0xef02f6d94ef93a9755fcfa001708a45f058569e5a871b9b0ed574a2ee79501c6",
    "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x0",
    "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "timestamp": "0x63ff621c",
    "totalDifficulty": "0x0",
    "transactions": [
      {
        "accessList": [],
        "blockHash": "0x52206698ebadc31c0e3e211a9cd3f02dc81603f74e8a604dc460fa3cab1f597b",
        "blockNumber": "0x1f302",
        "chainId": "0xc45",
        "from": "0xff000000000000000000000000000000000005e4",
        "gas": "0x18149c7",
        "hash": "0xcc502ba55e9d312349c647783964c7edb00c3890b96842bd53e718475dc8c71e",
        "input": "0x",
        "maxFeePerGas": "0x3a27a7a0",
        "maxPriorityFeePerGas": "0x3a27a382",
        "nonce": "0x113f",
        "r": "0x0",
        "s": "0x0",
        "to": "0xff0000000000000000000000000000000000088a",
        "transactionIndex": "0x1",
        "type": "0x2",
        "v": "0x0",
        "value": "0x0"
      }
    ],
    "transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "uncles": []
  }
}

Originally posted by @wanyvic in #10380 (comment)

@raulk
Copy link
Member Author

raulk commented Mar 11, 2023

Fixed in #10419.

@raulk raulk closed this as completed Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants