feat: sqlite indexer - #6720
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a SQLite-backed chain indexer with schema initialization, validation, backfilling, indexed event queries, daemon integration, RPC support, and the ChangesSQLite chain indexer
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ForestCLI
participant ChainValidateIndex
participant SqliteIndexer
participant ChainStore
ForestCLI->>ChainValidateIndex: validate epoch with backfill flag
ChainValidateIndex->>SqliteIndexer: validate_index(epoch, backfill)
SqliteIndexer->>ChainStore: load canonical tipset data
ChainStore-->>SqliteIndexer: return chain data
SqliteIndexer-->>ChainValidateIndex: return ChainIndexValidation
ChainValidateIndex-->>ForestCLI: return validation result
sequenceDiagram
participant EthClient
participant EthGetLogs
participant ParsedFilter
participant SqliteIndexer
participant SQLite
EthClient->>EthGetLogs: submit event filter
EthGetLogs->>ParsedFilter: parse tipset range
ParsedFilter-->>EthGetLogs: select SQL index for large range
EthGetLogs->>SqliteIndexer: query indexed events
SqliteIndexer->>SQLite: execute filtered event query
SQLite-->>EthGetLogs: return collected events
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
80855f0 to
9865f72
Compare
| | `FOREST_ETH_RPC_COMPUTE_BLOOM_ON_MISS` | 1 or true | false | 1 | Allows `eth` block RPC methods to compute (and store) the block `logsBloom` when it is not already stored, otherwise such blocks report an all-ones bloom | | ||
| | `FOREST_RPC_METRICS_DISABLED` | 1 or true | false | 1 | Disable per-method JSON-RPC metrics only, leaving the metrics endpoint and all other metrics (cache, sync, database, ...) intact. To turn off metrics entirely, disable the endpoint instead with `--no-metrics` | | ||
| | `FOREST_STATE_COMPUTE_MAX_RANGE` | positive integer | 2000 | 100 | The maximum `nEpochs` value `Forest.StateCompute` accepts | | ||
| | `FOREST_RPC_SQL_RANGE_THRESHOLD` | positive integer | 500 | 1000 | The RPC tipset range threshold above which SQL index is prefered over in-memory event collection | |
There was a problem hiding this comment.
As agreed, let's have it disabled for now.
| // Copyright 2019-2026 ChainSafe Systems | ||
| // SPDX-License-Identifier: Apache-2.0, MIT | ||
|
|
||
| pub static DDLS: [&str; 10] = [ |
There was a problem hiding this comment.
If you took it from Lotus, let's have a permalink.
Summary of changes
Changes introduced in this pull request:
benchmark:
Reference issue to close (if applicable)
Closes #7017
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
New Features
Filecoin.ChainValidateIndexand theforest-cli index validate-backfillcommand for validating and optionally backfilling index data.EthGetLogsrequests can now use the SQL index for improved retrieval.Documentation
FOREST_RPC_SQL_RANGE_THRESHOLD, configurable with a default of 500.