Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Enable download of future forks #10739

Merged
merged 2 commits into from
Feb 2, 2022
Merged

Conversation

arkpar
Copy link
Member

@arkpar arkpar commented Jan 26, 2022

Currently sync won't download forks ahead of the best chain announced with is_best=false This PR removes this limitation as long as the fork is not too long.

@arkpar arkpar added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C3-medium PR touches the given topic and has a medium impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Jan 26, 2022
// Download the fork only if it is behind or not too far ahead our tip of the chain
// Otherwise it should be downloaded in full sync mode.
if r.number <= best_num ||
(r.number - best_num).saturated_into::<u32>() < MAX_BLOCKS_TO_REQUEST as u32
Copy link
Contributor

Choose a reason for hiding this comment

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

@eskimor let's hope disputes travel & resolve quickly! Haha

Seriously, though, this seems brittle so kind of OK for a dirty patch but we should have a think about doing this 'right' which will involve changes outside of sync about fork-choice.

@rphmeier
Copy link
Contributor

I'm waiting on giving an approval as a result of testing on Versi to make sure this alleviates the stalls we've been seeing.

Comment on lines +890 to +891
net.peer(0).num_peers() == 1 &&
net.peer(2).num_peers() == 1
Copy link
Member

Choose a reason for hiding this comment

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

This should be the consequence of net.peer(1).num_peers() == 2?

Copy link
Member

Choose a reason for hiding this comment

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

Aka we don't need it?

Copy link
Member Author

Choose a reason for hiding this comment

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

This change is unrelated to the fix. Just noticed that a test is racing. Peers register connections asynchronously. So if peers0 considers peer1 to be connected, peer1 might not yet register peer0 as connected and will miss the block announcement that follows. Resulting in occasional test failure.

Copy link
Member

Choose a reason for hiding this comment

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

Okay :)

@chevdor chevdor modified the milestone: v0.9.16 Jan 28, 2022
@arkpar
Copy link
Member Author

arkpar commented Feb 2, 2022

Is this still being tested?

@bkchr
Copy link
Member

bkchr commented Feb 2, 2022

Is this still being tested?

AFAIK it was successful, let us merge it.

@bkchr
Copy link
Member

bkchr commented Feb 2, 2022

bot merge

@paritytech-processbot
Copy link

Bot will approve on the behalf of @bkchr, since they are a team lead, in an attempt to reach the minimum approval count

@paritytech-processbot paritytech-processbot bot merged commit 5948416 into master Feb 2, 2022
@paritytech-processbot paritytech-processbot bot deleted the a-sync-all-forks branch February 2, 2022 11:29
agryaznov pushed a commit to agryaznov/substrate that referenced this pull request Feb 4, 2022
* Enable download of future forks

* Fixed external tests
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* Enable download of future forks

* Fixed external tests
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Enable download of future forks

* Fixed external tests
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C3-medium PR touches the given topic and has a medium impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants