Skip to content

node, server/index-node: say when a node has no chain for a network - #6801

Open
lx3133584 wants to merge 1 commit into
graphprotocol:masterfrom
lx3133584:fix/block-hash-missing-network-log
Open

lx3133584 wants to merge 1 commit into
graphprotocol:masterfrom
lx3133584:fix/block-hash-missing-network-log

Conversation

@lx3133584

@lx3133584 lx3133584 commented Nov 25, 2026 •

Copy link
Copy Markdown

IndexNodeResolver::block_ptr_for_number answered Ok(None) without a word when the network was not in the node's BlockchainMap. The caller turns that into a null, and from outside it reads the same as "no such block". The same function already logs a warning when a chain exists but the fetch fails, so this was the one silent path.

The common case is a query node: from_config_inner gives a node whose id matches [general] query a Networks::noop(), so it has no chains at all, and nothing at startup said so either. An indexer-agent pointed at such a node reports IE070 no data returned, and the search goes to the RPC and the EBO subgraph instead of to the node's role.

Fix

Two log lines, no behaviour change:

  • resolver.rs: a warning naming the network and block number before the Ok(None). It matches the one resolve_cached_ethereum_calls already emits for the same situation.
  • network_setup.rs: an info at startup when the node comes up query-only, with its node id.

The GraphQL answer is unchanged: still null, still Ok(None).

Testing

This is log-only, and resolver.rs has no test harness: IndexNodeResolver needs a BlockchainMap, a Store and an amp::Client, so a test that captured the slog output would be mostly scaffolding around two lines. I verified the placement by reading the one path that reaches it instead — the warning sits after both try_resolve_for_chain! attempts miss and immediately before the Ok(None) that ends the function, so no other route reaches that point.

  • cargo check -p graph-node -p graph-server-index-node — clean
  • cargo test -p graph-server-index-node — 9 passed
  • cargo test -p graph-node --lib — 51 passed
  • cargo test --workspace --exclude graph-tests — the command just test-unit runs, so the whole workspace and every target. 296 passed; gnd's gnd_test fails 6 of 7, all at pgtemp's run_db.rs with Failed to start initdb. Is it installed and on your path? — the test harness starts a throwaway PostgreSQL and this machine has the client library but not the server binaries. It fails before reaching any code.
  • cargo fmt --all — no change
  • cargo clippy --all-targets — no warnings, the same command just lint runs
  • cargo check --release — clean, every crate in the workspace, the same command just check --release runs

Not run: the integration tests, which need PostgreSQL on 5432, IPFS on 5001 and Anvil on 3021.

Fixes #6721

`IndexNodeResolver::block_ptr_for_number` answered `Ok(None)` without a word
when the network was not in the node's `BlockchainMap`, and the caller turns
that into a `null` that reads the same as "no such block". A query node is the
common case: `from_config_inner` gives it `Networks::noop()`, so it has no
chains at all, and nothing at startup said so either.

The resolver now logs the network and block number before answering, which
matches the warning `resolve_cached_ethereum_calls` already emits for the same
situation. `from_config_inner` logs that the node came up query-only, with its
node id.

The GraphQL answer is unchanged: still `null`, still `Ok(None)`. Only the
silence is gone.

Signed-off-by: Liang Xu <24490353+lx3133584@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant