openethereum / parity-ethereum

The fast, light, and robust client for Ethereum-like networks.
Other
6.82k stars 1.69k forks source link

trace_call doesn't work with the "pending" block argument: Couldn't parse parameters: `BlockNumber::Pending` is not supported #11794

Open max-block opened 4 years ago

max-block commented 4 years ago

trace_call request works fine with "latest" block:

curl  -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"trace_call","params":[{"to": "0x509ee0d083ddf8ac028f2a56731412edd63223b9", "data": "0x18160ddd"}, ["trace"], "latest"],"id":71}'

{"jsonrpc":"2.0","result":{"output":"0x000000000000000000000000000000000000000000000000000000174876e800","stateDiff":null,"trace":[{"action":{"callType":"call","from":"0x0000000000000000000000000000000000000000","gas":"0x1dcd12b8","input":"0x18160ddd","to":"0x509ee0d083ddf8ac028f2a56731412edd63223b9","value":"0x0"},"result":{"gasUsed":"0x7db","output":"0x000000000000000000000000000000000000000000000000000000174876e800"},"subtraces":0,"traceAddress":[],"type":"call"}],"vmTrace":null},"id":71}

But it fails with the "pending" block parameter:

curl  -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"trace_call","params":[{"to": "0x509ee0d083ddf8ac028f2a56731412edd63223b9", "data": "0x18160ddd"}, ["trace"], "pending"],"id":71}'

{"jsonrpc":"2.0","error":{"code":-32602,"message":"Couldn't parse parameters: `BlockNumber::Pending` is not supported","data":"()"},"id":71}

Docs say that trace_call supports "pending" block parameter: https://openethereum.github.io/wiki/JSONRPC-trace-module.html#trace_call

Quantity or Tag - (optional) Integer of a block number, or the string 'earliest', 'latest' or 'pending'.

rakita commented 4 years ago

Hi, Pending was made deprecated, I suppose that there were some problems with it. We need to change that wiki.

BlockNumber::Pending => return Err(errors::invalid_params("`BlockNumber::Pending` is not supported", ())),