Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql: getBlock return error for notfound hash, but null for notfound number #28414

Closed
jsvisa opened this issue Oct 25, 2023 · 1 comment
Closed
Labels

Comments

@jsvisa
Copy link
Contributor

jsvisa commented Oct 25, 2023

System information

Geth version: geth version
CL client & version: e.g. lighthouse/nimbus/prysm@v1.0.0
OS & Version: Windows/Linux/OSX
Commit hash : (if develop)

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

{block(hash: "0xc1d1224983a2b43f2ea1b847337eda55e316e94603386e346abe3f6e08121028") { number }}

response

{
  "errors": [
    {
      "message": "header for hash not found",
      "path": [
        "block"
      ]
    }
  ],
  "data": {
    "block": null
  }
}
not found number

request

{block(number: "0x100") { number }}

response

{
  "data": {
    "block": null
  }
}

but the similar request in JSON-RPC all return null

hash not found request

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "id": 1,
  "params": [
    "0xc1d1224983a2b43f2ea1b847337eda55e316e94603386e346abe3f6e08121028",
    false
  ]
}

number not found request

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "id": 1,
  "params": [
    "0x100",
    false
  ]
}

the response

{
  "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 WDYT

@jsvisa
Copy link
Contributor Author

jsvisa commented Oct 25, 2023

Open an issue in ethereum/execution-apis#481 instead.

@jsvisa jsvisa closed this as completed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant