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(p2p): update height in blocksync loop #1035

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

srene
Copy link
Contributor

@srene srene commented Aug 22, 2024

PR Standards

Opening a pull request should be able to meet the following requirements

--

PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A


This PR fixes an issue when DA is downloading blocks faster than blocksync, which may cause blocksync keeps downloading old blocks already applied.

Close #1031

<-- Briefly describe the content of this pull request -->

For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@srene srene requested a review from a team as a code owner August 22, 2024 16:18
if err != nil {
return
}
h = max(h, state.NextHeight()-1)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not setting it in the for loop definition?
also need to validate that h progress, otherwise we can be stuck in endless loop (in case the height doesn't progress)

Copy link
Contributor Author

@srene srene Aug 27, 2024

Choose a reason for hiding this comment

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

i think is fine, because the max func will cause that h is always progressing, it will just skip already applied heights, in case state.NextHeight() is updated in parallel

@srene srene requested a review from mtsitrin August 27, 2024 16:14
@omritoptix omritoptix merged commit 562f673 into main Aug 28, 2024
7 checks passed
@omritoptix omritoptix deleted the srene/1031-optimize-blocksync branch August 28, 2024 12:24
omritoptix pushed a commit that referenced this pull request Aug 28, 2024
omritoptix pushed a commit that referenced this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

blocksync may download blocks already applied
3 participants