We're updating the issue view to help you get more done. 

JSON-RPC eth_getcode behaviour is different from go-ethereum during contract deployment

Description

Problem

The issue is that when `go-thereum` package is used to communicate with Pantheon through JSON-RPC the `eth_getCode` (https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode) is executed with parameter "pending" and Pantheon's JSON-RPC return a response with a value "null" instead of containing contract's code.

1 2 3 4 5 { "jsonrpc" : "2.0", "id" : 4, "result" : null }

Expected behaviour

`go-ethereum` backend (and JSON-RPC) returns contract code bytes no matter what "BLOCK PARAMETER" was passed as the second parameter (`pending` or `latest`) to `eth_getCode` method.

Example of one of the contract codes retrieved through infura.io from mainnet. As you can see both `latest` and `pending` returns contract's byte code.

1 curl -H "Accept: application/json" -X POST --data '{"jsonrpc":"2.0","id":4,"method":"eth_getCode","params":["0x448f8ce6e115acd755b2085d1a0a8b8f41f4f740", "pending"]}' https://mainnet.infura.io
1 curl -H "Accept: application/json" -X POST --data '{"jsonrpc":"2.0","id":4,"method":"eth_getCode","params":["0x448f8ce6e115acd755b2085d1a0a8b8f41f4f740", "latest"]}' https://mainnet.infura.io

Current behaviour

In our case if there is no pending transaction for the contract's code and we call the Pantheon JSON-RPC `eth_getCode` method with parameter "pending" we receive different responses than what we expect per infura.io example.

Call with parameter "pending":

1 2 3 4 5 6 curl -H "Accept: application/json" -X POST --data '{"jsonrpc":"2.0","id":4,"method":"eth_getCode","params":["0xfbeaa81cd91fd42dd509556b28486f4d1965d655","pending"]}' http://localhost:32770/jsonrpc { "jsonrpc" : "2.0", "id" : 4, "result" : null }

Call with parameter "latest":

1 2 3 4 5 6 curl -H "Accept: application/json" -X POST --data '{"jsonrpc":"2.0","id":4,"method":"eth_getCode","params":["0xfbeaa81cd91fd42dd509556b28486f4d1965d655", "latest"]}' http://localhost:32770/jsonrpc { "jsonrpc" : "2.0", "id" : 4, "result" : "0x60806040526004361061008e576000357...........2dcc450a17aa3c677fc665129a17dbfc282346881153bce8dd76b1dc272c0029" }

Environment

None

Status

Assignee

Unassigned

Reporter

Viaceslav Ruckis

Labels

None

Scrum Team

None

Refinement State

Not Started

Priority

P2