Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON_RPC - Geth 1.9.1 has changed block size from being a hex number with a prefix to one without. #19882

Closed
credfeto opened this issue Jul 24, 2019 · 1 comment · Fixed by #19885
Assignees
Milestone

Comments

@credfeto
Copy link

credfeto commented Jul 24, 2019

Hi there,

Since updating from Geth 1.9.0 to 1.9.1 the response from the JSON RPC call eth_getBlockByNumber has changed such that the 'size' field of the response is no longer a hex number.

System information

Geth version: Geth/novichock-rpc-node/v1.9.1-stable-b7b2f60f/linux-amd64/go1.11.5
OS & Version: Linux
Commit hash : (if develop)

Expected behaviour

Response should have size being a hex number:

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "difficulty": "0x2",
        "extraData": "0xd883010901846765746888676f312e31312e35856c696e757800000000000000998ca2aaa1e193ba2d27ba25e64c159ff0e0398773b55e0965195f026fd380b5223cc40d7d6267e11d90a2aa8a1057ad714962097044662bd1d3218208b2c87101",
        "gasLimit": "0x7a1200",
        "gasUsed": "0x0",
        "hash": "0x3ea2f60d5a8b7dd7707c18d4f4dea52cdc250aaae099705c90fe5f711f7aba75",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x0000000000000000000000000000000000000000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0xe59cbb",
        "parentHash": "0x4b64d241c89b3dca989cf219626d7eab4b6318c0a02d0eb31e30527c524513e8",
        "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x261",
        "stateRoot": "0x076266ae92b8b16b0fbaf1ea6c2ff3580e271d5ff31ef1ec07886d81b83d2d6b",
        "timestamp": "0x5d386ebb",
        "totalDifficulty": "0x1cb3977",
        "transactions": [],
        "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "uncles": []
    }
}

Actual behaviour

Size no longer has a 0x prefix and I assume this is now a decimal number.

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "difficulty": "0x2",
        "extraData": "0xd883010901846765746888676f312e31312e35856c696e757800000000000000998ca2aaa1e193ba2d27ba25e64c159ff0e0398773b55e0965195f026fd380b5223cc40d7d6267e11d90a2aa8a1057ad714962097044662bd1d3218208b2c87101",
        "gasLimit": "0x7a1200",
        "gasUsed": "0x0",
        "hash": "0x3ea2f60d5a8b7dd7707c18d4f4dea52cdc250aaae099705c90fe5f711f7aba75",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x0000000000000000000000000000000000000000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0xe59cbb",
        "parentHash": "0x4b64d241c89b3dca989cf219626d7eab4b6318c0a02d0eb31e30527c524513e8",
        "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": 609,
        "stateRoot": "0x076266ae92b8b16b0fbaf1ea6c2ff3580e271d5ff31ef1ec07886d81b83d2d6b",
        "timestamp": "0x5d386ebb",
        "totalDifficulty": "0x1cb3977",
        "transactions": [],
        "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "uncles": []
    }
}

Steps to reproduce the behaviour

Call json RPC call:

{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":67}

Backtrace

[backtrace]
@ocoster-ff
Copy link

Looking at the code, it appears to have been introduced in this PR:

https://github.com/ethereum/go-ethereum/pull/19669/files

I expect this line:

fields["size"] = block.Size()

Should be:

fields["size"] = hexutil.Uint64(block.Size())

@credfeto credfeto changed the title Geth 1.9.1 has changed Block size from being a hex number with a prefix to one without. JSON_RPC - Geth 1.9.1 has changed block size from being a hex number with a prefix to one without. Jul 24, 2019
@rjl493456442 rjl493456442 self-assigned this Jul 24, 2019
@karalabe karalabe added this to the 1.9.2 milestone Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants