openapi: /statechain/blocks documents `count` but the node returns `block_count`
Report
Summary
GET /statechain/blocks is documented in the published OpenAPI with a count property.
The node returns block_count instead. The documented name does not exist in the shipped
source: api/handler.go:870 declares BlockCount uint64 json:"block_count"``, and
json:"count" occurs zero times anywhere in the repository.
Steps to reproduce (read-only, no auth)
curl -s https://ldn.core.test.network/statechain/blocks | python -c "import sys,json;print(list(json.load(sys.stdin)))"
Actual: ['block_count', 'blocks']
Published contract: https://test.network/openapi.json, path /statechain/blocks,
response 200 -> properties: blocks, count.
Expected vs actual
- Expected (documented):
count, the number of blocks in the page. - Actual:
block_count.
A client generated from the spec reads data.count, gets undefined, and treats every page
as empty: pagination stops or arithmetic produces NaN. It fails silently, with a 200 and a
well-formed body.
Not a duplicate (checked)
Scanned all 891 public bounty tickets. Closest matches are XE-0481 (POST /statechain/blocks maps a retryable ErrGap to HTTP 400 - status mapping, not a response field) and XE-0063 (openapi: state-chain read schemas wrong for /statechain/kv). Neither covers this field.
Same class, other sites
I diffed all 21 parameterless GET endpoints in the published spec against the live node;
9 drift. Beyond this one: /blocks/recent (filed separately), /statechain/tip returns
undocumented prev_hash/signatures/timestamp, /node returns undocumented
delegation_underflows/dropped_blocks/pending_sends, and /delegation and /frontiers
declare fields the node never emits. Root cause looks the same: the spec is maintained by
hand and has drifted from the Go structs it describes.
Suggested fix
Generate the spec from the handler structs, or rename the documented field to block_count.
A CI check that every json:"..." tag under api/ appears in the published schema would
catch this whole class.
Thread
Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-4501 and says what differs; it is read like any other.