onflow / flow-evm-gateway

FlowEVM Gateway implements an Ethereum-equivalent JSON-RPC API for EVM clients to use
https://developers.flow.com/evm/about
Apache License 2.0
11 stars 9 forks source link

Calculate `size` field on JSON-RPC calls that return block info #375

Closed m-Peter closed 2 months ago

m-Peter commented 2 months ago

Example:

{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "number": "0x2",
    "hash": "0x152687f0f77a6fb45aefcfc2977b958ac542333db6ec36af0d6baea9e48a22ca",
    "parentHash": "0x4804ee15127f564ed89f11a363790ae0349d909087a3dc69c7f2d711ffee397c",
    "nonce": "0x0100000000000000",
    "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "receiptsRoot": "0x597b7d6dac7ed0e172717eb3ecee0ebd56188817afe42be254e47a5d322efc89",
    "miner": "0x0000000000000000000000000000000000000000",
    "difficulty": "0x0",
    "totalDifficulty": "0x0",
    "extraData": "0x",
    "size": "0x0",
    "gasLimit": "0xe4e1c0",
    "gasUsed": "0x5b04",
    "timestamp": "0x66a0a29a",
    "transactions": [
      "0x41287df7a2b50b5f4729385d0eecc32fdfef4defdbab409856e26bce54b244f3"
    ],
    "uncles": [],
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "baseFeePerGas": "0x0"
  }
}

We see that the above block has a transaction, but the size value is still 0x0.