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

Simplify and refactor final state initialization and checks on the DB after bootstrap. #4234

Open
Leo-Besancon opened this issue Jul 8, 2023 · 0 comments
Labels
bootstrap Issues related to the bootstrap enhancement New feature or request

Comments

@Leo-Besancon
Copy link
Contributor

Leo-Besancon commented Jul 8, 2023

  • remove the is_db_valid function completely
  • after the bootstrap of the db (or its initialization or loading from disk) is done, create final_state by passing it the db and letting it initialize all its subsystems in its constructor:
    • pos_state = PosState::try_from_db(&db).map_err(||e| format!("could not init PosState in FinalState: {}"), e)?;
    • async_pool = AsyncPool::try_from_db(&db).map_err(||e| format!("could not AsyncPool state in FinalState: {}"), e)?;
    • ... each of those constructors initializes the subsystem but also checks the db validity on the prefix subset(s) they manage

That way we have each module take responsibility for checking its own parts of the db properly and we reduce the error surface when adding new elements to the db (eg. forgetting to add them to is_db_valid).

Originally posted by @damip in #4197 (comment)

@Leo-Besancon Leo-Besancon changed the title I think that things could be simplified a bit and better encapsulated: Simplify and refactor final state initialization and checks on the DB after bootstrap. Jul 8, 2023
@damip damip mentioned this issue Jul 8, 2023
13 tasks
@AurelienFT AurelienFT added enhancement New feature or request bootstrap Issues related to the bootstrap labels Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bootstrap Issues related to the bootstrap enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants