ChainSafe / ChainSafe/lodestar

Avoid accessing full beacon state in PrepareNextSlotScheduler

Open
#8,651 1 comment 0 reactions 0 assignees View on GitHub
lodestar-z integration meta-feature-request
Dominant language
TypeScript
Stars
1.4k
Forks
483
Avg merge
1d 16h
Merged PRs (30d)
150

Description

### Problem description

as part of #8650 we should not need the full beacon state in PrepareNextSlotScheduler

### Solution description

right now we need a full `CachedBeaconStateAllForks` in `PrepareNextSlotScheduler` in order to:
- get payload attributes
- get expected withdrawals
- genesis time
- epoch
- randao mix
- proposer index
- latest execution payload header block hash
- slot, epoch
- randao mix
- compute and cache its root early

instead of that, we should create a beacon state view as stated here and consume it everywhere

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reading PrepareNextSlotScheduler and the context from #8650, focusing on where it consumes CachedBeaconStateAllForks. Replace those full-state accesses with the proposed beacon state view while preserving payload attributes, slot, epoch, randao mix, and root caching. Done means the scheduler no longer requires the full beacon state and its existing behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.