graphprotocol / graphprotocol/graph-node

[Feature] Query data from a fixed amount of blocks before latest

Offen
#4,560 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

area/graphql enhancement
Vorherrschende Sprache
Rust
Sterne
3.2k
Forks
1.1k
Ø Merge
4 T. 1 Std.
Gemergte PRs (30 T.)
1

Beschreibung

Description

A nice DevX improvement would be to allow querying for data in a way akin to this

query {
  someEntity(block: {
    number: -100
  }) {
    # fields ...
  }
}

This query would fetch data at block latest - 100.

The rationale here is that a very common use case is to fetch data at a fixed amount of blocks prior to the tip to avoid data inconsistencies due to chain reorgs (or, in other words, to ensure data finality). AFAIK, right now the only way to do that is to first query the latest indexed block, and then perform the desired query at latest - n, which is cumbersome and repetitive.

Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.

No response

Some information to help us out
  • Tick this box if you plan on implementing this feature yourself.
  • I have searched the issue tracker to make sure this issue is not a duplicate.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Es werden keine Dateien oder Tests genannt. Beginne damit, die bestehende Verarbeitung von Blockargumenten in GraphQL und den Mechanismus zum Abrufen des neuesten indizierten Blocks nachzuverfolgen. Bestätige, wie eine negative Blocknummer relativ zum Tip aufgelöst werden soll und wie die Finalität bei Reorgs behandelt wird; erledigt ist die Aufgabe, wenn die Beispielabfrage ohne eine separate Anfrage für den neuesten Block funktioniert und durch Tests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
graphql, rust
Bereich
api, blockchain
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.