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

fix: throw error if genesis header found on static files, but empty db #13157

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

joshieDo
Copy link
Collaborator

@joshieDo joshieDo commented Dec 5, 2024

closes #13136
closes #11934

Some users will at times attempt to re-sync from scratch by just deleting the database. Since factory.block_hash will only query the static files, we need to make sure that our database has been written to, and throw error if it's empty.
Otherwise, it will proceed and eventually fail on the ExecutionStage, after going through a lengthy SenderRecoveryStage

@joshieDo joshieDo added C-bug An unexpected or incorrect behavior A-staged-sync Related to staged sync (pipelines and stages) A-db Related to the database labels Dec 5, 2024
@joshieDo joshieDo changed the title fix: throw error if genesis header found on sf, but empty db fix: throw error if genesis header found on static files, but empty db Dec 5, 2024
// database. Since `factory.block_hash` will only query the static files, we need to
// make sure that our database has been written to, and throw error if it's empty.
if factory.get_stage_checkpoint(StageId::Headers)?.is_none() {
return Err(InitStorageError::UninitializedDatabase)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we log an error here so in case this happens we know where this is thrown?

@joshieDo joshieDo requested a review from mattsse December 5, 2024 15:39
@joshieDo joshieDo added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 5, 2024
@joshieDo joshieDo added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 5, 2024
@joshieDo joshieDo added this pull request to the merge queue Dec 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 6, 2024
@joshieDo joshieDo added this pull request to the merge queue Dec 6, 2024
Merged via the queue into main with commit 242bbaa Dec 6, 2024
41 checks passed
@joshieDo joshieDo deleted the joshie/unit branch December 6, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database A-staged-sync Related to staged sync (pipelines and stages) C-bug An unexpected or incorrect behavior
Projects
None yet
2 participants