Granola-Team / mina-indexer

The Mina Indexer is a re-imagined version of the software collectively called the "Mina archive node."
Apache License 2.0
18 stars 10 forks source link

Querying snarks by blockHeight_lte and prover results in unpredictable results #1197

Closed n1tranquilla closed 2 months ago

n1tranquilla commented 2 months ago

query:

query SnarksQuery($sort_by: SnarkSortByInput, $limit: Int = 10, $query: SnarkQueryInput) {
  snarks(sortBy: $sort_by, limit: $limit, query: $query) {
    blockHeight
    dateTime
    prover
    canonical
    block {
      stateHash
    }
    fee
  }
}

Case 1:

{
  "sort_by": "BLOCKHEIGHT_DESC",
  "limit": 100,
  "query": {
    "prover": "B62qp6RfHVKvyLaA4Nf3NTQ96cxUTz8yxpTuZWAAvzdt1vbxqzxRGjF",
    "canonical": true,
    "blockHeight_lte": 9999
  }
}

Case 2:

{
  "sort_by": "BLOCKHEIGHT_DESC",
  "limit": 100,
  "query": {
    "prover": "B62qp6RfHVKvyLaA4Nf3NTQ96cxUTz8yxpTuZWAAvzdt1vbxqzxRGjF",
    "canonical": true,
    "blockHeight_lte": 7061
  }
}

After executing with variables from case 1, one can see blocks with height 7060 at the top of the returned data. One would expect results from case 2 to contain snark work from block 7060, also, but instead it yields empty data.

jhult commented 2 months ago

Code area where problem likely lies: https://github.com/Granola-Team/mina-indexer/blob/main/rust/src/web/graphql/snarks/mod.rs#L159