{"id":"XE-4501","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":968,"title":"openapi: /statechain/blocks documents `count` but the node returns `block_count`","area":"sdk-docs-web","claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":true,"internal_ref":"#1078","internal_url":"https://github.com/xeprotocol/core/issues/1078","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-11T02:26:11.414508+00:00","updated_at":"2026-11-15T17:42:16.598376+00:00","source_created_at":null,"told_at":"2026-11-15T17:42:49.184578+00:00","status_changed_at":"2026-11-15T17:42:49.165400+00:00","url":"https://bounty.xe.network/XE-4501","body":"## Summary\r\n\r\n`GET /statechain/blocks` is documented in the published OpenAPI with a `count` property.\r\nThe node returns `block_count` instead. The documented name does not exist in the shipped\r\nsource: `api/handler.go:870` declares `BlockCount uint64 `json:\"block_count\"``, and\r\n`json:\"count\"` occurs zero times anywhere in the repository.\r\n\r\n## Steps to reproduce (read-only, no auth)\r\n\r\n```\r\ncurl -s https://ldn.core.test.network/statechain/blocks | python -c \"import sys,json;print(list(json.load(sys.stdin)))\"\r\n```\r\n\r\nActual: `['block_count', 'blocks']`\r\n\r\nPublished contract: `https://test.network/openapi.json`, path `/statechain/blocks`,\r\nresponse 200 -> `properties: blocks, count`.\r\n\r\n## Expected vs actual\r\n\r\n- Expected (documented): `count`, the number of blocks in the page.\r\n- Actual: `block_count`.\r\n\r\nA client generated from the spec reads `data.count`, gets `undefined`, and treats every page\r\nas empty: pagination stops or arithmetic produces `NaN`. It fails silently, with a 200 and a\r\nwell-formed body.\r\n\r\n## Not a duplicate (checked)\r\n\r\nScanned all 891 public bounty tickets. Closest matches are XE-0481 (POST /statechain/blocks\r\nmaps a retryable ErrGap to HTTP 400 - status mapping, not a response field) and XE-0063\r\n(openapi: state-chain read schemas wrong for /statechain/kv). Neither covers this field.\r\n\r\n## Same class, other sites\r\n\r\nI diffed all 21 parameterless GET endpoints in the published spec against the live node;\r\n9 drift. Beyond this one: `/blocks/recent` (filed separately), `/statechain/tip` returns\r\nundocumented `prev_hash`/`signatures`/`timestamp`, `/node` returns undocumented\r\n`delegation_underflows`/`dropped_blocks`/`pending_sends`, and `/delegation` and `/frontiers`\r\ndeclare fields the node never emits. Root cause looks the same: the spec is maintained by\r\nhand and has drifted from the Go structs it describes.\r\n\r\n## Suggested fix\r\n\r\nGenerate the spec from the handler structs, or rename the documented field to `block_count`.\r\nA CI check that every `json:\"...\"` tag under `api/` appears in the published schema would\r\ncatch this whole class.","patch_refs":[],"thread":[{"id":6456,"source":"desk","source_ref":"reply:5096","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-4501 and says what differs; it is read like any other.","created_at":"2026-11-15T17:42:16.598376+00:00"}]}