ChainSafe / ChainSafe/lodestar

Simplify closestJustifiedBalancesStateToCheckpoint

Open
#8,717 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.