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

Suspicious query #1547

Closed n1tranquilla closed 5 hours ago

n1tranquilla commented 5 hours ago

When running the indexer locally at 10k blocks, there are only a few non-canonical blocks. These occur very near the end of the chain, as if we're only getting the last of the non-canonical branches.

query Blocks($limit: Int = 10, $sort_by: BlockSortByInput!, $query: BlockQueryInput!) {
  blocks(limit: $limit, sortBy: $sort_by, query: $query ) {
    blockHeight
  }
}
{
  "limit": 25,
  "sort_by": "BLOCKHEIGHT_DESC",
  "query": {
    "canonical": false,
    "blockHeight_lte":9995
  }
}
{
  "data": {
    "blocks": [
      {
        "blockHeight": 9994
      },
      {
        "blockHeight": 9993
      },
      {
        "blockHeight": 9992
      },
      {
        "blockHeight": 9991
      }
    ]
  }
}

Possibly Related / Coincidental

When ingesting 10k blocks, the checked_sub panic at block height 9990 for me which seems suspiciously close to bottom of height of the first non-canonical block in these results.

Again, when ingesting only 5000 blocks, the checked_sub panic at something like 4990 or thereabouts. We didn't get to the bottom of that but this seems very very suspicious... especially since the panic occurs near the end of the limit of the ingested blocks.

n1tranquilla commented 5 hours ago

Has to do with this line in the indexer

"--do-not-ingest-orphan-blocks"

Default should likely be to ingest everything.

The just recipe will likely have to be refactored to reflect this, however, we'll find a way to not ingest orphan blocks in tier2 and tier3