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

Added check for initial chain block for validator init #10278

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mh0lt
Copy link
Collaborator

@mh0lt mh0lt commented May 10, 2024

This fixes the validator initiator set issue when running amoy from zero with no snapshots.

The forward init check needs to take into account the first block in the chain.

@mh0lt mh0lt added the polygon label May 10, 2024
@@ -292,7 +292,7 @@ func BorHeimdallForward(
// if the last time we persisted snapshots is too far away re-run the forward
// initialization process - this is to avoid memory growth due to recusrion
// in persistValidatorSets
if snap == nil && blockNum-lastPersistedBlockNum > (snapshotPersistInterval*5) {
if snap == nil && (blockNum == 1 || blockNum-lastPersistedBlockNum > (snapshotPersistInterval*5)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

pls protect from uint underflow

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

Successfully merging this pull request may close these issues.

None yet

2 participants