Skip to content

Transaction lookup using eth_getTransactionReceipt returns the wrong information after reorg #28885

Closed
@tobidae-cb

Description

@tobidae-cb

System information

Geth version: Geth/v1.13.11-stable-8f7eb9cc/linux-amd64/go1.20.7
CL client & version: lighthouse@v4.6.0
OS & Version: Linux

Expected behaviour

eth_getTransactionReceipt returns the right receipt information including block hash, number, e.t.c. Even when a reorg occurs on that block and the transaction is mined in another block.

Actual behaviour

eth_getTransactionReceipt sometimes returns the receipt with information from the reorg'd block. This causes our internal systems to fail. This is especially observed in the sepolia/holesky testnets since 1.13.11 is required for the upcoming hardfork.

Steps to reproduce the behaviour

  1. Upgrade to 1.13.11 stable version along with lighthouse 4.6.0
  2. Run an archival node with the settings below (although it can possibly happen in full nodes)
exec /app/geth \
    --networkid "17000" \
    --syncmode="full" \
    --gcmode="archival" \
    --snapshot="true" \
    --rpc.txfeecap=0 \
    --rpc.batch-request-limit 100000 \
    --rpc.batch-response-max-size 500000000 \
    --http \
    --http.addr 0.0.0.0 \
    --http.vhosts=* \
    --http.api="engine,eth,web3,net,debug,txpool" \
    --http.corsdomain=* \
    --authrpc.addr 0.0.0.0 \
    --authrpc.vhosts=* \
    --cache "16384" \
    --state.scheme hash
  1. When a reorg occurs there's a probability that the cache for eth_getTransactionReceipt stores the wrong receipt information so any subsequent calls to get a receipt returns the wrong information. When querying the block using the hash or number, the right details are contained there

Backtrace

Logs that had reorg

# Specific transaction with observed behavior
curl -X POST -H "Content-Type: application/json" --data '{"method":"eth_getTransactionReceipt","params":["0x36057fedd64685fb69ba23f9d49cbf7b1c0039659d24adaf2b60274b716ef012"],"id":0,"jsonrpc":"2.0"}' http://localhost:8545 | jq

# Actual Result
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "blockHash": "0xa0056303bb52371aa38b7996f031a9d10bc8dd1d78ce921b5047abb47334ad7a",
    "blockNumber": "0xc78e8",
    "contractAddress": null,
    "cumulativeGasUsed": "0x1c7bac2",
    "effectiveGasPrice": "0x3b9aca00",
    "from": "0x9146a7ece7054c39f2d27dfc45efa8fa8e1d1323",
    "gasUsed": "0xfaa5e",
    "logs": [],
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "status": "0x1",
    "to": "0x3f5dfd1522a84394390382a9801616bd530a9655",
    "transactionHash": "0x36057fedd64685fb69ba23f9d49cbf7b1c0039659d24adaf2b60274b716ef012",
    "transactionIndex": "0x2d",
    "type": "0x2"
  }
}


# Expected result
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "blockHash": "0x046495e9e416d899e933c21cd0539aad3d90f6888bd46007246456189c482299",
    "blockNumber": "0xc78e9",
    "contractAddress": null,
    "cumulativeGasUsed": "0xffe36",
    "effectiveGasPrice": "0x3b9aca00",
    "from": "0x9146a7ece7054c39f2d27dfc45efa8fa8e1d1323",
    "gasUsed": "0xfaa5e",
    "logs": [],
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "status": "0x1",
    "to": "0x3f5dfd1522a84394390382a9801616bd530a9655",
    "transactionHash": "0x36057fedd64685fb69ba23f9d49cbf7b1c0039659d24adaf2b60274b716ef012",
    "transactionIndex": "0x1",
    "type": "0x2"
  }
}


# Logs from problematic deployment
For prod ethereum-0 archival holesky
ethereum-0 geth INFO [01-26|22:08:21.009] Chain head was updated                   number=817,384 hash=a00563..34ad7a root=51418b..2f5c82 elapsed=4.17309ms
ethereum-0 geth INFO [01-26|22:08:28.259] Imported new potential chain segment     number=817,384 hash=319dbf..fec640 blocks=1 txs=55 mgas=29.916 elapsed=128.272ms   mgasps=233.222 snapdiffs=1.35MiB triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:29.254] Imported new potential chain segment     number=817,385 hash=046495..482299 blocks=1 txs=33 mgas=29.944 elapsed=135.098ms   mgasps=221.645 snapdiffs=1.35MiB triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:31.895] Chain reorg detected                     number=817,383 hash=2bd818..756b40 drop=1 dropfrom=a00563..34ad7a add=2 addfrom=046495..482299
ethereum-0 geth INFO [01-26|22:08:31.904] Chain head was updated                   number=817,385 hash=046495..482299 root=c7fbc7..da6141 elapsed=9.360949ms
ethereum-0 geth INFO [01-26|22:08:38.883] Imported new potential chain segment     number=817,386 hash=6b13b0..95ed30 blocks=1 txs=23 mgas=9.466  elapsed=43.761ms    mgasps=216.302 snapdiffs=1.35MiB triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:39.176] Chain head was updated                   number=817,386 hash=6b13b0..95ed30 root=b1f284..f364cd elapsed=4.695815ms

# Logs from expected behavior
ethereum-0 geth INFO [01-26|22:07:39.776] Imported new potential chain segment     number=817,383 hash=2bd818..756b40 blocks=1    txs=0       mgas=0.000    elapsed=3.333ms     mgasps=0.000   snapdiffs=3.18MiB    triedirty=0.00B
ethereum-0 geth INFO [01-26|22:07:40.072] Chain head was updated                   number=817,383 hash=2bd818..756b40 root=c0724c..aab761 elapsed="815.439µs"
ethereum-0 geth INFO [01-26|22:08:14.904] Imported new potential chain segment     number=817,384 hash=a00563..34ad7a blocks=1    txs=49      mgas=29.998   elapsed=146.869ms   mgasps=204.250 snapdiffs=3.18MiB    triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:20.822] Chain head was updated                   number=817,384 hash=a00563..34ad7a root=51418b..2f5c82 elapsed=3.650328ms
ethereum-0 geth INFO [01-26|22:08:23.798] Imported new potential chain segment     number=817,384 hash=319dbf..fec640 blocks=1    txs=55      mgas=29.916   elapsed=122.690ms   mgasps=243.832 snapdiffs=3.19MiB    triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:24.836] Imported new potential chain segment     number=817,385 hash=046495..482299 blocks=1    txs=33      mgas=29.944   elapsed=120.422ms   mgasps=248.658 snapdiffs=3.19MiB    triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:26.823] Chain reorg detected                     number=817,383 hash=2bd818..756b40 drop=1 dropfrom=a00563..34ad7a add=1 addfrom=319dbf..fec640
ethereum-0 geth INFO [01-26|22:08:26.829] Chain head was updated                   number=817,384 hash=319dbf..fec640 root=aa8a16..a2261d elapsed=6.317064ms
ethereum-0 geth INFO [01-26|22:08:27.667] Chain head was updated                   number=817,385 hash=046495..482299 root=c7fbc7..da6141 elapsed=4.855725ms
ethereum-0 geth INFO [01-26|22:08:38.878] Imported new potential chain segment     number=817,386 hash=6b13b0..95ed30 blocks=1    txs=23      mgas=9.466    elapsed=39.822ms    mgasps=237.699 snapdiffs=3.19MiB    triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:39.170] Chain head was updated                   number=817,386 hash=6b13b0..95ed30 root=b1f284..f364cd elapsed=1.247488ms
ethereum-0 geth INFO [01-26|22:08:49.142] Imported new potential chain segment     number=817,387 hash=a6dd16..dbda80 blocks=1    txs=38      mgas=28.078   elapsed=109.512ms   mgasps=256.391 snapdiffs=3.19MiB    triedirty=0.00B
ethereum-0 geth INFO [01-26|22:08:49.440] Chain head was updated                   number=817,387 hash=a6dd16..dbda80 root=b8bece..4073f3 elapsed=1.507894ms
ethereum-0 geth INFO [01-26|22:09:02.154] Regenerated local transaction journal    transactions=0 accounts=0

When submitting logs: please submit them as text and not screenshots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions