erigontech / erigon

Ethereum implementation on the efficiency frontier https://erigon.gitbook.io
GNU Lesser General Public License v3.0
3.15k stars 1.13k forks source link

`eth_getTransactionReceipt` for pre-Byzantium transactions misses `root` #8159

Open etan-status opened 1 year ago

etan-status commented 1 year ago

When using eth_getTransactionReceipt on very old transactions (pre EIP-658 / pre Byzantium), Erigon incorrectly omits the root field in the response, and makes up an unexpected status field.

The Ethereum JSON-RPC specification requires root to be present for pre-Byzantium transactions:

It also returns either :

  • root : DATA 32 bytes of post-transaction stateroot (pre Byzantium)
  • status: QUANTITY either 1 (success) or 0 (failure)

Erigon seems to always reply with a status and without a root, irrespective of the corresponding original spec fork. This seems to be a regression since #2211, but it may have also been broken before.

It is important that the intermediate post-state root is provided for pre-Byzantium transactions; otherwise it is impossible to cryptographically verify that the JSON-RPC API response was not tampered with. The verification compares the provided receipt data against the block header's receipts_root. The technical background for the transition from root to status with Byzantium can be found here: https://eips.ethereum.org/EIPS/eip-658

System information

Cloudflare Ethereum Gateway Cloudflare technical support referred to Erigon for support with this issue.

Chain/Network: Mainnet

Expected behaviour

Infura response is correct and includes root:

{
  "blockHash": "0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd",
  "blockNumber": "0xb443",
  "contractAddress": null,
  "cumulativeGasUsed": "0x5208",
  "effectiveGasPrice": "0x2d79883d2000",
  "from": "0xa1e4380a3b1f749673e270229993ee55f35663b4",
  "gasUsed": "0x5208",
  "logs": [],
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "root": "0x96a8e009d2b88b1483e6941e6812e32263b05683fac202abc622a3e31aed1957",
  "to": "0x5df9b87991262f6ba471f09758cde1c0fc1de734",
  "transactionHash": "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060",
  "transactionIndex": "0x0",
  "type": "0x0"
}

Actual behaviour

Cloudflare response lacks root and includes status:

{
  "blockHash": "0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd",
  "blockNumber": "0xb443",
  "contractAddress": null,
  "cumulativeGasUsed": "0x5208",
  "effectiveGasPrice": "0x2d79883d2000",
  "from": "0xa1e4380a3b1f749673e270229993ee55f35663b4",
  "gasUsed": "0x5208",
  "logs": [],
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "status": "0x1",
  "to": "0x5df9b87991262f6ba471f09758cde1c0fc1de734",
  "transactionHash": "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060",
  "transactionIndex": "0x0",
  "type": "0x0"
}

Steps to reproduce the behaviour

{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionReceipt","params":["0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"]}
github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 40 days with no activity. Remove stale label or comment, or this will be closed in 7 days.

etan-status commented 1 year ago

Still relevant.

njgheorghita commented 10 months ago

Any update / proposed timeline for fixing this?