-
-
Notifications
You must be signed in to change notification settings - Fork 426
Speed up epoch transition using persistent vector #1925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Code Climate has analyzed commit 4118dfd and detected 6 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
packages/lodestar-beacon-state-transition/src/fast/util/interface.ts
Outdated
Show resolved
Hide resolved
packages/lodestar-beacon-state-transition/src/fast/util/interface.ts
Outdated
Show resolved
Hide resolved
packages/lodestar-beacon-state-transition/src/fast/util/interface.ts
Outdated
Show resolved
Hide resolved
packages/lodestar-beacon-state-transition/src/fast/util/persistentVector.ts
Show resolved
Hide resolved
packages/lodestar-beacon-state-transition/src/fast/util/persistentVector.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! Looks great. I would vote for @chainsafe/persistent-ts to be eventually spin-out into a different repo
wemeetagain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, we should merge for now.
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).
resolves #1789, resolves #1878, and resolves #1761
clone()TreeBacked<BeaconState>.validatorssetValidator()andaddValidator()instead of accessingvalidatorsdirectly3.5s-4.2sto1.2s-1.6s. This should speed up the validator exit process too.Testing
TODO