ChainSafe / ChainSafe/lodestar
State by slot not being fetched correctly
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 483
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 150
Description
### Describe the bug
Starting attempts to fetch chain state by slot fails before chain has synced to the said slot (expected) but also after (unexpected).
### Expected behavior
The BN returns the state at slot after successful sync.
### Steps to reproduce
1. Request chain state for a slot (i.e. at `POST /eth/v1/beacon/states/{state_id}/validators`) couple of seconds before the chain is synced to the slot.
2. Continue retrying each 0.5-1 seconds.
3. The chain syncs to this slot after couple of seconds.
4. The responses to the request are still unknown state.
### Additional context
I have reproduced the issue on local Kurtosis devnet, running Charon DV. The setup I have is geth v1.15.5, lodestar CL v1.28.1, Charon v1.3.0, lodestar VC v1.28.1. I have added more logging to v1.28.1 tag and ran lodestar CL from this branch https://github.com/KaloyanTanev/lodestar/pull/1/files. I attach logs from the run.
[lodestar.log](https://github.com/user-attachments/files/19684297/lodestar.log)
### Operating system
macOS
### Lodestar version or commit hash
v1.28.1
Contributor guide
Research direction
Start by reproducing the request sequence against the local Kurtosis devnet using POST /eth/v1/beacon/states/{state_id}/validators, retrying until the requested slot is synced. Review the state-fetching path for why responses remain unknown after sync; done when the endpoint returns the state at that slot after successful synchronization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100