internet-computer-protocol / evm-rpc-canister

Interact with EVM blockchains from the Internet Computer.
https://internetcomputer.org/docs/current/developer-docs/multi-chain/ethereum/evm-rpc/overview
Apache License 2.0
63 stars 13 forks source link

Various fields in `Block` should be optional #233

Closed gregorydemay closed 3 months ago

gregorydemay commented 3 months ago

According to the Ethereum JSON-RPC specification only the following fields in a Block record are required

  1. hash
  2. parentHash
  3. sha3Uncles
  4. miner
  5. stateRoot
  6. transactionsRoot
  7. receiptsRoot
  8. logsBloom
  9. number
  10. gasLimit
  11. gasUsed
  12. timestamp
  13. extraData
  14. mixHash
  15. nonce
  16. size
  17. transactions
  18. uncles

This means that the following fields in the current Candid definition of a Block are wrongly declared mandatory and should be made optional:

  1. totalDifficulty
  2. difficulty
  3. baseFeePerGas

The current Candid definition of a Block should be changed to follow the Ethereum JSON-RPC specification. This will ensure that older blocks can be retrieved by the EVM-RPC canister. E.g., currently trying to retrieve block 0 will fail because the field baseFeePerGas is missing, since it was only introduced after block 12_965_000 (London upgrade).