ChainSafe / ChainSafe/lodestar
Simplify closestJustifiedBalancesStateToCheckpoint
Open
meta-feature-request
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 483
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 150
Description
### Problem description
The assumption of this function is not correct anymore because we can store a lot of checkpoint states after `n-historical-state` flag implemented https://github.com/ChainSafe/lodestar/blob/b255111a2013d43d5f65889274294e2740493c28/packages/beacon-node/src/chain/chain.ts#L1009
### Solution description
switch to async function, use `PersistentCheckpointStateCache.getStateOrBytes()`
if it returns a Uint8Array, loop through it to extract effective balances of active validators
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.