Skip to content

feat(config): default from_latest to true, honor start_block on cold start - #116

Merged
anhthii merged 1 commit into
mainfrom
feat/from-latest-default
Oct 8, 2026
Merged

anhthii merged 1 commit into
mainfrom
feat/from-latest-default

Conversation

@anhthii

@anhthii anhthii commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • from_latest is now a *bool that defaults to true when unset in both defaults and the chain config. A per-chain value overrides defaults.
  • On a cold start (no checkpoint in the block store), a chain with from_latest: false begins at its configured start_block instead of the chain head. Previously start_block was ignored entirely.
  • Config validation rejects from_latest: false without a start_block (> 0), rather than silently falling back to the chain head.
  • Warm restarts are unchanged: they resume from the persisted checkpoint and queue catchup regardless of start_block.
defaults:
  from_latest: true
chains:
  ethereum_sepolia:
    from_latest: false
    start_block: 11869752   # cold start begins here

Notes

  • If start_block is more than max_lag (default 100) behind head, the regular worker skips ahead and queues the gap for the catchup worker, which needs --catchup enabled.

Test plan

  • go test ./pkg/common/config/ ./internal/worker/
  • New tests: cold start from start_block, from_latest ignores start_block, warm restart ignores start_block, defaults inheritance, validation

…start

from_latest is now a *bool that defaults to true when unset in both
defaults and the chain config. On a cold start, a chain with
from_latest: false begins at its configured start_block instead of the
chain head. Config validation rejects from_latest: false without a
start_block.
@anhthii
anhthii requested a review from vietddude October 8, 2026 12:37
@anhthii
anhthii merged commit 03b0449 into main Oct 8, 2026
2 checks passed
@anhthii
anhthii deleted the feat/from-latest-default branch October 8, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants