mina-indexer icon indicating copy to clipboard operation
mina-indexer copied to clipboard

`total_num_canonical_blocks` is likely to be misunderstood and misused

Open n1tranquilla opened this issue 5 months ago • 7 comments

Here is a query where we are limiting to the first 6k blocks, however the result for total_num_blocks is the length of the entire blockchain.

Query:

query BlocksQuery($query: BlockQueryInput!, $limit: Int = 10, $sort_by: BlockSortByInput!) {
  blocks(query: $query, limit: $limit, sortBy: $sort_by) {
    total_num_blocks
    total_num_canonical_blocks
    total_num_supercharged_blocks
    blockHeight
    globalSlotSinceGenesis
    transactions {
      coinbase
    }
    snarkFees
    txFees
    canonical
  }
}

Variables:

{
  "limit": 10000000,
  "sort_by": "BLOCKHEIGHT_DESC",
  "query": {
    "blockHeight_lte": 6000
  }
}

Response:

{
  "data": {
    "blocks": [
      {
        "total_num_blocks": 359614,
        "total_num_canonical_blocks": 359604,
        "total_num_supercharged_blocks": 142247,
        "blockHeight": 6000,
        "globalSlotSinceGenesis": 8478,
        "transactions": {
          "coinbase": "1440000000000"
        },
        "snarkFees": "0",
        "txFees": "1000000",
        "canonical": true
      },
...

n1tranquilla avatar Sep 22 '24 23:09 n1tranquilla