graphprotocol / graphprotocol/graph-node

POI is generated for invalid block number and hash

Abierto
#4,369 1 comentario 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Stale
Lenguaje dominante
Rust
Estrellas
3.2k
Forks
1.1k
Merge medio
4 d 1 h
PR fusionados (30 d)
1

Descripción

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Currently when querying proofOfIndexing in the admin API with incorrect block hash or invalid block number will each return different POIs. Since invalid POIs can be generated this way, would it make sense for graph-node to error out saying that the block number or hash is invalid for the subgraph (and network that the subgraph is indexing)?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Example query for a goerli subgraph with combination of POI queries on the same subgraph:

{
  indexingStatuses(subgraphs: ["QmfDSEUwk2Wp1cVEQ8FcJLVJLbPRfLpG75gLTEHkrSEFRC"]) {
    subgraph
    synced
    health
    fatalError {
      handler
      message
    }
    chains {
      network
      ... on EthereumIndexingStatus {
        latestBlock {
          number
          hash
        }
        chainHeadBlock {
          number
          hash
        }
      }
    }
  }
  blockHashFromNumber(network:"goerli", blockNumber:8491464)
  right_hash: proofOfIndexing(subgraph:"QmfDSEUwk2Wp1cVEQ8FcJLVJLbPRfLpG75gLTEHkrSEFRC",
  	blockNumber:8491464,
    blockHash: "5d80892e197d636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488"
  )
  wrong_hash: proofOfIndexing(subgraph:"QmfDSEUwk2Wp1cVEQ8FcJLVJLbPRfLpG75gLTEHkrSEFRC",
  	blockNumber:8491464,
    blockHash: "3d80892e197d636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488"
  )
  very_wrong_hash: proofOfIndexing(subgraph:"QmfDSEUwk2Wp1cVEQ8FcJLVJLbPRfLpG75gLTEHkrSEFRC",
  	blockNumber:8491464,
    blockHash: "636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488"
  )
  wrong_number: proofOfIndexing(subgraph:"QmfDSEUwk2Wp1cVEQ8FcJLVJLbPRfLpG75gLTEHkrSEFRC",
  	blockNumber:7491464,
    blockHash: "3d80892e197d636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488"
  )
  very_wrong_number: proofOfIndexing(subgraph:"QmfDSEUwk2Wp1cVEQ8FcJLVJLbPRfLpG75gLTEHkrSEFRC",
  	blockNumber:1464,
    blockHash: "3d80892e197d636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488"
  )
}

Corresponding output

{
  "data": {
    "indexingStatuses": [
      {
        "subgraph": "QmfDSEUwk2Wp1cVEQ8FcJLVJLbPRfLpG75gLTEHkrSEFRC",
        "synced": true,
        "health": "healthy",
        "fatalError": null,
        "chains": [
          {
            "network": "goerli",
            "latestBlock": {
              "number": "8491464",
              "hash": "5d80892e197d636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488"
            },
            "chainHeadBlock": {
              "number": "8491464",
              "hash": "5d80892e197d636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488"
            }
          }
        ]
      }
    ],
    "blockHashFromNumber": "5d80892e197d636d669af71f06e3fb23ffe5b16b0f3165ac866bdb34ec417488",   // correct hash from the block number
    "right_hash": "0xb632fc83cb304ce0dfc3697901b848b97dabcdeac0229bd097c94296a2f5ff66",                   // with valid hash and number
    "wrong_hash": "0xd8fc7f59e4f010a070f5b0096841db437085fdfab8e2c5c9575b24e0c1dbd24a",                  // expected error of invalid hash corresponding to the number
    "very_wrong_hash": "0x11a87231123516f68b93a13860a63e5c6773824be33299b7e2339a27dff7a4a4",        // expected error from invalid hash string length
    "wrong_number": "0x2a39bcf82d41759c16e669483969bea5a15ed2de4941dc6bc3b25eb78cf8b464",         // invalid block number
    "very_wrong_number": "0x2a39bcf82d41759c16e669483969bea5a15ed2de4941dc6bc3b25eb78cf8b464" // same answer when invalid block number
  }
}

What is the expected behavior?
It would be great if Graph node would validate the block inputs during a proof of indexing query, as it should prevent manual/accidental input errors

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza por la consulta proofOfIndexing de la admin API y compara sus entradas de bloque con los resultados de blockHashFromNumber e indexingStatuses que se muestran en el informe. Reproduce las combinaciones válidas e inválidas de hash y número del ejemplo. Se considera terminado cuando las entradas de bloque inválidas devuelven un error en lugar de generar POIs diferentes.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
graphql, rust
Área
api, blockchain
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.