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

check if the BABE next epoch is already persisted #2471

Closed
EclesioMeloJunior opened this issue Apr 6, 2022 · 0 comments · Fixed by #2472
Closed

check if the BABE next epoch is already persisted #2471

EclesioMeloJunior opened this issue Apr 6, 2022 · 0 comments · Fixed by #2472

Comments

@EclesioMeloJunior
Copy link
Member

Describe the bug

In the dot/digest package we listen for finalized headers and when a new finalized header arrives we execute the function persistBABEDigestsForNextEpoch(finalizedHeader *types.Header). This function retrieves the epoch for the finalized header add 1 and uses the result as the nextEpoch and then call the h.epochState.FinalizeBABENextEpochData(nextEpoch) and h.epochState.FinalizeBABENextConfigData(nextEpoch) in order to persist the next epoch BABE data and config and remove the in memory data.

The problem is that when another header is finalized in the same epoch we call the same functions again but this time they will fail as there is no data to persist in the database.

A possible solution is to check if the nextEpoch already has defined some data in the database and if so we skip the respective persistency step

@EclesioMeloJunior EclesioMeloJunior changed the title (dot/digest): Check if the BABE next epoch is already persisted Check if the BABE next epoch is already persisted Apr 6, 2022
@EclesioMeloJunior EclesioMeloJunior changed the title Check if the BABE next epoch is already persisted check if the BABE next epoch is already persisted Apr 6, 2022
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 a pull request may close this issue.

2 participants