ethereum / ethereum/execution-apis
Proposal: Error handling specification #1
- Dominant language
- Io
- Stars
- 1.1k
- Forks
- 530
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 9
Description
Hi all,
I am working on a project that validates whether four Ethereum client implementations (Geth, Erigon, Nethermind, Besu) behave consistently to one another.
And while doing the experiments, I found out that the clients handle error cases in very much different ways:
----------------------------------------------------------------------------------
1. Invalid block argument to `getBlockTransactionCount`
- (Geth, Erigon, Besu) returns `null`
- (Nethermind) returns an `Error`
2. Invalid block argument to `getPastLogs`
- (Geth, Erigon, Besu) returns `[]`
- (Nethermind) returns an `Error`
3. Invalid block argument to `getTransactionFromBlock`
- (Geth, Erigon, Besu) returns `null`
- (Nethermind) returns an `Error`
4. Invalid block argument to `getBlockUncleCount`
- (Geth, Erigon, Besu) returns `null`
- (Nethermind) returns an `Error`
5. Invalid block argument to `getUncle`
- (Geth, Erigon, Besu) returns `null`
- (Nethermind) returns an `Error`
6. Invalid block argument to `getCode` (1)
- (Geth, Nethermind, Besu) returns an `Error`
- (Erigon) returns the code of the address
7. Invalid block argument to `getCode` (2)
- (Geth, Erigon, Nethermind) returns an `Error`
- (Besu) returns `null`
8. Invalid block argument to `getBalance`
- (Geth, Erigon, Nethermind) returns an `Error`
- (Besu) returns `null`
9. Invalid block argument to `getTransactionCount`
- (Geth, Erigon, Nethermind) returns an `Error`
- (Besu) returns `0`
10. Invalid block argument to `getStorageAt`
- (Geth, Erigon, Nethermind) returns an `Error`
- (Besu) returns `null`
----------------------------------------------------------------------------------
11. Unknown account to `getProof`
- (Geth, Nethermind) returns an account object
- (Besu) returns an `Error`
- Note: Erigon does not support `eth_getProof`
----------------------------------------------------------------------------------
12. Wrong range to `getPastLogs`
- (Geth, Besu) returns `[]`
- (Erigon, Nethermind) returns an `Error`
13. Wrong range to `getFeeHistory`
- (Geth, Erigon) returns `{ "oldestBlock": "0x0", "gasUsedRatio": null }`
- (Nethermind, Besu) returns an `Error`
----------------------------------------------------------------------------------
14. Invalid index to `getTransactionFromBlock`
- (Geth, Erigon, Besu) returns `null`
- (Nethermind) returns an `Error`
15. Invalid index to `getUncle`
- (Geth, Erigon, Besu) returns `null`
- (Nethermind) returns an `Error`
I assume these discrepancies derived from the lack of error handling specification in this document. So, how about specifying the expected results (e.g., Error, null, 0, [ ], ...) so that different client implementations behave consistently in error cases as well?
Example test cases can be found in the following link: [https://github.com/JosephK95/RPCTests](url)
Thanks and please let me know if there is anything I can help you with.
Contributor guide
Assessment
This issue has not been assessed yet.