ChainSafe / ChainSafe/lodestar

Persist fork-choice state > start from head

Open
#4,000 2 comments 0 reactions 0 assignees View on GitHub
prio-low scope-ux
Dominant language
TypeScript
Stars
1.4k
Forks
483
Avg merge
1d 16h
Merged PRs (30d)
150

Description

Currently Lodestar follow the simpler strategy (1) on start-up to just consider the latest finalized state as the head. Then sync all blocks from finalized state to head from our peers, and re-populate fork-choice graph.

Another strategy (2) is to persist the fork-choice state (on shutdown and / or periodically) and restore that state on startup. This approach will prevent "reverting" the head to a much older state. This caused:
- https://github.com/ChainSafe/lodestar/issues/3647
- https://github.com/ChainSafe/lodestar/issues/3717

**TODO**:
- [ ] Research what each other client is doing
- [ ] Estimate the positives of strategy (2) vs (1), specially in periods of long non-finality
- [ ] Estimate the complexity of strategy (2) vs (1), and the cost of persisting this data + pruning.

Only if it's clear that **positives >> complexity + cost**, consider implementing.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked issues #3647 and #3717, then research how other consensus clients persist and restore fork-choice state. Compare the benefits during long non-finality with persistence, pruning, and implementation costs; the research is done when there is a clear decision on whether strategy (2) is worth implementing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.