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 invalid sync request #16779

Merged
merged 1 commit into from
Nov 9, 2023
Merged

Fix invalid sync request #16779

merged 1 commit into from
Nov 9, 2023

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Nov 6, 2023

Purpose:

When exposed to a heavier peak with a lower height than our current peak, we currently fall into the short-sync (catch-up) case because the current logic (mistakenly) assumes the heavier peak has a greater height. This results in us sending an invalid block request to the peer, which in turn responds with a None message.

The log looks like this:

11:52:23 chia.full_node.full_node: INFO Starting batch short sync from 1593 to height 1077
11:52:23 chia.full_node.full_node: ERROR Error short batch syncing, could not fetch block at height 1593

In the above test our (lighter) peak height is 1593 and the other (heavier) peak height is 1077. We end up requesting block 1593 from the peer.

This patch adds the additional condition that the heavier peak also has a greater or equal height, as it appears was the intention to begin with. This avoids sending an invalid block request to the peer and we immediately fall back to a long sync.

Current Behavior:

We send an invalid request, handle the resulting error and then initiate the long sync.

New Behavior:

We initiate the long sync right away.

@arvidn arvidn added the Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog label Nov 6, 2023
@github-actions github-actions bot added the merge_conflict Branch has conflicts that prevent merge to main label Nov 7, 2023
Copy link
Contributor

github-actions bot commented Nov 7, 2023

This pull request has conflicts, please resolve those before we can evaluate the pull request.

1 similar comment
Copy link
Contributor

github-actions bot commented Nov 7, 2023

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the merge_conflict Branch has conflicts that prevent merge to main label Nov 7, 2023
Copy link
Contributor

github-actions bot commented Nov 7, 2023

Conflicts have been resolved. A maintainer will review the pull request shortly.

@arvidn arvidn marked this pull request as ready for review November 7, 2023 17:14
@arvidn arvidn requested a review from a team as a code owner November 7, 2023 17:15
Copy link

Pull Request Test Coverage Report for Build 6787966429

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 26 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-0.02%) to 90.284%

Files with Coverage Reduction New Missed Lines %
chia/introducer/introducer.py 1 78.02%
chia/server/server.py 1 81.45%
chia/wallet/util/wallet_sync_utils.py 1 77.21%
chia/server/node_discovery.py 2 79.55%
chia/full_node/full_node.py 5 84.39%
chia/farmer/farmer.py 7 66.44%
chia/wallet/wallet_node.py 9 86.83%
Totals Coverage Status
Change from base Build 6787911924: -0.02%
Covered Lines: 93075
Relevant Lines: 103039

💛 - Coveralls

chia/full_node/full_node.py Outdated Show resolved Hide resolved
chia/full_node/full_node.py Outdated Show resolved Hide resolved
@arvidn arvidn mentioned this pull request Nov 8, 2023
…tly fall into the short-sync case because the current logic (mistakenly) assumes the heavier peak has a greater height. This patch adds the additional condition that the heavier peak also has a greater height. This avoids sending an invalid block request to the peer.
Copy link
Contributor

@wjblanke wjblanke left a comment

Choose a reason for hiding this comment

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

aok

@arvidn arvidn added the ready_to_merge Submitter and reviewers think this is ready label Nov 9, 2023
@Starttoaster Starttoaster merged commit 66d83db into main Nov 9, 2023
254 checks passed
@Starttoaster Starttoaster deleted the fix-invalid-sync-request branch November 9, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog ready_to_merge Submitter and reviewers think this is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants