Skip to content

Bug: start_block config field is parsed and validated but never used #106

Description

@aliraghebi

Summary

The start_block field in each chain's configuration is fully wired for input (YAML tag + validation) but is never read anywhere in the indexing logic. It's effectively dead configuration: operators can set it expecting to control where indexing begins, but it has no effect.

Details

The field is defined in pkg/common/config/types.go:

StartBlock int `yaml:"start_block" validate:"min=0"`

It is parsed from YAML and validated (min=0), but a codebase-wide search finds no reads of the field.

The only reference to config.StartBlock outside the struct definition is a comment in pkg/store/blockstore/store.go:

// propagate, so callers never silently rewind to config.StartBlock.

The actual starting block is determined by RegularWorker.determineStartingBlock() in internal/worker/regular.go, which uses only two sources:

  1. The KV store's last indexed block (resume from previous progress).
  2. The current chain head on cold start (or when the store is unavailable), via waitForChainHead().

The configured start_block is never consulted as the initial anchor.

As a result, on a cold start the indexer begins at the current chain head rather than the configured start_block.

Why this is misleading

The example configuration (configs/config.example.yaml) presents start_block as a meaningful per-chain option, for example:

start_block: 75144237

One entry is even annotated as a checkpoint sequence, which strongly implies that indexing will begin from that block.

In practice, the value is ignored without any warning or error. Operators expecting to backfill historical data from a specific block will instead begin indexing from the current chain head.

Expected behavior

One of the following should be implemented:

  • Option A: Honor start_block during cold starts (when no KV state exists) by using it as the initial starting block in determineStartingBlock().
  • Option B: Remove the unused start_block field from the configuration struct and the example configuration to avoid misleading operators.

Environment

  • Branch: main

Relevant files

  • pkg/common/config/types.go:52
  • internal/worker/regular.go:195
  • pkg/store/blockstore/store.go:105

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions