Go-ethereum: eth: eth_call requires block as last parameter

Created on 19 Apr 2016  路  4Comments  路  Source: ethereum/go-ethereum

System information

Geth version:

Version: 1.4.0-unstable
Git Commit: 27116bd46cbc14a8eec9e1818945f1f10b9b834a
Protocol Versions: [63 62 61]
Network Id: 1
Go Version: go1.5.3
OS: linux
GOPATH=
GOROOT=/usr/lib/go

OS & Version: Linux 6fc65e9ad3f4 4.1.8-hypriotos-v7+ #2 SMP PREEMPT Wed Sep 30 19:37:28 UTC 2015 armv7l GNU/Linux

Commit hash : 27116bd46cbc14a8eec9e1818945f1f10b9b834a

Expected behaviour (geth 1.3.5)

$ curl -sL http://127.0.0.1:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0xa6c80e03727bb386f0cbd62959d1f08bdc1dcc54","data":"0x75d74f39"}],"id":1}' | jq -r '.'
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001472616e646f6d206d657373616765203133373137000000000000000000000000"
}

Actual behaviour (geth 1.4 develop)

$ curl -sL http://127.0.0.1:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0x4f227306c9a15bf656971b09663a1bf0d5de1cb5","data":"0x75d74f39"}],"id":1}' | jq -r '.'
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "invalid or missing value for params[1]"
  }
}

Steps to reproduce the behaviour

eth_call

Backtrace

[backtrace]
rpc

Most helpful comment

The error occurs because the "default block parameter" is missing.
The spec doesn't say that it is optional, but I think it is indeed more convenient
to default it to "latest" (like we do in 1.3.x).

$ curl -sL http://127.0.0.1:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0xa6c80e03727bb386f0cbd62959d1f08bdc1dcc54","data":"0x75d74f39"}, "latest"],"id":1}' | jq -r '.'
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x"
}

works.

All 4 comments

Pling @bas-vk

The error occurs because the "default block parameter" is missing.
The spec doesn't say that it is optional, but I think it is indeed more convenient
to default it to "latest" (like we do in 1.3.x).

$ curl -sL http://127.0.0.1:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0xa6c80e03727bb386f0cbd62959d1f08bdc1dcc54","data":"0x75d74f39"}, "latest"],"id":1}' | jq -r '.'
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x"
}

works.

@fjl thanks! I'll make sure all of our RPC code uses "latest" and retest. Thanks.

BTW I was going to test "latest", but then it was ~4am my time and I forgot before submitting issue.

Was this page helpful?
0 / 5 - 0 ratings