graphprotocol / graphprotocol/graph-node

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

オープン
#4,560 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

area/graphql enhancement
主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ファイルやテストは指定されていません。まず、GraphQL における既存のブロック引数の処理と、最新のインデックス済みブロックを取得するために使われている仕組みを追跡してください。負のブロック番号が tip に対してどのように解決されるべきか、また reorg のファイナリティがどのように処理されるかを確認してください。サンプルクエリが別途最新ブロックをリクエストせずに動作し、テストでカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
graphql, rust
領域
api, blockchain
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。