A new ChainIndexer that subsumes that existing MsgIndex, EventIndex and TransactionIndex #12453
Open
2 of 10 tasks
Labels
kind/feature
Kind: Feature
Summary
This issue is for the implementation of a new
ChainIndexer
in Lotus that will replace and subsume the existingMsgIndex
,EventsIndex
, andEthTxHashIndex
, which are currently fragmented across multiple databases and have several known issues documented in filecoin-project/lotus#12293.Tasks
Key Features
The
ChainIndexer
offers the following key features:Here are the next implementation steps going ahead to get this PR in a ready for review/ready for testing state.
Switch RPC APIs to use the Chain Index
ChainIndexer
instead of theMsgIndex
,EthTxHashIndex
andEventsIndex
.EventFilterManager
will read events from theChainIndexer
and prefill all registered filters rather than depending on the Indexer to do the pre-filling of filters.ChainIndexer
will listen to Mpool message addition updates to index the corresponding ETH Tx Hash. TheEthTxHashManager
will no longer be used for this.Read APIs Should Account for the Async Nature of Indexing
T
only indexes events inT-1
because of deferred execution.ETH RPC APIs Should Only Expose Executed Tipsets and Messages
T
are executed in tipsetT + 1
.T
are also executed in tipsetT
.Removing Re-orged Tipsets That Are No Longer Part of the Canonical Chain
ChainIndexer
will periodically prune all permanently re-orged/reverted tipsets from the index. It can do this by simply pruning all tipsets at a height less than(current head - finality policy - some buffer)
.Garbage Collection
ChainIndexer
can perform periodic GC based on this configuration.ChainIndexer
because of the use ofFOREIGN KEY ON CASCADE DELETES
, as described in SQLite Foreign Keys.Snapshot Hydration
Automated Backfilling
ChainIndex
for which the corresponding state exists in the statestore.Observer
with that tipset as the current head.Observer
.ChainIndexer
will observe the(Apply, Revert)
path between its last non-reverted indexed tipset and the current heaviest tipset in the chainstore before processing real-time updates, effectively performing automated backfilling.Simplify Indexing Config
Migration from Old Indices to the New ChainIndex
lotus-shed
utility that allows users to migrate existing indices to the newChainIndexer
database. This command should only be executed when the Lotus node is offline to ensure data consistency and avoid potential conflicts.ChainIndexer
. This approach offers several benefits:The text was updated successfully, but these errors were encountered: