Skip to content

initialize genesis data asap at node start #15470

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

kasey
Copy link
Contributor

@kasey kasey commented Jul 3, 2025

What type of PR is this?

Other

What does this PR do? Why is it needed?

This PR initializes a package-level value that makes the genesis state, validators root and time available to other components as package level functions: genesis.State(), genesis.ValidatorsRoot(), genesis.Time(). By ensuring that these values are always easily available we can simplify a lot of code that requires complicated dependency injection, and remove tech debt like startup.Clock. Many pieces of code also have complex initialization logic to wait until the values are available (eg startup.ClockWaiter, one of my most shameful contributions to prysm).

Other notes for review

When reordering node initialization I noticed that clearDB had gotten out of control and made init more complicated, so I added a new type to manage handling the db clearing flags.

Acknowledgements

@kasey kasey force-pushed the init-genesis-asap branch 2 times, most recently from 8930b46 to 89386b7 Compare July 3, 2025 22:58
@kasey kasey force-pushed the init-genesis-asap branch from 89386b7 to 59cac6d Compare July 3, 2025 23:09
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