optakt / flow-dps

Flow Data Provisioning Service
Apache License 2.0
29 stars 13 forks source link

[EPIC] Include block hash in index keys #526

Open Ullaakut opened 2 years ago

Ullaakut commented 2 years ago

Description

In order to allow the live indexer to index live data before it is sealed, the DPS needs to change its indexing process to allow multiple versions of an index at a given height, in the case of a fork. In order to do this, we can change our indexes to include the block hash.

This will reduce the latency between the time at which events happen and they are available in our API, which is essential for the DPS to be relevant in the Flow ecosystem.

The consensus tracker currently already accesses block data as soon as they are finalized, while the execution tracker has access to all execution data that is uploaded onto its GCP bucket. All finalized blocks get pushed onto the execution tracker's queue, to be downloaded in the same order as they were finalized.

To double check: The consensus tracker follows the access nodes to bind its OnBlockFinalized so I assume that should be the case and we don't need to change anything.

To double check: The block order is very important in the execution tracker, since we need to read trie updates sequentially. Since trie updates contain the previous state commitment they apply to, as long as for each "fork" we get updates in the right order, the current implementation should work.

TODO: Once this is all confirmed, create sub tasks and start implementation.

Changes

Additional Notes