graphprotocol / graphprotocol/graph-node

[Bug] blockHashFromNumber returns null with no log when the node doesn't have the network (e.g. query nodes)

Open
#6,721 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.2k
Forks
1.1k
Avg merge
4d 1h
Merged PRs (30d)
1

Description

Bug report

IndexNodeResolver::block_ptr_for_number returns Ok(None) without logging when the network isn't in the node's BlockchainMap. blockHashFromNumber on a node without that network is therefore an instant null, and from outside that looks the same as "block not found".

The common case is a query node. A node whose id matches [general] query gets Networks::noop() in from_config_inner, so it has no chains at all. It still serves the index-node API on 8030 and answers version, and nothing at startup says it came up query-only.

indexer-agent pointed at that node reports IE070 no data returned, and people go chasing the RPC and the EBO subgraph. It's the same unanswered question as #4880.

resolve_cached_ethereum_calls already logs Failed to fetch cached Ethereum calls; nonexistent network for the same situation, so blockHashFromNumber is the odd one out.

Repro on v0.45.0:

  • [general] query = "index_node_0" with --node-id index_node_0, then { blockHashFromNumber(network: "mainnet", blockNumber: 25961537) } returns null with query_time_ms: 0 and no WARN
  • same result on a normal index node with network: "nosuchchain"

Suggestion: a WARN (or a GraphQL error) naming the network and this node's id when the network isn't configured here, and an INFO at startup when a node comes up query-only. Same idea as #6718 for the ingestor.

Relevant log output
INFO Query timing (GraphQL), block: 0, query_time_ms: 0, variables: null, query: { version { version } blockHashFromNumber(network: "mainnet", blockNumber: 25961537) } , subgraph_id: indexnode, component: IndexNodeServer
IPFS hash

No response

Subgraph name or link to explorer

No response

Some information to help us out
  • Tick this box if this bug is caused by a regression found in the latest release.
  • Tick this box if this bug is specific to the hosted service.
  • I have searched the issue tracker to make sure this issue is not a duplicate.
OS information

macOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at IndexNodeResolver::block_ptr_for_number and trace the no-network path through Networks::noop() and from_config_inner. Compare its behavior with resolve_cached_ethereum_calls, then reproduce the blockHashFromNumber query on a query-only or unknown-network node. Done means the missing network is clearly reported with the network and node id, and query-only startup is identified in logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, rust
Domain
backend-api-design, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.