ethereum / trin

An Ethereum portal client: a json-rpc server with nearly instant sync, and low CPU & storage usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add block size field to eth_getBlockByHash

carver opened this issue · comments

The json-rpc doc definition is underwhelming.

So we need to either:

  1. Find an authoritative spec (is it the length of the header? or the sum of the transactions' lengths? etc)
  2. Survey the existing implementations, making sure a variety of clients agree, then push a clarification back up to the specs
  3. If existing implementations don't agree... punt until we think we have our own need, or users ask for it?

Then, we need to add the test case, preferably for the block already tested by get block, mainnet block number 1000001. Simply change the size assertion from None to the correct expected value at: [TODO link after merging to master, in /tests/rpc_server test_eth_get_block_by_hash()]

Finally, of course, it needs to be implemented, by setting size in rpc/src/eth_rpc.rs

Hi @carver

I just did some quick research on block size in existing implementations. I think we can't implement it yet because we only have the header field, and block size is calculated from the header, transactions, and withdrawals.

@carver, can I work on this? We already have both withdrawals and transactions available.