Fix backward-compatiblity of GraphQL queries for pre-0.48.0 versions (#3258)
## Description Connecting `FuelClient` to a node running v0.47.x causes an error since the GraphQL query parameters mismatch. Again I'd like to mention that this is caused by the way we abuse GraphQL: it really should be only used to query the fields we actually need and `FuelClient` is an abomination. This PR adds a mechanism to query node version first and then performs old versions of queries when needed. We cache `node_version` in `ChainStateInfo`. Note that this PR only does this for pre-0.48.0 versions, calling them `Legacy` versions. A more generic naming schema might be needed in the future if new breaking changes are done. The current one shall suffice for now. It also adds snapshot tests for the fields to prevent this issue in the future. ### Trade-offs An extra round-trip is required on the first call to `chain_info()` or `consensus_parameters()` against a node of either version, since the node version must be fetched before we know which query to send. Subsequent calls within the same `FuelClient` instance pay no extra cost. ## Checklist - [ ] Breaking changes are clearly marked as such in the PR description and changelog - [x] New behavior is reflected in tests - [ ] [The specification](https://github.com/FuelLabs/fuel-specs/) matches the implemented behavior (link update PR if changes are needed) ### Before requesting review - [x] I have reviewed the code myself - [x] I have created follow-up issues caused by this PR and linked them here
H
Hannes Karppila committed
c30e093b2d24dca6ce1b960f071df7cc3b58336c
Parent: 0faeb99
Committed by GitHub <noreply@github.com>
on 4/16/2026, 10:46:56 PM