graphprotocol / graphprotocol/graph-node

[Bug] Graph-node save incorrect block cache during reorgs

Aperta
#4,792 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
Rust
Stelle
3.2k
Fork
1.1k
Merge medio
4g 1h
PR unite (30g)
1

Descrizione

Bug report

In case reorg happend and graph-node has seen it we would have 2 entries in the cache table:
Example for reorg on ethereum mainnet on block 17820205 with depth=1

graph=# select hash, number, parent_hash from chain1.blocks where number=17820205 (https://etherscan.io/block/17820205/f)

                                hash                                |  number  |                            parent_hash                             
--------------------------------------------------------------------+----------+--------------------------------------------------------------------
 \xdcb02b80a71bb335a8247298cfde2af9f589b491a1eb794a88fa377fb00e6fb8 | 17820205 | \x9432a65af5ecd186859c22bf4d809561aaa4daf3bf8101fccb3f228e34b64756
 \xc0455fae763cd8d53bc294cbd32225f207dee56cb396aee84eaaa5011513731a | 17820205 | \x9432a65af5ecd186859c22bf4d809561aaa4daf3bf8101fccb3f228e34b64756
(2 rows)

graph=# select hash, number, parent_hash from chain1.blocks where number=17820206;
                                hash                                |  number  |                            parent_hash                             
--------------------------------------------------------------------+----------+--------------------------------------------------------------------
 \x409c0bb686a5fac90e706a556d02cf99122b49c683374c82341cccc836807964 | 17820206 | \xc0455fae763cd8d53bc294cbd32225f207dee56cb396aee84eaaa5011513731a
(1 row)

graph=# select hash, number, parent_hash from chain1.blocks where number=17820204;
                                hash                                |  number  |                            parent_hash                             
--------------------------------------------------------------------+----------+--------------------------------------------------------------------
 \x9432a65af5ecd186859c22bf4d809561aaa4daf3bf8101fccb3f228e34b64756 | 17820204 | \x737d8549261f685b18b6c6f2dac460c6dfc4b88bf16b03d2a813ed51f9c08c40
(1 row)

From our experience that sometimes cause errors in subgraphs, because the subgraph takes incorrect data from the cache (This need confirming)
We had a problem when the subgraph was stuck until we remove duplicates from the cache.

Relevant log output

No response

IPFS hash

No response

Subgraph name or link to explorer

No response

Some information to help us out
  • Tick this box if this bug is caused by a regression found in the latest release.
  • Tick this box if this bug is specific to the hosted service.
  • I have searched the issue tracker to make sure this issue is not a duplicate.
OS information

None

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo le query SQL segnalate sulla cache chain1.blocks per la riorganizzazione citata ai blocchi 17820204–17820206. Traccia il modo in cui i blocchi riorganizzati vengono salvati e selezionati, quindi verifica se le voci di blocco duplicate possono far sì che un subgraph utilizzi dati errati o rimanga bloccato. Il lavoro è completato quando il comportamento della cache è confermato o smentito da un test di regressione o da una riproduzione documentata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
postgresql, rust
Ambito
blockchain, databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.