Skip to content
This repository was archived by the owner on Mar 24, 2023. It is now read-only.
This repository was archived by the owner on Mar 24, 2023. It is now read-only.

[BUG] eth_getBlockByHash returns some fields equal to zero #564

@maciej-kozuszek

Description

@maciej-kozuszek

Performing RPC call eth_getBlockByHash to https://v1.mainnet.godwoken.io/rpc return some values equal to zero. For example Rpc call with body:

{
  "method": "eth_getBlockByHash",
  "jsonrpc": "2.0",
  "id": 1,
  "params": [
    "0x9207b685f981f6bdd1a191de60db31557bafc4774cb2093b395a6c4407b0e6f3",
    false
  ]
}

returns

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "number": "0x2d9e2",
    "hash": "0x9207b685f981f6bdd1a191de60db31557bafc4774cb2093b395a6c4407b0e6f3",
    ...
    "timestamp": "0x634f55fe",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0000000000000000",
    "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "uncles": [],
    "difficulty": "0x8e1bc9bf04000",
    "totalDifficulty": "0x8e1bc9bf04000",
    "extraData": "0x"
  }
}

Also visible on gwscan

mixHash, stateRoot, sha3Uncles, receiptsRoot and transactionsRoot are all equal to zero. Doing same call to ethereum mainnet for block 0xa9f6827e3a12cd76be9d2327c6545b57f947ba748ab5506a49b92728c71b16f7 we get response like this:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "number": "0xf16d48",
    "hash": "0xa9f6827e3a12cd76be9d2327c6545b57f947ba748ab5506a49b92728c71b16f7",
    ...
    "mixHash": "0xf8d941477eeb485383d8e4a1fab83930bdddaf35fc1c1e62f196c8ad4099accd",
    "nonce": "0x0000000000000000",
    "parentHash": "0x78d724802d3fb66a7f1149d10f6eebdd122113803c37e3fd80eb3773da2753eb",
    "receiptsRoot": "0x5cf419c5ec3a2489858cfb91d3d50f5af1c11a22340bba442dfb4ddc3044282f",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x1dcb9",
    "stateRoot": "0x6f1280b9de56bf9b39649226d02f73644673cf7cbb07eaf029bad6ea5970b6a4",
    "timestamp": "0x63574bcb",
    "totalDifficulty": "0xc70d815d562d3cfa955",
    "transactionsRoot": "0x990e232c23c11f3e033717a3f7b53701685cc4204d8d1b09e2dc4d49f7c3bee1",
    "uncles": [],
    "baseFeePerGas": "0x2db9ff18d"
  }
}

Lack of those fields makes calculating block hash impossible for hardhat fork feature which make whole fork blockchain invalid. I have setup test with simple test that performs eth_getBlockByHash parse rpc call result with hardhat block object and calculates hash from call data.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions