Conversation
Adds indexer config utilizing the documented/verifiable config framework
There was a problem hiding this comment.
Pull request overview
Adds an initial configuration surface for a new Chainstate indexer using the repo’s documented/verifiable config framework, setting defaults and providing Verify() methods to validate config at startup.
Changes:
- Introduces
RootIndexerConfigto split public vs. secret config. - Adds
IndexerConfig/IndexerSecretConfigstructs with defaults and verification logic. - Implements config-framework hooks (
GetName,GetEnvVarPrefix,GetPackagePaths) for doc generation and env parsing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #2491 +/- ##
==========================================
- Coverage 40.31% 39.25% -1.07%
==========================================
Files 505 537 +32
Lines 45150 49071 +3921
==========================================
+ Hits 18204 19264 +1060
- Misses 24791 27367 +2576
- Partials 2155 2440 +285
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // Starting block number for indexing. If 0, starts from contract deployment block. | ||
| StartBlockNumber uint64 | ||
|
|
||
| // Number of blocks to process in each batch during indexing. |
There was a problem hiding this comment.
wouldn't this be the maximum number of blocks that can be in a batch during indexing? assuming once its synced to head it only asses the diff from head and the last block it went up-to in the last event loop iteration
| // Path to JSON file for persisting indexed state to disk. | ||
| PersistencePath string `docs:"required"` | ||
|
|
||
| // Interval for persisting state snapshots to disk. | ||
| PersistInterval time.Duration |
There was a problem hiding this comment.
knit:
| // Path to JSON file for persisting indexed state to disk. | |
| PersistencePath string `docs:"required"` | |
| // Interval for persisting state snapshots to disk. | |
| PersistInterval time.Duration | |
| // Path to JSON file for persisting indexed state to disk. | |
| SnapshotPath string `docs:"required"` | |
| // Interval for persisting state snapshots to disk. | |
| SnapshotInterval time.Duration |
| // DefaultIndexerConfig returns a default configuration with sensible values. | ||
| func DefaultIndexerConfig() *IndexerConfig { | ||
| return &IndexerConfig{ | ||
| StartBlockNumber: 0, |
There was a problem hiding this comment.
is there any reason we'd default 0 vs starting at now - blob_ttl? in practice having to update a StartBlockNumber every-time we do a fresh deployment could become tedious
| if port < 1 || port > 65535 { | ||
| return fmt.Errorf("HTTP port must be between 1 and 65535, got %d", port) | ||
| } | ||
| if c.BlockBatchSize <= 0 { |
There was a problem hiding this comment.
there's some relationship here between BlockBatchSize and PollInterval where they can be mis-expressed in-ways that affects the reliability of core service logic
| } | ||
|
|
||
| // Verify validates the configuration and returns an error if invalid. | ||
| func (c *IndexerConfig) Verify() error { |
There was a problem hiding this comment.
should we add a check for this Verify function for brevity?
Adds indexer config utilizing the documented/verifiable config framework
Note: This is the first PR in a series of indexer related PRs in order to split up the new indexer code into more digestible chunks.