Skip to content

Implement CachedBeaconState #1950

@twoeths

Description

@twoeths

The idea came from #1925 (review)

Going forward, we should take some time to possibly re-organize the beacon state, validator cache, epoch context, epoch process, etc. as needed.

This is mainly an issue of how we organize the various datastructures (BeaconState, CachedValidatorsBeaconState, EpochContext, EpochProcess, IStateContext). I'm not sure what the right organization is (possibly no re-organization needed) but what we have seems to be getting more cluttered as we've added more and more optimizations. We have several nested datastructures that are all related to the beacon state / epoch state.

My hunch is that we may be able to expand the CachedValidatorBeaconState to be more of a general CachedBeaconState at the 'top-level', like IStateContext, which exposes the BeaconState + extra methods, with various caches 'under the hood' (each cache using 'persistent-ts' or similar for cheap cloning).

Need to come to an agreement regarding how it looks like before implementation.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions