Skip to content
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

feat: improve prepareNextEpoch #7171

Draft
wants to merge 15 commits into
base: unstable
Choose a base branch
from
Draft

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Oct 17, 2024

Motivation

Reduce prepareNextEpoch time for lodestar

Description

  • use hashtree for batch hash implemented in ssz

    • copy the implementation of ListValidatorTreeViewDU from the ssz branch, the main thing is to compute validators' roots in batch during commit() phase
    • batch hash validators, execute HashComputation[] in batch
  • avoid memory allocation:

    • no tree creation when we modify/add validator
  • reuse balances tree ==> although this helps save ~250ms to 300ms on epoch transition time, this may introduce unpredictable behavior so I decided not to go with it

@twoeths
Copy link
Contributor Author

twoeths commented Oct 21, 2024

this is 6h rate interval on lg1k

  • PrepareNextEpoch is around 850ms (1.5s on beta)
Screenshot 2024-10-21 at 10 10 20
  • Block transition hash_tree_root is 27ms (vs 70ms on beta), epoch transition hash_tree_root is 130ms (vs 533ms on beta)
Screenshot 2024-10-21 at 10 13 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant