ethereum / ethereum/execution-apis
graphql: getBlock return error for notfound hash, but null for notfound number
- Dominant language
- Io
- Stars
- 1.1k
- Forks
- 530
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 9
Description
#### Expected behaviour
Whether the block-hash or block-number should always return an error or null, should be in the same behavior.
#### Actual behaviour
##### not found hash
> request
```graphql
{block(hash: "0xc1d1224983a2b43f2ea1b847337eda55e316e94603386e346abe3f6e08121028") { number }}
```
> response
```json
{
"errors": [
{
"message": "header for hash not found",
"path": [
"block"
]
}
],
"data": {
"block": null
}
}
```
##### not found number
> request
```graphql
{block(number: "0x100") { number }}
```
> response
```json
{
"data": {
"block": null
}
}
```
but the similar request in JSON-RPC all return `null`
> hash not found request
```json
{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"id": 1,
"params": [
"0xc1d1224983a2b43f2ea1b847337eda55e316e94603386e346abe3f6e08121028",
false
]
}
```
> number not found request
```json
{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"id": 1,
"params": [
"0x100",
false
]
}
```
> the response
```json
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
```
IMO, we should keep the GraphQL' requests in the same behavior as JSON-RPC's, both return `null`, or at least let the not-found hash also return null.
@s1na @shemnon WDYT
Contributor guide
Assessment
This issue has not been assessed yet.