Speed up epoch transition using persistent vector#1925
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
wemeetagain
left a comment
There was a problem hiding this comment.
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