-
-
Notifications
You must be signed in to change notification settings - Fork 416
Open
Labels
epicIssues used as milestones and tracking multiple issues.Issues used as milestones and tracking multiple issues.meta-feature-requestIssues to track feature requests.Issues to track feature requests.
Description
Problem description
right now beacon-node and state-transition both stay on typescript
in the near future, beacon-node stays on typescript while state transition is siwtched to native (zig) in lodestar-z
so we need to prepare for that
Solution description
avoid having CachedBeaconStateAllForks in all function parameters of beacon node. Instead of that, we need to implement a light version of BeaconState, for example
export interface IBeaconStateView {
slot: Slot;
root: Bytes32;
rootHex: RootHex;
epoch: Epoch;
genesisTime: number;
latestExecutionPayloadBlockHash: Bytes32;
previousDecisionRoot: RootHex;
currentDecisionRoot: RootHex;
nextDecisionRoot: RootHex;
effectiveBalanceIncrements: Uint16Array;
previousJustifiedCheckpoint: Checkpoint;
currentJustifiedCheckpoint: Checkpoint;
finalizedCheckpoint: Checkpoint;
getRandaoMix(epoch: Epoch): Bytes32;
getProposerIndex(slot: Slot): number;
getBlockRootAtSlot(slot: Slot): Root;
getValidator(index: number): phase0.Validator;
}- for now, in each consumer flow we create an implementation of
IBeaconStateView, for exampleTSBeaconStateView, based on an existingCachedBeaconStateAllForksand pass it everywhere - once it's done we populate
TSBeaconStateViewto state cache, changes all interface of regen + state cache toIBeaconStateView - once we have a binding for lodestar-z, we'll have another implementation, for example
NativeBeaconStateViewto lazy load and cache above data from native, then populate regen + state cache with it. All consumer codes of state cache + regen are unchanged because they work withIBeaconStateView - this provides way to have a feature flag to switch it on and off. Once it's stable we'll turn it on by default, like what we did in worker thread
also need to avoid using EpochCache data/functions
Tracked issues
- Avoid accessing config, pubkey2index, index2pubkey from cached state #8652
- Avoid accessing full beacon state in PrepareNextSlotScheduler #8651
- Refactor ShufflingCache #8653
- Remove Eth1ForBlockProduction #8654
- Use ShufflingCache instead of EpochCache for shuffling data #8655
- Gossip validation to work with EpochShuffling #8657
- Produce block using parent IBeaconStateView #8658
- Regen and state caches to work with IBeaconStateView #8659
- Api to work with IBeaconStateView #8663
wemeetagain, spiral-ladder and FoodChain1028philknows and FoodChain1028GrapeBaBa and FoodChain1028
Metadata
Metadata
Assignees
Labels
epicIssues used as milestones and tracking multiple issues.Issues used as milestones and tracking multiple issues.meta-feature-requestIssues to track feature requests.Issues to track feature requests.