subquery / subql

SubQuery is an Open, Flexible, Fast and Universal data indexing framework for web3. Our mission is to help developers create the decentralised products of the future.
https://subquery.network
GNU General Public License v3.0
18.96k stars 330 forks source link

Historical indexing support for multichain #2493

Open stwiname opened 2 months ago

stwiname commented 2 months ago

Background

Currently historical indexing works by having a hidden column on tables with the block height range. This doesn't work for multichain where each chains blocks are produced independently. In order to support historical with multichain we can use a timestamp instead

Requirements

Database changes

Rewind support

This will be more complex as currently each indexer runs independently.

Other considerations/unknowns

Future

Enabling historical indexing for multichain is a step towards enabling more features that are already supported with single chain indexing

jiqiang90 commented 2 months ago

The ability to find the nearest blocks to a timestamp. Some chains provide a RPC method for this, otherwise a binary search could be used to find the block.

My concern is currently indexing for multi chain also didn't following a timestamp order (there is no order), we can add an additional field indexing_order_id to record the indexing order, and we can find the record match network height, remove any record beyond this id