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

eth_getBlockByHash size is incorrect, missing withdrawals #1777

Closed
1 task done
Tracked by #1579
Rjected opened this issue Mar 15, 2023 · 3 comments · Fixed by #1945
Closed
1 task done
Tracked by #1579

eth_getBlockByHash size is incorrect, missing withdrawals #1777

Rjected opened this issue Mar 15, 2023 · 3 comments · Fixed by #1945
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior

Comments

@Rjected
Copy link
Member

Rjected commented Mar 15, 2023

Describe the bug

In the rpc-compat test eth_getBlockByHash:

  • The size parameter is wrong (off by one, maybe incorrect length calculation due to withdrawals?)
  • The author field should not be returned
  • Empty withdrawals should be returned

Here is the RPC request, response, and expected response:

>>  {"jsonrpc":"2.0","id":1,"method":"eth_getBlockByHash","params":["0x898753d8fdd8d92c1907ca21e68c7970abd290c647a202091181deec3f30a0b2",true]}
<<  {"jsonrpc":"2.0","result":{"hash":"0x898753d8fdd8d92c1907ca21e68c7970abd290c647a202091181deec3f30a0b2","parentHash":"0x1fc027d65f820d3eef441ebeec139ebe09e471cf98516dce7b5643ccb27f418c","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","author":"0x0000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0xa112033b100ca01e159de21f1bb229133c7734c616bbf34c2f51032c6da71f75","transactionsRoot":"0xbf06cffa242d5b5d567567b318fc73c54364a73827ab4cdbca7a9db1c788581a","receiptsRoot":"0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2","withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","number":"0x1","gasUsed":"0x5208","gasLimit":"0x4c4b40","extraData":"0x","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","timestamp":"0xa","difficulty":"0x0","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","totalDifficulty":"0x1","uncles":[],"transactions":[{"hash":"0x74e41d593675913d6d5521f46523f1bd396dff1891bdb35f59be47c7e5e0b34b","nonce":"0x0","blockHash":"0x898753d8fdd8d92c1907ca21e68c7970abd290c647a202091181deec3f30a0b2","blockNumber":"0x1","transactionIndex":"0x0","from":"0x658bdf435d810c91414ec09147daa6db62406379","to":"0x658bdf435d810c91414ec09147daa6db62406379","value":"0x3e8","gasPrice":"0x342770c1","gas":"0x5208","input":"0x","r":"0xaf5fc351b9e457a31f37c84e5cd99dd3c5de60af3de33c6f4160177a2c786a60","s":"0x201da7a21046af55837330a2c52fc1543cd4d9ead00ddf178dd96935b607ff9b","v":"0xa95","chainId":"0x539","type":"0x0"}],"size":"0x28a","baseFeePerGas":"0x342770c0"},"id":1}
response differs from expected:
 {
   "id": 1,
   "jsonrpc": "2.0",
   "result": {
-    "author": "0x0000000000000000000000000000000000000000",
     "baseFeePerGas": "0x342770c0",
     "difficulty": "0x0",
     "extraData": "0x",
     "gasLimit": "0x4c4b40",
     "gasUsed": "0x5208",
     "hash": "0x898753d8fdd8d92c1907ca21e68c7970abd290c647a202091181deec3f30a0b2",
     "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
     "miner": "0x0000000000000000000000000000000000000000",
     "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
     "nonce": "0x0000000000000000",
     "number": "0x1",
     "parentHash": "0x1fc027d65f820d3eef441ebeec139ebe09e471cf98516dce7b5643ccb27f418c",
     "receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
     "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
-    "size": "0x28a",
+    "size": "0x28b",
     "stateRoot": "0xa112033b100ca01e159de21f1bb229133c7734c616bbf34c2f51032c6da71f75",
     "timestamp": "0xa",
     "totalDifficulty": "0x1",
     "transactions": [
       : {
         "blockHash": "0x898753d8fdd8d92c1907ca21e68c7970abd290c647a202091181deec3f30a0b2",
         "blockNumber": "0x1",
         "chainId": "0x539",
         "from": "0x658bdf435d810c91414ec09147daa6db62406379",
         "gas": "0x5208",
         "gasPrice": "0x342770c1",
         "hash": "0x74e41d593675913d6d5521f46523f1bd396dff1891bdb35f59be47c7e5e0b34b",
         "input": "0x",
         "nonce": "0x0",
         "r": "0xaf5fc351b9e457a31f37c84e5cd99dd3c5de60af3de33c6f4160177a2c786a60",
         "s": "0x201da7a21046af55837330a2c52fc1543cd4d9ead00ddf178dd96935b607ff9b",
         "to": "0x658bdf435d810c91414ec09147daa6db62406379",
         "transactionIndex": "0x0",
         "type": "0x0",
         "v": "0xa95",
         "value": "0x3e8"
       }
     ],
     "transactionsRoot": "0xbf06cffa242d5b5d567567b318fc73c54364a73827ab4cdbca7a9db1c788581a",
     "uncles": [
     ],
     "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
+    "withdrawals": [
+    ]
   }
 }

Steps to reproduce

Run the steps in #851, but the docker image MUST be built in the dan/hive-ci branch, due to bug fixes.

Hive command:

./hive --client reth --sim ethereum/rpc-compat --sim.limit "/eth_getBlockByHash"

Node logs

No response

Platform(s)

No response

What version/commit are you on?

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@Rjected Rjected added C-bug An unexpected or incorrect behavior A-rpc Related to the RPC implementation labels Mar 15, 2023
@Rjected
Copy link
Member Author

Rjected commented Mar 15, 2023

These issues also prevent eth_getBlockByNumber hive tests from succeeding

@mattsse
Copy link
Collaborator

mattsse commented Mar 16, 2023

missing withdrawals

I'm not convinced this is the reason, because there are no withdrawals, no?

perhaps it's:

length += length_of_length(length);

@onbjerg
Copy link
Collaborator

onbjerg commented Mar 21, 2023

#1886 fixed this issue minus the off by one on the size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants