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_call for future blocks should return an error #12850

Open madumas opened 3 days ago

madumas commented 3 days ago

System information

Erigon version: v2.60.10

Chain/Network: Ethereum

Expected behaviour

Requesting an eth_call by RPC should return an error.

Actual behaviour

Any eth_call to a future block returns 0x. This can be problematic during reorgs, rewinds, and when used behind a load balancer, as clients may expect the node to be synced to that future block.

Steps to reproduce the behaviour

On an Erigon Ethereum Mainnet node, run the curl command:

curl http://erigon/   -X POST   -H "Content-Type: application/json"   --data '{"method":"eth_call","params":[{"from": null,"to":"0x6b175474e89094c44
da98b954eedeac495271d0f","data":"0x06fdde03"}, "0x50000000"],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"result":"0x"}

Result on Besu:

curl http://besu/   -X POST   -H "Content-Type: application/json"   --data '{"method":"eth_call","params":[{"from": null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x06fdde03"}, "0x50000000"],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"Block not found"}}

Result on Geth:

curl http://geth/   -X POST   -H "Content-Type: application/json"   --data '{"method":"eth_call","params":[{"from": null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x06fdde03"}, "0x50000000"],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"header not found"}}

Backtrace

n/a